ticket index rollback

This commit is contained in:
Carlos Jimenez Ruiz 2021-11-11 17:17:48 +01:00
parent d2dc0bd147
commit 4fe7d4f566
3 changed files with 157 additions and 239 deletions

View File

@ -1,75 +1,44 @@
<vn-auto-search <vn-auto-search
model="model"> model="model">
</vn-auto-search> </vn-auto-search>
<vn-data-viewer
model="model"
class="vn-mb-xl vn-w-xl">
<vn-card> <vn-card>
<smart-table <vn-table model="model">
model="model" <vn-thead>
view-config-id="ticketIndex" <vn-tr>
options="$ctrl.smartTableOptions" <vn-th shrink>
auto-save="true"
expr-builder="$ctrl.exprBuilder(param, value)"
default-new-data="$ctrl.defaultNewData()">
<slot-table>
<table class="vn-table">
<thead>
<tr>
<th shrink>
<vn-multi-check <vn-multi-check
model="model" model="model">
check-field="$checked"> <!-- Change $checked as default prop -->
</vn-multi-check> </vn-multi-check>
</th> </vn-th>
<th class="icon-field"></th> <vn-th class="icon-field"></vn-th>
<th field="id"> <vn-th field="id">Id</vn-th>
<span translate>#ID</span> <vn-th field="salesPersonFk" class="expendable">Salesperson</vn-th>
</th> <vn-th field="shipped" shrink-date>Date</vn-th>
<th field="salesPersonFk"> <vn-th>Hour</vn-th>
<span translate>Salesperson</span> <vn-th field="zoneHour" shrink>Closure</vn-th>
</th> <vn-th field="nickname">Alias</vn-th>
<th field="shipped" shrink-date> <vn-th field="provinceFk" class="expendable">Province</vn-th>
<span translate>Date</span> <vn-th field="stateFk" >State</vn-th>
</th> <vn-th field="zoneFk">Zone</vn-th>
<th> <vn-th field="warehouseFk">Warehouse</vn-th>
<span translate>Hour</span> <vn-th number>Total</vn-th>
</th> <vn-th></vn-th>
<th field="zoneHour" shrink> </vn-tr>
<span translate>Closure</span> </vn-thead>
</th> <vn-tbody>
<th field="nickname"> <a ng-repeat="ticket in model.data"
<span translate>Alias</span> class="clickable vn-tr search-result"
</th> ui-sref="ticket.card.summary({id: {{::ticket.id}}})">
<th field="provinceFk"> <vn-td>
<span translate>Province</span>
</th>
<th field="stateFk">
<span translate>State</span>
</th>
<th field="zoneFk">
<span translate>Zone</span>
</th>
<th field="warehouseFk">
<span translate>Warehouse</span>
</th>
<th field="totalWithVat" number>
<span translate>Total</span>
</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="ticket in model.data | orderBy:'!!id'"
ng-class="{'new-row': ticket.$isNew, 'changed-row': ticket.$oldData}"
vn-anchor="::{
state: 'ticket.card.summary',
params: {id: ticket.id}
}">
<td>
<vn-check <vn-check
ng-model="ticket.$checked" ng-model="ticket.checked"
vn-click-stop> vn-click-stop>
</vn-check> </vn-check>
</td> </vn-td>
<td class="icon-field"> <vn-td class="icon-field">
<vn-icon <vn-icon
ng-show="::ticket.isTaxDataChecked === 0" ng-show="::ticket.isTaxDataChecked === 0"
translate-attr="{title: 'No verified data'}" translate-attr="{title: 'No verified data'}"
@ -106,33 +75,33 @@
class="bright" class="bright"
icon="icon-components"> icon="icon-components">
</vn-icon> </vn-icon>
</td> </vn-td>
<td shrink>{{::ticket.id}}</td> <vn-td shrink>{{::ticket.id}}</vn-td>
<td class="expendable"> <vn-td class="expendable">
<span <span
title="{{::ticket.userName}}" title="{{::ticket.userName}}"
vn-click-stop="workerDescriptor.show($event, ticket.salesPersonFk)" vn-click-stop="workerDescriptor.show($event, ticket.salesPersonFk)"
class="link"> class="link">
{{::ticket.userName | dashIfEmpty}} {{::ticket.userName | dashIfEmpty}}
</span> </span>
</td> </vn-td>
<td shrink-date> <vn-td shrink-date>
<span class="chip {{$ctrl.compareDate(ticket.shipped)}}"> <span class="chip {{$ctrl.compareDate(ticket.shipped)}}">
{{::ticket.shipped | date: 'dd/MM/yyyy'}} {{::ticket.shipped | date: 'dd/MM/yyyy'}}
</span> </span>
</td> </vn-td>
<td shrink>{{::ticket.shipped | date: 'HH:mm'}}</td> <vn-td shrink>{{::ticket.shipped | date: 'HH:mm'}}</vn-td>
<td shrink>{{::ticket.zoneLanding | date: 'HH:mm'}}</td> <vn-td shrink>{{::ticket.zoneLanding | date: 'HH:mm'}}</vn-td>
<td> <vn-td>
<span <span
title="{{::ticket.nickname}}" title="{{::ticket.nickname}}"
vn-click-stop="clientDescriptor.show($event, ticket.clientFk)" vn-click-stop="clientDescriptor.show($event, ticket.clientFk)"
class="link"> class="link">
{{::ticket.nickname}} {{::ticket.nickname}}
</span> </span>
</td> </vn-td>
<td class="expendable">{{::ticket.province}}</td> <vn-td class="expendable">{{::ticket.province}}</vn-td>
<td class="expendable"> <vn-td class="expendable">
<span <span
ng-show="ticket.refFk" ng-show="ticket.refFk"
title="{{::ticket.refFk}}" title="{{::ticket.refFk}}"
@ -145,22 +114,22 @@
class="chip {{$ctrl.stateColor(ticket)}}"> class="chip {{$ctrl.stateColor(ticket)}}">
{{ticket.state}} {{ticket.state}}
</span> </span>
</td> </vn-td>
<td> <vn-td>
<span <span
title="{{::ticket.zoneName}}" title="{{::ticket.zoneName}}"
vn-click-stop="zoneDescriptor.show($event, ticket.zoneFk)" vn-click-stop="zoneDescriptor.show($event, ticket.zoneFk)"
class="link"> class="link">
{{::ticket.zoneName | dashIfEmpty}} {{::ticket.zoneName | dashIfEmpty}}
</span> </span>
</td> </vn-td>
<td>{{::ticket.warehouse}}</td> <vn-td>{{::ticket.warehouse}}</vn-td>
<td number> <vn-td number>
<span class="chip {{$ctrl.totalPriceColor(ticket)}}"> <span class="chip {{$ctrl.totalPriceColor(ticket)}}">
{{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
</span> </span>
</td> </vn-td>
<td actions> <vn-td actions>
<vn-icon-button <vn-icon-button
vn-anchor="::{ vn-anchor="::{
state: 'ticket.card.sale', state: 'ticket.card.sale',
@ -175,13 +144,12 @@
vn-tooltip="Preview" vn-tooltip="Preview"
icon="preview"> icon="preview">
</vn-icon-button> </vn-icon-button>
</td> </vn-td>
</tr> </a>
</tbody> </vn-tbody>
</table> </vn-table>
</slot-table>
</smart-table>
</vn-card> </vn-card>
</vn-data-viewer>
<div fixed-bottom-right> <div fixed-bottom-right>
<vn-vertical style="align-items: center;"> <vn-vertical style="align-items: center;">
<vn-button class="round sm vn-mb-sm" <vn-button class="round sm vn-mb-sm"
@ -237,8 +205,7 @@
<vn-invoice-out-descriptor-popover <vn-invoice-out-descriptor-popover
vn-id="invoiceOutDescriptor"> vn-id="invoiceOutDescriptor">
</vn-invoice-out-descriptor-popover> </vn-invoice-out-descriptor-popover>
<vn-contextmenu vn-id="contextmenu" targets="['vn-data-viewer']" model="model"
<vn-contextmenu vn-id="contextmenu" targets="['smart-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

View File

@ -7,49 +7,6 @@ export default class Controller extends Section {
constructor($element, $, vnReport) { constructor($element, $, vnReport) {
super($element, $); super($element, $);
this.vnReport = vnReport; this.vnReport = vnReport;
this.smartTableOptions = {
activeButtons: {
search: true,
crud: true,
shownColumns: true,
},
columns: [
{
field: 'salesPersonFk',
autocomplete: {
url: 'Workers/activeWithInheritedRole',
where: `{role: 'salesPerson'}`,
searchFunction: '{firstName: $search}',
showField: 'nickname',
valueField: 'id',
}
},
{
field: 'provinceFk',
autocomplete: {
url: 'Provinces',
}
},
{
field: 'stateFk',
autocomplete: {
url: 'States',
}
},
{
field: 'zoneFk',
autocomplete: {
url: 'Zones',
}
},
{
field: 'warehouseFk',
autocomplete: {
url: 'Warehouses',
}
},
]
};
} }
setDelivered() { setDelivered() {
@ -107,7 +64,7 @@ export default class Controller extends Section {
const tickets = this.$.model.data || []; const tickets = this.$.model.data || [];
const checkedLines = []; const checkedLines = [];
for (let ticket of tickets) { for (let ticket of tickets) {
if (ticket.$checked) if (ticket.checked)
checkedLines.push(ticket); checkedLines.push(ticket);
} }
@ -171,12 +128,6 @@ export default class Controller extends Section {
this.$.summary.show(); this.$.summary.show();
} }
defaultNewData() {
return {
nickname: 'my nickname',
};
}
exprBuilder(param, value) { exprBuilder(param, value) {
switch (param) { switch (param) {
case 'stateFk': case 'stateFk':

View File

@ -7,19 +7,19 @@ vn-ticket-index {
} }
} }
th.icon-field, vn-th.icon-field,
th.icon-field *, vn-th.icon-field *,
td.icon-field, vn-td.icon-field,
td.icon-field * { vn-td.icon-field * {
padding: 0 padding: 0
} }
td.icon-field > vn-icon { vn-td.icon-field > vn-icon {
margin-left: 3px; margin-left: 3px;
margin-right: 3px; margin-right: 3px;
} }
tbody a[ng-repeat].vn-tr:focus { vn-tbody a[ng-repeat].vn-tr:focus {
background-color: $color-primary-light background-color: $color-primary-light
} }
} }