Add support for "full" schedule and time sheet views
Temporarily removes support for viewing current user's time sheet; that will be added back in soon.
This commit is contained in:
parent
181123dfaa
commit
123f5ce0c6
11 changed files with 327 additions and 165 deletions
|
@ -8,124 +8,148 @@
|
|||
|
||||
$(function() {
|
||||
|
||||
$('.timesheet-header select').selectmenu();
|
||||
$('.timesheet-wrapper form').submit(function() {
|
||||
$('.timesheet-header').mask("Fetching data");
|
||||
});
|
||||
|
||||
$('.timesheet-header select').selectmenu({
|
||||
change: function(event, ui) {
|
||||
$(ui.item.element).parents('form').submit();
|
||||
}
|
||||
});
|
||||
|
||||
$('.timesheet-header a.goto').click(function() {
|
||||
$('.timesheet-header').mask("Fetching data");
|
||||
});
|
||||
|
||||
$('.week-picker button.nav').click(function() {
|
||||
$('.week-picker #date').val($(this).data('date'));
|
||||
});
|
||||
|
||||
$('.week-picker #date').datepicker({
|
||||
dateFormat: 'yy-mm-dd',
|
||||
dateFormat: 'mm/dd/yy',
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
showButtonPanel: true,
|
||||
onSelect: function(dateText, inst) {
|
||||
$(this).focus().select();
|
||||
$(this).parents('form').submit();
|
||||
}
|
||||
});
|
||||
|
||||
$('.week-picker form').submit(function() {
|
||||
location.href = '?date=' + $('.week-picker #date').val();
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
<%def name="timesheet(employees, employee_column=True)">
|
||||
<%def name="context_menu()"></%def>
|
||||
|
||||
<%def name="timesheet(employee_column=True)">
|
||||
<style type="text/css">
|
||||
.timesheet thead th {
|
||||
width: ${'{:0.2f}'.format(100.0 / float(9 if employee_column else 8))}%;
|
||||
}
|
||||
</style>
|
||||
<div class="timesheet-header">
|
||||
|
||||
## <div class="field-wrapper employee">
|
||||
## <label>Employee</label>
|
||||
## <div class="field">
|
||||
## ${employee}
|
||||
## </div>
|
||||
## </div>
|
||||
<div class="timesheet-wrapper">
|
||||
|
||||
<div class="fieldset">
|
||||
${form.begin()}
|
||||
|
||||
<div class="field-wrapper week">
|
||||
<label>Store</label>
|
||||
<div class="field">
|
||||
${form.select('store', store_options, selected_value=store.uuid if store else None)}
|
||||
</div>
|
||||
</div>
|
||||
<table class="timesheet-header">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
||||
<div class="field-wrapper week">
|
||||
<label>Department</label>
|
||||
<div class="field">
|
||||
${form.select('department', department_options, selected_value=department.uuid if department else None)}
|
||||
</div>
|
||||
</div>
|
||||
<td class="filters" rowspan="2">
|
||||
|
||||
<div class="field-wrapper week">
|
||||
<label>Week of</label>
|
||||
<div class="field">
|
||||
${week_of}
|
||||
</div>
|
||||
</div>
|
||||
## <div class="field-wrapper employee">
|
||||
## <label>Employee</label>
|
||||
## <div class="field">
|
||||
## ${employee}
|
||||
## </div>
|
||||
## </div>
|
||||
|
||||
</div>
|
||||
${form.field_div('store', h.select('store', store.uuid if store else None, store_options))}
|
||||
|
||||
<div class="week-picker">
|
||||
${h.form(request.current_route_url())}
|
||||
${h.link_to(u"« Previous", '?date=' + prev_sunday.strftime('%Y-%m-%d'), class_='button')}
|
||||
${h.link_to(u"Next »", '?date=' + next_sunday.strftime('%Y-%m-%d'), class_='button')}
|
||||
<label>Jump to week:</label>
|
||||
${h.text('date', value=sunday.strftime('%Y-%m-%d'))}
|
||||
${h.submit('go', "Go")}
|
||||
${h.end_form()}
|
||||
</div>
|
||||
${form.field_div('department', h.select('department', department.uuid if department else None, department_options))}
|
||||
|
||||
</div><!-- timesheet-header -->
|
||||
<div class="field-wrapper week">
|
||||
<label>Week of</label>
|
||||
<div class="field">
|
||||
${week_of}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="timesheet">
|
||||
<thead>
|
||||
<tr>
|
||||
% if employee_column:
|
||||
<th>Employee</th>
|
||||
% endif
|
||||
% for day in weekdays:
|
||||
<th>${day.strftime('%A')}<br />${day.strftime('%b %d')}</th>
|
||||
</td><!-- filters -->
|
||||
|
||||
<td class="menu">
|
||||
<ul id="context-menu">
|
||||
${self.context_menu()}
|
||||
</ul>
|
||||
</td><!-- menu -->
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="tools">
|
||||
<div class="grid-tools">
|
||||
<div class="week-picker">
|
||||
<button class="nav" data-date="${prev_sunday.strftime('%m/%d/%Y')}">« Previous</button>
|
||||
<button class="nav" data-date="${next_sunday.strftime('%m/%d/%Y')}">Next »</button>
|
||||
<label>Jump to week:</label>
|
||||
${form.text('date', value=sunday.strftime('%m/%d/%Y'))}
|
||||
</div>
|
||||
</div><!-- grid-tools -->
|
||||
</td><!-- tools -->
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table><!-- timesheet-header -->
|
||||
|
||||
${form.end()}
|
||||
|
||||
<table class="timesheet">
|
||||
<thead>
|
||||
<tr>
|
||||
% if employee_column:
|
||||
<th>Employee</th>
|
||||
% endif
|
||||
% for day in weekdays:
|
||||
<th>${day.strftime('%A')}<br />${day.strftime('%b %d')}</th>
|
||||
% endfor
|
||||
<th>Total<br />Hours</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% for employee in sorted(employees, key=unicode):
|
||||
<tr>
|
||||
% if employee_column:
|
||||
<td class="employee">${employee}</td>
|
||||
% endif
|
||||
% for day in employee.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>
|
||||
</tr>
|
||||
% endfor
|
||||
<th>Total<br />Hours</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% for employee in sorted(employees, key=unicode):
|
||||
<tr>
|
||||
% if employee_column:
|
||||
<td class="employee">${employee}</td>
|
||||
% endif
|
||||
% for day in employee.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>
|
||||
</tr>
|
||||
% endfor
|
||||
% if employee_column:
|
||||
<tr class="total">
|
||||
<td class="employee">${len(employees)} employees</td>
|
||||
% for day in weekdays:
|
||||
<td></td>
|
||||
% endfor
|
||||
<td></td>
|
||||
</tr>
|
||||
% else:
|
||||
<tr>
|
||||
% for day in employee.weekdays:
|
||||
<td>${day['hours_display']}</td>
|
||||
% endfor
|
||||
<td>${employee.hours_display}</td>
|
||||
</tr>
|
||||
% endif
|
||||
</tbody>
|
||||
</table>
|
||||
% if employee_column:
|
||||
<tr class="total">
|
||||
<td class="employee">${len(employees)} employees</td>
|
||||
% for day in weekdays:
|
||||
<td></td>
|
||||
% endfor
|
||||
<td></td>
|
||||
</tr>
|
||||
% else:
|
||||
<tr>
|
||||
% for day in employee.weekdays:
|
||||
<td>${day['hours_display']}</td>
|
||||
% endfor
|
||||
<td>${employee.hours_display}</td>
|
||||
</tr>
|
||||
% endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!-- timesheet-wrapper -->
|
||||
</%def>
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/shifts/base.mako" />
|
||||
|
||||
<%def name="title()">Schedule: ${sunday}</%def>
|
||||
<%def name="title()">Full Schedule</%def>
|
||||
|
||||
<ul id="context-menu">
|
||||
<li>${h.link_to("Print this Schedule", '#')}</li>
|
||||
<li>${h.link_to("Edit this Schedule", '#')}</li>
|
||||
</ul>
|
||||
<%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>
|
||||
% endif
|
||||
## <li>${h.link_to("Print this Schedule", '#')}</li>
|
||||
## <li>${h.link_to("Edit this Schedule", '#')}</li>
|
||||
</%def>
|
||||
|
||||
${self.timesheet(employees)}
|
||||
${self.timesheet()}
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/shifts/base.mako" />
|
||||
|
||||
<%def name="title()">Time Sheet: ${sunday}</%def>
|
||||
<%def name="title()">Full Time Sheet</%def>
|
||||
|
||||
${self.timesheet(employees, employee_column=False)}
|
||||
<%def name="context_menu()">
|
||||
% if request.has_perm('schedule.view'):
|
||||
<li>${h.link_to("View this Schedule", url('timesheet.goto.schedule'), class_='goto')}</li>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
${self.timesheet()}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue