fix(salesMonitor): now sorts correctly by practical and theorical hour
gitea/salix/pipeline/head This commit looks good Details

Refs: 3219
This commit is contained in:
Joan Sanchez 2021-10-13 14:17:45 +02:00
parent 3d57e9a618
commit a0a01de937
3 changed files with 60 additions and 110 deletions

View File

@ -196,7 +196,6 @@ module.exports = Self => {
t.id, t.id,
t.shipped, t.shipped,
CAST(DATE(t.shipped) AS CHAR) AS shippedDate, CAST(DATE(t.shipped) AS CHAR) AS shippedDate,
HOUR(t.shipped) AS shippedHour,
t.nickname, t.nickname,
t.refFk, t.refFk,
t.routeFk, t.routeFk,
@ -218,11 +217,10 @@ module.exports = Self => {
u.name AS userName, u.name AS userName,
c.salesPersonFk, c.salesPersonFk,
z.hour AS zoneLanding, z.hour AS zoneLanding,
HOUR(z.hour) AS zoneHour,
MINUTE(z.hour) AS zoneMinute,
z.name AS zoneName, z.name AS zoneName,
z.id AS zoneFk, z.id AS zoneFk,
CAST(z.hour AS CHAR) AS hour, th.preparationHour,
TIME_FORMAT(z.hour, '%H:%i') AS theoreticalhour,
TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour
FROM ticket t FROM ticket t
LEFT JOIN invoiceOut io ON t.refFk = io.ref LEFT JOIN invoiceOut io ON t.refFk = io.ref
@ -236,7 +234,11 @@ module.exports = Self => {
LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.userFk LEFT JOIN account.user u ON u.id = wk.userFk
LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`); LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk
JOIN (
SELECT t.id, TIME_FORMAT(t.shipped, '%H:%i') AS preparationHour
FROM ticket AS t
) AS th ON th.id = t.id`);
if (args.orderFk) { if (args.orderFk) {
stmt.merge({ stmt.merge({

View File

@ -1,31 +1,28 @@
<vn-crud-model auto-load="true" <vn-crud-model
vn-id="model" vn-id="model"
params="::$ctrl.filterParams" auto-load="true"
url="SalesMonitors/salesFilter" url="SalesMonitors/salesFilter"
params="::$ctrl.filterParams"
limit="20" limit="20"
order="shippedDate DESC, shippedHour ASC, zoneLanding ASC, id"> order="shippedDate DESC, preparationHour ASC, zoneLanding ASC, id">
</vn-crud-model> </vn-crud-model>
<vn-portal slot="topbar"> <vn-portal slot="topbar">
<vn-searchbar <vn-searchbar vn-focus
vn-focus panel="vn-monitor-sales-search-panel"
panel="vn-monitor-sales-search-panel"
placeholder="Search tickets" placeholder="Search tickets"
info="Search ticket by id or alias" info="Search ticket by id or alias"
model="model" model="model"
fetch-params="$ctrl.fetchParams($params)" fetch-params="$ctrl.fetchParams($params)"
suggested-filter="$ctrl.filterParams" suggested-filter="$ctrl.filterParams"
auto-state="false"> auto-state="false">
</vn-searchbar> </vn-searchbar>
</vn-portal> </vn-portal>
<vn-horizontal class="header"> <vn-horizontal class="header">
<vn-one translate> <vn-one translate>
Tickets monitor Tickets monitor
</vn-one> </vn-one>
<vn-none> <vn-none>
<vn-icon <vn-icon icon="refresh" vn-tooltip="Refresh" ng-click="model.refresh()">
icon="refresh"
vn-tooltip="Refresh"
ng-click="model.refresh()">
</vn-icon> </vn-icon>
</vn-none> </vn-none>
</vn-horizontal> </vn-horizontal>
@ -37,8 +34,8 @@
<vn-th field="nickname">Client</vn-th> <vn-th field="nickname">Client</vn-th>
<vn-th field="salesPersonFk" class="expendable" shrink>Salesperson</vn-th> <vn-th field="salesPersonFk" class="expendable" shrink>Salesperson</vn-th>
<vn-th field="shipped" shrink-date>Date</vn-th> <vn-th field="shipped" shrink-date>Date</vn-th>
<vn-th>Prep.</vn-th> <vn-th field="preparationHour">Prep.</vn-th>
<vn-th field="hour" shrink>Theoretical</vn-th> <vn-th field="theoreticalHour">Theoretical</vn-th>
<vn-th field="practicalHour">Practical</vn-th> <vn-th field="practicalHour">Practical</vn-th>
<vn-th field="provinceFk" class="expendable">Province</vn-th> <vn-th field="provinceFk" class="expendable">Province</vn-th>
<vn-th field="stateFk">State</vn-th> <vn-th field="stateFk">State</vn-th>
@ -48,61 +45,37 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<a ng-repeat="ticket in model.data" <a ng-repeat="ticket in model.data" class="clickable vn-tr search-result"
class="clickable vn-tr search-result"
ui-sref="ticket.card.summary({id: {{::ticket.id}}})" target="_blank"> ui-sref="ticket.card.summary({id: {{::ticket.id}}})" target="_blank">
<vn-td class="icon-field"> <vn-td class="icon-field">
<vn-icon <vn-icon ng-show="::ticket.isTaxDataChecked === 0" translate-attr="{title: 'No verified data'}"
ng-show="::ticket.isTaxDataChecked === 0" class="bright" icon="icon-no036">
translate-attr="{title: 'No verified data'}"
class="bright"
icon="icon-no036">
</vn-icon> </vn-icon>
<vn-icon <vn-icon ng-show="::ticket.hasTicketRequest" translate-attr="{title: 'Purchase request'}"
ng-show="::ticket.hasTicketRequest" class="bright" icon="icon-100">
translate-attr="{title: 'Purchase request'}"
class="bright"
icon="icon-100">
</vn-icon> </vn-icon>
<vn-icon <vn-icon ng-show="::ticket.isAvailable === 0" translate-attr="{title: 'Not available'}"
ng-show="::ticket.isAvailable === 0" class="bright" icon="icon-unavailable">
translate-attr="{title: 'Not available'}"
class="bright"
icon="icon-unavailable">
</vn-icon> </vn-icon>
<vn-icon <vn-icon ng-show="::ticket.isFreezed" translate-attr="{title: 'Client frozen'}" class="bright"
ng-show="::ticket.isFreezed"
translate-attr="{title: 'Client frozen'}"
class="bright"
icon="icon-frozen"> icon="icon-frozen">
</vn-icon> </vn-icon>
<vn-icon <vn-icon ng-show="::ticket.risk" ng-class="::{'highRisk': ticket.hasHighRisk}"
ng-show="::ticket.risk" title="{{::$ctrl.$t('Risk')}}: {{ticket.risk}}" class="bright" icon="icon-risk">
ng-class="::{'highRisk': ticket.hasHighRisk}"
title="{{::$ctrl.$t('Risk')}}: {{ticket.risk}}"
class="bright"
icon="icon-risk">
</vn-icon> </vn-icon>
<vn-icon <vn-icon ng-show="::ticket.hasComponentLack" translate-attr="{title: 'Component lack'}"
ng-show="::ticket.hasComponentLack" class="bright" icon="icon-components">
translate-attr="{title: 'Component lack'}"
class="bright"
icon="icon-components">
</vn-icon> </vn-icon>
</vn-td> </vn-td>
<vn-td name="nickname"> <vn-td name="nickname">
<span <span title="{{::ticket.nickname}}" vn-click-stop="clientDescriptor.show($event, ticket.clientFk)"
title="{{::ticket.nickname}}"
vn-click-stop="clientDescriptor.show($event, ticket.clientFk)"
class="link"> class="link">
{{::ticket.nickname}} {{::ticket.nickname}}
</span> </span>
</vn-td> </vn-td>
<vn-td class="expendable" shrink> <vn-td class="expendable" shrink>
<span <span title="{{::ticket.userName}}"
title="{{::ticket.userName}}" vn-click-stop="workerDescriptor.show($event, ticket.salesPersonFk)" class="link">
vn-click-stop="workerDescriptor.show($event, ticket.salesPersonFk)"
class="link">
{{::ticket.userName | dashIfEmpty}} {{::ticket.userName | dashIfEmpty}}
</span> </span>
</vn-td> </vn-td>
@ -116,23 +89,16 @@
<vn-td shrink>{{::ticket.practicalHour | date: 'HH:mm'}}</vn-td> <vn-td shrink>{{::ticket.practicalHour | date: 'HH:mm'}}</vn-td>
<vn-td class="expendable">{{::ticket.province}}</vn-td> <vn-td class="expendable">{{::ticket.province}}</vn-td>
<vn-td class="expendable"> <vn-td class="expendable">
<span <span ng-show="::ticket.refFk" title="{{::ticket.refFk}}"
ng-show="::ticket.refFk" vn-click-stop="invoiceOutDescriptor.show($event, ticket.invoiceOutId)" class="link">
title="{{::ticket.refFk}}"
vn-click-stop="invoiceOutDescriptor.show($event, ticket.invoiceOutId)"
class="link">
{{::ticket.refFk}} {{::ticket.refFk}}
</span> </span>
<span <span ng-show="::!ticket.refFk" class="chip {{::$ctrl.stateColor(ticket)}}">
ng-show="::!ticket.refFk"
class="chip {{::$ctrl.stateColor(ticket)}}">
{{::ticket.state}} {{::ticket.state}}
</span> </span>
</vn-td> </vn-td>
<vn-td> <vn-td>
<span <span title="{{::ticket.zoneName}}" vn-click-stop="zoneDescriptor.show($event, ticket.zoneFk)"
title="{{::ticket.zoneName}}"
vn-click-stop="zoneDescriptor.show($event, ticket.zoneFk)"
class="link"> class="link">
{{::ticket.zoneName | dashIfEmpty}} {{::ticket.zoneName | dashIfEmpty}}
</span> </span>
@ -143,70 +109,48 @@
</span> </span>
</vn-td> </vn-td>
<vn-td actions> <vn-td actions>
<vn-icon-button <vn-icon-button vn-anchor="::{
vn-anchor="::{
state: 'ticket.card.sale', state: 'ticket.card.sale',
params: {id: ticket.id}, params: {id: ticket.id},
target: '_blank' target: '_blank'
}" }" vn-tooltip="Go to lines" icon="icon-lines">
vn-tooltip="Go to lines"
icon="icon-lines">
</vn-icon-button> </vn-icon-button>
<vn-icon-button <vn-icon-button vn-click-stop="$ctrl.preview(ticket)" vn-tooltip="Preview" icon="preview">
vn-click-stop="$ctrl.preview(ticket)"
vn-tooltip="Preview"
icon="preview">
</vn-icon-button> </vn-icon-button>
</vn-td> </vn-td>
</a> </a>
</vn-tbody> </vn-tbody>
</vn-table> </vn-table>
<vn-pagination <vn-pagination model="model" class="vn-pt-xs">
model="model"
class="vn-pt-xs">
</vn-pagination> </vn-pagination>
</vn-card> </vn-card>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover vn-id="workerDescriptor">
vn-id="workerDescriptor">
</vn-worker-descriptor-popover> </vn-worker-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-zone-descriptor-popover <vn-zone-descriptor-popover vn-id="zoneDescriptor">
vn-id="zoneDescriptor">
</vn-zone-descriptor-popover> </vn-zone-descriptor-popover>
<vn-popup vn-id="summary"> <vn-popup vn-id="summary">
<vn-ticket-summary <vn-ticket-summary ticket="$ctrl.selectedTicket" model="model">
ticket="$ctrl.selectedTicket"
model="model">
</vn-ticket-summary> </vn-ticket-summary>
</vn-popup> </vn-popup>
<vn-contextmenu vn-id="contextmenu" targets="['vn-monitor-sales-tickets vn-table']" model="model" <vn-contextmenu vn-id="contextmenu" targets="['vn-monitor-sales-tickets vn-table']" model="model"
expr-builder="$ctrl.exprBuilder(param, value)"> expr-builder="$ctrl.exprBuilder(param, value)">
<slot-menu> <slot-menu>
<vn-item translate <vn-item translate ng-if="contextmenu.isFilterAllowed()" ng-click="contextmenu.filterBySelection()">
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.filterBySelection()">
Filter by selection Filter by selection
</vn-item> </vn-item>
<vn-item translate <vn-item translate ng-if="contextmenu.isFilterAllowed()" ng-click="contextmenu.excludeSelection()">
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.excludeSelection()">
Exclude selection Exclude selection
</vn-item> </vn-item>
<vn-item translate <vn-item translate ng-if="contextmenu.isFilterAllowed()" ng-click="contextmenu.removeFilter()">
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.removeFilter()">
Remove filter Remove filter
</vn-item> </vn-item>
<vn-item translate <vn-item translate ng-click="contextmenu.removeAllFilters()">
ng-click="contextmenu.removeAllFilters()">
Remove all filters Remove all filters
</vn-item> </vn-item>
<vn-item translate <vn-item translate ng-if="contextmenu.isActionAllowed()" ng-click="contextmenu.copyValue()">
ng-if="contextmenu.isActionAllowed()"
ng-click="contextmenu.copyValue()">
Copy value Copy value
</vn-item> </vn-item>
</slot-menu> </slot-menu>
</vn-contextmenu> </vn-contextmenu>

View File

@ -68,8 +68,12 @@ export default class Controller extends Section {
return {'c.salesPersonFk': value}; return {'c.salesPersonFk': value};
case 'provinceFk': case 'provinceFk':
return {'a.provinceFk': value}; return {'a.provinceFk': value};
case 'hour': case 'theoreticalHour':
return {'z.hour': value}; return {'z.hour': value};
case 'practicalHour':
return {'zed.etc': value};
case 'preparationHour':
return {'th.preparationHour': value};
case 'shipped': case 'shipped':
return {'t.shipped': { return {'t.shipped': {
between: this.dateRange(value)} between: this.dateRange(value)}