Merge branch 'dev' into 6281_buyFk
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Robert Ferrús 2024-05-21 08:00:50 +00:00
commit 0ef93bd98a
32 changed files with 219 additions and 98 deletions

View File

@ -39,8 +39,6 @@ module.exports = Self => {
const xmlString = response.data; const xmlString = response.data;
const parser = new DOMParser(); const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
const [resultElement] = xmlDoc.getElementsByTagName('Mensaje'); return xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
return resultElement.textContent;
}; };
}; };

View File

@ -42,7 +42,8 @@ module.exports = Self => {
throw new UserError(`Some mrwConfig parameters are not set`); throw new UserError(`Some mrwConfig parameters are not set`);
const query = const query =
`SELECT CASE co.code `SELECT
CASE co.code
WHEN 'ES' THEN a.postalCode WHEN 'ES' THEN a.postalCode
WHEN 'PT' THEN LEFT(a.postalCode, 4) WHEN 'PT' THEN LEFT(a.postalCode, 4)
WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00') WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00')
@ -89,14 +90,9 @@ module.exports = Self => {
const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml'); const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml');
const file = getTextByTag(getLabelResponse, 'EtiquetaFile'); const file = getTextByTag(getLabelResponse, 'EtiquetaFile');
try { if (tx) await tx.commit();
await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions);
if (tx) await tx.commit(); return {shipmentId, file};
} catch (error) {
if (tx) await tx.rollback();
throw error;
}
return file;
}; };
function getTextByTag(xmlDoc, tag) { function getTextByTag(xmlDoc, tag) {

View File

@ -81,9 +81,9 @@ describe('MRWConfig createShipment()', () => {
spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop())); spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop()));
const base64Binary = await models.MrwConfig.createShipment(expedition1.id, options); const {file} = await models.MrwConfig.createShipment(expedition1.id, options);
expect(base64Binary).toEqual(mockBase64Binary); expect(file).toEqual(mockBase64Binary);
}); });
it('should fail if mrwConfig has no data', async() => { it('should fail if mrwConfig has no data', async() => {

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`client_userDisable`
ON SCHEDULE EVERY 1 MONTH
STARTS '2023-06-01 00:00:00.000'
ON COMPLETION PRESERVE
ENABLE
DO CALL client_userDisable()$$
DELIMITER ;

View File

@ -1,25 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable`
ON SCHEDULE EVERY 1 MONTH
STARTS '2023-06-01 00:00:00.000'
ON COMPLETION PRESERVE
ENABLE
DO BEGIN
UPDATE account.user u
JOIN client c ON c.id = u.id
LEFT JOIN account.account a ON a.id = u.id
SET u.active = FALSE
WHERE c.typeFk = 'normal'
AND a.id IS NULL
AND u.active
AND c.created < util.VN_CURDATE() - INTERVAL 12 MONTH
AND u.id NOT IN (
SELECT DISTINCT c.id
FROM client c
LEFT JOIN ticket t ON t.clientFk = c.id
WHERE c.salesPersonFk IS NOT NULL
OR t.created > util.VN_CURDATE() - INTERVAL 12 MONTH
OR shipped > util.VN_CURDATE() - INTERVAL 12 MONTH
);
END$$
DELIMITER ;

View File

@ -19,7 +19,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
price1, price1,
@ -41,7 +40,6 @@ BEGIN
b.packing, b.packing,
b.`grouping`, b.`grouping`,
b.groupingMode, b.groupingMode,
b.containerFk,
b.comissionValue, b.comissionValue,
b.packageValue, b.packageValue,
b.price1, b.price1,

View File

@ -0,0 +1,33 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_userDisable`()
BEGIN
/**
* Desactiva los clientes inactivos en los últimos X meses.
*/
DECLARE vMonths INT;
SELECT monthsToDisableUser INTO vMonths
FROM clientConfig;
IF vMonths IS NULL THEN
CALL util.throw('Config parameter not set');
END IF;
UPDATE account.user u
JOIN client c ON c.id = u.id
LEFT JOIN account.account a ON a.id = u.id
SET u.active = FALSE
WHERE c.typeFk = 'normal'
AND a.id IS NULL
AND u.active
AND c.created < util.VN_CURDATE() - INTERVAL vMonths MONTH
AND u.id NOT IN (
SELECT DISTINCT c.id
FROM client c
LEFT JOIN ticket t ON t.clientFk = c.id
WHERE c.salesPersonFk IS NOT NULL
OR t.created > util.VN_CURDATE() - INTERVAL vMonths MONTH
OR shipped > util.VN_CURDATE() - INTERVAL vMonths MONTH
);
END$$
DELIMITER ;

View File

@ -26,7 +26,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
location, location,
@ -46,7 +45,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
location, location,

View File

@ -56,7 +56,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
packagingFk, packagingFk,
@ -77,7 +76,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
packagingFk, packagingFk,
@ -114,7 +112,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
location, location,
@ -133,7 +130,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
location, location,

View File

@ -76,7 +76,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
location, location,
@ -103,7 +102,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
location, location,

View File

@ -18,11 +18,12 @@ BEGIN
JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.parking p ON p.id = sh.parkingFk
JOIN vn.sector sc ON sc.id = p.sectorFk JOIN vn.sector sc ON sc.id = p.sectorFk
JOIN vn.warehouse w ON w.id = sc.warehouseFk JOIN vn.warehouse w ON w.id = sc.warehouseFk
WHERE sc.id = vSectorFk WHERE ish.visible > 0
AND ish.visible > 0
AND ish.itemFk = vItemFk AND ish.itemFk = vItemFk
GROUP BY ish.id GROUP BY ish.id
ORDER BY sh.priority DESC, ORDER BY
(sc.id = vSectorFk) DESC,
sh.priority DESC,
ish.created, ish.created,
p.pickingOrder; p.pickingOrder;
END$$ END$$

View File

@ -319,7 +319,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
price1, price1,
@ -341,7 +340,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
price1, price1,
@ -366,7 +364,6 @@ BEGIN
packing, packing,
`grouping`, `grouping`,
groupingMode, groupingMode,
containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
price1, price1,

View File

@ -151,8 +151,8 @@ BEGIN
supplier, supplier,
entryFk, entryFk,
landed, landed,
`in`, CAST(`in` AS DECIMAL(10,0)) `in`,
`out`, CAST(`out` AS DECIMAL(10,0)) `out`,
warehouse, warehouse,
buyingValue, buyingValue,
balance balance

View File

@ -28,6 +28,5 @@ AS SELECT `c`.`id` AS `Id_Compra`,
`c`.`workerFk` AS `Id_Trabajador`, `c`.`workerFk` AS `Id_Trabajador`,
`c`.`weight` AS `weight`, `c`.`weight` AS `weight`,
`c`.`dispatched` AS `dispatched`, `c`.`dispatched` AS `dispatched`,
`c`.`containerFk` AS `container_id`,
`c`.`itemOriginalFk` AS `itemOriginalFk` `c`.`itemOriginalFk` AS `itemOriginalFk`
FROM `vn`.`buy` `c` FROM `vn`.`buy` `c`

View File

@ -0,0 +1,5 @@
ALTER TABLE vn.clientConfig
ADD monthsToDisableUser int(10) unsigned DEFAULT NULL NULL;
UPDATE IGNORE vn.clientConfig
SET monthsToDisableUser = 12;

View File

@ -0,0 +1,26 @@
DROP TABLE IF EXISTS vn2008.scanTree__;
DROP TABLE IF EXISTS vn2008.payroll_embargos__;
DROP TABLE IF EXISTS vn2008.unary_source__;
DROP TABLE IF EXISTS vn2008.unary_scan__;
DROP TABLE IF EXISTS vn2008.unary_scan_line_buy__;
DROP TABLE IF EXISTS vn2008.unary_scan_line__;
DROP TABLE IF EXISTS vn2008.scan_line__;
DROP TABLE IF EXISTS vn2008.Familias__;
DROP TABLE IF EXISTS vn2008.language__;
DROP TABLE IF EXISTS vn2008.Clientes_dits__;
DROP TABLE IF EXISTS vn2008.unary_scan_line_expedition__;
DROP TABLE IF EXISTS vn2008.warehouse_group__;
DROP TABLE IF EXISTS vn2008.Espionajes__;
DROP TABLE IF EXISTS vn2008.jerarquia__;
DROP TABLE IF EXISTS vn2008.wks__;
DROP TABLE IF EXISTS vn2008.Proveedores_comunicados__;
DROP TABLE IF EXISTS vn2008.integra2_escala__;
DROP TABLE IF EXISTS vn2008.cp__;
DROP TABLE IF EXISTS vn2008.unary__;
DROP TABLE IF EXISTS vn2008.Estados__;
DROP TABLE IF EXISTS vn2008.agency_hour__;
DROP TABLE IF EXISTS vn2008.Reservas__;
DROP TABLE IF EXISTS vn2008.cyc_declaration__;
DROP TABLE IF EXISTS vn2008.route__;
DROP TABLE IF EXISTS vn2008.Proveedores_escritos__;
DROP TABLE IF EXISTS vn2008.config__;

View File

@ -0,0 +1,41 @@
DROP TABLE IF EXISTS vn2008.form_query__;
DROP TABLE IF EXISTS vn2008.filtros__;
DROP TABLE IF EXISTS vn2008.Objetivos__;
UPDATE IGNORE vn.province
SET zoneFk = NULL
WHERE zoneFk IN (
SELECT zoneFk
FROM vn.province
WHERE zoneFk IS NOT NULL AND zoneFk NOT IN (SELECT id FROM vn.`zone`)
);
ALTER TABLE vn.province DROP FOREIGN KEY province_zone_fk;
ALTER TABLE vn.province MODIFY COLUMN zoneFk int(11) DEFAULT NULL NULL;
ALTER TABLE vn.province ADD CONSTRAINT
province_zone_FK FOREIGN KEY (zoneFk) REFERENCES vn.`zone`(id) ON DELETE CASCADE ON UPDATE CASCADE;
DROP TABLE IF EXISTS vn2008.zones__;
DROP TABLE IF EXISTS vn2008.rec_translator__;
DROP TABLE IF EXISTS vn2008.warehouse_joined__;
DROP TABLE IF EXISTS vn2008.warehouse_filtro__;
DROP TABLE IF EXISTS vn2008.viaxpress__;
DROP TABLE IF EXISTS vn2008.cl_que__;
DROP TABLE IF EXISTS vn2008.Recibos_recorded__;
RENAME TABLE vn.coolerPathDetail TO vn.coolerPathDetail__;
ALTER TABLE vn.coolerPathDetail__ DROP FOREIGN KEY coolerPathDetail_FK;
DROP TABLE IF EXISTS vn2008.cooler_path__;
DROP TABLE IF EXISTS vn2008.payrroll_apEmpresarial__;
DROP TABLE IF EXISTS vn2008.Compres_ok__;
DROP TABLE IF EXISTS vn2008.Movimientos_avisar__;
DROP TABLE IF EXISTS vn2008.Clases__;
DROP TABLE IF EXISTS vn2008.payroll_basess__;
DROP TABLE IF EXISTS vn2008.payroll_tipobasess__;
DROP TABLE IF EXISTS vn2008.guillen__;
DROP TABLE IF EXISTS vn2008.guillen_carry__;
DROP TABLE IF EXISTS vn2008.Series__;
DROP TABLE IF EXISTS vn2008.Permisos__;
ALTER TABLE vn.buy DROP FOREIGN KEY buy_FK_1;
DROP TABLE IF EXISTS vn2008.container__;
DROP TABLE IF EXISTS vn2008.travel_reserve__;
DROP TABLE IF EXISTS vn2008.tmpNEWTARIFAS__;
DROP TABLE IF EXISTS vn2008.Clientes_potenciales__;
DROP TABLE IF EXISTS vn2008.duaDismissed__;
DROP TABLE IF EXISTS vn2008.cl_pet__;

View File

@ -0,0 +1,27 @@
DROP TABLE IF EXISTS vn2008.expeditions_deleted__;
DROP TABLE IF EXISTS vn2008.Tipos_f11__;
DROP TABLE IF EXISTS vn2008.commission__;
DROP TABLE IF EXISTS vn2008.Movimientos_revisar__;
DROP TABLE IF EXISTS vn2008.recibida_agricola__;
DROP TABLE IF EXISTS vn2008.tipsa__;
DROP TABLE IF EXISTS vn2008.rounding__;
DROP TABLE IF EXISTS vn2008.Informes__;
DROP TABLE IF EXISTS vn2008.Monitoring__;
DROP TABLE IF EXISTS vn2008.Forms__;
DROP TABLE IF EXISTS vn2008.Clientes_event__;
DROP TABLE IF EXISTS vn2008.wh_selection__;
DROP TABLE IF EXISTS vn2008.template_bionic_component__;
DROP TABLE IF EXISTS vn2008.Agencias_province__;
DROP TABLE IF EXISTS vn2008.travel_pattern__;
DROP TABLE IF EXISTS vn2008.sort_merge_results_ernesto__;
DROP TABLE IF EXISTS vn2008.Conteo__;
DROP TABLE IF EXISTS vn2008.Consignatarios_devices__;
DROP TABLE IF EXISTS vn2008.link__;
DROP TABLE IF EXISTS vn2008.agency_warehouse__;
DROP TABLE IF EXISTS vn2008.warehouse_lc__;
DROP TABLE IF EXISTS vn2008.emp_day_pay__;
DROP TABLE IF EXISTS vn2008.Entradas_kop__;
DROP TABLE IF EXISTS vn2008.dock__;
DROP TABLE IF EXISTS vn2008.unaryScanFilter__;
DROP TABLE IF EXISTS vn2008.Grupos__;
DROP TABLE IF EXISTS vn2008.nichos__;

View File

@ -0,0 +1,26 @@
DROP TABLE IF EXISTS vn2008.preparation_exception__;
DROP TABLE IF EXISTS vn2008.Clientes_empresa__;
DROP TABLE IF EXISTS vn2008.call_information__;
DROP TABLE IF EXISTS vn2008.template_bionic_price__;
DROP TABLE IF EXISTS vn2008.invoice_observation__;
DROP TABLE IF EXISTS vn2008.edi_testigos__;
DROP TABLE IF EXISTS vn2008.cl_dep__;
DROP TABLE IF EXISTS vn2008.agencia_descuadre__;
DROP TABLE IF EXISTS vn2008.payroll_datos__;
DROP TABLE IF EXISTS vn2008.tblIVA__;
DROP TABLE IF EXISTS vn2008.cyc__;
DROP TABLE IF EXISTS vn2008.Tickets_stack__;
DROP TABLE IF EXISTS vn2008.config_host_forms__;
DROP TABLE IF EXISTS vn2008.template_bionic_lot__;
DROP TABLE IF EXISTS vn2008.payroll_bonificaciones__;
DROP TABLE IF EXISTS vn2008.widget__;
DROP TABLE IF EXISTS vn2008.accion_dits__;
DROP TABLE IF EXISTS vn2008.credit_card__;
DROP TABLE IF EXISTS vn2008.Brasa__;
DROP TABLE IF EXISTS vn2008.Jefes__;
DROP TABLE IF EXISTS vn2008.call_option__;
DROP TABLE IF EXISTS vn2008.expeditions_pictures__;
DROP TABLE IF EXISTS vn2008.scan__;
DROP TABLE IF EXISTS vn2008.trolley__;
DROP TABLE IF EXISTS vn2008.transport__;
DROP TABLE IF EXISTS vn2008.Baldas__;

View File

@ -0,0 +1,2 @@
-- Place your SQL code here
ALTER TABLE floranet.`order` ADD IF NOT EXISTS observations TEXT NULL;

View File

@ -0,0 +1 @@
ALTER TABLE vn.buy CHANGE containerFk containerFk__ smallint(5) unsigned DEFAULT NULL NULL;

View File

@ -76,7 +76,6 @@ module.exports = Self => {
packing: buyUltimate.packing, packing: buyUltimate.packing,
grouping: buyUltimate.grouping, grouping: buyUltimate.grouping,
groupingMode: buyUltimate.groupingMode, groupingMode: buyUltimate.groupingMode,
containerFk: buyUltimate.containerFk,
comissionValue: buyUltimate.comissionValue, comissionValue: buyUltimate.comissionValue,
packageValue: buyUltimate.packageValue, packageValue: buyUltimate.packageValue,
location: buyUltimate.location, location: buyUltimate.location,

View File

@ -63,9 +63,6 @@
"isIgnored": { "isIgnored": {
"type": "boolean" "type": "boolean"
}, },
"containerFk": {
"type": "number"
},
"location": { "location": {
"type": "number" "type": "number"
}, },

View File

@ -62,12 +62,12 @@ module.exports = Self => {
const clone = await models.Roadmap.create(roadmap, options); const clone = await models.Roadmap.create(roadmap, options);
const expeditionTrucks = roadmap.expeditionTruck(); const roadmapStops = roadmap.roadmapStop();
expeditionTrucks.map(expeditionTruck => { roadmapStops.map(roadmapStop => {
expeditionTruck.roadmapFk = clone.id; roadmapStop.roadmapFk = clone.id;
return expeditionTruck; return roadmapStop;
}); });
await models.ExpeditionTruck.create(expeditionTrucks, options); await models.RoadmapStop.create(roadmapStops, options);
} }
await tx.commit(); await tx.commit();

View File

@ -8,7 +8,7 @@
"DeliveryPoint": { "DeliveryPoint": {
"dataSource": "vn" "dataSource": "vn"
}, },
"ExpeditionTruck": { "RoadmapStop": {
"dataSource": "vn" "dataSource": "vn"
}, },
"Roadmap": { "Roadmap": {

View File

@ -54,9 +54,9 @@
"model": "Supplier", "model": "Supplier",
"foreignKey": "supplierFk" "foreignKey": "supplierFk"
}, },
"expeditionTruck": { "roadmapStop": {
"type": "hasMany", "type": "hasMany",
"model": "ExpeditionTruck", "model": "RoadmapStop",
"foreignKey": "roadmapFk" "foreignKey": "roadmapFk"
} }
} }

View File

@ -1,9 +1,9 @@
{ {
"name": "ExpeditionTruck", "name": "RoadmapStop",
"base": "VnModel", "base": "VnModel",
"options": { "options": {
"mysql": { "mysql": {
"table": "expeditionTruck" "table": "roadmapStop"
} }
}, },
"properties": { "properties": {

View File

@ -1,22 +1,22 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="ExpeditionTrucks" url="RoadmapStops"
where="{roadmapFk: $ctrl.$params.id}" where="{roadmapFk: $ctrl.$params.id}"
order="eta ASC" order="eta ASC"
data="$ctrl.expeditionTrucks" data="$ctrl.roadmapStops"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-watcher <vn-watcher
vn-id="watcher" vn-id="watcher"
data="$ctrl.expeditionTrucks" data="$ctrl.roadmapStops"
form="form"> form="form">
</vn-watcher> </vn-watcher>
<form class="vn-w-md" name="form" ng-submit="$ctrl.onSubmit()"> <form class="vn-w-md" name="form" ng-submit="$ctrl.onSubmit()">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg">
<vn-horizontal ng-repeat="expeditionTruck in $ctrl.expeditionTrucks"> <vn-horizontal ng-repeat="roadmapStop in $ctrl.roadmapStops">
<vn-autocomplete vn-one <vn-autocomplete vn-one
label="Warehouse" label="Warehouse"
ng-model="expeditionTruck.warehouseFk" ng-model="roadmapStop.warehouseFk"
url="Warehouses" url="Warehouses"
show-field="name" show-field="name"
value-field="id" value-field="id"
@ -25,18 +25,18 @@
</vn-autocomplete> </vn-autocomplete>
<vn-date-picker vn-one <vn-date-picker vn-one
label="ETA date" label="ETA date"
ng-model="expeditionTruck.eta" ng-model="roadmapStop.eta"
rule> rule>
</vn-date-picker> </vn-date-picker>
<vn-input-time <vn-input-time
vn-one vn-one
label="ETA hour" label="ETA hour"
ng-model="expeditionTruck.eta"> ng-model="roadmapStop.eta">
</vn-input-time> </vn-input-time>
<vn-textArea <vn-textArea
vn-one vn-one
label="Description" label="Description"
ng-model="expeditionTruck.description" ng-model="roadmapStop.description"
rule> rule>
</vn-textArea> </vn-textArea>
<vn-none> <vn-none>

View File

@ -49,7 +49,7 @@
vn-bind="+" vn-bind="+"
vn-tooltip="Add stop" vn-tooltip="Add stop"
icon="add_circle" icon="add_circle"
vn-click-stop="addExpeditionTruck.show()"> vn-click-stop="addRoadmapStop.show()">
</vn-icon-button> </vn-icon-button>
</a> </a>
</h4> </h4>
@ -61,9 +61,9 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="expeditionTruck in summary.expeditionTruck"> <vn-tr ng-repeat="roadmapStop in summary.roadmapStop">
<vn-td>{{expeditionTruck.warehouse.name}}</vn-td> <vn-td>{{roadmapStop.warehouse.name}}</vn-td>
<vn-td expand>{{expeditionTruck.eta | date:'dd/MM/yyyy HH:mm'}}</vn-td> <vn-td expand>{{roadmapStop.eta | date:'dd/MM/yyyy HH:mm'}}</vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>
</vn-table> </vn-table>
@ -75,14 +75,14 @@
</vn-supplier-descriptor-popover> </vn-supplier-descriptor-popover>
<vn-dialog <vn-dialog
vn-id="addExpeditionTruck" vn-id="addRoadmapStop"
on-open="$ctrl.getETD()" on-open="$ctrl.getETD()"
on-accept="$ctrl.onAddAccept()"> on-accept="$ctrl.onAddAccept()">
<tpl-body> <tpl-body>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete <vn-autocomplete
label="Warehouse" label="Warehouse"
ng-model="$ctrl.expeditionTruck.warehouseFk" ng-model="$ctrl.roadmapStop.warehouseFk"
url="Warehouses" url="Warehouses"
show-field="name" show-field="name"
value-field="id" value-field="id"
@ -93,18 +93,18 @@
<vn-horizontal> <vn-horizontal>
<vn-date-picker <vn-date-picker
label="ETA date" label="ETA date"
ng-model="$ctrl.expeditionTruck.eta" ng-model="$ctrl.roadmapStop.eta"
rule> rule>
</vn-date-picker> </vn-date-picker>
<vn-input-time <vn-input-time
label="ETA hour" label="ETA hour"
ng-model="$ctrl.expeditionTruck.eta"> ng-model="$ctrl.roadmapStop.eta">
</vn-input-time> </vn-input-time>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textArea <vn-textArea
label="Description" label="Description"
ng-model="$ctrl.expeditionTruck.description" ng-model="$ctrl.roadmapStop.description"
rule> rule>
</vn-textArea> </vn-textArea>
</vn-horizontal> </vn-horizontal>

View File

@ -20,7 +20,7 @@ class Controller extends Component {
include: [ include: [
{relation: 'supplier'}, {relation: 'supplier'},
{relation: 'worker'}, {relation: 'worker'},
{relation: 'expeditionTruck', {relation: 'roadmapStop',
scope: { scope: {
include: [ include: [
{relation: 'warehouse'} {relation: 'warehouse'}
@ -36,19 +36,19 @@ class Controller extends Component {
const eta = new Date(this.roadmap.etd); const eta = new Date(this.roadmap.etd);
eta.setDate(eta.getDate() + 1); eta.setDate(eta.getDate() + 1);
this.expeditionTruck = {eta: eta}; this.roadmapStop = {eta: eta};
} }
onAddAccept() { onAddAccept() {
try { try {
const data = { const data = {
roadmapFk: this.roadmap.id, roadmapFk: this.roadmap.id,
warehouseFk: this.expeditionTruck.warehouseFk, warehouseFk: this.roadmapStop.warehouseFk,
eta: this.expeditionTruck.eta, eta: this.roadmapStop.eta,
description: this.expeditionTruck.description description: this.roadmapStop.description
}; };
this.$http.post(`ExpeditionTrucks`, data) this.$http.post(`RoadmapStops`, data)
.then(() => { .then(() => {
this.loadData(); this.loadData();
this.vnApp.showSuccess(this.$t('Data saved!')); this.vnApp.showSuccess(this.$t('Data saved!'));

View File

@ -23,9 +23,9 @@
} }
}, },
"relations": { "relations": {
"expeditionTruck": { "roadmapStop": {
"type": "belongsTo", "type": "belongsTo",
"model": "ExpeditionTruck", "model": "RoadmapStop",
"foreignKey": "truckFk" "foreignKey": "truckFk"
} }
} }

View File

@ -227,7 +227,7 @@ localFixtures:
- expeditionScan - expeditionScan
- expeditionState - expeditionState
- expeditionStateType - expeditionStateType
- expeditionTruck - roadmapStop
- expense - expense
- genus - genus
- greuge - greuge