Merge branch 'dev' into 3081-newbankentity_component_refactor
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
01db0f6ece
|
@ -6,6 +6,11 @@ ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1;
|
|||
ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1;
|
||||
ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1;
|
||||
|
||||
INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`)
|
||||
VALUES
|
||||
('TOTALLY_SECURE_TOKEN', '1209600', CURDATE(), 66);
|
||||
|
||||
|
||||
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
|
||||
VALUES
|
||||
('1', '6');
|
||||
|
@ -125,14 +130,14 @@ INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
|
|||
(1, 'Main Warehouse'),
|
||||
(2, 'Silla');
|
||||
|
||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`, `hasComission`, `aliasFk`, `countryFk`)
|
||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`, `hasComission`, `aliasFk`, `countryFk`, `hasProduction`)
|
||||
VALUES
|
||||
(1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 1, 2, 1),
|
||||
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 0, 1, 2, 13),
|
||||
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1),
|
||||
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1),
|
||||
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1),
|
||||
(13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 0, 2, 1);
|
||||
(1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 1, 2, 1, 1),
|
||||
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 0, 1, 2, 13, 1),
|
||||
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1),
|
||||
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1),
|
||||
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1),
|
||||
(13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 0, 2, 1, 0);
|
||||
|
||||
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`, `pickingPlacement`, `path`)
|
||||
VALUES
|
||||
|
@ -208,7 +213,7 @@ UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 8;
|
|||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 4 WHERE `id` = 23;
|
||||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 10;
|
||||
|
||||
UPDATE `vn`.`agencyMode` SET `web` = 1;
|
||||
UPDATE `vn`.`agencyMode` SET `web` = 1, `reportMail` = 'no-reply@gothamcity.com';
|
||||
|
||||
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
|
||||
|
||||
|
@ -845,7 +850,7 @@ INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `create
|
|||
(7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL, 1, 1, 18, NULL, 94),
|
||||
(8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), NULL, 1, 1, 18, NULL, 94),
|
||||
(9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94),
|
||||
(10, 7, 7, 71, CURDATE(), NULL, 1, 1, 18, NULL, 94);
|
||||
(10, 7, 7, 71, NOW(), NULL, 1, 1, 18, NULL, 94);
|
||||
|
||||
INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`)
|
||||
VALUES
|
||||
|
@ -2408,4 +2413,6 @@ INSERT INTO `vn`.`expeditionScan` (`id`, `expeditionFk`, `scanned`, `palletFk`)
|
|||
(7, 7, CURDATE(), 1),
|
||||
(8, 8, CURDATE(), 1),
|
||||
(9, 9, CURDATE(), 1),
|
||||
(10, 10, CURDATE(), 1);
|
||||
(10, 10, CURDATE(), 1);
|
||||
|
||||
CALL `cache`.`last_buy_refresh`(FALSE);
|
|
@ -3,22 +3,18 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
|||
|
||||
describe('last_buy_refresh()', () => {
|
||||
it(`should store some data on cache.last_buy`, async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
const stmts = [];
|
||||
|
||||
stmts.push('START TRANSACTION');
|
||||
|
||||
stmt = new ParameterizedSQL('CALL cache.last_buy_refresh(true)');
|
||||
stmts.push(stmt);
|
||||
|
||||
let lastBuyTableIndex = stmts.push(`SELECT * FROM cache.last_buy ORDER BY item_id ASC`) - 1;
|
||||
const lastBuyTableIndex = stmts.push(`SELECT * FROM cache.last_buy ORDER BY item_id ASC`) - 1;
|
||||
|
||||
stmts.push('ROLLBACK');
|
||||
|
||||
let sql = ParameterizedSQL.join(stmts, ';');
|
||||
let result = await app.models.Ticket.rawStmt(sql);
|
||||
const sql = ParameterizedSQL.join(stmts, ';');
|
||||
const result = await app.models.Ticket.rawStmt(sql);
|
||||
|
||||
let lastBuyTable = result[lastBuyTableIndex];
|
||||
const lastBuyTable = result[lastBuyTableIndex];
|
||||
|
||||
expect(lastBuyTable.length).toEqual(12);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
message="Edit photo">
|
||||
<tpl-body class="upload-photo">
|
||||
<vn-horizontal>
|
||||
<vn-one ng-if="file.value">
|
||||
<vn-one ng-if="file.value || $ctrl.newPhoto.url">
|
||||
<vn-horizontal>
|
||||
<vn-icon-button vn-none
|
||||
icon="rotate_left"
|
||||
|
@ -20,12 +20,26 @@
|
|||
</vn-horizontal>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-horizontal>
|
||||
<vn-vertical class="vn-mb-sm">
|
||||
<vn-radio
|
||||
label="Select file from computer"
|
||||
val="computer"
|
||||
ng-model="$ctrl.uploadMethod"
|
||||
tabindex="-1">
|
||||
</vn-radio>
|
||||
<vn-radio
|
||||
label="Import from external URL"
|
||||
val="URL"
|
||||
ng-model="$ctrl.uploadMethod"
|
||||
tabindex="-1">
|
||||
</vn-radio>
|
||||
</vn-vertical>
|
||||
<vn-horizontal ng-if="$ctrl.uploadMethod == 'computer'">
|
||||
<vn-input-file vn-id="file"
|
||||
vn-one
|
||||
label="File"
|
||||
ng-model="$ctrl.newPhoto.files"
|
||||
on-change="$ctrl.updatePhotoPreview(value)"
|
||||
on-change="$ctrl.updatePhotoPreview(value[0])"
|
||||
accept="{{$ctrl.allowedContentTypes}}"
|
||||
required="true">
|
||||
<append>
|
||||
|
@ -37,6 +51,14 @@
|
|||
</append>
|
||||
</vn-input-file>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal ng-if="$ctrl.uploadMethod == 'URL'">
|
||||
<vn-textfield
|
||||
vn-one
|
||||
ng-model="$ctrl.newPhoto.url"
|
||||
on-change="$ctrl.updatePhotoPreview(value)"
|
||||
placeholder="https://">
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
label="Type"
|
||||
|
|
|
@ -39,6 +39,7 @@ export default class UploadPhoto extends Component {
|
|||
}
|
||||
];
|
||||
this.viewportType = 'normal';
|
||||
this.uploadMethod = 'computer';
|
||||
this.getAllowedContentTypes();
|
||||
}
|
||||
|
||||
|
@ -64,11 +65,16 @@ export default class UploadPhoto extends Component {
|
|||
set viewportSelection(value) {
|
||||
this._viewportSelection = value;
|
||||
|
||||
if (value && this.newPhoto.files) {
|
||||
this.displayEditor();
|
||||
const files = this.newPhoto.files;
|
||||
this.updatePhotoPreview(files);
|
||||
}
|
||||
const hasFile = this.newPhoto.files || this.newPhoto.url;
|
||||
if (!value || !hasFile) return;
|
||||
|
||||
let file;
|
||||
if (this.uploadMethod == 'computer')
|
||||
file = this.newPhoto.files[0];
|
||||
else if (this.uploadMethod == 'URL')
|
||||
file = this.newPhoto.url;
|
||||
|
||||
this.updatePhotoPreview(file);
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
|
@ -90,13 +96,15 @@ export default class UploadPhoto extends Component {
|
|||
* @param {string} value
|
||||
*/
|
||||
updatePhotoPreview(value) {
|
||||
if (value && value[0]) {
|
||||
if (!this.editor)
|
||||
this.displayEditor();
|
||||
if (value) {
|
||||
this.displayEditor();
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = e => this.editor.bind({url: e.target.result});
|
||||
reader.readAsDataURL(value[0]);
|
||||
if (this.uploadMethod == 'computer') {
|
||||
const reader = new FileReader();
|
||||
reader.onload = e => this.editor.bind({url: e.target.result});
|
||||
reader.readAsDataURL(value);
|
||||
} else if (this.uploadMethod == 'URL')
|
||||
this.editor.bind({url: value});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,17 +24,30 @@ describe('Salix', () => {
|
|||
});
|
||||
|
||||
describe('viewportSelection()', () => {
|
||||
it('should call to displayEditor() and updatePhotoPreview() methods', () => {
|
||||
controller.displayEditor = jest.fn();
|
||||
it('should call to the updatePhotoPreview() method when uploadMethod property is set to "computer"', () => {
|
||||
controller.updatePhotoPreview = jest.fn();
|
||||
|
||||
const files = [{name: 'test.jpg'}];
|
||||
controller.newPhoto.files = files;
|
||||
|
||||
controller.uploadMethod = 'computer';
|
||||
controller.viewportSelection = {code: 'normal'};
|
||||
|
||||
expect(controller.displayEditor).toHaveBeenCalledWith();
|
||||
expect(controller.updatePhotoPreview).toHaveBeenCalledWith(files);
|
||||
const firstFile = files[0];
|
||||
|
||||
expect(controller.updatePhotoPreview).toHaveBeenCalledWith(firstFile);
|
||||
});
|
||||
|
||||
it('should call to the updatePhotoPreview() method when uploadMethod property is set to "URL"', () => {
|
||||
controller.updatePhotoPreview = jest.fn();
|
||||
|
||||
const url = 'http://gothamcity.com/batman.png';
|
||||
controller.newPhoto.url = url;
|
||||
|
||||
controller.uploadMethod = 'URL';
|
||||
controller.viewportSelection = {code: 'normal'};
|
||||
|
||||
expect(controller.updatePhotoPreview).toHaveBeenCalledWith(url);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -3,4 +3,6 @@ Select an image: Selecciona una imagen
|
|||
File name: Nombre del fichero
|
||||
Rotate left: Girar a la izquierda
|
||||
Rotate right: Girar a la derecha
|
||||
Panoramic: Panorámico
|
||||
Panoramic: Panorámico
|
||||
Select from computer: Seleccionar foto desde ordenador
|
||||
Import from external URL: Importar desde URL externa
|
|
@ -115,7 +115,6 @@ module.exports = Self => {
|
|||
const stmts = [];
|
||||
let stmt;
|
||||
|
||||
stmts.push('CALL cache.last_buy_refresh(FALSE)');
|
||||
stmts.push('CALL cache.visible_refresh(@calc_id, FALSE, 1)');
|
||||
|
||||
stmt = new ParameterizedSQL(`
|
||||
|
|
|
@ -127,7 +127,6 @@ module.exports = Self => {
|
|||
filter = mergeFilters(filter, {where});
|
||||
|
||||
const stmts = [];
|
||||
stmts.push('CALL cache.last_buy_refresh(FALSE)');
|
||||
const stmt = new ParameterizedSQL(
|
||||
`SELECT
|
||||
i.id,
|
||||
|
|
|
@ -223,7 +223,8 @@ module.exports = Self => {
|
|||
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,
|
||||
TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour
|
||||
FROM ticket t
|
||||
LEFT JOIN invoiceOut io ON t.refFk = io.ref
|
||||
LEFT JOIN zone z ON z.id = t.zoneFk
|
||||
|
@ -235,7 +236,8 @@ module.exports = Self => {
|
|||
LEFT JOIN state st ON st.id = ts.stateFk
|
||||
LEFT JOIN client c ON c.id = t.clientFk
|
||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||
LEFT JOIN account.user u ON u.id = wk.userFk`);
|
||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
||||
LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`);
|
||||
|
||||
if (args.orderFk) {
|
||||
stmt.merge({
|
||||
|
|
|
@ -6,4 +6,6 @@ Delete selected elements: Eliminar los elementos seleccionados
|
|||
All the selected elements will be deleted. Are you sure you want to continue?: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
|
||||
Component lack: Faltan componentes
|
||||
Minimize/Maximize: Minimizar/Maximizar
|
||||
Problems: Problemas
|
||||
Problems: Problemas
|
||||
Theoretical: Teórica
|
||||
Practical: Práctica
|
|
@ -37,8 +37,9 @@
|
|||
<vn-th field="nickname">Client</vn-th>
|
||||
<vn-th field="salesPersonFk" class="expendable" shrink>Salesperson</vn-th>
|
||||
<vn-th field="shipped" shrink-date>Date</vn-th>
|
||||
<vn-th>Hour</vn-th>
|
||||
<vn-th field="zoneHour" shrink>Closure</vn-th>
|
||||
<vn-th>Prep.</vn-th>
|
||||
<vn-th field="hour" shrink>Theoretical</vn-th>
|
||||
<vn-th field="practicalHour">Practical</vn-th>
|
||||
<vn-th field="provinceFk" class="expendable">Province</vn-th>
|
||||
<vn-th field="stateFk">State</vn-th>
|
||||
<vn-th field="zoneFk">Zone</vn-th>
|
||||
|
@ -112,6 +113,7 @@
|
|||
</vn-td>
|
||||
<vn-td shrink>{{::ticket.shipped | date: 'HH:mm'}}</vn-td>
|
||||
<vn-td shrink>{{::ticket.zoneLanding | date: 'HH:mm'}}</vn-td>
|
||||
<vn-td shrink>{{::ticket.practicalHour | date: 'HH:mm'}}</vn-td>
|
||||
<vn-td class="expendable">{{::ticket.province}}</vn-td>
|
||||
<vn-td class="expendable">
|
||||
<span
|
||||
|
|
|
@ -74,12 +74,8 @@ export default class Controller extends Section {
|
|||
return {'t.shipped': {
|
||||
between: this.dateRange(value)}
|
||||
};
|
||||
case 'id':
|
||||
case 'refFk':
|
||||
case 'zoneFk':
|
||||
case 'nickname':
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseFk':
|
||||
return {[`t.${param}`]: value};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,8 +143,24 @@ module.exports = app => {
|
|||
AND t.refFk IS NULL
|
||||
GROUP BY e.ticketFk`, [reqArgs.routeId]);
|
||||
const ticketIds = tickets.map(ticket => ticket.id);
|
||||
|
||||
await closeAll(ticketIds, reqArgs);
|
||||
|
||||
// Send route report to the agency
|
||||
const agencyMail = await db.findValue(`
|
||||
SELECT am.reportMail
|
||||
FROM route r
|
||||
JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||
WHERE r.id = ?`, [reqArgs.routeId]);
|
||||
|
||||
if (agencyMail) {
|
||||
const args = Object.assign({
|
||||
routeId: reqArgs.routeId,
|
||||
recipient: agencyMail
|
||||
}, reqArgs);
|
||||
|
||||
const email = new Email('driver-route', args);
|
||||
await email.send();
|
||||
}
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue