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
10e99188
Commit
10e99188
authored
6 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
fixed issue
#265
removing buttons and adding divs with tooltips
parent
7536a235
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!187
fixed issue #265 removing buttons and adding divs with tooltips
Pipeline
#7358
passed
6 years ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
smash/web/models/worker.py
+9
-0
9 additions, 0 deletions
smash/web/models/worker.py
smash/web/templates/doctors/index.html
+18
-2
18 additions, 2 deletions
smash/web/templates/doctors/index.html
smash/web/tests/models/test_worker.py
+10
-0
10 additions, 0 deletions
smash/web/tests/models/test_worker.py
with
37 additions
and
2 deletions
smash/web/models/worker.py
+
9
−
0
View file @
10e99188
...
...
@@ -153,6 +153,15 @@ class Worker(models.Model):
return
True
return
False
def
current_leave_details
(
self
):
holidays
=
self
.
holiday_set
.
filter
(
datetime_end__gt
=
datetime
.
datetime
.
now
(),
datetime_start__lt
=
datetime
.
datetime
.
now
(),
kind
=
AVAILABILITY_HOLIDAY
).
order_by
(
'
-datetime_end
'
)
if
len
(
holidays
)
>
0
:
return
holidays
[
0
]
else
:
return
None
def
disable
(
self
):
if
self
.
user
is
not
None
:
self
.
user
.
is_active
=
False
...
...
This diff is collapsed.
Click to expand it.
smash/web/templates/doctors/index.html
+
18
−
2
View file @
10e99188
...
...
@@ -5,6 +5,20 @@
{{ block.super }}
<!-- DataTables -->
<link
rel=
"stylesheet"
href=
"{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"
>
<style
type=
"text/css"
>
.no_leave
{
height
:
100%
;
line-height
:
2.5
;
text-align
:
center
;
background-color
:
#00a65b
;
}
.on_leave
{
height
:
100%
;
line-height
:
2.5
;
text-align
:
center
;
background-color
:
#dd4b39
;
}
</style>
{% endblock styles %}
{% block ui_active_tab %}'workers'{% endblock ui_active_tab %}
...
...
@@ -82,9 +96,9 @@
{% if worker_type == 'STAFF' %}
<td>
{% if worker.is_on_leave %}
<
button
type=
"button"
class=
"btn btn-block btn-danger"
>
YES
</button
>
<
div
title=
"Worker is on leave until: {{ worker.current_leave_details.datetime_end }}"
class=
"on_leave"
>
✘
</div
>
{% else %}
<
button
type=
"button"
class=
"btn btn-block btn-success"
>
NO
</button
>
<
div
title=
"Worker is not on leave"
class=
"no_leave"
>
✔
</div
>
{% endif %}
</td>
<td>
...
...
@@ -120,5 +134,7 @@
"
autoWidth
"
:
false
});
});
$
(
'
.no_leave, .on_leave
'
).
tooltip
();
</script>
{% endblock scripts %}
This diff is collapsed.
Click to expand it.
smash/web/tests/models/test_worker.py
+
10
−
0
View file @
10e99188
...
...
@@ -61,6 +61,16 @@ class WorkerModelTests(TestCase):
self
.
assertTrue
(
worker
.
is_on_leave
())
def
test_current_leave_details
(
self
):
worker
=
create_worker
()
self
.
assertEqual
(
worker
.
current_leave_details
(),
None
)
h
=
Holiday
(
person
=
worker
,
datetime_start
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
2
),
datetime_end
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=
2
))
h
.
save
()
self
.
assertEqual
(
worker
.
current_leave_details
(),
h
)
def
test_get_by_user_for_anonymous
(
self
):
self
.
assertIsNone
(
Worker
.
get_by_user
(
AnonymousUser
()))
...
...
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