fix(salesMonitor): now sorts correctly by practical and theorical hour

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

View File

@ -197,7 +197,6 @@ module.exports = Self => {
t.id,
t.shipped,
CAST(DATE(t.shipped) AS CHAR) AS shippedDate,
HOUR(t.shipped) AS shippedHour,
t.nickname,
t.refFk,
t.routeFk,
@ -219,11 +218,10 @@ module.exports = Self => {
u.name AS userName,
c.salesPersonFk,
z.hour AS zoneLanding,
HOUR(z.hour) AS zoneHour,
MINUTE(z.hour) AS zoneMinute,
z.name AS zoneName,
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
FROM ticket t
LEFT JOIN invoiceOut io ON t.refFk = io.ref
@ -237,7 +235,11 @@ module.exports = Self => {
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
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) {
stmt.merge({

View File

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

View File

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