Add support for viewing single employee's schedule / time sheet
A little sloppy perhaps, here and there..but seems to do the job.
This commit is contained in:
parent
c6ab3b80f9
commit
1e0ef53aea
4 changed files with 153 additions and 44 deletions
|
@ -1,11 +1,18 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/base.mako" />
|
||||
<%namespace file="/autocomplete.mako" import="autocomplete" />
|
||||
|
||||
<%def name="title()">${page_title}</%def>
|
||||
|
||||
<%def name="head_tags()">
|
||||
${parent.head_tags()}
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/css/timesheet.css'))}
|
||||
<script type="text/javascript">
|
||||
|
||||
function employee_selected(uuid, name) {
|
||||
$('.timesheet-wrapper form').submit();
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
$('.timesheet-wrapper form').submit(function() {
|
||||
|
@ -43,10 +50,10 @@
|
|||
|
||||
<%def name="context_menu()"></%def>
|
||||
|
||||
<%def name="timesheet(employee_column=True)">
|
||||
<%def name="timesheet()">
|
||||
<style type="text/css">
|
||||
.timesheet thead th {
|
||||
width: ${'{:0.2f}'.format(100.0 / float(9 if employee_column else 8))}%;
|
||||
width: ${'{:0.2f}'.format(100.0 / 9)}%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -60,16 +67,30 @@
|
|||
|
||||
<td class="filters" rowspan="2">
|
||||
|
||||
## <div class="field-wrapper employee">
|
||||
## <label>Employee</label>
|
||||
## <div class="field">
|
||||
## ${employee}
|
||||
## </div>
|
||||
## </div>
|
||||
% if employee is not UNDEFINED:
|
||||
<div class="field-wrapper employee">
|
||||
<label>Employee</label>
|
||||
<div class="field">
|
||||
% if request.has_perm('{}.viewall'.format(permission_prefix)):
|
||||
${autocomplete('employee', url('employees.autocomplete'),
|
||||
field_value=employee.uuid if employee else None,
|
||||
field_display=unicode(employee or ''),
|
||||
selected='employee_selected')}
|
||||
% else:
|
||||
${form.hidden('employee', value=employee.uuid)}
|
||||
${employee}
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
% endif
|
||||
|
||||
${form.field_div('store', h.select('store', store.uuid if store else None, store_options))}
|
||||
% if store_options is not UNDEFINED:
|
||||
${form.field_div('store', h.select('store', store.uuid if store else None, store_options))}
|
||||
% endif
|
||||
|
||||
${form.field_div('department', h.select('department', department.uuid if department else None, department_options))}
|
||||
% if department_options is not UNDEFINED:
|
||||
${form.field_div('department', h.select('department', department.uuid if department else None, department_options))}
|
||||
% endif
|
||||
|
||||
<div class="field-wrapper week">
|
||||
<label>Week of</label>
|
||||
|
@ -108,9 +129,7 @@
|
|||
<table class="timesheet">
|
||||
<thead>
|
||||
<tr>
|
||||
% if employee_column:
|
||||
<th>Employee</th>
|
||||
% endif
|
||||
<th>Employee</th>
|
||||
% for day in weekdays:
|
||||
<th>${day.strftime('%A')}<br />${day.strftime('%b %d')}</th>
|
||||
% endfor
|
||||
|
@ -118,22 +137,20 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% for employee in sorted(employees, key=unicode):
|
||||
% for emp in sorted(employees, key=unicode):
|
||||
<tr>
|
||||
% if employee_column:
|
||||
<td class="employee">${employee}</td>
|
||||
% endif
|
||||
% for day in employee.weekdays:
|
||||
<td class="employee">${emp}</td>
|
||||
% for day in emp.weekdays:
|
||||
<td>
|
||||
% for shift in day['shifts']:
|
||||
<p class="shift">${shift.get_display(request.rattail_config)}</p>
|
||||
% endfor
|
||||
</td>
|
||||
% endfor
|
||||
<td>${employee.hours_display}</td>
|
||||
<td>${emp.hours_display}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
% if employee_column:
|
||||
% if employee is UNDEFINED:
|
||||
<tr class="total">
|
||||
<td class="employee">${len(employees)} employees</td>
|
||||
% for day in weekdays:
|
||||
|
@ -143,6 +160,7 @@
|
|||
</tr>
|
||||
% else:
|
||||
<tr>
|
||||
<td> </td>
|
||||
% for day in employee.weekdays:
|
||||
<td>${day['hours_display']}</td>
|
||||
% endfor
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/shifts/base.mako" />
|
||||
|
||||
<%def name="title()">Full Schedule</%def>
|
||||
|
||||
<%def name="context_menu()">
|
||||
% if request.has_perm('timesheet.view'):
|
||||
<li>${h.link_to("View this Time Sheet", url('schedule.goto.timesheet'), class_='goto')}</li>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/shifts/base.mako" />
|
||||
|
||||
<%def name="title()">Full Time Sheet</%def>
|
||||
|
||||
<%def name="context_menu()">
|
||||
% if request.has_perm('schedule.view'):
|
||||
<li>${h.link_to("View this Schedule", url('timesheet.goto.schedule'), class_='goto')}</li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue