2961 - Show tickets on summary
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
47c9071bdb
commit
353d0e352d
|
@ -1,3 +1,12 @@
|
|||
<vn-crud-model
|
||||
vn-id="ticketsModel"
|
||||
auto-load="true"
|
||||
url="Tickets/filter"
|
||||
link="{'t.clientFk': $ctrl.$params.id}"
|
||||
limit="5"
|
||||
data="tickets"
|
||||
order="shippedDate DESC, shippedHour ASC">
|
||||
</vn-crud-model>
|
||||
<vn-card class="summary">
|
||||
<h5>
|
||||
<a ng-if="::$ctrl.summary.id"
|
||||
|
@ -269,14 +278,112 @@
|
|||
ng-class="{alert: $ctrl.summary.defaulters[0].amount}"
|
||||
info="Deviated invoices minus payments">
|
||||
</vn-label-value>
|
||||
<vn-vertical ng-if="$ctrl.summary.recovery.started">
|
||||
<vn-label-value label="Recovery since"
|
||||
value="{{$ctrl.summary.recovery.started | date:'dd/MM/yyyy'}}">
|
||||
<vn-label-value label="Recovery since"
|
||||
ng-if="$ctrl.summary.recovery.started"
|
||||
value="{{$ctrl.summary.recovery.started | date:'dd/MM/yyyy'}}">
|
||||
</vn-label-value>
|
||||
</vn-vertical>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<h4 translate>Last tickets</h4>
|
||||
<vn-table model="ticketsModel" class="scrollable sm">
|
||||
<vn-thead>
|
||||
<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="shipped" shrink-date>Date</vn-th>
|
||||
<vn-th field="stateFk">State</vn-th>
|
||||
<vn-th shrink>Total</vn-th>
|
||||
<vn-th></vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<a ng-repeat="ticket in ticketsModel.data"
|
||||
class="clickable vn-tr search-result"
|
||||
ui-sref="ticket.card.summary({id: {{::ticket.id}}})">
|
||||
<vn-td number>{{::ticket.id}}</vn-td>
|
||||
<vn-td expand>
|
||||
<span
|
||||
title="{{::ticket.nickname}}"
|
||||
vn-click-stop="clientDescriptor.show($event, ticket.clientFk)"
|
||||
class="link">
|
||||
{{::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>
|
||||
<vn-td shrink-date>
|
||||
<span class="chip {{::$ctrl.chipColor(ticket.shipped)}}">
|
||||
{{::ticket.shipped | date: 'dd/MM/yyyy'}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td>
|
||||
<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)}}">
|
||||
{{::ticket.state}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td shrink>
|
||||
<span class="chip {{$ctrl.totalPriceColor(ticket)}}">
|
||||
{{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-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>
|
||||
</vn-td>
|
||||
</a>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
<vn-pagination
|
||||
model="ticketsModel"
|
||||
class="vn-pt-xs"
|
||||
scroll-selector="vn-table[model='ticketsModel']"
|
||||
scroll-offset="100">
|
||||
</vn-pagination>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-client-descriptor-popover
|
||||
vn-id="clientDescriptor">
|
||||
</vn-client-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor">
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-invoice-out-descriptor-popover
|
||||
vn-id="invoiceOutDescriptor">
|
||||
</vn-invoice-out-descriptor-popover>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-ticket-summary
|
||||
ticket="$ctrl.selectedTicket"
|
||||
model="model">
|
||||
</vn-ticket-summary>
|
||||
</vn-popup>
|
|
@ -39,6 +39,44 @@ class Controller extends Summary {
|
|||
if (rate)
|
||||
return rate * 100;
|
||||
}
|
||||
|
||||
stateColor(ticket) {
|
||||
if (ticket.alertLevelCode === 'OK')
|
||||
return 'success';
|
||||
else if (ticket.alertLevelCode === 'FREE')
|
||||
return 'notice';
|
||||
else if (ticket.alertLevel === 1)
|
||||
return 'warning';
|
||||
else if (ticket.alertLevel === 0)
|
||||
return 'alert';
|
||||
}
|
||||
|
||||
chipColor(date) {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
const ticketShipped = new Date(date);
|
||||
ticketShipped.setHours(0, 0, 0, 0);
|
||||
|
||||
const difference = today - ticketShipped;
|
||||
|
||||
if (difference == 0)
|
||||
return 'warning';
|
||||
if (difference < 0)
|
||||
return 'success';
|
||||
console.log('a');
|
||||
}
|
||||
|
||||
totalPriceColor(ticket) {
|
||||
const total = parseInt(ticket.totalWithVat);
|
||||
if (total > 0 && total < 50)
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
preview(ticket) {
|
||||
this.selectedTicket = ticket;
|
||||
this.$.summary.show();
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnClientSummary', {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
@import "variables";
|
||||
|
||||
vn-client-summary {
|
||||
vn-client-summary .summary {
|
||||
max-width: $width-lg;
|
||||
|
||||
.alert span {
|
||||
color: $color-alert !important
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue