refs #5138 summary changed like route/tickets
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alexandre Riera 2023-01-30 12:19:11 +01:00
parent 39835069f9
commit 77742d94d7
3 changed files with 66 additions and 53 deletions

View File

@ -50,14 +50,17 @@ module.exports = Self => {
am.name AS agencyModeName, am.name AS agencyModeName,
u.nickname AS userNickname, u.nickname AS userNickname,
vn.ticketTotalVolume(t.id) AS volume, vn.ticketTotalVolume(t.id) AS volume,
tob.description tob.description,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt
FROM vn.route r FROM vn.route r
JOIN ticket t ON t.routeFk = r.id JOIN ticket t ON t.routeFk = r.id
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
LEFT JOIN observationType ot ON ot.code = 'delivery' LEFT JOIN observationType ot ON ot.code = 'delivery'
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
AND tob.observationTypeFk = ot.id AND tob.observationTypeFk = ot.id
LEFT JOIN address a ON a.id = t.addressFk LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
@ -70,7 +73,9 @@ module.exports = Self => {
const where = filter.where; const where = filter.where;
where['r.id'] = filter.id; where['r.id'] = filter.id;
stmt.merge(conn.makeSuffix(filter)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeGroupBy('t.id'));
stmt.merge(conn.makeOrderBy(filter.order));
const tickets = await conn.executeStmt(stmt, myOptions); const tickets = await conn.executeStmt(stmt, myOptions);

View File

@ -10,26 +10,26 @@
</h5> </h5>
<vn-horizontal> <vn-horizontal>
<vn-one> <vn-one>
<vn-label-value label="Id" <vn-label-value label="Id"
value="{{$ctrl.summary.route.id}}"> value="{{$ctrl.summary.route.id}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Date" <vn-label-value label="Date"
value="{{$ctrl.summary.route.created | date: 'dd/MM/yyyy'}}"> value="{{$ctrl.summary.route.created | date: 'dd/MM/yyyy'}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Agency" <vn-label-value label="Agency"
value="{{$ctrl.summary.route.agencyMode.name}}"> value="{{$ctrl.summary.route.agencyMode.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Vehicle" <vn-label-value label="Vehicle"
value="{{$ctrl.summary.route.vehicle.numberPlate}}"> value="{{$ctrl.summary.route.vehicle.numberPlate}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Driver"> <vn-label-value label="Driver">
<span <span
ng-click="workerDescriptor.show($event, $ctrl.summary.route.workerFk)" ng-click="workerDescriptor.show($event, $ctrl.summary.route.workerFk)"
class="link"> class="link">
{{$ctrl.summary.route.worker.user.name}} {{$ctrl.summary.route.worker.user.name}}
</span> </span>
</vn-label-value> </vn-label-value>
<vn-label-value label="Cost" <vn-label-value label="Cost"
value="{{$ctrl.summary.route.cost | currency: 'EUR':2}}"> value="{{$ctrl.summary.route.cost | currency: 'EUR':2}}">
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
@ -40,35 +40,35 @@
<vn-label-value label="Finishing time" <vn-label-value label="Finishing time"
value="{{$ctrl.summary.route.finished | date: 'HH:MM'}}"> value="{{$ctrl.summary.route.finished | date: 'HH:MM'}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Km Start" <vn-label-value label="Km Start"
value="{{$ctrl.summary.route.kmStart}}"> value="{{$ctrl.summary.route.kmStart}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Km End" <vn-label-value label="Km End"
value="{{$ctrl.summary.route.kmEnd}}"> value="{{$ctrl.summary.route.kmEnd}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Volume" <vn-label-value label="Volume"
value="{{$ctrl.summary.route.m3 | dashIfEmpty}} / {{$ctrl.summary.route.vehicle.m3 | dashIfEmpty}} m³"> value="{{$ctrl.summary.route.m3 | dashIfEmpty}} / {{$ctrl.summary.route.vehicle.m3 | dashIfEmpty}} m³">
</vn-label-value> </vn-label-value>
<vn-label-value label="Packages" <vn-label-value label="Packages"
value="{{$ctrl.packagesTotal}}"> value="{{$ctrl.packagesTotal}}">
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-one> <vn-one>
<vn-textarea <vn-textarea
disabled="true" disabled="true"
label="Description" label="Description"
ng-model="$ctrl.summary.route.description"> ng-model="$ctrl.summary.route.description">
</vn-textarea> </vn-textarea>
</vn-one> </vn-one>
<vn-auto> <vn-auto>
<h4 ng-show="$ctrl.isDelivery"> <h4 ng-show="$ctrl.isDelivery">
<a <a
ui-sref="route.card.tickets({id:$ctrl.route.id})" ui-sref="route.card.tickets({id:$ctrl.route.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Ticket</span> <span translate vn-tooltip="Go to">Ticket</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isDelivery"> ng-show="!$ctrl.isDelivery">
Ticket Ticket
@ -77,45 +77,49 @@
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th shrink>Order</vn-th> <vn-th shrink>Order</vn-th>
<vn-th number>Ticket id</vn-th> <vn-th>Street</vn-th>
<vn-th>Alias</vn-th> <vn-th>City</vn-th>
<vn-th shrink>PC</vn-th>
<vn-th>Client</vn-th>
<vn-th>Warehouse</vn-th>
<vn-th number shrink>Packages</vn-th> <vn-th number shrink>Packages</vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
<vn-th>Warehouse</vn-th> <vn-th shrink>Packaging</vn-th>
<vn-th shrink>PC</vn-th> <vn-th number>Ticket</vn-th>
<vn-th>Street</vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="ticket in $ctrl.summary.tickets"> <vn-tr ng-repeat="ticket in $ctrl.summary.tickets">
<vn-td shrink>{{ticket.priority | dashIfEmpty}}</vn-td> <vn-td shrink>{{ticket.priority | dashIfEmpty}}</vn-td>
<vn-td expand title="{{ticket.address.street}}">{{ticket.street}}</vn-td>
<vn-td expand>{{ticket.city}}</vn-td>
<vn-td shrink>{{ticket.postalCode}}</vn-td>
<vn-td>
<span
ng-click="clientDescriptor.show($event, ticket.clientFk)"
class="link">
{{ticket.nickname}}
</span>
</vn-td>
<vn-td>{{ticket.warehouseName}}</vn-td>
<vn-td number shrink>{{ticket.packages}}</vn-td>
<vn-td shrink>{{ticket.volume}}</vn-td>
<vn-td shrink>{{ticket.ipt}}</vn-td>
<vn-td number> <vn-td number>
<span <span
ng-click="ticketDescriptor.show($event, ticket.id)" ng-click="ticketDescriptor.show($event, ticket.id)"
class="link"> class="link">
{{ticket.id}} {{ticket.id}}
</span> </span>
</vn-td> </vn-td>
<vn-td> <vn-td>
<span <vn-icon-button
ng-click="clientDescriptor.show($event, ticket.clientFk)" ng-if="::ticket.description"
class="link"> vn-tooltip="{{::ticket.description}}"
{{ticket.nickname}} icon="icon-notes"
</span> tabindex="-1">
</vn-td> </vn-icon-button>
<vn-td number shrink>{{ticket.packages}}</vn-td>
<vn-td shrink>{{ticket.volume}}</vn-td>
<vn-td>{{ticket.warehouseName}}</vn-td>
<vn-td shrink>{{ticket.postalCode}}</vn-td>
<vn-td expand title="{{ticket.address.street}}">{{ticket.street}}</vn-td>
<vn-td shrink>
<vn-icon
ng-if="ticket.notes.length"
vn-tooltip="{{ticket.notes[0].description}}"
icon="insert_drive_file"
class="bright">
</vn-icon>
</vn-td> </vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>
@ -123,12 +127,12 @@
</vn-auto> </vn-auto>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-ticket-descriptor-popover <vn-ticket-descriptor-popover
vn-id="ticketDescriptor"> vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover> </vn-ticket-descriptor-popover>
<vn-client-descriptor-popover <vn-client-descriptor-popover
vn-id="clientDescriptor"> vn-id="clientDescriptor">
</vn-client-descriptor-popover> </vn-client-descriptor-popover>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor"> vn-id="workerDescriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>

View File

@ -6,9 +6,9 @@
data="$ctrl.tickets" data="$ctrl.tickets"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-data-viewer <vn-data-viewer
model="model"> model="model">
<form <form
class="vn-w-xl" class="vn-w-xl"
name="form"> name="form">
<vn-card> <vn-card>
@ -25,18 +25,18 @@
vn-tooltip="Open buscaman" vn-tooltip="Open buscaman"
icon="icon-buscaman"> icon="icon-buscaman">
</vn-button> </vn-button>
<vn-button <vn-button
disabled="!$ctrl.isChecked" disabled="!$ctrl.isChecked"
ng-click="$ctrl.deletePriority()" ng-click="$ctrl.deletePriority()"
vn-tooltip="Delete priority" vn-tooltip="Delete priority"
icon="filter_alt"> icon="filter_alt">
</vn-button> </vn-button>
<vn-button <vn-button
ng-click="$ctrl.setOrderedPriority($ctrl.tickets)" ng-click="$ctrl.setOrderedPriority($ctrl.tickets)"
vn-tooltip="Renumber all tickets in the order you see on the screen" vn-tooltip="Renumber all tickets in the order you see on the screen"
icon="format_list_numbered"> icon="format_list_numbered">
</vn-button> </vn-button>
<vn-button <vn-button
vn-acl="deliveryBoss" vn-acl="deliveryBoss"
vn-acl-action="remove" vn-acl-action="remove"
disabled="!$ctrl.isChecked" disabled="!$ctrl.isChecked"
@ -59,8 +59,10 @@
<vn-th field="city">City</vn-th> <vn-th field="city">City</vn-th>
<vn-th field="postalCode" translate-attr="{title: 'Postcode'}" shrink>PC</vn-th> <vn-th field="postalCode" translate-attr="{title: 'Postcode'}" shrink>PC</vn-th>
<vn-th field="clientFk" expand>Client</vn-th> <vn-th field="clientFk" expand>Client</vn-th>
<vn-th field="warehouse" expand>Warehouse</vn-th>
<vn-th field="packages" shrink>Packages</vn-th> <vn-th field="packages" shrink>Packages</vn-th>
<vn-th field="volume" shrink></vn-th> <vn-th field="volume" shrink></vn-th>
<vn-th field="packaging" shrink>Packaging</vn-th>
<vn-th field="id" number>Ticket</vn-th> <vn-th field="id" number>Ticket</vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
@ -100,8 +102,10 @@
{{::ticket.nickname}} {{::ticket.nickname}}
</span> </span>
</vn-td> </vn-td>
<vn-td>{{ticket.warehouseName}}</vn-td>
<vn-td shrink>{{::ticket.packages}}</vn-td> <vn-td shrink>{{::ticket.packages}}</vn-td>
<vn-td shrink>{{::ticket.volume | number:2}}</vn-td> <vn-td shrink>{{::ticket.volume | number:2}}</vn-td>
<vn-td shrink>{{::ticket.ipt}}</vn-td>
<vn-td number> <vn-td number>
<span <span
ng-click="ticketDescriptor.show($event, ticket.id)" ng-click="ticketDescriptor.show($event, ticket.id)"
@ -140,13 +144,13 @@
</vn-card> </vn-card>
</form> </form>
</vn-data-viewer> </vn-data-viewer>
<vn-ticket-descriptor-popover <vn-ticket-descriptor-popover
vn-id="ticketDescriptor"> vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover> </vn-ticket-descriptor-popover>
<vn-client-descriptor-popover <vn-client-descriptor-popover
vn-id="clientDescriptor"> vn-id="clientDescriptor">
</vn-client-descriptor-popover> </vn-client-descriptor-popover>
<vn-confirm <vn-confirm
vn-id="confirm" vn-id="confirm"
question="Delete ticket from route?" question="Delete ticket from route?"
on-accept="$ctrl.removeTicketFromRoute($index)"> on-accept="$ctrl.removeTicketFromRoute($index)">
@ -160,7 +164,7 @@
<div fixed-bottom-right> <div fixed-bottom-right>
<vn-vertical style="align-items: center;"> <vn-vertical style="align-items: center;">
<a vn-bind="+"> <a vn-bind="+">
<vn-button <vn-button
class="round md vn-mb-sm" class="round md vn-mb-sm"
ng-click="$ctrl.$.ticketPopup.show()" ng-click="$ctrl.$.ticketPopup.show()"
icon="add" icon="add"
@ -172,14 +176,14 @@
</a> </a>
</vn-vertical> </vn-vertical>
</div> </div>
<vn-ticket-descriptor-popover <vn-ticket-descriptor-popover
vn-id="ticket-descriptor"> vn-id="ticket-descriptor">
</vn-ticket-descriptor-popover> </vn-ticket-descriptor-popover>
<vn-client-descriptor-popover <vn-client-descriptor-popover
vn-id="client-descriptor"> vn-id="client-descriptor">
</vn-client-descriptor-popover> </vn-client-descriptor-popover>
<!-- SMS Dialog --> <!-- SMS Dialog -->
<vn-route-sms <vn-route-sms
vn-id="sms" vn-id="sms"
sms="$ctrl.newSMS"> sms="$ctrl.newSMS">
</vn-route-sms> </vn-route-sms>