Merge branch 'dev' into 3126-changePackageFkTopackagingFk
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
e2f7ce8b35
|
@ -23,10 +23,6 @@
|
||||||
"columnName": "name"
|
"columnName": "name"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"password": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"roleFk": {
|
"roleFk": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
@ -42,9 +38,6 @@
|
||||||
"active": {
|
"active": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"email": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"created": {
|
"created": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES
|
||||||
|
('WorkerDepartment', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES('TicketCollection', '*', 'WRITE', 'ALLOW', 'ROLE', 'production');
|
|
@ -0,0 +1,6 @@
|
||||||
|
UPDATE `vn`.`supplier`
|
||||||
|
SET account = LPAD(id,10,'0')
|
||||||
|
WHERE account IS NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`supplier` ADD CONSTRAINT supplierAccountTooShort CHECK (LENGTH(account) = 10);
|
||||||
|
ALTER TABLE `vn`.`supplier` MODIFY COLUMN account varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT 4100000000 NOT NULL COMMENT 'Default accounting code for suppliers.';
|
|
@ -2832,24 +2832,24 @@ UPDATE `account`.`user`
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`)
|
INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
(7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 1, NULL),
|
(7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 22, NULL),
|
||||||
(7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 1, NULL),
|
(7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 22, NULL),
|
||||||
(7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 1, NULL),
|
(7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 22, NULL),
|
||||||
(7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 100cm de '5' a '10'"),
|
(7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 100cm de '5' a '10'"),
|
||||||
(16, 9, 'update', 'Sale', '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', '{"quantity":8,"concept":"Shield", "price": 10.5, "itemFk": 1}' , 5689, 'Shield');
|
(16, 9, 'update', 'Sale', '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', '{"quantity":8,"concept":"Shield", "price": 10.5, "itemFk": 1}' , 12, 'Shield');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedModel, changedModelId, changedModelValue, oldInstance, newInstance, description)
|
INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedModel, changedModelId, changedModelValue, oldInstance, newInstance, description)
|
||||||
VALUES
|
VALUES
|
||||||
(1, NULL, 'delete', '2001-06-09 11:00:04', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
|
(1, NULL, 'delete', '2001-06-09 11:00:04', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
|
||||||
(1, 18, 'select', '2001-06-09 11:00:03', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
|
(1, 18, 'select', '2001-06-09 11:00:03', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
|
||||||
(1, NULL, 'update', '2001-05-09 10:00:02', 'Sale', 69854, 'Armor' , '{"isPicked": false}','{"isPicked": true}', NULL),
|
(1, NULL, 'update', '2001-05-09 10:00:02', 'Sale', 5, 'Armor' , '{"isPicked": false}','{"isPicked": true}', NULL),
|
||||||
(1, 18, 'update', '2001-01-01 10:05:01', 'Sale', 69854, 'Armor' , NULL, NULL, 'Armor quantity changed from ''15'' to ''10'''),
|
(1, 18, 'update', '2001-01-01 10:05:01', 'Sale', 5, 'Armor' , NULL, NULL, 'Armor quantity changed from ''15'' to ''10'''),
|
||||||
(1, NULL, 'delete', '2001-01-01 10:00:10', 'Sale', 5689, 'Shield' , '{"quantity":10,"concept":"Shield"}', NULL, NULL),
|
(1, NULL, 'delete', '2001-01-01 10:00:10', 'Sale', 4, 'Shield' , '{"quantity":10,"concept":"Shield"}', NULL, NULL),
|
||||||
(1, 18, 'insert', '2000-12-31 15:00:05', 'Sale', 69854, 'Armor' , NULL,'{"quantity":15,"concept":"Armor", "price": 345.99, "itemFk": 2}', NULL),
|
(1, 18, 'insert', '2000-12-31 15:00:05', 'Sale', 1, 'Armor' , NULL,'{"quantity":15,"concept":"Armor", "price": 345.99, "itemFk": 2}', NULL),
|
||||||
(1, 18, 'update', '2000-12-28 08:40:45', 'Ticket', 45, 'Spider Man' , '{"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"isBlocked":false,"hasPriority":false,"companyFk":442,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}','{"warehouseFk":61,"shipped":"2023-05-17T22:00:00.000Z","nickname":"Spider Man","isSigned":false,"isLabeled":false,"isPrinted":false,"packages":1,"hour":0,"isBlocked":true,"hasPriority":true,"companyFk":443,"landed":"2023-05-18T22:00:00.000Z","isBoxed":false,"isDeleted":false,"zoneFk":713,"zonePrice":13,"zoneBonus":1}', NULL),
|
(1, 18, 'update', '2000-12-28 08:40:45', 'Ticket', 45, 'Spider Man' , '{"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"isBlocked":false,"hasPriority":false,"companyFk":442,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}','{"warehouseFk":61,"shipped":"2023-05-17T22:00:00.000Z","nickname":"Spider Man","isSigned":false,"isLabeled":false,"isPrinted":false,"packages":1,"hour":0,"isBlocked":true,"hasPriority":true,"companyFk":443,"landed":"2023-05-18T22:00:00.000Z","isBoxed":false,"isDeleted":false,"zoneFk":713,"zonePrice":13,"zoneBonus":1}', NULL),
|
||||||
(1, 18, 'select', '2000-12-27 03:40:30', 'Ticket', 45, NULL , NULL, NULL, NULL),
|
(1, 18, 'select', '2000-12-27 03:40:30', 'Ticket', 45, NULL , NULL, NULL, NULL),
|
||||||
(1, 18, 'insert', '2000-04-10 09:40:15', 'Sale', 5689, 'Shield' , NULL, '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', NULL),
|
(1, 18, 'insert', '2000-04-10 09:40:15', 'Sale', 4, 'Shield' , NULL, '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', NULL),
|
||||||
(1, 18, 'insert', '1999-05-09 10:00:00', 'Ticket', 45, 'Super Man' , NULL, '{"id":45,"clientFk":8608,"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","addressFk":48637,"isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"created":"2023-05-16T11:42:56.000Z","isBlocked":false,"hasPriority":false,"companyFk":442,"agencyModeFk":639,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}', NULL);
|
(1, 18, 'insert', '1999-05-09 10:00:00', 'Ticket', 45, 'Super Man' , NULL, '{"id":45,"clientFk":8608,"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","addressFk":48637,"isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"created":"2023-05-16T11:42:56.000Z","isBlocked":false,"hasPriority":false,"companyFk":442,"agencyModeFk":639,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}', NULL);
|
||||||
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
|
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -39,6 +39,7 @@ import './range';
|
||||||
import './input-time';
|
import './input-time';
|
||||||
import './input-file';
|
import './input-file';
|
||||||
import './label';
|
import './label';
|
||||||
|
import './link-phone';
|
||||||
import './list';
|
import './list';
|
||||||
import './popover';
|
import './popover';
|
||||||
import './popup';
|
import './popup';
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<span ng-if="$ctrl.phoneNumber">
|
||||||
|
{{$ctrl.phoneNumber}}
|
||||||
|
<a href="tel:{{$ctrl.phoneNumber}}">
|
||||||
|
<vn-icon
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
icon="phone"
|
||||||
|
title="MicroSIP"
|
||||||
|
ng-click="$event.stopPropagation();"
|
||||||
|
>
|
||||||
|
</vn-icon>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<span ng-if="!$ctrl.phoneNumber">-</span>
|
|
@ -0,0 +1,15 @@
|
||||||
|
import ngModule from '../../module';
|
||||||
|
import './style.scss';
|
||||||
|
class Controller {
|
||||||
|
constructor() {
|
||||||
|
this.phoneNumber = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnLinkPhone', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
phoneNumber: '<',
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
vn-link-phone {
|
||||||
|
vn-icon {
|
||||||
|
font-size: 1.1em;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,5 +22,4 @@ import './user-photo';
|
||||||
import './upload-photo';
|
import './upload-photo';
|
||||||
import './bank-entity';
|
import './bank-entity';
|
||||||
import './log';
|
import './log';
|
||||||
import './instance-log';
|
|
||||||
import './sendSms';
|
import './sendSms';
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
<vn-dialog
|
|
||||||
vn-id="instanceLog">
|
|
||||||
<tpl-body>
|
|
||||||
<vn-log
|
|
||||||
class="vn-instance-log"
|
|
||||||
url="{{$ctrl.url}}"
|
|
||||||
origin-id="$ctrl.originId"
|
|
||||||
changed-model="$ctrl.changedModel"
|
|
||||||
changed-model-id="$ctrl.changedModelId">
|
|
||||||
</vn-log>
|
|
||||||
</tpl-body>
|
|
||||||
</vn-dialog>
|
|
|
@ -1,21 +0,0 @@
|
||||||
import ngModule from '../../module';
|
|
||||||
import Section from '../section';
|
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
export default class Controller extends Section {
|
|
||||||
open() {
|
|
||||||
this.$.instanceLog.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ngModule.vnComponent('vnInstanceLog', {
|
|
||||||
controller: Controller,
|
|
||||||
template: require('./index.html'),
|
|
||||||
bindings: {
|
|
||||||
model: '<',
|
|
||||||
originId: '<',
|
|
||||||
changedModelId: '<',
|
|
||||||
changedModel: '@',
|
|
||||||
url: '@'
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,9 +0,0 @@
|
||||||
vn-log.vn-instance-log {
|
|
||||||
vn-card {
|
|
||||||
width: 900px;
|
|
||||||
visibility: hidden;
|
|
||||||
& > * {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -72,6 +72,7 @@ export default class Controller extends Section {
|
||||||
|
|
||||||
$postLink() {
|
$postLink() {
|
||||||
this.resetFilter();
|
this.resetFilter();
|
||||||
|
this.defaultFilter();
|
||||||
this.$.$watch(
|
this.$.$watch(
|
||||||
() => this.$.filter,
|
() => this.$.filter,
|
||||||
() => this.applyFilter(),
|
() => this.applyFilter(),
|
||||||
|
@ -79,6 +80,14 @@ export default class Controller extends Section {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultFilter() {
|
||||||
|
const defaultFilters = ['changedModel', 'changedModelId'];
|
||||||
|
for (const defaultFilter of defaultFilters) {
|
||||||
|
if (this[defaultFilter])
|
||||||
|
this.$.filter[defaultFilter] = this[defaultFilter];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get logs() {
|
get logs() {
|
||||||
return this._logs;
|
return this._logs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,6 +216,7 @@
|
||||||
"The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
|
"The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
|
||||||
"The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
|
"The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
|
||||||
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
|
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
|
||||||
|
"The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres",
|
||||||
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
|
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
|
||||||
"You don't have privileges to create refund": "No tienes permisos para crear un abono",
|
"You don't have privileges to create refund": "No tienes permisos para crear un abono",
|
||||||
"The item is required": "El artículo es requerido",
|
"The item is required": "El artículo es requerido",
|
||||||
|
|
|
@ -33,6 +33,12 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'The company id',
|
description: 'The company id',
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'addressId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The address id',
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
|
|
|
@ -21,6 +21,12 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'The company id',
|
description: 'The company id',
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'addressId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The address id',
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
|
|
@ -21,6 +21,12 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'The company id',
|
description: 'The company id',
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'addressId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The address id',
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('Client transactions', () => {
|
describe('Client transactions', () => {
|
||||||
|
const ctx = {};
|
||||||
|
|
||||||
it('should call transactions() method to receive a list of Web Payments from BRUCE WAYNE', async() => {
|
it('should call transactions() method to receive a list of Web Payments from BRUCE WAYNE', async() => {
|
||||||
const tx = await models.Client.beginTransaction({});
|
const tx = await models.Client.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ctx = {};
|
|
||||||
const filter = {where: {clientFk: 1101}};
|
const filter = {where: {clientFk: 1101}};
|
||||||
const result = await models.Client.transactions(ctx, filter, options);
|
const result = await models.Client.transactions(
|
||||||
|
ctx,
|
||||||
|
filter,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
expect(result[1].id).toBeTruthy();
|
expect(result[1].id).toBeTruthy();
|
||||||
|
|
||||||
|
@ -26,9 +35,17 @@ describe('Client transactions', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ctx = {args: {orderFk: 6}};
|
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const result = await models.Client.transactions(ctx, filter, options);
|
const result = await models.Client.transactions(
|
||||||
|
ctx,
|
||||||
|
filter,
|
||||||
|
6,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
const firstRow = result[0];
|
const firstRow = result[0];
|
||||||
|
|
||||||
|
@ -47,10 +64,17 @@ describe('Client transactions', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ctx = {args: {amount: 40}};
|
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const result = await models.Client.transactions(ctx, filter, options);
|
const result = await models.Client.transactions(
|
||||||
|
ctx,
|
||||||
|
filter,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
40,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
const randomIndex = Math.floor(Math.random() * result.length);
|
const randomIndex = Math.floor(Math.random() * result.length);
|
||||||
const transaction = result[randomIndex];
|
const transaction = result[randomIndex];
|
||||||
|
@ -63,4 +87,43 @@ describe('Client transactions', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should call transactions() method filtering by date', async() => {
|
||||||
|
const tx = await models.Client.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const filter = {};
|
||||||
|
const withResults = await models.Client.transactions(
|
||||||
|
ctx,
|
||||||
|
filter,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
'2000/12/31',
|
||||||
|
undefined,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(withResults.length).toEqual(6);
|
||||||
|
|
||||||
|
const noResults = await models.Client.transactions(
|
||||||
|
ctx,
|
||||||
|
filter,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
'2099/12/31',
|
||||||
|
undefined,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(noResults.length).toEqual(0);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,22 +12,26 @@ module.exports = Self => {
|
||||||
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: 'orderFk',
|
arg: 'orderFk',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
http: {source: 'query'}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'clientFk',
|
arg: 'clientFk',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
http: {source: 'query'}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'amount',
|
arg: 'amount',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
http: {source: 'query'}
|
},
|
||||||
|
{
|
||||||
|
arg: 'from',
|
||||||
|
type: 'date',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'to',
|
||||||
|
type: 'date',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
|
@ -40,14 +44,15 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.transactions = async(ctx, filter, options) => {
|
Self.transactions = async(ctx, filter, orderFk, clientFk, amount, from, to, options) => {
|
||||||
const args = ctx.args;
|
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const where = buildFilter(args, (param, value) => {
|
if (to) to.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
|
const where = buildFilter({orderFk, clientFk, amount, from, to}, (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'orderFk':
|
case 'orderFk':
|
||||||
return {'t.id': value};
|
return {'t.id': value};
|
||||||
|
@ -55,6 +60,10 @@ module.exports = Self => {
|
||||||
return {'t.clientFk': value};
|
return {'t.clientFk': value};
|
||||||
case 'amount':
|
case 'amount':
|
||||||
return {'t.amount': (value * 100)};
|
return {'t.amount': (value * 100)};
|
||||||
|
case 'from':
|
||||||
|
return {'t.created': {gte: value}};
|
||||||
|
case 'to':
|
||||||
|
return {'t.created': {lte: value}};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,12 @@
|
||||||
auto-load="true"
|
auto-load="true"
|
||||||
url="Samples/visible"
|
url="Samples/visible"
|
||||||
fields="[
|
fields="[
|
||||||
'id',
|
'id',
|
||||||
'code',
|
'code',
|
||||||
'description',
|
'description',
|
||||||
'model',
|
'model',
|
||||||
'hasCompany',
|
'hasCompany',
|
||||||
|
'hasAddress',
|
||||||
'hasPreview',
|
'hasPreview',
|
||||||
'datepickerEnabled'
|
'datepickerEnabled'
|
||||||
]"
|
]"
|
||||||
|
@ -65,10 +66,36 @@
|
||||||
model="ClientSample.companyFk"
|
model="ClientSample.companyFk"
|
||||||
data="companiesData"
|
data="companiesData"
|
||||||
show-field="code"
|
show-field="code"
|
||||||
label="Company"
|
label="Company"
|
||||||
ng-if="sampleType.selection.hasCompany"
|
ng-if="sampleType.selection.hasCompany"
|
||||||
required="true">
|
required="true">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
<vn-autocomplete
|
||||||
|
ng-if="sampleType.selection.id == 20"
|
||||||
|
vn-one
|
||||||
|
required="true"
|
||||||
|
data="$ctrl.addresses"
|
||||||
|
label="Address"
|
||||||
|
show-field="nickname"
|
||||||
|
value-field="id"
|
||||||
|
ng-model="$ctrl.addressId"
|
||||||
|
model="ClientSample.addressFk"
|
||||||
|
order="isActive DESC">
|
||||||
|
<tpl-item class="address" ng-class="::{inactive: !isActive}">
|
||||||
|
<span class="inactive" translate>{{::!isActive ? '(Inactive)' : ''}}</span>
|
||||||
|
{{::nickname}}
|
||||||
|
<span ng-show="city || province || street">
|
||||||
|
, {{::street}}, {{::city}}, {{::province.name}} - {{::agencyMode.name}}
|
||||||
|
</span>
|
||||||
|
</tpl-item>
|
||||||
|
<append>
|
||||||
|
<vn-icon-button
|
||||||
|
ui-sref="client.card.address.edit({id: $ctrl.clientId, addressId: $ctrl.addressId})"
|
||||||
|
icon="edit"
|
||||||
|
vn-tooltip="Edit address">
|
||||||
|
</vn-icon-button>
|
||||||
|
</append>
|
||||||
|
</vn-autocomplete>
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
vn-one
|
vn-one
|
||||||
label="From"
|
label="From"
|
||||||
|
@ -85,7 +112,7 @@
|
||||||
</vn-submit>
|
</vn-submit>
|
||||||
<vn-button
|
<vn-button
|
||||||
disabled="!sampleType.selection.hasPreview"
|
disabled="!sampleType.selection.hasPreview"
|
||||||
label="Preview"
|
label="Preview"
|
||||||
ng-click="$ctrl.preview()">
|
ng-click="$ctrl.preview()">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
<vn-button
|
<vn-button
|
||||||
|
|
|
@ -15,8 +15,10 @@ class Controller extends Section {
|
||||||
set client(value) {
|
set client(value) {
|
||||||
this._client = value;
|
this._client = value;
|
||||||
|
|
||||||
if (value)
|
if (value) {
|
||||||
this.setClientSample(value);
|
this.setClientSample(value);
|
||||||
|
this.clientAddressesList(value.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get companyId() {
|
get companyId() {
|
||||||
|
@ -29,6 +31,16 @@ class Controller extends Section {
|
||||||
this.clientSample.companyFk = value;
|
this.clientSample.companyFk = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get addressId() {
|
||||||
|
if (!this.clientSample.addressId)
|
||||||
|
this.clientSample.addressId = this.client.defaultAddressFk;
|
||||||
|
return this.clientSample.addressId;
|
||||||
|
}
|
||||||
|
|
||||||
|
set addressId(value) {
|
||||||
|
this.clientSample.addressId = value;
|
||||||
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.$.watcher.check();
|
this.$.watcher.check();
|
||||||
|
|
||||||
|
@ -65,6 +77,9 @@ class Controller extends Section {
|
||||||
|
|
||||||
if (sampleType.datepickerEnabled)
|
if (sampleType.datepickerEnabled)
|
||||||
params.from = this.clientSample.from;
|
params.from = this.clientSample.from;
|
||||||
|
|
||||||
|
if (this.clientSample.addressId)
|
||||||
|
params.addressId = this.clientSample.addressId;
|
||||||
}
|
}
|
||||||
|
|
||||||
preview() {
|
preview() {
|
||||||
|
@ -126,6 +141,40 @@ class Controller extends Section {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientAddressesList(value) {
|
||||||
|
let filter = {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'province',
|
||||||
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'agencyMode',
|
||||||
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
filter = encodeURIComponent(JSON.stringify(filter));
|
||||||
|
|
||||||
|
let query = `Clients/${value}/addresses?filter=${filter}`;
|
||||||
|
this.$http.get(query).then(res => {
|
||||||
|
if (res.data)
|
||||||
|
this.addresses = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getClientDefaultAddress(value) {
|
||||||
|
let query = `Clients/${value}`;
|
||||||
|
this.$http.get(query).then(res => {
|
||||||
|
if (res.data)
|
||||||
|
this.addressId = res.data.defaultAddressFk;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$element', '$scope', 'vnEmail'];
|
Controller.$inject = ['$element', '$scope', 'vnEmail'];
|
||||||
|
|
|
@ -45,11 +45,18 @@
|
||||||
<vn-label-value label="Contact"
|
<vn-label-value label="Contact"
|
||||||
value="{{$ctrl.summary.contact}}">
|
value="{{$ctrl.summary.contact}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Phone"
|
<vn-label-value label="Phone">
|
||||||
value="{{$ctrl.summary.phone}}">
|
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.phone"
|
||||||
|
></vn-link-phone>
|
||||||
|
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Mobile"
|
<vn-label-value label="Mobile">
|
||||||
value="{{$ctrl.summary.mobile}}">
|
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.mobile"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Email" no-ellipsize
|
<vn-label-value label="Email" no-ellipsize
|
||||||
value="{{$ctrl.listEmails($ctrl.summary.email)}}">
|
value="{{$ctrl.listEmails($ctrl.summary.email)}}">
|
||||||
|
|
|
@ -47,6 +47,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "VnUser",
|
"model": "VnUser",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "userFk"
|
||||||
|
},
|
||||||
|
"shelving": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Shelving",
|
||||||
|
"foreignKey": "shelvingFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,10 @@
|
||||||
<vn-label-value label="Landed"
|
<vn-label-value label="Landed"
|
||||||
value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy HH:mm'}}">
|
value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy HH:mm'}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Phone"
|
<vn-label-value label="Phone">
|
||||||
value="{{$ctrl.summary.address.phone}}">
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.address.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Created from"
|
<vn-label-value label="Created from"
|
||||||
value="{{$ctrl.summary.sourceApp}}">
|
value="{{$ctrl.summary.sourceApp}}">
|
||||||
|
|
|
@ -25,7 +25,10 @@
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Phone"
|
label="Phone"
|
||||||
value="{{summary.phone}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="summary.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Worker"
|
label="Worker"
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
@import "variables";
|
@import "variables";
|
||||||
|
|
||||||
vn-roadmap-summary .summary {
|
vn-roadmap-summary .summary {
|
||||||
a {
|
a:not(vn-link-phone a) {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 18.328px;
|
height: 18.328px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ describe('Supplier newSupplier()', () => {
|
||||||
const result = await models.Supplier.newSupplier(ctx, options);
|
const result = await models.Supplier.newSupplier(ctx, options);
|
||||||
|
|
||||||
expect(result.name).toEqual('newSupplier');
|
expect(result.name).toEqual('newSupplier');
|
||||||
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -123,5 +123,21 @@ describe('loopback model Supplier', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should update the account attribute when a new supplier is created', async() => {
|
||||||
|
const tx = await models.Supplier.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const newSupplier = await models.Supplier.create({name: 'Alfred Pennyworth'}, options);
|
||||||
|
const fetchedSupplier = await models.Supplier.findById(newSupplier.id, null, options);
|
||||||
|
|
||||||
|
expect(Number(fetchedSupplier.account)).toEqual(4100000000 + newSupplier.id);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -117,6 +117,16 @@ module.exports = Self => {
|
||||||
throw new UserError('You can not modify is pay method checked');
|
throw new UserError('You can not modify is pay method checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Self.observe('after save', async function(ctx) {
|
||||||
|
if (ctx.instance && ctx.isNewInstance) {
|
||||||
|
const {id} = ctx.instance;
|
||||||
|
const {Supplier} = Self.app.models;
|
||||||
|
|
||||||
|
const supplier = await Supplier.findById(id, null, ctx.options);
|
||||||
|
await supplier?.updateAttribute('account', Number(supplier.account) + id, ctx.options);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Self.validateAsync('name', 'countryFk', hasSupplierSameName, {
|
Self.validateAsync('name', 'countryFk', hasSupplierSameName, {
|
||||||
message: 'A supplier with the same name already exists. Change the country.'
|
message: 'A supplier with the same name already exists. Change the country.'
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
<vn-submit
|
<vn-submit
|
||||||
disabled="!watcher.dataChanged()"
|
|
||||||
label="Create">
|
label="Create">
|
||||||
</vn-submit>
|
</vn-submit>
|
||||||
<vn-button
|
<vn-button
|
||||||
|
|
|
@ -138,14 +138,15 @@ module.exports = Self => {
|
||||||
// Update original sale
|
// Update original sale
|
||||||
const rest = originalSale.quantity - sale.quantity;
|
const rest = originalSale.quantity - sale.quantity;
|
||||||
query = `UPDATE sale
|
query = `UPDATE sale
|
||||||
SET quantity = ?
|
SET quantity = ?,
|
||||||
|
originalQuantity = ?
|
||||||
WHERE id = ?`;
|
WHERE id = ?`;
|
||||||
await Self.rawSql(query, [rest, sale.id], options);
|
await Self.rawSql(query, [rest, rest, sale.id], options);
|
||||||
|
|
||||||
// Clone sale with new quantity
|
// Clone sale with new quantity
|
||||||
query = `INSERT INTO sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed,
|
query = `INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, discount, priceFixed,
|
||||||
reserved, isPicked, isPriceFixed, isAdded)
|
reserved, isPicked, isPriceFixed, isAdded)
|
||||||
SELECT itemFk, ?, concept, ?, originalQuantity, price, discount, priceFixed,
|
SELECT itemFk, ?, concept, ?, price, discount, priceFixed,
|
||||||
reserved, isPicked, isPriceFixed, isAdded
|
reserved, isPicked, isPriceFixed, isAdded
|
||||||
FROM sale
|
FROM sale
|
||||||
WHERE id = ?`;
|
WHERE id = ?`;
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
"id": {
|
"id": {
|
||||||
"id": true,
|
"id": true,
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"usedShelves": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -201,7 +201,7 @@ class Controller extends Section {
|
||||||
sendImportSms() {
|
sendImportSms() {
|
||||||
const params = {
|
const params = {
|
||||||
ticketId: this.id,
|
ticketId: this.id,
|
||||||
created: this.ticket.updated
|
shipped: this.ticket.shipped
|
||||||
};
|
};
|
||||||
this.showSMSDialog({
|
this.showSMSDialog({
|
||||||
message: this.$t('Minimum is needed', params)
|
message: this.$t('Minimum is needed', params)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
Make a payment: "Verdnatura communicates:\rYour order is pending of payment.\rPlease, enter the web page and make the payment with card.\rThank you."
|
Make a payment: "Verdnatura communicates:\rYour order is pending of payment.\rPlease, enter the web page and make the payment with card.\rThank you."
|
||||||
Minimum is needed: "Verdnatura communicates:\rA minimum import of 50€ (Without BAT) is needed for your order {{ticketId}} from date {{created | date: 'dd/MM/yyyy'}} to receive it with no extra fees."
|
Minimum is needed: "Verdnatura communicates:\rA minimum import of 50€ (Without BAT) is needed for your order {{ticketId}} from date {{shipped | date: 'dd/MM/yyyy'}} to receive it with no extra fees."
|
||||||
Send changes: "Verdnatura communicates:\rOrder {{ticketId}} date {{created | date: 'dd/MM/yyyy'}}\r{{changes}}"
|
Send changes: "Verdnatura communicates:\rOrder {{ticketId}} date {{created | date: 'dd/MM/yyyy'}}\r{{changes}}"
|
||||||
|
|
|
@ -3,8 +3,8 @@ Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
|
||||||
Show pallet report: Ver hoja de pallet
|
Show pallet report: Ver hoja de pallet
|
||||||
Change shipped hour: Cambiar hora de envío
|
Change shipped hour: Cambiar hora de envío
|
||||||
Shipped hour: Hora de envío
|
Shipped hour: Hora de envío
|
||||||
Make a payment: "Verdnatura le comunica:\rSu pedido está pendiente de pago.\rPor favor, entre en la página web y efectue el pago con tarjeta.\rMuchas gracias."
|
Make a payment: "Verdnatura le comunica:\rSu pedido está pendiente de pago.\rPor favor, entre en la página web y efectúe el pago con tarjeta.\rMuchas gracias."
|
||||||
Minimum is needed: "Verdnatura le recuerda:\rEs necesario un importe mínimo de 50€ (Sin IVA) en su pedido {{ticketId}} del día {{created | date: 'dd/MM/yyyy'}} para recibirlo sin portes adicionales."
|
Minimum is needed: "Verdnatura le recuerda:\rEs necesario un importe mínimo de 50€ (Sin IVA) en su pedido {{ticketId}} del día {{shipped | date: 'dd/MM/yyyy'}} para recibirlo sin portes adicionales."
|
||||||
Ticket invoiced: Ticket facturado
|
Ticket invoiced: Ticket facturado
|
||||||
Make invoice: Crear factura
|
Make invoice: Crear factura
|
||||||
Regenerate invoice PDF: Regenerar PDF factura
|
Regenerate invoice PDF: Regenerar PDF factura
|
||||||
|
|
|
@ -1 +1,6 @@
|
||||||
<vn-log url="TicketLogs" origin-id="$ctrl.$params.id"></vn-log>
|
<vn-log
|
||||||
|
url="TicketLogs"
|
||||||
|
origin-id="$ctrl.$params.id"
|
||||||
|
changed-model="$ctrl.$params.changedModel"
|
||||||
|
changed-model-id="$ctrl.$params.changedModelId">
|
||||||
|
</vn-log>
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url" : "/log",
|
"url" : "/log?changedModel&changedModelId",
|
||||||
"state": "ticket.card.log",
|
"state": "ticket.card.log",
|
||||||
"component": "vn-ticket-log",
|
"component": "vn-ticket-log",
|
||||||
"description": "Log"
|
"description": "Log"
|
||||||
|
|
|
@ -212,16 +212,9 @@
|
||||||
vn-none
|
vn-none
|
||||||
vn-tooltip="History"
|
vn-tooltip="History"
|
||||||
icon="history"
|
icon="history"
|
||||||
ng-click="log.open()"
|
ng-click="$ctrl.goToLog(sale.id)"
|
||||||
ng-show="sale.$hasLogs">
|
ng-show="sale.$hasLogs">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
<vn-instance-log
|
|
||||||
vn-id="log"
|
|
||||||
url="TicketLogs"
|
|
||||||
origin-id="$ctrl.$params.id"
|
|
||||||
changed-model="Sale"
|
|
||||||
changed-model-id="sale.id">
|
|
||||||
</vn-instance-log>
|
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
|
|
|
@ -558,6 +558,14 @@ class Controller extends Section {
|
||||||
cancel() {
|
cancel() {
|
||||||
this.$.editDiscount.hide();
|
this.$.editDiscount.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goToLog(saleId) {
|
||||||
|
this.$state.go('ticket.card.log', {
|
||||||
|
originId: this.$params.id,
|
||||||
|
changedModel: 'Sale',
|
||||||
|
changedModelId: saleId
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnTicketSale', {
|
ngModule.vnComponent('vnTicketSale', {
|
||||||
|
|
|
@ -83,19 +83,29 @@
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Address phone"
|
<vn-label-value label="Address phone"
|
||||||
ng-if="$ctrl.summary.address.phone != null"
|
ng-if="$ctrl.summary.address.phone != null"
|
||||||
value="{{$ctrl.summary.address.phone}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.address.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Address mobile"
|
<vn-label-value label="Address mobile"
|
||||||
ng-if="$ctrl.summary.address.mobile != null"
|
ng-if="$ctrl.summary.address.mobile != null"
|
||||||
value="{{$ctrl.summary.address.mobile}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.address.mobile"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Client phone"
|
<vn-label-value label="Client phone"
|
||||||
ng-if="$ctrl.summary.client.phone != null"
|
ng-if="$ctrl.summary.client.phone != null">
|
||||||
value="{{$ctrl.summary.client.phone}}">
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.client.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Client mobile"
|
<vn-label-value label="Client mobile"
|
||||||
ng-if="$ctrl.summary.client.mobile != null"
|
ng-if="$ctrl.summary.client.mobile != null">
|
||||||
value="{{$ctrl.summary.client.mobile}}">
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.client.mobile"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Address" no-ellipsize
|
<vn-label-value label="Address" no-ellipsize
|
||||||
value="{{$ctrl.formattedAddress}}">
|
value="{{$ctrl.formattedAddress}}">
|
||||||
|
|
|
@ -47,4 +47,9 @@ vn-ticket-summary .summary {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vn-icon.tel {
|
||||||
|
font-size: 1.1em;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('updateWorkerTimeControlMail()', () => {
|
||||||
|
it('should update WorkerTimeControlMail if exist record', async() => {
|
||||||
|
const tx = await models.WorkerTimeControlMail.beginTransaction({});
|
||||||
|
const args = {
|
||||||
|
workerId: 9,
|
||||||
|
week: 50,
|
||||||
|
year: 2000,
|
||||||
|
state: 'CONFIRMED'
|
||||||
|
};
|
||||||
|
const ctx = {args};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const beforeMail = await models.WorkerTimeControlMail.findOne({
|
||||||
|
where: {
|
||||||
|
workerFk: args.workerId,
|
||||||
|
year: args.year,
|
||||||
|
week: args.week,
|
||||||
|
}
|
||||||
|
}, options);
|
||||||
|
await models.WorkerTimeControl.updateWorkerTimeControlMail(ctx, options);
|
||||||
|
const afterMail = await models.WorkerTimeControlMail.findOne({
|
||||||
|
where: {
|
||||||
|
workerFk: args.workerId,
|
||||||
|
year: args.year,
|
||||||
|
week: args.week,
|
||||||
|
}
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
expect(beforeMail.state).toEqual('SENDED');
|
||||||
|
expect(afterMail.state).toEqual(args.state);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should insert WorkerTimeControlMail if exist record', async() => {
|
||||||
|
const tx = await models.WorkerTimeControlMail.beginTransaction({});
|
||||||
|
const args = {
|
||||||
|
workerId: 1,
|
||||||
|
week: 51,
|
||||||
|
year: 2000,
|
||||||
|
state: 'SENDED'
|
||||||
|
};
|
||||||
|
const ctx = {args};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const beforeMail = await models.WorkerTimeControlMail.find({
|
||||||
|
where: {
|
||||||
|
workerFk: args.workerId,
|
||||||
|
year: args.year,
|
||||||
|
week: args.week,
|
||||||
|
}
|
||||||
|
}, options);
|
||||||
|
await models.WorkerTimeControl.updateWorkerTimeControlMail(ctx, options);
|
||||||
|
const afterMail = await models.WorkerTimeControlMail.find({
|
||||||
|
where: {
|
||||||
|
workerFk: args.workerId,
|
||||||
|
year: args.year,
|
||||||
|
week: args.week,
|
||||||
|
}
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
expect(beforeMail).toEqual([]);
|
||||||
|
expect(afterMail.length).toEqual(1);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw error if not exist any record in this week', async() => {
|
||||||
|
const tx = await models.WorkerTimeControlMail.beginTransaction({});
|
||||||
|
const ctx = {args: {
|
||||||
|
workerId: 1,
|
||||||
|
week: 1,
|
||||||
|
year: 0,
|
||||||
|
state: 'SENDED'
|
||||||
|
}};
|
||||||
|
|
||||||
|
let error;
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
await models.WorkerTimeControl.updateWorkerTimeControlMail(ctx, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toEqual(`There aren't records for this week`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -40,30 +40,39 @@ module.exports = Self => {
|
||||||
Self.updateWorkerTimeControlMail = async(ctx, options) => {
|
Self.updateWorkerTimeControlMail = async(ctx, options) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const args = ctx.args;
|
const args = ctx.args;
|
||||||
|
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const workerTimeControlMail = await models.WorkerTimeControlMail.findOne({
|
const [sent] = await models.WorkerTimeControlMail.find({
|
||||||
where: {
|
where: {
|
||||||
workerFk: args.workerId,
|
|
||||||
year: args.year,
|
year: args.year,
|
||||||
week: args.week
|
week: args.week,
|
||||||
}
|
},
|
||||||
|
limit: 1
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (!workerTimeControlMail) throw new UserError(`There aren't records for this week`);
|
if (!sent) throw new UserError(`There aren't records for this week`);
|
||||||
|
|
||||||
await workerTimeControlMail.updateAttributes({
|
const workerTimeControlMail = await models.WorkerTimeControlMail.upsertWithWhere(
|
||||||
state: args.state,
|
{
|
||||||
reason: args.reason || null
|
year: args.year,
|
||||||
}, myOptions);
|
week: args.week,
|
||||||
|
workerFk: args.workerId
|
||||||
|
},
|
||||||
|
{
|
||||||
|
state: args.state,
|
||||||
|
reason: args.workerId,
|
||||||
|
year: args.year,
|
||||||
|
week: args.week,
|
||||||
|
workerFk: args.workerId
|
||||||
|
},
|
||||||
|
myOptions);
|
||||||
|
|
||||||
if (args.state == 'SENDED') {
|
if (args.state == 'SENDED') {
|
||||||
await workerTimeControlMail.updateAttributes({
|
await workerTimeControlMail.updateAttributes({
|
||||||
sendedCounter: workerTimeControlMail.sendedCounter + 1
|
sendedCounter: workerTimeControlMail.sendedCounter ? workerTimeControlMail.sendedCounter + 1 : 1
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,9 +61,8 @@ module.exports = Self => {
|
||||||
const url = `${salix.url}worker/${args.workerId}/time-control?timestamp=${timestamp}`;
|
const url = `${salix.url}worker/${args.workerId}/time-control?timestamp=${timestamp}`;
|
||||||
ctx.args.url = url;
|
ctx.args.url = url;
|
||||||
|
|
||||||
await Self.sendTemplate(ctx, 'weekly-hour-record');
|
await models.WorkerTimeControl.updateWorkerTimeControlMail(ctx, myOptions);
|
||||||
|
return Self.sendTemplate(ctx, 'weekly-hour-record');
|
||||||
return models.WorkerTimeControl.updateWorkerTimeControlMail(ctx, myOptions);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getMondayDateFromYearWeek(yearNumber, weekNumber) {
|
function getMondayDateFromYearWeek(yearNumber, weekNumber) {
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
},
|
},
|
||||||
"locker": {
|
"locker": {
|
||||||
"type" : "number"
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"isF11Allowed": {
|
||||||
|
"type" : "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -28,11 +28,17 @@
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Phone"
|
label="Phone"
|
||||||
value="{{$ctrl.worker.phone}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.worker.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Extension"
|
label="Extension"
|
||||||
value="{{$ctrl.worker.sip.extension}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.worker.sip.extension"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</div>
|
</div>
|
||||||
<div class="icons">
|
<div class="icons">
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Descriptor from 'salix/components/descriptor';
|
import Descriptor from 'salix/components/descriptor';
|
||||||
|
|
||||||
class Controller extends Descriptor {
|
class Controller extends Descriptor {
|
||||||
constructor($element, $, $rootScope) {
|
constructor($element, $, $rootScope) {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
|
|
|
@ -42,14 +42,21 @@
|
||||||
{{::worker.boss.name}}
|
{{::worker.boss.name}}
|
||||||
</span>
|
</span>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Mobile extension"
|
<vn-label-value label="Mobile extension">
|
||||||
value="{{worker.mobileExtension}}">
|
<vn-link-phone
|
||||||
|
phone-number="worker.mobileExtension"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Business phone"
|
<vn-label-value label="Business phone">
|
||||||
value="{{worker.phone}}">
|
<vn-link-phone
|
||||||
|
phone-number="worker.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Personal phone"
|
<vn-label-value label="Personal phone"
|
||||||
value="{{worker.client.phone}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="worker.client.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Locker"
|
<vn-label-value label="Locker"
|
||||||
value="{{worker.locker}}">
|
value="{{worker.locker}}">
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Summary from 'salix/components/summary';
|
import Summary from 'salix/components/summary';
|
||||||
|
|
||||||
class Controller extends Summary {
|
class Controller extends Summary {
|
||||||
get worker() {
|
get worker() {
|
||||||
return this._worker;
|
return this._worker;
|
||||||
|
|
|
@ -79,30 +79,32 @@
|
||||||
</vn-table>
|
</vn-table>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
||||||
<vn-button-bar ng-show="$ctrl.state" class="vn-w-lg">
|
<vn-button-bar class="vn-w-lg">
|
||||||
|
<div ng-show="$ctrl.state">
|
||||||
|
<vn-button
|
||||||
|
label="Satisfied"
|
||||||
|
disabled="$ctrl.state == 'CONFIRMED'"
|
||||||
|
ng-show="$ctrl.isHimSelf"
|
||||||
|
ng-click="$ctrl.isSatisfied()">
|
||||||
|
</vn-button>
|
||||||
|
<vn-button
|
||||||
|
label="Not satisfied"
|
||||||
|
disabled="$ctrl.state == 'REVISE'"
|
||||||
|
ng-show="$ctrl.isHimSelf"
|
||||||
|
ng-click="reason.show()">
|
||||||
|
</vn-button>
|
||||||
|
<vn-button
|
||||||
|
label="Reason"
|
||||||
|
ng-show="$ctrl.reason && ($ctrl.isHimSelf || $ctrl.isHr)"
|
||||||
|
ng-click="reason.show()">
|
||||||
|
</vn-button>
|
||||||
|
</div>
|
||||||
<vn-button
|
<vn-button
|
||||||
label="Satisfied"
|
label="{{$ctrl.state ? 'Resend' : 'Send'}}"
|
||||||
disabled="$ctrl.state == 'CONFIRMED'"
|
|
||||||
ng-if="$ctrl.isHimSelf"
|
|
||||||
ng-click="$ctrl.isSatisfied()">
|
|
||||||
</vn-button>
|
|
||||||
<vn-button
|
|
||||||
label="Not satisfied"
|
|
||||||
disabled="$ctrl.state == 'REVISE'"
|
|
||||||
ng-if="$ctrl.isHimSelf"
|
|
||||||
ng-click="reason.show()">
|
|
||||||
</vn-button>
|
|
||||||
<vn-button
|
|
||||||
label="Reason"
|
|
||||||
ng-if="$ctrl.reason && ($ctrl.isHimSelf || $ctrl.isHr)"
|
|
||||||
ng-click="reason.show()">
|
|
||||||
</vn-button>
|
|
||||||
<vn-button
|
|
||||||
label="Resend"
|
|
||||||
ng-click="sendEmailConfirmation.show()"
|
ng-click="sendEmailConfirmation.show()"
|
||||||
class="right"
|
class="right"
|
||||||
vn-tooltip="Resend email of this week to the user"
|
vn-tooltip="{{$ctrl.state ? 'Resend' : 'Send'}} email of this week to the user"
|
||||||
ng-show="::$ctrl.isHr">
|
ng-if="$ctrl.isHr && $ctrl.state != 'CONFIRMED' && $ctrl.canResend">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -53,6 +53,8 @@ class Controller extends Section {
|
||||||
set worker(value) {
|
set worker(value) {
|
||||||
this._worker = value;
|
this._worker = value;
|
||||||
this.fetchHours();
|
this.fetchHours();
|
||||||
|
if (this.date)
|
||||||
|
this.getWeekData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +112,8 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.weekTotalHours) this.fetchHours();
|
if (!this.weekTotalHours) this.fetchHours();
|
||||||
this.getWeekData();
|
if (this.worker)
|
||||||
|
this.getWeekData();
|
||||||
}
|
}
|
||||||
|
|
||||||
set weekTotalHours(totalHours) {
|
set weekTotalHours(totalHours) {
|
||||||
|
@ -127,17 +130,34 @@ class Controller extends Section {
|
||||||
workerFk: this.$params.id,
|
workerFk: this.$params.id,
|
||||||
year: this._date.getFullYear(),
|
year: this._date.getFullYear(),
|
||||||
week: this.getWeekNumber(this._date)
|
week: this.getWeekNumber(this._date)
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
this.$http.get('WorkerTimeControlMails', {filter})
|
this.$http.get('WorkerTimeControlMails', {filter})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const mail = res.data;
|
if (!res.data.length) {
|
||||||
if (!mail.length) {
|
|
||||||
this.state = null;
|
this.state = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.state = mail[0].state;
|
const [mail] = res.data;
|
||||||
this.reason = mail[0].reason;
|
this.state = mail.state;
|
||||||
|
this.reason = mail.reason;
|
||||||
|
});
|
||||||
|
this.canBeResend();
|
||||||
|
}
|
||||||
|
|
||||||
|
canBeResend() {
|
||||||
|
this.canResend = false;
|
||||||
|
const filter = {
|
||||||
|
where: {
|
||||||
|
year: this._date.getFullYear(),
|
||||||
|
week: this.getWeekNumber(this._date)
|
||||||
|
},
|
||||||
|
limit: 1
|
||||||
|
};
|
||||||
|
this.$http.get('WorkerTimeControlMails', {filter})
|
||||||
|
.then(res => {
|
||||||
|
if (res.data.length)
|
||||||
|
this.canResend = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,30 +376,25 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
isSatisfied() {
|
isSatisfied() {
|
||||||
const params = {
|
this.updateWorkerTimeControlMail('CONFIRMED');
|
||||||
workerId: this.worker.id,
|
|
||||||
year: this.date.getFullYear(),
|
|
||||||
week: this.weekNumber,
|
|
||||||
state: 'CONFIRMED'
|
|
||||||
};
|
|
||||||
const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
|
|
||||||
this.$http.post(query, params).then(() => {
|
|
||||||
this.getMailStates(this.date);
|
|
||||||
this.getWeekData();
|
|
||||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isUnsatisfied() {
|
isUnsatisfied() {
|
||||||
if (!this.reason) throw new UserError(`You must indicate a reason`);
|
if (!this.reason) throw new UserError(`You must indicate a reason`);
|
||||||
|
this.updateWorkerTimeControlMail('REVISE', this.reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateWorkerTimeControlMail(state, reason) {
|
||||||
const params = {
|
const params = {
|
||||||
workerId: this.worker.id,
|
workerId: this.worker.id,
|
||||||
year: this.date.getFullYear(),
|
year: this.date.getFullYear(),
|
||||||
week: this.weekNumber,
|
week: this.weekNumber,
|
||||||
state: 'REVISE',
|
state
|
||||||
reason: this.reason
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (reason)
|
||||||
|
params.reason = reason;
|
||||||
|
|
||||||
const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
|
const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
|
||||||
this.$http.post(query, params).then(() => {
|
this.$http.post(query, params).then(() => {
|
||||||
this.getMailStates(this.date);
|
this.getMailStates(this.date);
|
||||||
|
|
|
@ -28,6 +28,10 @@ module.exports = {
|
||||||
companyId: {
|
companyId: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
addressId: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const vnPrintPath = path.resolve('print');
|
||||||
|
|
||||||
|
module.exports = new Stylesheet([
|
||||||
|
`${vnPrintPath}/common/css/spacing.css`,
|
||||||
|
`${vnPrintPath}/common/css/misc.css`,
|
||||||
|
`${vnPrintPath}/common/css/layout.css`,
|
||||||
|
`${vnPrintPath}/common/css/email.css`,
|
||||||
|
`${__dirname}/style.css`])
|
||||||
|
.mergeStyles();
|
|
@ -0,0 +1,8 @@
|
||||||
|
.jsonSection {
|
||||||
|
text-align: left;
|
||||||
|
background-color: #e4e4e4;
|
||||||
|
padding: 25px;
|
||||||
|
margin-left: 60px;
|
||||||
|
margin-right: 60px;
|
||||||
|
border-radius: 25px;
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
subject: Modified collection volumetry
|
||||||
|
title: Modified collection volumetry
|
||||||
|
description: Action performed
|
|
@ -0,0 +1,3 @@
|
||||||
|
subject: Volumetría de colección modificada
|
||||||
|
title: Volumetría de colección modificada
|
||||||
|
description: Acción realizada
|
|
@ -0,0 +1,15 @@
|
||||||
|
<email-body v-bind="$props">
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block vn-pa-ml">
|
||||||
|
<div class="centered">
|
||||||
|
<h1>{{ $t('title') }}</h1>
|
||||||
|
<h3>{{ $t('description') }}: <u>{{ data.action }}</u> <i> {{ `(${this.username})` }} </i></h3>
|
||||||
|
<div class="jsonSection">
|
||||||
|
<span v-for="(value, key) in data" v-if="key !== 'action' && key !== 'userFk'">
|
||||||
|
<b> {{ `${key}:` }} </b> {{ value }} <br>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</email-body>
|
|
@ -0,0 +1,25 @@
|
||||||
|
const Component = require(`vn-print/core/component`);
|
||||||
|
const emailBody = new Component('email-body');
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'modified-collection-volumetry',
|
||||||
|
components: {
|
||||||
|
'email-body': emailBody.build(),
|
||||||
|
},
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.username = (this.data.userFk) ? await this.getUsername(this.data.userFk) : 'system';
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getUsername(id) {
|
||||||
|
const account = await models.VnUser.findById(id);
|
||||||
|
return account.name;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -3,16 +3,16 @@
|
||||||
<div class="grid-block">
|
<div class="grid-block">
|
||||||
<p
|
<p
|
||||||
v-html="$t('description', {
|
v-html="$t('description', {
|
||||||
socialName: client.socialName,
|
socialName: address.nickname,
|
||||||
name: client.name,
|
name: client.name,
|
||||||
address: client.street,
|
address: address.street,
|
||||||
country: client.country,
|
country: client.country,
|
||||||
fiscalID: client.fi
|
fiscalID: client.fi
|
||||||
})"
|
})"
|
||||||
></p>
|
></p>
|
||||||
<p
|
<p
|
||||||
v-html="$t('declaration', {
|
v-html="$t('declaration', {
|
||||||
socialName: client.socialName
|
socialName: address.nickname
|
||||||
})"
|
})"
|
||||||
></p>
|
></p>
|
||||||
<p
|
<p
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
v-html="$t('declarations[' + $index + ']', {
|
v-html="$t('declarations[' + $index + ']', {
|
||||||
companyName: company.name,
|
companyName: company.name,
|
||||||
companyCity: company.city,
|
companyCity: company.city,
|
||||||
socialName: client.socialName,
|
socialName: address.nickname,
|
||||||
destinationCountry: client.country
|
destinationCountry: client.country
|
||||||
})"
|
})"
|
||||||
></p>
|
></p>
|
||||||
|
|
|
@ -7,6 +7,7 @@ module.exports = {
|
||||||
this.client = await this.findOneFromDef('client', [this.id]);
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
this.checkMainEntity(this.client);
|
this.checkMainEntity(this.client);
|
||||||
this.company = await this.findOneFromDef('company', [this.companyId]);
|
this.company = await this.findOneFromDef('company', [this.companyId]);
|
||||||
|
this.address = await this.findOneFromDef('address', [this.addressId]);
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
@ -17,6 +18,10 @@ module.exports = {
|
||||||
companyId: {
|
companyId: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
addressId: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,28 +1,25 @@
|
||||||
reportName: autorizacion-incoterms
|
reportName: autorizacion-incoterms
|
||||||
description: '<em>{socialName}</em> una sociedad debidamente constituida con responsabilidad <em>limitada</em>
|
description: '<em>{socialName}</em> una sociedad debidamente constituida con responsabilidad <em>limitada</em>
|
||||||
y registrada conforme al derecho de sociedades de {country} y aquí representada por
|
y registrada conforme al derecho de sociedades de {country} y aquí representada por {socialName}, con domicilio en {address},
|
||||||
<span>___________________</span>. {socialName}, con domicilio en {address},
|
|
||||||
CIF <em>{fiscalID}</em>. En adelante denominada {name}.'
|
CIF <em>{fiscalID}</em>. En adelante denominada {name}.'
|
||||||
issued: 'En {0}, a {1} de {2} de {3}'
|
issued: 'En {0}, a {1} de {2} de {3}'
|
||||||
client: 'Cliente {0}'
|
client: 'Cliente {0}'
|
||||||
declaration: '<em>{socialName}</em> declara por la presente que:'
|
declaration: '<em>{socialName}</em> declara por la presente que:'
|
||||||
declarations:
|
declarations:
|
||||||
- 'Todas las compras realizadas por {socialName} con {companyName} se
|
- 'Todas las compras realizadas por {socialName} con {companyName} se entregan según las condiciones definidas en el incoterm.'
|
||||||
entregan, Ex Works (Incoterms), en el almacén de {companyName} situado en
|
- '{socialName} reconoce que es importante para {companyName} tener
|
||||||
{companyCity}.'
|
comprobante de la entrega intracomunitaria de la mercancía a {destinationCountry} para
|
||||||
- '{socialName} reconoce que es importante para {companyName} tener
|
|
||||||
comprobante de la entrega intracomunitaria de la mercancía a {destinationCountry} para
|
|
||||||
poder facturar con 0% de IVA.'
|
poder facturar con 0% de IVA.'
|
||||||
- 'Por tanto, al firmar este acuerdo, {socialName} declara que todos los bienes que
|
- 'Por tanto, al firmar este acuerdo, {socialName} declara que todos los bienes que
|
||||||
se compren a {companyName} serán entregados a {destinationCountry}.'
|
se compren a {companyName} serán entregados a {destinationCountry}.'
|
||||||
- 'Además, {socialName} deberá, a primera solicitud de {companyName},
|
- 'Además, {socialName} deberá, a primera solicitud de {companyName},
|
||||||
proporcionar una prueba de que todos los productos comprados a {companyName} han
|
proporcionar una prueba de que todos los productos comprados a {companyName} han
|
||||||
sido entregados en {destinationCountry}.'
|
sido entregados en {destinationCountry}.'
|
||||||
- 'Además de lo anterior, {companyName} proporcionará a {socialName}
|
- 'Además de lo anterior, {companyName} proporcionará a {socialName}
|
||||||
un resumen mensual en el que se incluyen todas las facturas (y las entregas correspondientes).
|
un resumen mensual en el que se incluyen todas las facturas (y las entregas correspondientes).
|
||||||
{socialName} firmará y devolverá el resumen mensual a {companyName},
|
{socialName} firmará y devolverá el resumen mensual a {companyName},
|
||||||
S.L. dentro de los 5 días posteriores a la recepción del resumen.'
|
S.L. dentro de los 5 días posteriores a la recepción del resumen.'
|
||||||
signer:
|
signer:
|
||||||
representative: Representante
|
representative: Representante
|
||||||
representativeRole: Cargo del representante
|
representativeRole: Cargo del representante
|
||||||
signed: Fecha de firma
|
signed: Fecha de firma
|
||||||
|
@ -39,4 +36,4 @@ months:
|
||||||
- 'Septiembre'
|
- 'Septiembre'
|
||||||
- 'Octubre'
|
- 'Octubre'
|
||||||
- 'Noviembre'
|
- 'Noviembre'
|
||||||
- 'Diciembre'
|
- 'Diciembre'
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
reportName: autorizacion-incoterms
|
reportName: autorizacion-incoterms
|
||||||
description: '<em>{socialName}</em> uma sociedade devidamente constituída com responsabilidade <em>limitada e registada</em>
|
description: '<em>{socialName}</em> uma sociedade devidamente constituída com responsabilidade <em>limitada e registada</em>
|
||||||
conforme ao direito de sociedades da {country} e aqui representada por
|
conforme ao direito de sociedades da {country} e aqui representada por {socialName}, com domicílio em {address},
|
||||||
<span>___________________</span>. {socialName}, com domicílio em {address},
|
|
||||||
CIF <em>{fiscalID}</em>. Em adiante denominada {name}.'
|
CIF <em>{fiscalID}</em>. Em adiante denominada {name}.'
|
||||||
issued: 'Em {0}, em {1} de {2} de {3}'
|
issued: 'Em {0}, em {1} de {2} de {3}'
|
||||||
client: 'Cliente {0}'
|
client: 'Cliente {0}'
|
||||||
declaration: '<em>{socialName}</em> declara através da presente que:'
|
declaration: '<em>{socialName}</em> declara através da presente que:'
|
||||||
declarations:
|
declarations:
|
||||||
- 'Todas as compras realizadas por {socialName} a {companyName} se entregam,
|
- 'Todas as compras realizadas por {socialName} a {companyName} se entregam,
|
||||||
Ex Works (Incoterms), no armazém da {companyName} situado em
|
Ex Works (Incoterms), no armazém da {companyName} situado em
|
||||||
{companyCity}.'
|
{companyCity}.'
|
||||||
- '{socialName} reconhece ser importante para {companyName}
|
- '{socialName} reconhece ser importante para {companyName}
|
||||||
ter o comprovante da entrega intracomunitária da mercadoria a {destinationCountry}
|
ter o comprovante da entrega intracomunitária da mercadoria em {destinationCountry}
|
||||||
para poder faturar com 0% de IVA.'
|
para poder faturar com 0% de IVA.'
|
||||||
- 'Portanto, ao assinar este acordo, {socialName} declara que todos os bens
|
- 'Portanto, ao assinar este acordo, {socialName} declara que todos os bens
|
||||||
que se comprem na {companyName} serão entregues na {destinationCountry}.'
|
que se comprem na {companyName} serão entregues na {destinationCountry}.'
|
||||||
- 'Além disto, {socialName} deverá, na primeira solicitude da {companyName},
|
- 'Além disto, {socialName} deverá, na primeira solicitude da {companyName},
|
||||||
proporcionar uma prova de que todos os produtos comprados na {companyName}
|
proporcionar uma prova de que todos os produtos comprados em {companyName}
|
||||||
foram entregues na {destinationCountry}.'
|
foram entregues em {destinationCountry}.'
|
||||||
- 'Além do anterio, {companyName} proporcionará a {socialName}
|
- 'Além do anterior, {companyName} proporcionará a {socialName}
|
||||||
um resumo mensal onde se incluem todas as faturas (e as entregas correspondentes).
|
um resumo mensal onde se incluem todas as faturas (e as entregas correspondentes).
|
||||||
{socialName} assinará e devolverá o resumo mensal à {companyName},
|
{socialName} assinará e devolverá o resumo mensal à {companyName},
|
||||||
dentro dos 5 dias posteriores à receção do resumo.'
|
dentro dos 5 dias posteriores à receção do resumo.'
|
||||||
signer:
|
signer:
|
||||||
representative: Representante
|
representative: Representante
|
||||||
representativeRole: Cargo de representante
|
representativeRole: Cargo de representante
|
||||||
signed: Data da assinatura
|
signed: Data da assinatura
|
||||||
|
@ -39,4 +38,4 @@ months:
|
||||||
- 'Setembro'
|
- 'Setembro'
|
||||||
- 'Outubro'
|
- 'Outubro'
|
||||||
- 'Novembro'
|
- 'Novembro'
|
||||||
- 'Dezembro'
|
- 'Dezembro'
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
SELECT
|
||||||
|
a.nickname,
|
||||||
|
a.street,
|
||||||
|
a.postalCode,
|
||||||
|
a.city,
|
||||||
|
p.name province
|
||||||
|
FROM address a
|
||||||
|
LEFT JOIN province p ON p.id = a.provinceFk
|
||||||
|
WHERE a.id = ?
|
|
@ -1,8 +1,8 @@
|
||||||
SELECT
|
SELECT
|
||||||
s.name,
|
s.name,
|
||||||
s.city,
|
s.city,
|
||||||
cl.name AS manager
|
cl.name AS manager
|
||||||
FROM company c
|
FROM company c
|
||||||
JOIN supplier s ON s.id = c.id
|
JOIN supplier s ON s.id = c.id
|
||||||
JOIN client cl ON cl.id = c.workerManagerFk
|
JOIN client cl ON cl.id = c.workerManagerFk
|
||||||
WHERE c.id = ?
|
WHERE c.id = ?
|
||||||
|
|
Loading…
Reference in New Issue