ticket index and zone descriptor refactor #342

Merged
bernat merged 1 commits from 2377-ticket_index into dev 2020-07-30 11:02:07 +00:00
10 changed files with 71 additions and 25 deletions
Showing only changes of commit 9402f368f6 - Show all commits

View File

@ -556,7 +556,7 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
(12, 1, 1, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()), (12, 1, 1, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
(13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 3, CURDATE()), (13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 3, CURDATE()),
(14, 1, 2, 1, NULL, CURDATE(), CURDATE(), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()), (14, 1, 2, 1, NULL, CURDATE(), CURDATE(), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()),
(15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, 3, CURDATE()), (15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, CURDATE()),
(16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()), (16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
(17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()), (17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
(18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()), (18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()),

View File

@ -203,14 +203,16 @@ module.exports = Self => {
am.id AS agencyModeFk, am.id AS agencyModeFk,
st.name AS state, st.name AS state,
wk.lastName AS salesPerson, wk.lastName AS salesPerson,
ts.stateFk as stateFk, ts.stateFk AS stateFk,
ts.alertLevel as alertLevel, ts.alertLevel AS alertLevel,
ts.code as alertLevelCode, ts.code AS alertLevelCode,
u.nickname userNickname, u.name AS userName,
c.salesPersonFk, c.salesPersonFk,
z.hour zoneLanding, z.hour AS zoneLanding,
HOUR(z.hour) zoneHour, HOUR(z.hour) AS zoneHour,
MINUTE(z.hour) zoneMinute, MINUTE(z.hour) AS zoneMinute,
z.name AS zoneName,
z.id AS zoneFk,
CAST(z.hour AS CHAR) AS hour CAST(z.hour AS CHAR) AS hour
FROM ticket t FROM ticket t
LEFT JOIN zone z ON z.id = t.zoneFk LEFT JOIN zone z ON z.id = t.zoneFk

View File

@ -5,19 +5,25 @@ class Controller extends ModuleCard {
reload() { reload() {
let filter = { let filter = {
include: [ include: [
{relation: 'address'}, {
{relation: 'ship'}, relation: 'address'},
{relation: 'stowaway'}, {
relation: 'ship'},
{
relation: 'stowaway'},
{ {
relation: 'warehouse', relation: 'warehouse',
scope: {fields: ['name']} scope: {fields: ['name']}
}, { },
{
relation: 'invoiceOut', relation: 'invoiceOut',
scope: {fields: ['id']} scope: {fields: ['id']}
}, { },
{
relation: 'agencyMode', relation: 'agencyMode',
scope: {fields: ['name']} scope: {fields: ['name']}
}, { },
{
relation: 'client', relation: 'client',
scope: { scope: {
fields: [ fields: [

View File

@ -21,7 +21,7 @@
<vn-th field="nickname">Alias</vn-th> <vn-th field="nickname">Alias</vn-th>
<vn-th field="provinceFk" class="expendable">Province</vn-th> <vn-th field="provinceFk" class="expendable">Province</vn-th>
<vn-th field="stateFk" >State</vn-th> <vn-th field="stateFk" >State</vn-th>
<vn-th field="agencyModeFk">Agency</vn-th> <vn-th field="zoneFk">Zone</vn-th>
<vn-th field="warehouseFk">Warehouse</vn-th> <vn-th field="warehouseFk">Warehouse</vn-th>
<vn-th field="refFk" class="expendable">Invoice</vn-th> <vn-th field="refFk" class="expendable">Invoice</vn-th>
<vn-th field="hour" shrink>Closure</vn-th> <vn-th field="hour" shrink>Closure</vn-th>
@ -66,21 +66,23 @@
</vn-icon> </vn-icon>
</vn-td> </vn-td>
<vn-td number>{{::ticket.id}}</vn-td> <vn-td number>{{::ticket.id}}</vn-td>
<vn-td expand class="expendable"> <vn-td class="expendable">
<span <span
title="{{::ticket.userName}}"
vn-click-stop="workerDescriptor.show($event, ticket.salesPersonFk)" vn-click-stop="workerDescriptor.show($event, ticket.salesPersonFk)"
class="link"> class="link">
{{::ticket.userNickname | dashIfEmpty}} {{::ticket.userName | dashIfEmpty}}
</span> </span>
</vn-td> </vn-td>
<vn-td> <vn-td expand>
<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>
</vn-td> </vn-td>
<vn-td>{{::ticket.shipped | date: 'HH:mm'}}</vn-td> <vn-td>{{::ticket.shipped | date: 'HH:mm'}}</vn-td>
<vn-td expand> <vn-td>
<span <span
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}}
@ -92,7 +94,14 @@
{{ticket.state}} {{ticket.state}}
</span> </span>
</vn-td> </vn-td>
<vn-td>{{::ticket.agencyMode}}</vn-td> <vn-td>
<span
title="{{::ticket.zoneName}}"
vn-click-stop="zoneDescriptor.show($event, ticket.zoneFk)"
class="link">
{{::ticket.zoneName | dashIfEmpty}}
</span>
</vn-td>
<vn-td>{{::ticket.warehouse}}</vn-td> <vn-td>{{::ticket.warehouse}}</vn-td>
<vn-td class="expendable">{{::ticket.refFk | dashIfEmpty}}</vn-td> <vn-td class="expendable">{{::ticket.refFk | dashIfEmpty}}</vn-td>
<vn-td shrink>{{::ticket.zoneLanding | date: 'HH:mm'}}</vn-td> <vn-td shrink>{{::ticket.zoneLanding | date: 'HH:mm'}}</vn-td>
@ -155,6 +164,9 @@
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor"> vn-id="workerDescriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>
<vn-zone-descriptor-popover
vn-id="zoneDescriptor">
</vn-zone-descriptor-popover>
<vn-client-balance-create <vn-client-balance-create
vn-id="balanceCreateDialog"> vn-id="balanceCreateDialog">
</vn-client-balance-create> </vn-client-balance-create>

View File

@ -3,7 +3,7 @@
"name": "Tickets", "name": "Tickets",
"icon": "icon-ticket", "icon": "icon-ticket",
"validations": true, "validations": true,
"dependencies": ["worker", "item", "client", "route", "invoiceOut"], "dependencies": ["worker", "item", "client", "route", "invoiceOut", "zone"],
"menus": { "menus": {
"main": [ "main": [
{"state": "ticket.index", "icon": "icon-ticket"}, {"state": "ticket.index", "icon": "icon-ticket"},

View File

@ -0,0 +1,4 @@
<slot-descriptor>
<vn-zone-descriptor>
</vn-zone-descriptor>
</slot-descriptor>

View File

@ -0,0 +1,9 @@
import ngModule from '../module';
import DescriptorPopover from 'salix/components/descriptor-popover';
class Controller extends DescriptorPopover {}
ngModule.vnComponent('vnZoneDescriptorPopover', {
slotTemplate: require('./index.html'),
controller: Controller
});

View File

@ -16,10 +16,6 @@
</slot-menu> </slot-menu>
<slot-body> <slot-body>
<div class="attributes"> <div class="attributes">
<vn-label-value
label="Warehouse"
value="{{$ctrl.zone.warehouse.name}}">
</vn-label-value>
<vn-label-value <vn-label-value
label="Agency" label="Agency"
value="{{$ctrl.zone.agencyMode.name}}"> value="{{$ctrl.zone.agencyMode.name}}">

View File

@ -10,6 +10,22 @@ class Controller extends Descriptor {
this.entity = value; this.entity = value;
} }
loadData() {
const filter = {
include: [
{
relation: 'agencyMode',
scope: {
fields: ['name'],
}
}
]
};
return this.getData(`Zones/${this.id}`, {filter})
.then(res => this.entity = res.data);
}
onDelete() { onDelete() {
const $t = this.$translate.instant; const $t = this.$translate.instant;
const today = new Date(); const today = new Date();

View File

@ -6,6 +6,7 @@ import './delivery-days';
import './summary'; import './summary';
import './card'; import './card';
import './descriptor'; import './descriptor';
import './descriptor-popover';
import './search-panel'; import './search-panel';
import './create'; import './create';
import './basic-data'; import './basic-data';