Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
54adf8d6
Commit
54adf8d6
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
when adding new appointment info about worker availabilities is visible
parent
b6ffdc57
No related branches found
No related tags found
1 merge request
!55
Resolve "worker list should be in alphabetic order"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/static/js/appointment.js
+23
-16
23 additions, 16 deletions
smash/web/static/js/appointment.js
smash/web/templates/appointments/add.html
+2
-0
2 additions, 0 deletions
smash/web/templates/appointments/add.html
with
25 additions
and
16 deletions
smash/web/static/js/appointment.js
+
23
−
16
View file @
54adf8d6
...
...
@@ -17,7 +17,7 @@ function appointment_type_behaviour(checkboxes, outObject, api_call) {
if
((
checkbox
.
is
(
"
:checked
"
)
&&
checkbox
.
attr
(
'
id
'
)
!=
object_id
)
||
(
!
checkbox
.
is
(
"
:checked
"
)
&&
checkbox
.
attr
(
'
id
'
)
==
object_id
))
{
var
appointment_type
=
appointment_types_data
[
val
];
if
(
appointment_type
.
can_be_parallelized
)
{
result
=
Math
.
max
(
result
,
appointment_type
.
default_duration
)
result
=
Math
.
max
(
result
,
appointment_type
.
default_duration
)
;
}
}
});
...
...
@@ -36,7 +36,7 @@ function appointment_type_behaviour(checkboxes, outObject, api_call) {
if
((
checkbox
.
is
(
"
:checked
"
)
&&
checkbox
.
attr
(
'
id
'
)
!=
object_id
)
||
(
!
checkbox
.
is
(
"
:checked
"
)
&&
checkbox
.
attr
(
'
id
'
)
==
object_id
))
{
var
appointment_type
=
appointment_types_data
[
val
];
if
(
!
appointment_type
.
can_be_parallelized
)
{
result
+=
appointment_type
.
default_duration
result
+=
appointment_type
.
default_duration
;
}
}
});
...
...
@@ -66,6 +66,7 @@ function appointment_type_behaviour(checkboxes, outObject, api_call) {
}
global_time
=
Math
.
max
(
global_parallel_time
,
global_sequential_time
);
$
(
outObject
).
val
(
global_time
+
""
);
$
(
outObject
).
trigger
(
"
change
"
);
}
}
...
...
@@ -117,7 +118,7 @@ function appointment_date_change_behaviour(datetime_picker, worker_select, minut
id
=
parseInt
(
id
);
for
(
var
i
=
0
;
i
<
availabilities
.
length
;
i
++
)
{
var
availability
=
availabilities
[
i
];
if
(
availability
.
link_who
===
id
&&
appointment_id
!==
availability
.
appointment_id
)
{
if
(
availability
.
link_who
===
id
&&
(
appointment_id
!==
availability
.
appointment_id
||
appointment_id
===
undefined
)
)
{
var
event_start
=
Date
.
parse
(
availability
.
link_when
);
var
event_end
=
Date
.
parse
(
availability
.
link_end
);
if
(
partialMatch
&&
event_start
>=
date_start
&&
event_start
<=
date_end
)
{
...
...
@@ -157,30 +158,33 @@ function appointment_date_change_behaviour(datetime_picker, worker_select, minut
$
(
worker_select
).
addClass
(
previousClass
);
});
$
(
datetime_picker
).
on
(
"
dp.change
"
,
function
()
{
if
(
$
(
this
).
val
()
!=
""
)
{
var
datetime_start
=
Date
.
parse
(
$
(
this
).
val
());
function
timeChange
()
{
if
(
$
(
datetime_picker
).
val
()
!=
""
)
{
var
datetime_start
=
Date
.
parse
(
$
(
datetime_picker
).
val
());
var
datetime_end
=
datetime_start
+
60
*
1000
*
parseInt
(
minutes_input
.
val
());
var
date
=
$
(
this
).
val
().
substr
(
0
,
10
);
if
(
isNaN
(
datetime_end
))
{
datetime_end
=
datetime_start
;
}
var
date
=
$
(
datetime_picker
).
val
().
substr
(
0
,
10
);
$
.
get
(
'
/api/availabilities/
'
+
date
,
function
(
data
)
{
var
options
=
$
(
"
option
"
,
worker_select
);
for
(
var
i
=
0
;
i
<
options
.
length
;
i
++
)
{
var
option
=
options
[
i
];
if
(
match_availability
(
option
.
value
,
data
.
holidays
,
true
,
datetime_start
,
datetime_end
))
{
console
.
log
(
data
.
holidays
);
console
.
log
(
"
HOLIDAY
"
);
//
console.log(data.holidays);
//
console.log("HOLIDAY");
option
.
className
=
"
worker-option-holiday
"
;
}
else
if
(
match_availability
(
option
.
value
,
data
.
conflicts
,
true
,
datetime_start
,
datetime_end
))
{
console
.
log
(
data
.
conflicts
);
console
.
log
(
"
CONFLICT
"
);
//
console.log(data.conflicts);
//
console.log("CONFLICT");
option
.
className
=
"
worker-option-conflict
"
;
}
else
if
(
match_availability
(
option
.
value
,
data
.
availabilities
,
false
,
datetime_start
,
datetime_end
))
{
console
.
log
(
data
.
availabilities
);
console
.
log
(
"
MATCH
"
);
//
console.log(data.availabilities);
//
console.log("MATCH");
option
.
className
=
"
worker-option-match
"
;
}
else
if
(
match_availability
(
option
.
value
,
data
.
availabilities
,
true
,
datetime_start
,
datetime_end
))
{
console
.
log
(
data
.
availabilities
);
console
.
log
(
"
PARTIAL_MATCH
"
);
//
console.log(data.availabilities);
//
console.log("PARTIAL_MATCH");
option
.
className
=
"
worker-option-partial-match
"
;
}
else
{
option
.
className
=
"
worker-option-no-match
"
;
...
...
@@ -189,7 +193,10 @@ function appointment_date_change_behaviour(datetime_picker, worker_select, minut
$
(
worker_select
).
trigger
(
"
change
"
);
});
}
});
}
$
(
datetime_picker
).
on
(
"
dp.change
"
,
timeChange
);
$
(
minutes_input
).
on
(
"
change
"
,
timeChange
);
}
...
...
This diff is collapsed.
Click to expand it.
smash/web/templates/appointments/add.html
+
2
−
0
View file @
54adf8d6
...
...
@@ -12,6 +12,7 @@
<link
rel=
"stylesheet"
href=
"{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.print.css' %}"
media=
"print"
>
{% include "includes/datetimepicker.css.html" %}
<link
rel=
"stylesheet"
href=
"{% static 'css/appointment.css' %}"
>
{% endblock styles %}
{% block ui_active_tab %}'appointments'{% endblock ui_active_tab %}
...
...
@@ -139,6 +140,7 @@
appointment_type_behaviour
(
$
(
"
input[name='appointment_types']
"
),
$
(
"
input[name='length']
"
),
"
{% url 'web.api.appointment_types' %}
"
);
appointment_flying_team_place_behaviour
(
$
(
"
select[name='flying_team']
"
),
$
(
"
select[name='location']
"
));
appointment_date_change_behaviour
(
$
(
"
input[name='datetime_when']
"
),
$
(
"
select[name='worker_assigned']
"
),
$
(
"
input[name='length']
"
));
</script>
{% include "includes/datetimepicker.js.html" %}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment