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,187 +1,155 @@
<vn-auto-search <vn-auto-search
model="model"> model="model">
</vn-auto-search> </vn-auto-search>
<vn-card> <vn-data-viewer
<smart-table model="model"
model="model" class="vn-mb-xl vn-w-xl">
view-config-id="ticketIndex" <vn-card>
options="$ctrl.smartTableOptions" <vn-table model="model">
auto-save="true" <vn-thead>
expr-builder="$ctrl.exprBuilder(param, value)" <vn-tr>
default-new-data="$ctrl.defaultNewData()"> <vn-th shrink>
<slot-table> <vn-multi-check
<table class="vn-table"> model="model">
<thead> </vn-multi-check>
<tr> </vn-th>
<th shrink> <vn-th class="icon-field"></vn-th>
<vn-multi-check <vn-th field="id">Id</vn-th>
model="model" <vn-th field="salesPersonFk" class="expendable">Salesperson</vn-th>
check-field="$checked"> <!-- Change $checked as default prop --> <vn-th field="shipped" shrink-date>Date</vn-th>
</vn-multi-check> <vn-th>Hour</vn-th>
</th> <vn-th field="zoneHour" shrink>Closure</vn-th>
<th class="icon-field"></th> <vn-th field="nickname">Alias</vn-th>
<th field="id"> <vn-th field="provinceFk" class="expendable">Province</vn-th>
<span translate>#ID</span> <vn-th field="stateFk" >State</vn-th>
</th> <vn-th field="zoneFk">Zone</vn-th>
<th field="salesPersonFk"> <vn-th field="warehouseFk">Warehouse</vn-th>
<span translate>Salesperson</span> <vn-th number>Total</vn-th>
</th> <vn-th></vn-th>
<th field="shipped" shrink-date> </vn-tr>
<span translate>Date</span> </vn-thead>
</th> <vn-tbody>
<th> <a ng-repeat="ticket in model.data"
<span translate>Hour</span> class="clickable vn-tr search-result"
</th> ui-sref="ticket.card.summary({id: {{::ticket.id}}})">
<th field="zoneHour" shrink> <vn-td>
<span translate>Closure</span> <vn-check
</th> ng-model="ticket.checked"
<th field="nickname"> vn-click-stop>
<span translate>Alias</span> </vn-check>
</th> </vn-td>
<th field="provinceFk"> <vn-td class="icon-field">
<span translate>Province</span> <vn-icon
</th> ng-show="::ticket.isTaxDataChecked === 0"
<th field="stateFk"> translate-attr="{title: 'No verified data'}"
<span translate>State</span> class="bright"
</th> icon="icon-no036">
<th field="zoneFk"> </vn-icon>
<span translate>Zone</span> <vn-icon
</th> ng-show="::ticket.hasTicketRequest"
<th field="warehouseFk"> translate-attr="{title: 'Purchase request'}"
<span translate>Warehouse</span> class="bright"
</th> icon="icon-100">
<th field="totalWithVat" number> </vn-icon>
<span translate>Total</span> <vn-icon
</th> ng-show="::ticket.isAvailable === 0"
<th></th> translate-attr="{title: 'Not available'}"
</tr> class="bright"
</thead> icon="icon-unavailable">
<tbody> </vn-icon>
<tr ng-repeat="ticket in model.data | orderBy:'!!id'" <vn-icon
ng-class="{'new-row': ticket.$isNew, 'changed-row': ticket.$oldData}" ng-show="::ticket.isFreezed"
vn-anchor="::{ translate-attr="{title: 'Client frozen'}"
state: 'ticket.card.summary', class="bright"
params: {id: ticket.id} icon="icon-frozen">
}"> </vn-icon>
<td> <vn-icon
<vn-check ng-show="::ticket.risk"
ng-model="ticket.$checked" title="{{::$ctrl.$t('Risk')}}: {{ticket.risk}}"
vn-click-stop> class="bright"
</vn-check> icon="icon-risk">
</td> </vn-icon>
<td class="icon-field"> <vn-icon
<vn-icon ng-show="::ticket.hasComponentLack"
ng-show="::ticket.isTaxDataChecked === 0" translate-attr="{title: 'Component lack'}"
translate-attr="{title: 'No verified data'}" class="bright"
class="bright" icon="icon-components">
icon="icon-no036"> </vn-icon>
</vn-icon> </vn-td>
<vn-icon <vn-td shrink>{{::ticket.id}}</vn-td>
ng-show="::ticket.hasTicketRequest" <vn-td class="expendable">
translate-attr="{title: 'Purchase request'}" <span
class="bright" title="{{::ticket.userName}}"
icon="icon-100"> vn-click-stop="workerDescriptor.show($event, ticket.salesPersonFk)"
</vn-icon> class="link">
<vn-icon {{::ticket.userName | dashIfEmpty}}
ng-show="::ticket.isAvailable === 0" </span>
translate-attr="{title: 'Not available'}" </vn-td>
class="bright" <vn-td shrink-date>
icon="icon-unavailable"> <span class="chip {{$ctrl.compareDate(ticket.shipped)}}">
</vn-icon> {{::ticket.shipped | date: 'dd/MM/yyyy'}}
<vn-icon </span>
ng-show="::ticket.isFreezed" </vn-td>
translate-attr="{title: 'Client frozen'}" <vn-td shrink>{{::ticket.shipped | date: 'HH:mm'}}</vn-td>
class="bright" <vn-td shrink>{{::ticket.zoneLanding | date: 'HH:mm'}}</vn-td>
icon="icon-frozen"> <vn-td>
</vn-icon> <span
<vn-icon title="{{::ticket.nickname}}"
ng-show="::ticket.risk" vn-click-stop="clientDescriptor.show($event, ticket.clientFk)"
title="{{::$ctrl.$t('Risk')}}: {{ticket.risk}}" class="link">
class="bright" {{::ticket.nickname}}
icon="icon-risk"> </span>
</vn-icon> </vn-td>
<vn-icon <vn-td class="expendable">{{::ticket.province}}</vn-td>
ng-show="::ticket.hasComponentLack" <vn-td class="expendable">
translate-attr="{title: 'Component lack'}" <span
class="bright" ng-show="ticket.refFk"
icon="icon-components"> title="{{::ticket.refFk}}"
</vn-icon> vn-click-stop="invoiceOutDescriptor.show($event, ticket.invoiceOutId)"
</td> class="link">
<td shrink>{{::ticket.id}}</td> {{::ticket.refFk}}
<td class="expendable"> </span>
<span <span
title="{{::ticket.userName}}" ng-show="!ticket.refFk"
vn-click-stop="workerDescriptor.show($event, ticket.salesPersonFk)" class="chip {{$ctrl.stateColor(ticket)}}">
class="link"> {{ticket.state}}
{{::ticket.userName | dashIfEmpty}} </span>
</span> </vn-td>
</td> <vn-td>
<td shrink-date> <span
<span class="chip {{$ctrl.compareDate(ticket.shipped)}}"> title="{{::ticket.zoneName}}"
{{::ticket.shipped | date: 'dd/MM/yyyy'}} vn-click-stop="zoneDescriptor.show($event, ticket.zoneFk)"
</span> class="link">
</td> {{::ticket.zoneName | dashIfEmpty}}
<td shrink>{{::ticket.shipped | date: 'HH:mm'}}</td> </span>
<td shrink>{{::ticket.zoneLanding | date: 'HH:mm'}}</td> </vn-td>
<td> <vn-td>{{::ticket.warehouse}}</vn-td>
<span <vn-td number>
title="{{::ticket.nickname}}" <span class="chip {{$ctrl.totalPriceColor(ticket)}}">
vn-click-stop="clientDescriptor.show($event, ticket.clientFk)" {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
class="link"> </span>
{{::ticket.nickname}} </vn-td>
</span> <vn-td actions>
</td> <vn-icon-button
<td class="expendable">{{::ticket.province}}</td> vn-anchor="::{
<td class="expendable"> state: 'ticket.card.sale',
<span params: {id: ticket.id},
ng-show="ticket.refFk" target: '_blank'
title="{{::ticket.refFk}}" }"
vn-click-stop="invoiceOutDescriptor.show($event, ticket.invoiceOutId)" vn-tooltip="Go to lines"
class="link"> icon="icon-lines">
{{::ticket.refFk}} </vn-icon-button>
</span> <vn-icon-button
<span vn-click-stop="$ctrl.preview(ticket)"
ng-show="!ticket.refFk" vn-tooltip="Preview"
class="chip {{$ctrl.stateColor(ticket)}}"> icon="preview">
{{ticket.state}} </vn-icon-button>
</span> </vn-td>
</td> </a>
<td> </vn-tbody>
<span </vn-table>
title="{{::ticket.zoneName}}" </vn-card>
vn-click-stop="zoneDescriptor.show($event, ticket.zoneFk)" </vn-data-viewer>
class="link">
{{::ticket.zoneName | dashIfEmpty}}
</span>
</td>
<td>{{::ticket.warehouse}}</td>
<td number>
<span class="chip {{$ctrl.totalPriceColor(ticket)}}">
{{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
</span>
</td>
<td actions>
<vn-icon-button
vn-anchor="::{
state: 'ticket.card.sale',
params: {id: ticket.id},
target: '_blank'
}"
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>
</td>
</tr>
</tbody>
</table>
</slot-table>
</smart-table>
</vn-card>
<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
} }
} }