feat: allow update route.isOk field
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-09-13 13:34:32 +02:00
parent 1e521f1a8b
commit bddc998b86
8 changed files with 47 additions and 15 deletions

View File

@ -47,6 +47,9 @@
},
"description": {
"type": "string"
},
"isOk": {
"type": "boolean"
}
},
"relations": {

View File

@ -68,6 +68,11 @@
label="Hour finished"
ng-model="$ctrl.route.finished">
</vn-input-time>
<vn-check
class="vn-mr-md"
label="Is served"
ng-model="$ctrl.route.isOk">
</vn-check>
</vn-horizontal>
<vn-horizontal>
<vn-textArea

View File

@ -5,3 +5,4 @@ Km end: Km de fin
Description: Descripción
Hour started: Hora inicio
Hour finished: Hora fin
Is served: Se ha servido

View File

@ -18,7 +18,8 @@ class Controller extends ModuleCard {
'started',
'finished',
'cost',
'zoneFk'
'zoneFk',
'isOk'
],
include: [
{

View File

@ -22,6 +22,8 @@ class Controller extends Descriptor {
recipient: workerUser.emailUser.email,
routeId: this.id
});
const params = {isOk: true};
return this.$http.patch(`Routes/${this.id}`, params);
}
updateVolume() {

View File

@ -7,6 +7,29 @@
model="model"
options="$ctrl.smartTableOptions"
expr-builder="$ctrl.exprBuilder(param, value)">
<slot-actions>
<section class="header">
<vn-tool-bar class="vn-mb-md">
<vn-button
icon="icon-clone"
ng-show="$ctrl.totalChecked > 0"
ng-click="$ctrl.openClonationDialog()"
vn-tooltip="Clone selected routes">
</vn-button>
<vn-button
icon="cloud_download"
ng-show="$ctrl.totalChecked > 0"
ng-click="$ctrl.showRouteReport()"
vn-tooltip="Download selected routes as PDF">
</vn-button>
<vn-button
icon="check"
ng-show="$ctrl.totalChecked > 0"
ng-click="$ctrl.markAsServed()"
vn-tooltip="Mark as served">
</vn-button>
</section>
</slot-actions>
<slot-table>
<table model="model">
<thead>
@ -160,20 +183,6 @@
<div fixed-bottom-right>
<vn-vertical style="align-items: center;">
<vn-button class="round sm vn-mb-sm"
icon="icon-clone"
ng-show="$ctrl.totalChecked > 0"
ng-click="$ctrl.openClonationDialog()"
vn-tooltip="Clone selected routes"
tooltip-position="left">
</vn-button>
<vn-button class="round sm vn-mb-sm"
icon="cloud_download"
ng-show="$ctrl.totalChecked > 0"
ng-click="$ctrl.showRouteReport()"
vn-tooltip="Download selected routes as PDF"
tooltip-position="left">
</vn-button>
<a ui-sref="route.create" vn-bind="+">
<vn-button class="round md vn-mb-sm"
icon="add"

View File

@ -122,6 +122,16 @@ export default class Controller extends Section {
this.vnApp.showSuccess(this.$t('Data saved!'));
});
}
markAsServed() {
const routes = [];
for (let route of this.checked)
routes.push(route.id);
const params = {isOk: true};
for (let routeId of routes)
this.$http.patch(`Routes/${routeId}`, params);
}
}
Controller.$inject = ['$element', '$scope', 'vnReport'];

View File

@ -8,3 +8,4 @@ Hour finished: Hora fin
Go to route: Ir a la ruta
You must select a valid time: Debe seleccionar una hora válida
You must select a valid date: Debe seleccionar una fecha válida
Mark as served: Marcar como servidas