2708 - Extra community changes #503
|
@ -832,7 +832,8 @@ export default {
|
||||||
},
|
},
|
||||||
travelExtraCommunity: {
|
travelExtraCommunity: {
|
||||||
anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr',
|
anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr',
|
||||||
firstTravelReference: 'vn-travel-extra-community vn-card:nth-child(1) vn-td-editable',
|
firstTravelReference: 'vn-travel-extra-community vn-card:nth-child(1) vn-td-editable[name="reference"]',
|
||||||
|
firstTravelLockedKg: 'vn-travel-extra-community vn-card:nth-child(1) vn-td-editable[name="lockedKg"]',
|
||||||
removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i'
|
removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i'
|
||||||
},
|
},
|
||||||
travelBasicData: {
|
travelBasicData: {
|
||||||
|
|
|
@ -16,19 +16,22 @@ describe('Travel extra community path', () => {
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the travel reference', async() => {
|
it('should edit the travel reference and the locked kilograms', async() => {
|
||||||
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
||||||
await page.waitForSpinnerLoad();
|
await page.waitForSpinnerLoad();
|
||||||
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
||||||
|
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reload the index and confirm the reference was edited', async() => {
|
it('should reload the index and confirm the reference and locked kg were edited', async() => {
|
||||||
await page.accessToSection('travel.index');
|
await page.accessToSection('travel.index');
|
||||||
await page.accessToSection('travel.extraCommunity');
|
await page.accessToSection('travel.extraCommunity');
|
||||||
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
||||||
await page.waitForTextInElement(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
await page.waitForTextInElement(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
||||||
const reference = await page.getProperty(selectors.travelExtraCommunity.firstTravelReference, 'innerText');
|
const reference = await page.getProperty(selectors.travelExtraCommunity.firstTravelReference, 'innerText');
|
||||||
|
const lockedKg = await page.getProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'innerText');
|
||||||
|
|
||||||
expect(reference).toContain('edited reference');
|
expect(reference).toContain('edited reference');
|
||||||
|
expect(lockedKg).toContain(1500);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,75 +10,75 @@ module.exports = Self => {
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'ctx',
|
arg: 'ctx',
|
||||||
type: 'Object',
|
type: 'object',
|
||||||
http: {source: 'context'}
|
http: {source: 'context'}
|
||||||
}, {
|
}, {
|
||||||
arg: 'filter',
|
arg: 'filter',
|
||||||
type: 'Object',
|
type: 'object',
|
||||||
description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string`
|
description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string`
|
||||||
}, {
|
}, {
|
||||||
arg: 'search',
|
arg: 'search',
|
||||||
type: 'String',
|
type: 'string',
|
||||||
description: `If it's and integer searchs by id, otherwise it searchs by nickname`
|
description: `If it's and number searchs by id, otherwise it searchs by nickname`
|
||||||
}, {
|
}, {
|
||||||
arg: 'from',
|
arg: 'from',
|
||||||
type: 'Date',
|
type: 'date',
|
||||||
description: `The from date filter`
|
description: `The from date filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'to',
|
arg: 'to',
|
||||||
type: 'Date',
|
type: 'date',
|
||||||
description: `The to date filter`
|
description: `The to date filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'nickname',
|
arg: 'nickname',
|
||||||
type: 'String',
|
type: 'string',
|
||||||
description: `The nickname filter`
|
description: `The nickname filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'Integer',
|
type: 'number',
|
||||||
description: `The ticket id filter`
|
description: `The ticket id filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'clientFk',
|
arg: 'clientFk',
|
||||||
type: 'Integer',
|
type: 'number',
|
||||||
description: `The client id filter`
|
description: `The client id filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'agencyModeFk',
|
arg: 'agencyModeFk',
|
||||||
type: 'Integer',
|
type: 'number',
|
||||||
description: `The agency mode id filter`
|
description: `The agency mode id filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'warehouseFk',
|
arg: 'warehouseFk',
|
||||||
type: 'Integer',
|
type: 'number',
|
||||||
description: `The warehouse id filter`
|
description: `The warehouse id filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'salesPersonFk',
|
arg: 'salesPersonFk',
|
||||||
type: 'Integer',
|
type: 'number',
|
||||||
description: `The salesperson id filter`
|
description: `The salesperson id filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'provinceFk',
|
arg: 'provinceFk',
|
||||||
type: 'Integer',
|
type: 'number',
|
||||||
description: `The province id filter`
|
description: `The province id filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'stateFk',
|
arg: 'stateFk',
|
||||||
type: 'Number',
|
type: 'number',
|
||||||
description: `The state id filter`
|
description: `The state id filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'myTeam',
|
arg: 'myTeam',
|
||||||
type: 'Boolean',
|
type: 'boolean',
|
||||||
description: `Whether to show only tickets for the current logged user team (For now it shows only the current user tickets)`
|
description: `Whether to show only tickets for the current logged user team (For now it shows only the current user tickets)`
|
||||||
}, {
|
}, {
|
||||||
arg: 'problems',
|
arg: 'problems',
|
||||||
type: 'Boolean',
|
type: 'boolean',
|
||||||
description: `Whether to show only tickets with problems`
|
description: `Whether to show only tickets with problems`
|
||||||
}, {
|
}, {
|
||||||
arg: 'pending',
|
arg: 'pending',
|
||||||
type: 'Boolean',
|
type: 'boolean',
|
||||||
description: `Whether to show only tickets with state 'Pending'`
|
description: `Whether to show only tickets with state 'Pending'`
|
||||||
}, {
|
}, {
|
||||||
arg: 'mine',
|
arg: 'mine',
|
||||||
type: 'Boolean',
|
type: 'boolean',
|
||||||
description: `Whether to show only tickets for the current logged user`
|
description: `Whether to show only tickets for the current logged user`
|
||||||
}, {
|
}, {
|
||||||
arg: 'orderFk',
|
arg: 'orderFk',
|
||||||
type: 'Number',
|
type: 'number',
|
||||||
description: `The order id filter`
|
description: `The order id filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'refFk',
|
arg: 'refFk',
|
||||||
|
@ -86,12 +86,12 @@ module.exports = Self => {
|
||||||
description: `The invoice reference filter`
|
description: `The invoice reference filter`
|
||||||
}, {
|
}, {
|
||||||
arg: 'alertLevel',
|
arg: 'alertLevel',
|
||||||
type: 'Number',
|
type: 'number',
|
||||||
description: `The alert level of the tickets`
|
description: `The alert level of the tickets`
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
type: ['Object'],
|
type: ['object'],
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
|
|
|
@ -10,68 +10,74 @@ module.exports = Self => {
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'filter',
|
arg: 'filter',
|
||||||
type: 'Object',
|
type: 'object',
|
||||||
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'search',
|
arg: 'search',
|
||||||
type: 'String',
|
type: 'string',
|
||||||
description: 'Searchs the travel by id',
|
description: 'Searchs the travel by id'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'Integer',
|
type: 'number',
|
||||||
description: 'The travel id',
|
description: 'The travel id'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'shippedFrom',
|
arg: 'shippedFrom',
|
||||||
type: 'Date',
|
type: 'date',
|
||||||
description: 'The shipped from date filter',
|
description: 'The shipped from date filter'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'shippedTo',
|
arg: 'shippedTo',
|
||||||
type: 'Date',
|
type: 'date',
|
||||||
description: 'The shipped to date filter',
|
description: 'The shipped to date filter'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'landedFrom',
|
arg: 'landedFrom',
|
||||||
type: 'Date',
|
type: 'date',
|
||||||
description: 'The landed from date filter',
|
description: 'The landed from date filter'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'landedTo',
|
arg: 'landedTo',
|
||||||
type: 'Date',
|
type: 'date',
|
||||||
description: 'The landed to date filter',
|
description: 'The landed to date filter'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'agencyFk',
|
arg: 'agencyFk',
|
||||||
type: 'Number',
|
type: 'number',
|
||||||
description: 'The agencyModeFk id',
|
description: 'The agencyModeFk id'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'warehouseOutFk',
|
arg: 'warehouseOutFk',
|
||||||
type: 'Number',
|
type: 'number',
|
||||||
description: 'The warehouseOutFk filter',
|
description: 'The warehouseOutFk filter'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'warehouseInFk',
|
arg: 'warehouseInFk',
|
||||||
type: 'Number',
|
type: 'number',
|
||||||
description: 'The warehouseInFk filter',
|
description: 'The warehouseInFk filter'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'totalEntries',
|
arg: 'totalEntries',
|
||||||
type: 'Number',
|
type: 'number',
|
||||||
description: 'The totalEntries filter',
|
description: 'The totalEntries filter'
|
||||||
http: {source: 'query'}
|
},
|
||||||
}, {
|
{
|
||||||
arg: 'ref',
|
arg: 'ref',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The reference'
|
description: 'The reference'
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
arg: 'continent',
|
arg: 'continent',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'The continent code'
|
description: 'The continent code'
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
arg: 'cargoSupplierFk',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The freighter supplier id'
|
||||||
|
},
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
type: ['Object'],
|
type: ['Object'],
|
||||||
|
@ -108,6 +114,7 @@ module.exports = Self => {
|
||||||
case 'warehouseOutFk':
|
case 'warehouseOutFk':
|
||||||
case 'warehouseInFk':
|
case 'warehouseInFk':
|
||||||
case 'totalEntries':
|
case 'totalEntries':
|
||||||
|
case 'cargoSupplierFk':
|
||||||
param = `t.${param}`;
|
param = `t.${param}`;
|
||||||
return {[param]: value};
|
return {[param]: value};
|
||||||
}
|
}
|
||||||
|
@ -172,8 +179,8 @@ module.exports = Self => {
|
||||||
e.notes,
|
e.notes,
|
||||||
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg,
|
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg,
|
||||||
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
|
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
|
||||||
FROM entry e
|
FROM tmp.travel tr
|
||||||
JOIN tmp.travel tr ON tr.id = e.travelFk
|
JOIN entry e ON e.travelFk = tr.id
|
||||||
JOIN buy b ON b.entryFk = e.id
|
JOIN buy b ON b.entryFk = e.id
|
||||||
JOIN packaging pkg ON pkg.id = b.packageFk
|
JOIN packaging pkg ON pkg.id = b.packageFk
|
||||||
JOIN item i ON i.id = b.itemFk
|
JOIN item i ON i.id = b.itemFk
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
"m3": {
|
"m3": {
|
||||||
"type": "Number"
|
"type": "Number"
|
||||||
},
|
},
|
||||||
|
"kg": {
|
||||||
|
"type": "Number"
|
||||||
|
},
|
||||||
"cargoSupplierFk": {
|
"cargoSupplierFk": {
|
||||||
"type": "Number"
|
"type": "Number"
|
||||||
},
|
},
|
||||||
|
|
|
@ -39,24 +39,28 @@
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
vn-one
|
vn-one
|
||||||
label="Shipped from"
|
label="Shipped from"
|
||||||
ng-model="filter.shippedFrom">
|
ng-model="filter.shippedFrom"
|
||||||
|
on-change="$ctrl.shippedFrom = value">
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
vn-one
|
vn-one
|
||||||
label="Shipped to"
|
label="Shipped to"
|
||||||
ng-model="filter.shippedTo">
|
ng-model="filter.shippedTo"
|
||||||
|
on-change="$ctrl.shippedTo = value">
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
vn-one
|
vn-one
|
||||||
label="Landed from"
|
label="Landed from"
|
||||||
ng-model="filter.landedFrom">
|
ng-model="filter.landedFrom"
|
||||||
|
on-change="$ctrl.landedFrom = value">
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
vn-one
|
vn-one
|
||||||
label="Landed to"
|
label="Landed to"
|
||||||
ng-model="filter.landedTo">
|
ng-model="filter.landedTo"
|
||||||
|
on-change="$ctrl.landedTo = value">
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -76,6 +80,13 @@
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
<vn-autocomplete vn-one
|
||||||
|
label="Freighter"
|
||||||
|
ng-model="filter.cargoSupplierFk"
|
||||||
|
url="Suppliers"
|
||||||
|
show-field="name"
|
||||||
|
value-field="id">
|
||||||
|
</vn-autocomplete>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
label="Continent Out"
|
label="Continent Out"
|
||||||
ng-model="filter.continent"
|
ng-model="filter.continent"
|
||||||
|
|
|
@ -1,7 +1,59 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import SearchPanel from 'core/components/searchbar/search-panel';
|
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||||
|
|
||||||
|
class Controller extends SearchPanel {
|
||||||
|
constructor($, $element) {
|
||||||
|
super($, $element);
|
||||||
|
|
||||||
|
this.filter = this.$.filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
get shippedFrom() {
|
||||||
|
return this._shippedFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
set shippedFrom(value) {
|
||||||
|
this._shippedFrom = value;
|
||||||
|
|
||||||
|
if (!this.filter.shippedTo)
|
||||||
|
this.filter.shippedTo = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get shippedTo() {
|
||||||
|
return this._shippedTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
set shippedTo(value) {
|
||||||
|
this._shippedTo = value;
|
||||||
|
|
||||||
|
if (!this.filter.shippedFrom)
|
||||||
|
this.filter.shippedFrom = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get landedFrom() {
|
||||||
|
return this._landedFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
set landedFrom(value) {
|
||||||
|
this._landedFrom = value;
|
||||||
|
|
||||||
|
if (!this.filter.landedTo)
|
||||||
|
this.filter.landedTo = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get landedTo() {
|
||||||
|
return this._landedTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
set landedTo(value) {
|
||||||
|
this._landedTo = value;
|
||||||
|
|
||||||
|
if (!this.filter.landedFrom)
|
||||||
|
this.filter.landedFrom = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnExtraCommunitySearchPanel', {
|
ngModule.vnComponent('vnExtraCommunitySearchPanel', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: SearchPanel
|
controller: Controller
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,19 +9,27 @@
|
||||||
<vn-searchbar
|
<vn-searchbar
|
||||||
vn-focus
|
vn-focus
|
||||||
panel="vn-extra-community-search-panel"
|
panel="vn-extra-community-search-panel"
|
||||||
|
info="Search by travel id or reference"
|
||||||
|
placeholder="Search by extra community travel"
|
||||||
suggested-filter="$ctrl.defaultFilter"
|
suggested-filter="$ctrl.defaultFilter"
|
||||||
filter="$ctrl.defaultFilter"
|
filter="$ctrl.defaultFilter"
|
||||||
info="Search by travel id or reference"
|
|
||||||
auto-state="false"
|
auto-state="false"
|
||||||
model="model">
|
model="model">
|
||||||
</vn-searchbar>
|
</vn-searchbar>
|
||||||
</vn-portal>
|
</vn-portal>
|
||||||
<vn-data-viewer model="model" class="travel-list">
|
<vn-data-viewer model="model" class="travel-list">
|
||||||
joan marked this conversation as resolved
Outdated
|
|||||||
<vn-card ng-repeat="travel in travels" class="vn-mb-md">
|
<vn-card>
|
||||||
<section class="vn-pa-md">
|
<section class="vn-pa-md">
|
||||||
<vn-table vn-droppable="$ctrl.onDrop($event)" ng-attr-id="{{::travel.id}}">
|
<vn-tool-bar class="vn-mb-md">
|
||||||
|
<vn-button disabled="!model.userParams.landedFrom || !model.userParams.landedTo"
|
||||||
|
icon="picture_as_pdf"
|
||||||
|
ng-click="$ctrl.showReport()"
|
||||||
|
vn-tooltip="Open as PDF">
|
||||||
|
</vn-button>
|
||||||
|
</vn-tool-bar>
|
||||||
|
<vn-table>
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr ng-if="$index == 0">
|
<vn-tr>
|
||||||
<vn-th shrink>Id</vn-th>
|
<vn-th shrink>Id</vn-th>
|
||||||
<vn-th expand>Supplier</vn-th>
|
<vn-th expand>Supplier</vn-th>
|
||||||
<vn-th expand>Freighter</vn-th>
|
<vn-th expand>Freighter</vn-th>
|
||||||
|
@ -33,14 +41,14 @@
|
||||||
<vn-th expand translate-attr="{title: 'Warehouse Out'}">
|
<vn-th expand translate-attr="{title: 'Warehouse Out'}">
|
||||||
Wh. Out
|
Wh. Out
|
||||||
</vn-th>
|
</vn-th>
|
||||||
<vn-th expand>Shipped</vn-th>
|
<vn-th expand>W. Shipped</vn-th>
|
||||||
<vn-th expand translate-attr="{title: 'Warehouse In'}">
|
<vn-th expand translate-attr="{title: 'Warehouse In'}">
|
||||||
Wh. In
|
Wh. In
|
||||||
</vn-th>
|
</vn-th>
|
||||||
<vn-th expand>Landed</vn-th>
|
<vn-th expand>W. Landed</vn-th>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-thead>
|
</vn-thead>
|
||||||
<vn-tbody>
|
<vn-tbody ng-repeat="travel in travels" class="vn-mb-md" vn-droppable="$ctrl.onDrop($event)" ng-attr-id="{{::travel.id}}">
|
||||||
<vn-tr class="header">
|
<vn-tr class="header">
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span class="link"
|
<span class="link"
|
||||||
|
@ -50,17 +58,26 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td expand>{{::travel.agencyModeName}}</vn-td>
|
<vn-td expand>{{::travel.agencyModeName}}</vn-td>
|
||||||
<vn-td expand>{{::travel.cargoSupplierNickname}}</vn-td>
|
<vn-td expand>{{::travel.cargoSupplierNickname}}</vn-td>
|
||||||
<vn-td-editable expand>
|
<vn-td-editable name="reference" expand>
|
||||||
<text>{{travel.ref}}</text>
|
<text>{{travel.ref}}</text>
|
||||||
<field>
|
<field>
|
||||||
<vn-textfield class="dense" vn-focus
|
<vn-textfield class="dense" vn-focus
|
||||||
ng-model="travel.ref"
|
ng-model="travel.ref"
|
||||||
on-change="$ctrl.changeReference(travel)">
|
on-change="$ctrl.save(travel.id, {ref: value})">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</field>
|
</field>
|
||||||
</vn-td-editable>
|
</vn-td-editable>
|
||||||
<vn-td number>{{::travel.stickers}}</vn-td>
|
<vn-td number>{{::travel.stickers}}</vn-td>
|
||||||
<vn-td number>{{::travel.kg}}</vn-td>
|
<vn-td-editable name="lockedKg" expand style="text-align: right">
|
||||||
|
<text number>{{travel.kg}}</text>
|
||||||
|
<field>
|
||||||
|
<vn-input-number class="dense" vn-focus
|
||||||
|
ng-model="travel.kg"
|
||||||
|
on-change="$ctrl.save(travel.id, {kg: value})"
|
||||||
|
min="0">
|
||||||
|
</vn-input-number>
|
||||||
|
</field>
|
||||||
|
</vn-td-editable>
|
||||||
<vn-td number>{{::travel.loadedKg}}</vn-td>
|
<vn-td number>{{::travel.loadedKg}}</vn-td>
|
||||||
<vn-td number>{{::travel.volumeKg}}</vn-td>
|
<vn-td number>{{::travel.volumeKg}}</vn-td>
|
||||||
<vn-td expand>{{::travel.warehouseOutName}}</vn-td>
|
<vn-td expand>{{::travel.warehouseOutName}}</vn-td>
|
||||||
|
@ -80,17 +97,17 @@
|
||||||
<vn-td>{{::entry.supplierName}}</vn-td>
|
<vn-td>{{::entry.supplierName}}</vn-td>
|
||||||
<vn-td></vn-td>
|
<vn-td></vn-td>
|
||||||
<vn-td expand>{{::entry.ref}}</vn-td>
|
<vn-td expand>{{::entry.ref}}</vn-td>
|
||||||
<vn-th number>{{::entry.stickers}}</vn-th>
|
<vn-td number>{{::entry.stickers}}</vn-td>
|
||||||
<vn-td number></vn-td>
|
<vn-td number></vn-td>
|
||||||
<vn-td number>{{::entry.loadedkg}}</vn-td>
|
<vn-td number>{{::entry.loadedkg}}</vn-td>
|
||||||
<vn-td number>{{::entry.volumeKg}}</vn-td>
|
<vn-td number>{{::entry.volumeKg}}</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span nf-if="::entry.notes" vn-tooltip="{{::entry.notes}}">
|
<span ng-if="::entry.notes" vn-tooltip="{{::entry.notes}}">
|
||||||
{{::entry.notes}}
|
{{::entry.notes}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span nf-if="::entry.evaNotes" vn-tooltip="{{::entry.evaNotes}}">
|
<span ng-if="::entry.evaNotes" vn-tooltip="{{::entry.evaNotes}}">
|
||||||
{{::entry.evaNotes}}
|
{{::entry.evaNotes}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
|
@ -3,9 +3,11 @@ import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
constructor($element, $) {
|
constructor($element, $, vnReport) {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
|
|
||||||
|
this.vnReport = vnReport;
|
||||||
|
|
||||||
const draggable = this.element.querySelector('.travel-list');
|
const draggable = this.element.querySelector('.travel-list');
|
||||||
draggable.addEventListener('dragstart',
|
draggable.addEventListener('dragstart',
|
||||||
event => this.dragStart(event));
|
event => this.dragStart(event));
|
||||||
|
@ -13,7 +15,7 @@ class Controller extends Section {
|
||||||
event => this.dragEnd(event));
|
event => this.dragEnd(event));
|
||||||
|
|
||||||
this.draggableElement = 'a[draggable]';
|
this.draggableElement = 'a[draggable]';
|
||||||
this.droppableElement = 'vn-table[vn-droppable]';
|
this.droppableElement = 'vn-tbody[vn-droppable]';
|
||||||
|
|
||||||
const scopeDays = 14;
|
const scopeDays = 14;
|
||||||
const landedFrom = new Date();
|
const landedFrom = new Date();
|
||||||
|
@ -77,14 +79,26 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeReference(travel) {
|
save(id, data) {
|
||||||
const params = {ref: travel.ref};
|
const endpoint = `Travels/${id}`;
|
||||||
const endpoint = `Travels/${travel.id}`;
|
this.$http.patch(endpoint, data)
|
||||||
this.$http.patch(endpoint, params)
|
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get reportParams() {
|
||||||
|
const userParams = this.$.model.userParams;
|
||||||
|
return Object.assign({
|
||||||
|
authorization: this.vnToken.token
|
||||||
|
}, userParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
showReport() {
|
||||||
|
this.vnReport.show('extra-community', this.reportParams);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Controller.$inject = ['$element', '$scope', 'vnReport'];
|
||||||
|
|
||||||
ngModule.vnComponent('vnTravelExtraCommunity', {
|
ngModule.vnComponent('vnTravelExtraCommunity', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
|
@ -14,20 +14,6 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
controller.$.model.refresh = jest.fn();
|
controller.$.model.refresh = jest.fn();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('changeReference()', () => {
|
|
||||||
it('should make an HTTP query', () => {
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
|
||||||
|
|
||||||
const travel = {id: 1, ref: 'New reference'};
|
|
||||||
const expectedData = {ref: 'New reference'};
|
|
||||||
$httpBackend.expect('PATCH', `Travels/${travel.id}`, expectedData).respond(200);
|
|
||||||
controller.changeReference(travel);
|
|
||||||
$httpBackend.flush();
|
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('findDraggable()', () => {
|
describe('findDraggable()', () => {
|
||||||
it('should find the draggable element', () => {
|
it('should find the draggable element', () => {
|
||||||
const draggable = document.createElement('a');
|
const draggable = document.createElement('a');
|
||||||
|
@ -46,7 +32,7 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
|
|
||||||
describe('findDroppable()', () => {
|
describe('findDroppable()', () => {
|
||||||
it('should find the droppable element', () => {
|
it('should find the droppable element', () => {
|
||||||
const droppable = document.createElement('vn-table');
|
const droppable = document.createElement('vn-tbody');
|
||||||
droppable.setAttribute('vn-droppable', true);
|
droppable.setAttribute('vn-droppable', true);
|
||||||
|
|
||||||
const $event = new Event('drop');
|
const $event = new Event('drop');
|
||||||
|
@ -103,13 +89,13 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
|
|
||||||
describe('onDrop()', () => {
|
describe('onDrop()', () => {
|
||||||
it('should make an HTTP patch query', () => {
|
it('should make an HTTP patch query', () => {
|
||||||
const droppable = document.createElement('vn-table');
|
const droppable = document.createElement('vn-tbody');
|
||||||
droppable.setAttribute('vn-droppable', true);
|
droppable.setAttribute('vn-droppable', true);
|
||||||
droppable.setAttribute('id', 1);
|
droppable.setAttribute('id', 1);
|
||||||
|
|
||||||
jest.spyOn(controller, 'findDroppable').mockReturnValue(droppable);
|
jest.spyOn(controller, 'findDroppable').mockReturnValue(droppable);
|
||||||
|
|
||||||
const oldDroppable = document.createElement('vn-table');
|
const oldDroppable = document.createElement('vn-tbody');
|
||||||
oldDroppable.setAttribute('vn-droppable', true);
|
oldDroppable.setAttribute('vn-droppable', true);
|
||||||
const entry = document.createElement('div');
|
const entry = document.createElement('div');
|
||||||
oldDroppable.appendChild(entry);
|
oldDroppable.appendChild(entry);
|
||||||
|
@ -124,4 +110,19 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('save()', () => {
|
||||||
|
it('should make an HTTP query', () => {
|
||||||
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
||||||
|
const travelId = 1;
|
||||||
|
const data = {ref: 'New reference'};
|
||||||
|
const expectedData = {ref: 'New reference'};
|
||||||
|
$httpBackend.expect('PATCH', `Travels/${travelId}`, expectedData).respond(200);
|
||||||
|
controller.save(travelId, data);
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,5 +4,8 @@ Freighter: Transitario
|
||||||
Bl. KG: KG Bloq.
|
Bl. KG: KG Bloq.
|
||||||
Phy. KG: KG físico
|
Phy. KG: KG físico
|
||||||
Vol. KG: KG Vol.
|
Vol. KG: KG Vol.
|
||||||
Search by travel id or reference: Buscar por id travel o referencia
|
Search by travel id or reference: Buscar por id de travel o referencia
|
||||||
Continent Out: Continente salida
|
Search by extra community travel: Buscar por envío extra comunitario
|
||||||
|
Continent Out: Continente salida
|
||||||
|
W. Shipped: F. envío
|
||||||
|
W. Landed: F. llegada
|
|
@ -26,11 +26,11 @@ vn-travel-extra-community {
|
||||||
color: $color-active
|
color: $color-active
|
||||||
}
|
}
|
||||||
|
|
||||||
vn-td-editable text:after {
|
vn-td-editable:hover text:after {
|
||||||
font-family: 'Material Icons';
|
font-family: 'Material Icons';
|
||||||
content: 'edit';
|
content: 'edit';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-left: 5px;
|
right: -15px;
|
||||||
color: $color-spacer
|
color: $color-spacer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,30 +125,56 @@
|
||||||
padding-right: 16px;
|
padding-right: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Medium-Large */
|
||||||
|
|
||||||
|
.vn-pa-ml {
|
||||||
|
padding: 32px;
|
||||||
|
}
|
||||||
|
.vn-pl-ml {
|
||||||
|
padding-left: 32px;
|
||||||
|
}
|
||||||
|
.vn-pr-ml {
|
||||||
|
padding-right: 32px;
|
||||||
|
}
|
||||||
|
.vn-pt-ml {
|
||||||
|
padding-top: 32px;
|
||||||
|
}
|
||||||
|
.vn-pb-ml {
|
||||||
|
padding-bottom: 32px;
|
||||||
|
}
|
||||||
|
.vn-py-ml {
|
||||||
|
padding-top: 32px;
|
||||||
|
padding-bottom: 32px;
|
||||||
|
}
|
||||||
|
.vn-px-ml {
|
||||||
|
padding-left: 32px;
|
||||||
|
padding-right: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Large */
|
/* Large */
|
||||||
|
|
||||||
.vn-pa-lg {
|
.vn-pa-lg {
|
||||||
padding: 32px;
|
padding: 64px;
|
||||||
}
|
}
|
||||||
.vn-pl-lg {
|
.vn-pl-lg {
|
||||||
padding-left: 32px;
|
padding-left: 64px;
|
||||||
}
|
}
|
||||||
.vn-pr-lg {
|
.vn-pr-lg {
|
||||||
padding-right: 32px;
|
padding-right: 64px;
|
||||||
}
|
}
|
||||||
.vn-pt-lg {
|
.vn-pt-lg {
|
||||||
padding-top: 32px;
|
padding-top: 64px;
|
||||||
}
|
}
|
||||||
.vn-pb-lg {
|
.vn-pb-lg {
|
||||||
padding-bottom: 32px;
|
padding-bottom: 64px;
|
||||||
}
|
}
|
||||||
.vn-py-lg {
|
.vn-py-lg {
|
||||||
padding-top: 32px;
|
padding-top: 64px;
|
||||||
padding-bottom: 32px;
|
padding-bottom: 64px;
|
||||||
}
|
}
|
||||||
.vn-px-lg {
|
.vn-px-lg {
|
||||||
padding-left: 32px;
|
padding-left: 64px;
|
||||||
padding-right: 32px;
|
padding-right: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extra large */
|
/* Extra large */
|
||||||
|
@ -296,30 +322,56 @@
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Medium-Large */
|
||||||
|
|
||||||
|
.vn-ma-ml {
|
||||||
|
margin: 32px;
|
||||||
|
}
|
||||||
|
.vn-mt-ml {
|
||||||
|
margin-top: 32px;
|
||||||
|
}
|
||||||
|
.vn-ml-ml {
|
||||||
|
margin-left: 32px;
|
||||||
|
}
|
||||||
|
.vn-mr-ml {
|
||||||
|
margin-right: 32px;
|
||||||
|
}
|
||||||
|
.vn-mb-ml {
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
.vn-my-ml {
|
||||||
|
margin-top: 32px;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
.vn-mx-ml {
|
||||||
|
margin-left: 32px;
|
||||||
|
margin-right: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Large */
|
/* Large */
|
||||||
|
|
||||||
.vn-ma-lg {
|
.vn-ma-lg {
|
||||||
margin: 32px;
|
margin: 64px;
|
||||||
}
|
}
|
||||||
.vn-mt-lg {
|
.vn-mt-lg {
|
||||||
margin-top: 32px;
|
margin-top: 64px;
|
||||||
}
|
}
|
||||||
.vn-ml-lg {
|
.vn-ml-lg {
|
||||||
margin-left: 32px;
|
margin-left: 64px;
|
||||||
}
|
}
|
||||||
.vn-mr-lg {
|
.vn-mr-lg {
|
||||||
margin-right: 32px;
|
margin-right: 64px;
|
||||||
}
|
}
|
||||||
.vn-mb-lg {
|
.vn-mb-lg {
|
||||||
margin-bottom: 32px;
|
margin-bottom: 64px;
|
||||||
}
|
}
|
||||||
.vn-my-lg {
|
.vn-my-lg {
|
||||||
margin-top: 32px;
|
margin-top: 64px;
|
||||||
margin-bottom: 32px;
|
margin-bottom: 64px;
|
||||||
}
|
}
|
||||||
.vn-mx-lg {
|
.vn-mx-lg {
|
||||||
margin-left: 32px;
|
margin-left: 64px;
|
||||||
margin-right: 32px;
|
margin-right: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extra large */
|
/* Extra large */
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const mysql = require('mysql2/promise');
|
const mysql = require('mysql2/promise');
|
||||||
const config = require('./config.js');
|
const config = require('./config.js');
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
|
const PromisePoolConnection = mysql.PromisePoolConnection;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init() {
|
init() {
|
||||||
|
@ -16,11 +17,17 @@ module.exports = {
|
||||||
* Makes a query from a raw sql
|
* Makes a query from a raw sql
|
||||||
* @param {String} query - The raw SQL query
|
* @param {String} query - The raw SQL query
|
||||||
* @param {Object} params - Parameterized values
|
* @param {Object} params - Parameterized values
|
||||||
|
* @param {Object} connection - Optional pool connection
|
||||||
*
|
*
|
||||||
* @return {Object} - Result promise
|
* @return {Object} - Result promise
|
||||||
*/
|
*/
|
||||||
rawSql(query, params) {
|
rawSql(query, params, connection) {
|
||||||
return this.pool.query(query, params).then(([rows]) => {
|
let pool = this.pool;
|
||||||
|
if (params instanceof PromisePoolConnection)
|
||||||
|
connection = params;
|
||||||
|
if (connection) pool = connection;
|
||||||
|
|
||||||
|
return pool.query(query, params).then(([rows]) => {
|
||||||
return rows;
|
return rows;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -85,5 +92,57 @@ module.exports = {
|
||||||
return this.findOneFromDef(queryName, params).then(row => {
|
return this.findOneFromDef(queryName, params).then(row => {
|
||||||
return Object.values(row)[0];
|
return Object.values(row)[0];
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the content of a SQL file
|
||||||
|
* @param {String} queryName - The SQL file name
|
||||||
|
*
|
||||||
|
* @return {Object} - SQL
|
||||||
|
*/
|
||||||
|
getSqlFromDef(queryName) {
|
||||||
|
return fs.readFileSync(`${queryName}.sql`, 'utf8');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merges two SQL strings
|
||||||
|
*
|
||||||
|
* @param {String} query - Input SQL
|
||||||
|
* @param {String} sql - String to merge
|
||||||
|
*
|
||||||
|
* @return {String} - Merged SQL string
|
||||||
|
*/
|
||||||
|
merge(query, sql) {
|
||||||
|
return query += `\r\n ${sql}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds where string
|
||||||
|
*
|
||||||
|
* @param {Object} args - Query params
|
||||||
|
* @param {Function} callback - Callback
|
||||||
|
*
|
||||||
|
* @return {String} - Where Sql string
|
||||||
|
*/
|
||||||
|
buildWhere(args, callback) {
|
||||||
|
let sql = '';
|
||||||
|
|
||||||
|
for (let prop in args) {
|
||||||
|
const value = args[prop];
|
||||||
|
if (!value) continue;
|
||||||
|
|
||||||
|
const sanitizedValue = mysql.escape(value);
|
||||||
|
const conditional = callback(prop, sanitizedValue);
|
||||||
|
|
||||||
|
if (!conditional) continue;
|
||||||
|
|
||||||
|
if (sql) sql += ' AND ';
|
||||||
|
sql += conditional;
|
||||||
|
}
|
||||||
|
let where = '';
|
||||||
|
if (sql)
|
||||||
|
where = `WHERE ${sql}`;
|
||||||
|
|
||||||
|
return where;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@ const defaultLocale = config.i18n.locale;
|
||||||
|
|
||||||
const number = function(value, locale = defaultLocale) {
|
const number = function(value, locale = defaultLocale) {
|
||||||
if (!locale) locale = defaultLocale;
|
if (!locale) locale = defaultLocale;
|
||||||
|
if (value === null || value == '') return;
|
||||||
return new Intl.NumberFormat(locale, {
|
return new Intl.NumberFormat(locale, {
|
||||||
style: 'decimal'
|
style: 'decimal'
|
||||||
}).format(parseFloat(value));
|
}).format(parseFloat(value));
|
||||||
|
|
|
@ -8,10 +8,12 @@ const dbHelper = {
|
||||||
* Makes a query from a raw sql
|
* Makes a query from a raw sql
|
||||||
* @param {String} query - The raw SQL query
|
* @param {String} query - The raw SQL query
|
||||||
* @param {Object} params - Parameterized values
|
* @param {Object} params - Parameterized values
|
||||||
|
* @param {Object} connection - Optional pool connection
|
||||||
*
|
*
|
||||||
* @return {Object} - Result promise
|
* @return {Object} - Result promise
|
||||||
*/
|
*/
|
||||||
rawSql: db.rawSql,
|
rawSql: (query, params, connection) =>
|
||||||
|
db.rawSql(query, params, connection),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a query from a SQL file
|
* Makes a query from a SQL file
|
||||||
|
@ -32,7 +34,7 @@ const dbHelper = {
|
||||||
*
|
*
|
||||||
* @return {Object} - Result promise
|
* @return {Object} - Result promise
|
||||||
*/
|
*/
|
||||||
findOne: db.findOne,
|
findOne: (query, params) => db.findOne(query, params),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first row from a given SQL file
|
* Returns the first row from a given SQL file
|
||||||
|
@ -53,7 +55,7 @@ const dbHelper = {
|
||||||
*
|
*
|
||||||
* @return {Object} - Result promise
|
* @return {Object} - Result promise
|
||||||
*/
|
*/
|
||||||
findValue: db.findValue,
|
findValue: (query, params) => db.findValue(query, params),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first property from a given SQL file
|
* Returns the first property from a given SQL file
|
||||||
|
@ -66,7 +68,18 @@ const dbHelper = {
|
||||||
return this.findOneFromDef(queryName, params).then(row => {
|
return this.findOneFromDef(queryName, params).then(row => {
|
||||||
return Object.values(row)[0];
|
return Object.values(row)[0];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the content of an SQL file
|
||||||
|
* @param {String} queryName - The SQL file name
|
||||||
|
*
|
||||||
|
* @return {Object} - SQL
|
||||||
|
*/
|
||||||
|
getSqlFromDef(queryName) {
|
||||||
|
const absolutePath = path.join(__dirname, '../', this.tplPath, 'sql', queryName);
|
||||||
|
return db.getSqlFromDef(absolutePath);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
props: ['tplPath']
|
props: ['tplPath']
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('dear')}},</p>
|
<p>{{$t('dear')}},</p>
|
||||||
<p v-html="$t('description', [dated])"></p>
|
<p v-html="$t('description', [dated])"></p>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<table class="column-oriented">
|
<table class="column-oriented">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('dear')}},</p>
|
<p>{{$t('dear')}},</p>
|
||||||
<p v-html="$t('description', [minDate, maxDate])"></p>
|
<p v-html="$t('description', [minDate, maxDate])"></p>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('description.dear')}},</p>
|
<p>{{$t('description.dear')}},</p>
|
||||||
<p>{{$t('description.instructions')}}</p>
|
<p>{{$t('description.instructions')}}</p>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('dearClient')}},</p>
|
<p>{{$t('dearClient')}},</p>
|
||||||
<p v-html="$t('clientData')"></p>
|
<p v-html="$t('clientData')"></p>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('dear')}}</p>
|
<p>{{$t('dear')}}</p>
|
||||||
<p v-html="$t('description', [ticketId])"></p>
|
<p v-html="$t('description', [ticketId])"></p>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-px-lg">
|
<div class="grid-block vn-px-ml">
|
||||||
<p>{{$t('copyLink')}}</p>
|
<p>{{$t('copyLink')}}</p>
|
||||||
<div class="external-link vn-pa-sm vn-m-md">
|
<div class="external-link vn-pa-sm vn-m-md">
|
||||||
https://www.verdnatura.es/#!form=ecomerce/ticket&ticket={{ticketId}}
|
https://www.verdnatura.es/#!form=ecomerce/ticket&ticket={{ticketId}}
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<p v-html="$t('poll')"></p>
|
<p v-html="$t('poll')"></p>
|
||||||
<p v-html="$t('help')"></p>
|
<p v-html="$t('help')"></p>
|
||||||
<p v-html="$t('conclusion')"></p>
|
<p v-html="$t('conclusion')"></p>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('dear')}},</p>
|
<p>{{$t('dear')}},</p>
|
||||||
<p v-html="$t('description', [ticketId])"></p>
|
<p v-html="$t('description', [ticketId])"></p>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('description.instructions')}}</p>
|
<p>{{$t('description.instructions')}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{ $t('sections.introduction.title') }},</p>
|
<p>{{ $t('sections.introduction.title') }},</p>
|
||||||
<p>{{ $t('sections.introduction.description') }}</p>
|
<p>{{ $t('sections.introduction.description') }}</p>
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row" v-if="isPreview">
|
<div class="grid-row" v-if="isPreview">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<attachment v-for="attachment in attachments"
|
<attachment v-for="attachment in attachments"
|
||||||
v-bind:key="attachment.filename"
|
v-bind:key="attachment.filename"
|
||||||
v-bind:attachment="attachment"
|
v-bind:attachment="attachment"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }} {{$i18n.locale}}</h1>
|
<h1>{{ $t('title') }} {{$i18n.locale}}</h1>
|
||||||
<p>{{ $t('sections.introduction.title') }},</p>
|
<p>{{ $t('sections.introduction.title') }},</p>
|
||||||
<p>{{ $t('sections.introduction.description') }}</p>
|
<p>{{ $t('sections.introduction.description') }}</p>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row" v-if="isPreview">
|
<div class="grid-row" v-if="isPreview">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<attachment v-for="attachment in attachments"
|
<attachment v-for="attachment in attachments"
|
||||||
v-bind:key="attachment.filename"
|
v-bind:key="attachment.filename"
|
||||||
v-bind:attachment="attachment"
|
v-bind:attachment="attachment"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{ $t('sections.introduction.title') }},</p>
|
<p>{{ $t('sections.introduction.title') }},</p>
|
||||||
<p v-html="`${$t('sections.introduction.description')}:`"></p>
|
<p v-html="`${$t('sections.introduction.description')}:`"></p>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('description.dear')}},</p>
|
<p>{{$t('description.dear')}},</p>
|
||||||
<p>{{$t('description.instructions')}}</p>
|
<p>{{$t('description.instructions')}}</p>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{$t('sections.help.title')}}</h1>
|
<h1>{{$t('sections.help.title')}}</h1>
|
||||||
<p>{{$t('sections.help.description')}}</p>
|
<p>{{$t('sections.help.description')}}</p>
|
||||||
<p v-html="$t('sections.help.remoteSupport')"></p>
|
<p v-html="$t('sections.help.remoteSupport')"></p>
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<div v-if="client.salesPersonName">
|
<div v-if="client.salesPersonName">
|
||||||
{{$t('salesPersonName')}}: <strong>{{client.salesPersonName}}</strong>
|
{{$t('salesPersonName')}}: <strong>{{client.salesPersonName}}</strong>
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row" v-if="isPreview">
|
<div class="grid-row" v-if="isPreview">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<attachment v-for="attachment in attachments"
|
<attachment v-for="attachment in attachments"
|
||||||
v-bind:key="attachment.filename"
|
v-bind:key="attachment.filename"
|
||||||
v-bind:attachment="attachment"
|
v-bind:attachment="attachment"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('description.dear')}},</p>
|
<p>{{$t('description.dear')}},</p>
|
||||||
<div v-html="$t('description.instructions')"></div>
|
<div v-html="$t('description.instructions')"></div>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Attachments block -->
|
<!-- Attachments block -->
|
||||||
<div class="grid-row" v-if="isPreview">
|
<div class="grid-row" v-if="isPreview">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<attachment v-for="attachment in attachments"
|
<attachment v-for="attachment in attachments"
|
||||||
v-bind:key="attachment.filename"
|
v-bind:key="attachment.filename"
|
||||||
v-bind:attachment="attachment"
|
v-bind:attachment="attachment"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- Block -->
|
<!-- Block -->
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-block vn-pa-lg">
|
<div class="grid-block vn-pa-ml">
|
||||||
<h1>{{ $t('title') }}</h1>
|
<h1>{{ $t('title') }}</h1>
|
||||||
<p>{{$t('dear')}},</p>
|
<p>{{$t('dear')}},</p>
|
||||||
<p v-html="$t('description', [minDate, maxDate])"></p>
|
<p v-html="$t('description', [minDate, maxDate])"></p>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="column-oriented vn-mt-lg">
|
<table class="column-oriented vn-mt-ml">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{$t('reference')}}</th>
|
<th>{{$t('reference')}}</th>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="grid-block">
|
<div class="grid-block">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="size50">
|
<div class="size50">
|
||||||
<div class="size75 vn-mt-lg">
|
<div class="size75 vn-mt-ml">
|
||||||
<h1 class="title uppercase">{{$t('title')}}</h1>
|
<h1 class="title uppercase">{{$t('title')}}</h1>
|
||||||
<table class="row-oriented ticket-info">
|
<table class="row-oriented ticket-info">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Buy block -->
|
<!-- Buy block -->
|
||||||
<table class="column-oriented vn-mt-lg">
|
<table class="column-oriented vn-mt-ml">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="number">{{$t('boxes')}}</th>
|
<th class="number">{{$t('boxes')}}</th>
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
const Stylesheet = require(`${appPath}/core/stylesheet`);
|
||||||
|
|
||||||
|
module.exports = new Stylesheet([
|
||||||
|
`${appPath}/common/css/spacing.css`,
|
||||||
|
`${appPath}/common/css/misc.css`,
|
||||||
|
`${appPath}/common/css/layout.css`,
|
||||||
|
`${appPath}/common/css/report.css`,
|
||||||
|
`${__dirname}/style.css`])
|
||||||
|
.mergeStyles();
|
|
@ -0,0 +1,7 @@
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
th.align-right {
|
||||||
|
padding-right: 1em;
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html v-bind:lang="$i18n.locale">
|
||||||
|
<body>
|
||||||
|
<table class="grid">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<!-- Header block -->
|
||||||
|
<report-header v-bind="$props"></report-header>
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block">
|
||||||
|
<h1 class="title uppercase">{{$t('title')}}</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Block -->
|
||||||
|
<div class="grid-row vn-mb-lg" v-for="travel in travels">
|
||||||
|
<div class="grid-block">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="header">{{$t('information')}}</div>
|
||||||
|
<div class="body">
|
||||||
|
<div>
|
||||||
|
<table width="100%">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th class="font gray align-right">{{$t('reference')}}</th>
|
||||||
|
<td>{{travel.ref}}</td>
|
||||||
|
<th class="font gray align-right">{{$t('blockedKg')}}</th>
|
||||||
|
<td>{{travel.kg | number($i18n.locale)}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="font gray align-right">{{$t('packages')}}</th>
|
||||||
|
<td>{{travel.stickers}}</td>
|
||||||
|
<th class="font gray align-right">{{$t('volumeKg')}}</th>
|
||||||
|
<td>{{travel.volumeKg | number($i18n.locale)}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="font gray align-right">{{$t('shipped')}}</th>
|
||||||
|
<td>{{travel.shipped | date('%d-%m-%Y')}}</td>
|
||||||
|
<th class="font gray align-right">{{$t('physicalKg')}}</th>
|
||||||
|
<td>{{travel.loadedKg | number($i18n.locale)}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="column-oriented">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{$t('supplier')}}</th>
|
||||||
|
<th>{{$t('reference')}}</th>
|
||||||
|
<th class="number">{{$t('volKg')}}</th>
|
||||||
|
<th class="number">{{$t('phyKg')}}</th>
|
||||||
|
<th class="number">{{$t('packages')}}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="entry in travel.entries">
|
||||||
|
<td>{{entry.supplierName}}</td>
|
||||||
|
<td>{{entry.ref}}</td>
|
||||||
|
<td class="number">{{entry.volumeKg | number($i18n.locale)}}</td>
|
||||||
|
<td class="number">{{entry.loadedKg | number($i18n.locale)}}</td>
|
||||||
|
<td class="number">{{entry.stickers}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="!travel.entries">
|
||||||
|
<td colspan="5" class="centered">{{$t('noRows')}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Footer block -->
|
||||||
|
<report-footer id="pageFooter"
|
||||||
|
v-bind:left-text="dated"
|
||||||
|
v-bind="$props">
|
||||||
|
</report-footer>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,115 @@
|
||||||
|
const Component = require(`${appPath}/core/component`);
|
||||||
|
const reportHeader = new Component('report-header');
|
||||||
|
const reportFooter = new Component('report-footer');
|
||||||
|
const db = require(`${appPath}/core/database`);
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'extra-community',
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.filters = this.$options.filters;
|
||||||
|
const args = {
|
||||||
|
landedFrom: this.landedStart,
|
||||||
|
landedTo: this.landedEnd,
|
||||||
|
shippedFrom: this.shippedStart,
|
||||||
|
shippedTo: this.shippedEnd,
|
||||||
|
continent: this.continent
|
||||||
|
};
|
||||||
|
|
||||||
|
const connection = await db.pool.getConnection();
|
||||||
|
|
||||||
|
await this.fetchTravels(args, connection);
|
||||||
|
|
||||||
|
const travels = await this.rawSql(`
|
||||||
|
SELECT * FROM tmp.travel`, connection);
|
||||||
|
const entries = await this.fetchEntries(connection);
|
||||||
|
|
||||||
|
await this.rawSql(`
|
||||||
|
DROP TEMPORARY TABLE
|
||||||
|
tmp.travel`, connection);
|
||||||
|
|
||||||
|
await connection.release();
|
||||||
|
|
||||||
|
const map = new Map();
|
||||||
|
|
||||||
|
for (let travel of travels)
|
||||||
|
map.set(travel.id, travel);
|
||||||
|
|
||||||
|
for (let entry of entries) {
|
||||||
|
const travel = map.get(entry.travelFk);
|
||||||
|
if (!travel.entries) travel.entries = [];
|
||||||
|
travel.entries.push(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.travels = travels;
|
||||||
|
|
||||||
|
if (!this.travels)
|
||||||
|
throw new Error('Something went wrong');
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
dated: function() {
|
||||||
|
return this.filters.date(new Date(), '%d-%m-%Y');
|
||||||
|
},
|
||||||
|
landedStart: function() {
|
||||||
|
if (!this.landedFrom) return;
|
||||||
|
|
||||||
|
return this.filters.date(this.landedFrom, '%Y-%m-%d');
|
||||||
|
},
|
||||||
|
landedEnd: function() {
|
||||||
|
if (!this.landedTo) return;
|
||||||
|
|
||||||
|
return this.filters.date(this.landedTo, '%Y-%m-%d');
|
||||||
|
},
|
||||||
|
shippedStart: function() {
|
||||||
|
if (!this.shippedFrom) return;
|
||||||
|
|
||||||
|
return this.filters.date(this.shippedFrom, '%Y-%m-%d');
|
||||||
|
},
|
||||||
|
shippedEnd: function() {
|
||||||
|
if (!this.shippedTo) return;
|
||||||
|
|
||||||
|
return this.filters.date(this.shippedTo, '%Y-%m-%d');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchTravels(args, connection) {
|
||||||
|
const where = db.buildWhere(args, (key, value) => {
|
||||||
|
switch (key) {
|
||||||
|
case 'shippedFrom':
|
||||||
|
return `t.shipped >= ${value}`;
|
||||||
|
case 'shippedTo':
|
||||||
|
return `t.shipped <= ${value}`;
|
||||||
|
case 'landedFrom':
|
||||||
|
return `t.landed >= ${value}`;
|
||||||
|
case 'landedTo':
|
||||||
|
return `t.landed <= ${value}`;
|
||||||
|
case 'continent':
|
||||||
|
return `cnt.code = ${value}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let query = this.getSqlFromDef('travels');
|
||||||
|
query = db.merge(query, where);
|
||||||
|
query = db.merge(query, 'GROUP BY t.id');
|
||||||
|
|
||||||
|
return this.rawSql(query, connection);
|
||||||
|
},
|
||||||
|
|
||||||
|
fetchEntries(connection) {
|
||||||
|
let query = this.getSqlFromDef('entries');
|
||||||
|
query = db.merge(query, 'GROUP BY e.id');
|
||||||
|
|
||||||
|
return this.rawSql(query, connection);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
'report-header': reportHeader.build(),
|
||||||
|
'report-footer': reportFooter.build()
|
||||||
|
},
|
||||||
|
props: [
|
||||||
|
'landedFrom',
|
||||||
|
'landedTo',
|
||||||
|
'shippedFrom',
|
||||||
|
'shippedTo',
|
||||||
|
'continent'
|
||||||
|
]
|
||||||
|
};
|
|
@ -0,0 +1,15 @@
|
||||||
|
title: Orden de carga
|
||||||
|
reference: Referencia
|
||||||
|
information: Información
|
||||||
|
packages: Bultos
|
||||||
|
blockedKg: KG Bloqueado
|
||||||
|
volumeKg: KG Volumen
|
||||||
|
physicalKg: KG Físico
|
||||||
|
volKg: KG Vol.
|
||||||
|
phyKg: KG Fís.
|
||||||
|
warehouseIn: Alm. entrada
|
||||||
|
shipped: F. envío
|
||||||
|
warehouseOut: Alm. salida
|
||||||
|
landed: F. llegada
|
||||||
|
noRows: Sin líneas que mostrar
|
||||||
|
supplier: Proveedor
|
|
@ -0,0 +1,15 @@
|
||||||
|
SELECT
|
||||||
|
e.id,
|
||||||
|
e.travelFk,
|
||||||
|
e.ref,
|
||||||
|
s.name AS supplierName,
|
||||||
|
SUM(b.stickers) AS stickers,
|
||||||
|
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg,
|
||||||
|
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
|
||||||
|
FROM tmp.travel t
|
||||||
|
JOIN entry e ON e.travelFk = t.id
|
||||||
|
JOIN buy b ON b.entryFk = e.id
|
||||||
|
JOIN packaging pkg ON pkg.id = b.packageFk
|
||||||
|
JOIN item i ON i.id = b.itemFk
|
||||||
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
|
JOIN supplier s ON s.id = e.supplierFk
|
|
@ -0,0 +1,24 @@
|
||||||
|
CREATE TEMPORARY TABLE tmp.travel
|
||||||
|
(INDEX (id))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT
|
||||||
|
t.id,
|
||||||
|
t.ref,
|
||||||
|
t.shipped,
|
||||||
|
t.landed,
|
||||||
|
t.kg,
|
||||||
|
SUM(b.stickers) AS stickers,
|
||||||
|
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg,
|
||||||
|
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
|
||||||
|
FROM travel t
|
||||||
|
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
|
||||||
|
LEFT JOIN entry e ON e.travelFk = t.id
|
||||||
|
LEFT JOIN buy b ON b.entryFk = e.id
|
||||||
|
LEFT JOIN packaging pkg ON pkg.id = b.packageFk
|
||||||
|
LEFT JOIN item i ON i.id = b.itemFk
|
||||||
|
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||||
|
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||||
|
JOIN warehouse wo ON wo.id = t.warehouseOutFk
|
||||||
|
JOIN country c ON c.id = wo.countryFk
|
||||||
|
LEFT JOIN continent cnt ON cnt.id = c.continentFk
|
||||||
|
JOIN agencyMode am ON am.id = t.agencyFk
|
Loading…
Reference in New Issue
drag & drop needs fixing