Replaced salesPerson by packages column

This commit is contained in:
Joan Sanchez 2021-06-18 16:07:13 +02:00
parent 962724a29e
commit a50eebfed4
2 changed files with 30 additions and 16 deletions

View File

@ -1,11 +1,12 @@
<vn-crud-model
vn-id="ticketsModel"
auto-load="true"
url="Tickets/filter"
link="{'t.clientFk': $ctrl.$params.id}"
url="Tickets"
link="{clientFk: $ctrl.$params.id}"
filter="::$ctrl.ticketFilter"
limit="5"
data="tickets"
order="shippedDate DESC, shippedHour ASC">
order="shipped DESC">
</vn-crud-model>
<vn-card class="summary">
<h5>
@ -292,7 +293,7 @@
<vn-tr>
<vn-th field="id" number>Id</vn-th>
<vn-th field="nickname" expand>Client</vn-th>
<vn-th field="salesPersonFk">Salesperson</vn-th>
<vn-th field="packages" shrink>Packages</vn-th>
<vn-th field="shipped" shrink-date>Date</vn-th>
<vn-th field="stateFk">State</vn-th>
<vn-th shrink>Total</vn-th>
@ -312,13 +313,8 @@
{{::ticket.nickname}}
</span>
</vn-td>
<vn-td>
<span
title="{{::ticket.userName}}"
vn-click-stop="workerDescriptor.show($event, ticket.salesPersonFk)"
class="link">
{{::ticket.userName | dashIfEmpty}}
</span>
<vn-td shrink>
{{::ticket.packages}}
</vn-td>
<vn-td shrink-date>
<span class="chip {{::$ctrl.chipColor(ticket.shipped)}}">
@ -336,7 +332,7 @@
<span
ng-show="::!ticket.refFk"
class="chip {{::$ctrl.stateColor(ticket)}}">
{{::ticket.state}}
{{::ticket.ticketState.state.name}}
</span>
</vn-td>
<vn-td shrink>

View File

@ -3,6 +3,21 @@ import Summary from 'salix/components/summary';
import './style.scss';
class Controller extends Summary {
constructor($element, $) {
super($element, $);
this.ticketFilter = {
include: {
relation: 'ticketState',
scope: {
fields: ['stateFk', 'code', 'alertLevel'],
include: {
relation: 'state'
}
}
}
};
}
$onChanges() {
if (!this.client)
return;
@ -18,6 +33,7 @@ class Controller extends Summary {
}
});
}
get isEmployee() {
return this.aclService.hasAny(['employee']);
}
@ -41,13 +57,15 @@ class Controller extends Summary {
}
stateColor(ticket) {
if (ticket.alertLevelCode === 'OK')
const ticketState = ticket.ticketState;
if (ticketState.code === 'OK')
return 'success';
else if (ticket.alertLevelCode === 'FREE')
else if (ticketState.code === 'FREE')
return 'notice';
else if (ticket.alertLevel === 1)
else if (ticketState.alertLevel === 1)
return 'warning';
else if (ticket.alertLevel === 0)
else if (ticketState.alertLevel === 0)
return 'alert';
}