Merge pull request 'ticket index and zone descriptor refactor' (#342) from 2377-ticket_index into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #342
Reviewed-by: Bernat Exposito <bernat@verdnatura.es>
This commit is contained in:
Bernat Exposito 2020-07-30 11:01:53 +00:00
commit 2e44c2d9db
10 changed files with 71 additions and 25 deletions

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()),
(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()),
(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()),
(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()),

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
"name": "Tickets",
"icon": "icon-ticket",
"validations": true,
"dependencies": ["worker", "item", "client", "route", "invoiceOut"],
"dependencies": ["worker", "item", "client", "route", "invoiceOut", "zone"],
"menus": {
"main": [
{"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-body>
<div class="attributes">
<vn-label-value
label="Warehouse"
value="{{$ctrl.zone.warehouse.name}}">
</vn-label-value>
<vn-label-value
label="Agency"
value="{{$ctrl.zone.agencyMode.name}}">

View File

@ -10,6 +10,22 @@ class Controller extends Descriptor {
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() {
const $t = this.$translate.instant;
const today = new Date();

View File

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