| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- const app = require('../app')
- const { editIcon } = require('../assets')
- app.component('appLaborPage', {
- template: html`
- <app-user-area>
- <app-breadcrumb links="[
- { text: 'Home', link: '/dashboard' },
- { text: ctrl.locationKey + ' Labor', link: '/labor/' + ctrl.locationKey }
- ]"></app-breadcrumb>
- <h1>Labor</h1>
- <table md-table ng-model="ctrl.selected" md-progress="ctrl.promise">
- <thead md-head>
- <tr md-row>
- <th md-column>Week Starting</th>
- <th md-column ng-repeat="weekday in ::ctrl.weekdays">
- <span hide show-xs>{{::weekday.min}}</span>
- <span hide show-sm>{{::weekday.short}}</span>
- <span hide show-gt-sm>{{::weekday.name}}</span>
- </th>
- <th md-column>Actions</th>
- </tr>
- </thead>
- <tbody md-body>
- <tr md-row ng-repeat="week in ::ctrl.labor track by week.workweek">
- <td md-cell>
- {{::week.workweek}}
- </td>
- <td md-cell ng-repeat="workday in ::week.workdays track by $index">
- <div>
- <span ng-if="::workday" style="white-space: nowrap;">
- {{::workday.regularHours + workday.overtimeHours}}
- <span hide show-xs>h</span>
- <span hide show-sm>hrs</span>
- <span hide show-gt-sm>hours</span>
- </span>
- <span ng-if="::!workday" md-colors="{ color: 'primary-100' }">
- N/A
- </span>
- </div>
- <div ng-if="::workday.laborCost">
- {{::workday.laborCost | currency}}
- </div>
- </td>
- <td md-cell>
- <md-button ng-href="labor/{{::ctrl.location.key}}/{{::week.workweek}}">
- <md-icon md-svg-icon="${editIcon}"></md-icon>
- Edit
- </md-button>
- </td>
- </tr>
- </tbody>
- </table>
- </app-user-area>
- `,
- controllerAs: 'ctrl',
- controller: function(api, $routeParams, weekdays) {
- this.locationKey = $routeParams.location
- this.weekdays = weekdays
- api.location($routeParams.location).then(location => {
- this.location = location
- })
- this.promise = api.get(`/api/labor/${$routeParams.location}`).then(labor => {
- this.labor = labor
- })
- }
- })
|