Resolved conflicts
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2022-08-10 12:13:31 +02:00
parent 398df267a7
commit 768e4d5e77
323 changed files with 5693 additions and 3204 deletions

5
back/helpers.spec.js Normal file
View File

@ -0,0 +1,5 @@
const baseTime = null; // new Date(2022, 0, 19, 8, 0, 0, 0);
if (baseTime) {
jasmine.clock().install();
jasmine.clock().mockDate(baseTime);
}

View File

@ -1,16 +1,15 @@
module.exports = Self => {
Self.remoteMethod('setPassword', {
description: 'Sets the user password',
accepts: [
{
arg: 'id',
type: 'Number',
type: 'number',
description: 'The user id',
http: {source: 'path'}
}, {
arg: 'newPassword',
type: 'String',
type: 'string',
description: 'The new password',
required: true
}

View File

@ -1,3 +1,4 @@
const UserError = require('vn-loopback/util/user-error');
const fs = require('fs-extra');
const path = require('path');
@ -26,6 +27,9 @@ module.exports = Self => {
myOptions.transaction = tx;
try {
if (process.env.NODE_ENV == 'test')
throw new UserError(`Action not allowed on the test environment`);
const models = Self.app.models;
const DmsContainer = models.DmsContainer;
@ -33,9 +37,15 @@ module.exports = Self => {
where: {code: 'trash'}
}, myOptions);
const date = new Date();
date.setMonth(date.getMonth() - 4);
const dmsToDelete = await models.Dms.find({
where: {
dmsTypeFk: trashDmsType.id
and: [
{dmsTypeFk: trashDmsType.id},
{created: {lt: date}}
]
}
}, myOptions);
@ -43,8 +53,14 @@ module.exports = Self => {
const pathHash = DmsContainer.getHash(dms.id);
const dmsContainer = await DmsContainer.container(pathHash);
const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file);
const dstFolder = path.join(dmsContainer.client.root, pathHash);
await fs.unlink(dstFile);
try {
await fs.rmdir(dstFolder);
await dms.destroy(myOptions);
} catch (err) {
await dms.destroy(myOptions);
}
}
if (tx) await tx.commit();
} catch (e) {

View File

@ -24,9 +24,6 @@
},
"isManaged":{
"type": "boolean"
},
"hasStowaway":{
"type": "boolean"
}
},
"acls": [

View File

@ -18,6 +18,7 @@
"modules/supplier/front/**/*",
"modules/ticket/front/**/*",
"modules/travel/front/**/*",
"modules/shelving/front/**/*",
"modules/worker/front/**/*",
"modules/zone/front/**/*"
]

View File

@ -1,4 +1,4 @@
FROM mariadb:10.4.13
FROM mariadb:10.7.3
ENV MYSQL_ROOT_PASSWORD root
ENV TZ Europe/Madrid
@ -31,11 +31,13 @@ COPY \
import-changes.sh \
config.ini \
dump/mysqlPlugins.sql \
dump/mockDate.sql \
dump/structure.sql \
dump/dumpedFixtures.sql \
./
RUN gosu mysql docker-init.sh \
&& docker-dump.sh mysqlPlugins \
&& docker-dump.sh mockDate \
&& docker-dump.sh structure \
&& docker-dump.sh dumpedFixtures \
&& gosu mysql docker-temp-stop.sh

View File

@ -0,0 +1,21 @@
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
VALUES
('InvoiceOut','refund','WRITE','ALLOW','ROLE','invoicing'),
('InvoiceOut','refund','WRITE','ALLOW','ROLE','salesAssistant'),
('InvoiceOut','refund','WRITE','ALLOW','ROLE','claimManager'),
('Ticket','refund','WRITE','ALLOW','ROLE','invoicing'),
('Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'),
('Ticket','refund','WRITE','ALLOW','ROLE','claimManager'),
('Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'),
('Sale','refund','WRITE','ALLOW','ROLE','claimManager'),
('TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'),
('ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'),
('ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'),
('Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),
('Client','updateUser','WRITE','ALLOW','ROLE','salesPerson');
DELETE FROM `salix`.`ACL` WHERE id=313;
UPDATE `salix`.`ACL`
SET principalId='invoicing'
WHERE id=297;

View File

@ -0,0 +1,3 @@
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
VALUES
('ShelvingLog','*','READ','ALLOW','ROLE','employee');

View File

@ -0,0 +1,4 @@
INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('ZoneExclusionGeo', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
('ZoneExclusionGeo', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');

View File

@ -0,0 +1,2 @@
ALTER TABLE `vn2008`.`albaran_gestdoc` DROP FOREIGN KEY fk_albaran_gestdoc_gestdoc1;
ALTER TABLE `vn2008`.`albaran_gestdoc` ADD CONSTRAINT albaran_gestdoc_FK FOREIGN KEY (gestdoc_id) REFERENCES `vn`.`dms`(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,3 @@
alter table `vn`.`client`
add hasIncoterms tinyint(1) default 0 not null comment 'Received incoterms authorization from client';

View File

@ -0,0 +1,13 @@
DROP FUNCTION `account`.`userGetId`;
DROP FUNCTION `account`.`myUserGetName`;
DROP FUNCTION `account`.`myUserGetId`;
DROP FUNCTION `account`.`myUserHasRole`;
DROP FUNCTION `account`.`myUserHasRoleId`;
DROP FUNCTION `account`.`userGetName`;
DROP FUNCTION `account`.`userHasRole`;
DROP FUNCTION `account`.`userHasRoleId`;
DROP PROCEDURE `account`.`myUserLogout`;
DROP PROCEDURE `account`.`userLogin`;
DROP PROCEDURE `account`.`userLoginWithKey`;
DROP PROCEDURE `account`.`userLoginWithName`;
DROP PROCEDURE `account`.`userSetPassword`;

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`item` MODIFY COLUMN description TEXT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL;

View File

@ -0,0 +1,10 @@
UPDATE `vn`.`route` r
JOIN(SELECT r.id, wl.workcenterFk
FROM `vn`.`route` r
JOIN `vn`.`routeLog` rl ON rl.originFk = r.id
JOIN `vn`.`workerLabour` wl ON wl.workerFk = rl.userFk
AND r.created BETWEEN wl.started AND IFNULL(wl.ended, r.created)
WHERE r.created BETWEEN '2021-12-01' AND CURDATE()
AND rl.action = 'insert'
)sub ON sub.id = r.id
SET r.commissionWorkCenterFk = sub.workcenterFk;

View File

@ -0,0 +1,2 @@
INSERT INTO `vn`.`sample` (code, description, isVisible, hasCompany, hasPreview, datepickerEnabled)
VALUES ('incoterms-authorization', 'Autorización de incoterms', 1, 1, 1, 0);

View File

@ -0,0 +1,18 @@
ALTER TABLE `vn`.`itemShelving` DROP FOREIGN KEY itemShelving_fk2;
ALTER TABLE `vn`.`shelvingLog` DROP FOREIGN KEY shelvingLog_FK_ibfk_1;
ALTER TABLE `vn`.`smartTag` DROP FOREIGN KEY smartTag_shelving_fk;
ALTER TABLE `vn`.`workerShelving` DROP FOREIGN KEY workerShelving_shelving_fk;
ALTER TABLE `vn`.`shelving` DROP PRIMARY KEY;
ALTER TABLE `vn`.`shelving` ADD id INT auto_increment PRIMARY KEY NULL;
ALTER TABLE `vn`.`shelving` CHANGE id id int(11) auto_increment NOT NULL FIRST;
ALTER TABLE `vn`.`shelving` ADD CONSTRAINT shelving_UN UNIQUE KEY (code);
ALTER TABLE `vn`.`itemShelving` ADD CONSTRAINT itemShelving_fk2 FOREIGN KEY (shelvingFk) REFERENCES `vn`.`shelving`(code) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `vn`.`shelvingLog` ADD CONSTRAINT shelvingLog_FK_ibfk_1 FOREIGN KEY (originFk) REFERENCES `vn`.`shelving`(code) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `vn`.`smartTag` ADD CONSTRAINT smartTag_FK FOREIGN KEY (shelvingFk) REFERENCES `vn`.`shelving`(code) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `vn`.`workerShelving` ADD CONSTRAINT workerShelving_FK_1 FOREIGN KEY (shelvingFk) REFERENCES `vn`.`shelving`(code) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.shelvingLog DROP FOREIGN KEY shelvingLog_FK_ibfk_1;
ALTER TABLE vn.shelvingLog MODIFY COLUMN originFk INT NOT NULL;
ALTER TABLE vn.shelvingLog ADD CONSTRAINT shelvingLog_FK FOREIGN KEY (originFk) REFERENCES vn.shelving(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,21 @@
DROP PROCEDURE IF EXISTS `vn`.`ticketRefund_beforeUpsert`;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketRefund_beforeUpsert`(vRefundTicketFk INT, vOriginalTicketFk INT)
BEGIN
DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE;
IF vRefundTicketFk = vOriginalTicketFk THEN
CALL util.throw('Original ticket and refund ticket has same id');
END IF;
SELECT COUNT(*) INTO vAlreadyExists
FROM ticketRefund
WHERE originalTicketFk = vOriginalTicketFk;
IF vAlreadyExists > 0 THEN
CALL util.throw('This ticket is already a refund');
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,13 @@
CREATE TABLE `vn`.`claimObservation` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`claimFk` int(10) unsigned NOT NULL,
`workerFk` int(10) unsigned DEFAULT NULL,
`text` text COLLATE utf8_unicode_ci NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `worker_key` (`workerFk`),
KEY `claim_key` (`claimFk`),
KEY `claimObservation_created_IDX` (`created`) USING BTREE,
CONSTRAINT `claimObservation_ibfk_1` FOREIGN KEY (`claimFk`) REFERENCES `vn`.`claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `claimObservation_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE
) COMMENT='Todas las observaciones referentes a una reclamación'

View File

@ -0,0 +1,2 @@
INSERT INTO `vn`.`claimObservation` (`claimFk`, `text`, `created`)
SELECT `id`, `observation`, `created` FROM `vn`.`claim`

View File

@ -0,0 +1,2 @@
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
VALUES ('Parking','*','*','ALLOW','ROLE','employee')

View File

@ -0,0 +1,2 @@
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
VALUES ('Shelving','*','*','ALLOW','ROLE','employee')

File diff suppressed because it is too large Load Diff

43
db/dump/mockDate.sql Normal file
View File

@ -0,0 +1,43 @@
CREATE SCHEMA IF NOT EXISTS `util`;
USE `util`;
DELIMITER ;;
DROP FUNCTION IF EXISTS `util`.`mockedDate`;
CREATE FUNCTION `util`.`mockedDate`()
RETURNS DATETIME
DETERMINISTIC
BEGIN
RETURN NOW();
-- '2022-01-19 08:00:00'
END ;;
DELIMITER ;
DELIMITER ;;
DROP FUNCTION IF EXISTS `util`.`VN_CURDATE`;
CREATE FUNCTION `util`.`VN_CURDATE`()
RETURNS DATE
DETERMINISTIC
BEGIN
RETURN DATE(mockedDate());
END ;;
DELIMITER ;
DELIMITER ;;
DROP FUNCTION IF EXISTS `util`.`VN_CURTIME`;
CREATE FUNCTION `util`.`VN_CURTIME`()
RETURNS TIME
DETERMINISTIC
BEGIN
RETURN TIME(mockedDate());
END ;;
DELIMITER ;
DELIMITER ;;
DROP FUNCTION IF EXISTS `util`.`VN_NOW`;
CREATE FUNCTION `util`.`VN_NOW`()
RETURNS DATETIME
DETERMINISTIC
BEGIN
RETURN mockedDate();
END ;;
DELIMITER ;

View File

@ -96,5 +96,12 @@ mysqldump \
--databases \
${SCHEMAS[@]} \
${IGNORETABLES[@]} \
| sed 's/\bCURDATE\b/util.VN_CURDATE/ig'\
| sed 's/\bCURTIME\b/util.VN_CURTIME/ig' \
| sed 's/\bNOW\b/util.VN_NOW/ig' \
| sed 's/\bCURRENT_DATE\b/util.VN_CURDATE/ig' \
| sed 's/\bCURRENT_TIME\b/util.VN_CURTIME/ig' \
| sed 's/\bLOCALTIME\b/util.VN_NOW/ig' \
| sed 's/\bLOCALTIMESTAMP\b/util.VN_NOW/ig' \
| sed 's/ AUTO_INCREMENT=[0-9]* //g' \
> dump/structure.sql

View File

@ -5,8 +5,9 @@ describe('zone zone_getLanded()', () => {
it(`should return data for a shipped in the past`, async() => {
let stmts = [];
let stmt;
stmts.push('START TRANSACTION');
const date = new Date();
date.setHours(0, 0, 0, 0);
let params = {
addressFk: 121,
@ -14,7 +15,8 @@ describe('zone zone_getLanded()', () => {
warehouseFk: 1,
showExpiredZones: true};
stmt = new ParameterizedSQL('CALL zone_getLanded(DATE_ADD(CURDATE(), INTERVAL -1 DAY), ?, ?, ?, ?)', [
stmt = new ParameterizedSQL('CALL zone_getLanded(DATE_ADD(?, INTERVAL -1 DAY), ?, ?, ?, ?)', [
date,
params.addressFk,
params.agencyModeFk,
params.warehouseFk,
@ -38,6 +40,8 @@ describe('zone zone_getLanded()', () => {
it(`should return data for a shipped tomorrow`, async() => {
let stmts = [];
let stmt;
const date = new Date();
date.setHours(0, 0, 0, 0);
stmts.push('START TRANSACTION');
@ -47,7 +51,8 @@ describe('zone zone_getLanded()', () => {
warehouseFk: 1,
showExpiredZones: false};
stmt = new ParameterizedSQL('CALL zone_getLanded(DATE_ADD(CURDATE(), INTERVAL +2 DAY), ?, ?, ?, ?)', [
stmt = new ParameterizedSQL('CALL zone_getLanded(DATE_ADD(?, INTERVAL +2 DAY), ?, ?, ?, ?)', [
date,
params.addressFk,
params.agencyModeFk,
params.warehouseFk,

View File

@ -55,6 +55,7 @@ export default {
setPassword: '.vn-menu [name="setPassword"]',
activateAccount: '.vn-menu [name="enableAccount"]',
activateUser: '.vn-menu [name="activateUser"]',
deactivateUser: '.vn-menu [name="deactivateUser"]',
newPassword: 'vn-textfield[ng-model="$ctrl.newPassword"]',
repeatPassword: 'vn-textfield[ng-model="$ctrl.repeatPassword"]',
newRole: 'vn-autocomplete[ng-model="$ctrl.newRole"]',
@ -275,6 +276,7 @@ export default {
clientWebAccess: {
enableWebAccessCheckbox: 'vn-check[label="Enable web access"]',
userName: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.name"]',
email: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.email"]',
saveButton: 'button[type=submit]'
},
clientNotes: {
@ -542,9 +544,8 @@ export default {
searchResultDate: 'vn-ticket-summary [label=Landed] span',
topbarSearch: 'vn-searchbar',
moreMenu: 'vn-ticket-index vn-icon-button[icon=more_vert]',
fourthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(4)',
fifthhWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(5)',
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6)',
fourthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tbody vn-tr:nth-child(4)',
fiveWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tbody vn-tr:nth-child(5)',
weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr',
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
firstWeeklyTicketAgency: 'vn-ticket-weekly-index vn-tr:nth-child(1) [ng-model="weekly.agencyModeFk"]',
@ -564,8 +565,6 @@ export default {
isDeletedIcon: 'vn-ticket-descriptor vn-icon[icon="icon-deletedTicket"]',
goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]',
moreMenu: 'vn-ticket-descriptor vn-ticket-descriptor-menu > vn-icon-button[icon=more_vert]',
moreMenuAddStowaway: '.vn-menu [name="addStowaway"]',
moreMenuDeleteStowawayButton: '.vn-menu [name="deleteStowaway"]',
moreMenuAddToTurn: '.vn-menu [name="addTurn"]',
moreMenuDeleteTicket: '.vn-menu [name="deleteTicket"]',
moreMenuRestoreTicket: '.vn-menu [name="restoreTicket"]',
@ -578,8 +577,6 @@ export default {
sendSMSbutton: 'button[response="accept"]',
changeShippedHourDialog: '.vn-dialog.shown',
changeShippedHour: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newShipped"]',
addStowawayDialogFirstTicket: '.vn-dialog.shown vn-table vn-tbody vn-tr',
shipButton: 'vn-ticket-descriptor vn-icon[icon="icon-stowaway"]',
thursdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(4)',
saturdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(6)',
acceptDialog: '.vn-dialog.shown button[response="accept"]',
@ -587,7 +584,6 @@ export default {
descriptorDeliveryDate: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(4) > section > span',
descriptorDeliveryAgency: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(5) > section > span',
acceptInvoiceOutButton: '.vn-confirm.shown button[response="accept"]',
acceptDeleteStowawayButton: '.vn-dialog.shown button[response="accept"]'
},
ticketNotes: {
firstNoteRemoveButton: 'vn-icon[icon="delete"]',
@ -597,7 +593,7 @@ export default {
submitNotesButton: 'button[type=submit]'
},
ticketExpedition: {
secondExpeditionRemoveButton: 'vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]',
thirdExpeditionRemoveButton: 'vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(3) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]',
expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr'
},
ticketPackages: {
@ -729,7 +725,7 @@ export default {
claimSummary: {
header: 'vn-claim-summary > vn-card > h5',
state: 'vn-claim-summary vn-label-value[label="State"] > section > span',
observation: 'vn-claim-summary vn-textarea[ng-model="$ctrl.summary.claim.observation"]',
observation: 'vn-claim-summary vn-horizontal.text',
firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span',
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
@ -741,7 +737,6 @@ export default {
},
claimBasicData: {
claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]',
observation: 'vn-textarea[ng-model="$ctrl.claim.observation"]',
packages: 'vn-input-number[ng-model="$ctrl.claim.packages"]',
hasToPickUpCheckbox: 'vn-claim-basic-data vn-check[ng-model="$ctrl.claim.hasToPickUp"]',
saveButton: `button[type=submit]`
@ -771,6 +766,12 @@ export default {
secondClaimRedelivery: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]',
saveDevelopmentButton: 'button[type=submit]'
},
claimNote: {
addNoteFloatButton: 'vn-float-button',
note: 'vn-textarea[ng-model="$ctrl.note.text"]',
saveButton: 'button[type=submit]',
firstNoteText: 'vn-claim-note .text'
},
claimAction: {
importClaimButton: 'vn-claim-action vn-button[label="Import claim"]',
anyLine: 'vn-claim-action vn-tbody > vn-tr',
@ -905,52 +906,16 @@ export default {
dialogTimeInput: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newTimeEntry.timed"]',
dialogTimeDirection: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newTimeEntry.direction"]',
mondayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button',
tuesdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(2) > vn-icon-button',
wednesdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(3) > vn-icon-button',
thursdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-icon-button',
fridayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(5) > vn-icon-button',
saturdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(6) > vn-icon-button',
sundayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(7) > vn-icon-button',
firstEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(1) > vn-chip > div:nth-child(2)',
firstEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(1) > vn-chip > div:nth-child(2)',
firstEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(1) > vn-chip > div:nth-child(2)',
firstEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(1) > vn-chip > div:nth-child(2)',
firstEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(1) > vn-chip > div:nth-child(2)',
firstEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(1) > vn-chip > div:nth-child(2)',
firstEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(1) > vn-chip > div:nth-child(2)',
firstEntryOfMondayDelete: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(1) > vn-chip > vn-icon[icon="cancel"]',
secondEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(2) > vn-chip > div:nth-child(2)',
secondEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(2) > vn-chip > div:nth-child(2)',
secondEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(2) > vn-chip > div:nth-child(2)',
secondEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(2) > vn-chip > div:nth-child(2)',
secondEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(2) > vn-chip > div:nth-child(2)',
secondEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(2) > vn-chip > div:nth-child(2)',
secondEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(2) > vn-chip > div:nth-child(2)',
thirdEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(3) > vn-chip > div:nth-child(2)',
thirdEntryOfMondayDelete: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(3) > vn-chip > vn-icon[icon="cancel"]',
thirdEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(3) > vn-chip > div:nth-child(2)',
thirdEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(3) > vn-chip > div:nth-child(2)',
thirdEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(3) > vn-chip > div:nth-child(2)',
thirdEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(3) > vn-chip > div:nth-child(2)',
thirdEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(3) > vn-chip > div:nth-child(2)',
thirdEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(3) > vn-chip > div:nth-child(2)',
fourthEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(4) > vn-chip > div:nth-child(2)',
fourthEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(4) > vn-chip > div:nth-child(2)',
fourthEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(4) > vn-chip > div:nth-child(2)',
fourthEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(4) > vn-chip > div:nth-child(2)',
fourthEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(4) > vn-chip > div:nth-child(2)',
fourthEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(4) > vn-chip > div:nth-child(2)',
fourthEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(4) > vn-chip > div:nth-child(2)',
mondayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(1)',
tuesdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(2)',
wednesdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(3)',
thursdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(4)',
fridayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(5)',
saturdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(6)',
sundayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(7)',
weekWorkedHours: 'vn-worker-time-control vn-side-menu vn-label-value > section > span',
nextMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_right]',
previousMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_left]',
monthName: 'vn-worker-time-control vn-side-menu vn-calendar div > .title',
secondWeekDay: 'vn-worker-time-control vn-side-menu vn-calendar .day:nth-child(8) > .day-number',
thrirdWeekDay: 'vn-worker-time-control vn-side-menu vn-calendar .day:nth-child(15) > .day-number',
navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]'
},
workerCalendar: {

View File

@ -276,7 +276,7 @@ describe('Client Edit fiscalData path', () => {
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => {
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
await page.waitForTextInField(selectors.clientAddresses.city, 'Silla');
await page.waitForTextInField(selectors.clientAddresses.city, 'Gotham');
await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox);
await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar();

View File

@ -45,7 +45,7 @@ describe('Client Add address path', () => {
expect(province).toContain('Province five');
});
it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => {
it(`should throw after clicking save button as consignee, incoterms and customsAgent are empty`, async() => {
await page.write(selectors.clientAddresses.consignee, 'Bruce Bunner');
await page.write(selectors.clientAddresses.streetAddress, '320 Park Avenue New York');
await page.waitToClick(selectors.clientAddresses.saveButton);

View File

@ -1,3 +1,4 @@
/* eslint max-len: ["error", { "code": 150 }]*/
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
@ -8,7 +9,7 @@ describe('Client Edit web access path', () => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'client');
await page.accessToSearchResult('Bruce Banner');
await page.accessToSearchResult('max');
await page.accessToSection('client.card.webAccess');
});
@ -17,8 +18,6 @@ describe('Client Edit web access path', () => {
});
it('should uncheck the Enable web access checkbox', async() => {
await page.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox);
await page.waitToClick(selectors.clientWebAccess.saveButton);
await page.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox);
await page.waitToClick(selectors.clientWebAccess.saveButton);
const message = await page.waitForSnackbar();
@ -28,7 +27,16 @@ describe('Client Edit web access path', () => {
it(`should update the name`, async() => {
await page.clearInput(selectors.clientWebAccess.userName);
await page.write(selectors.clientWebAccess.userName, 'Hulk');
await page.write(selectors.clientWebAccess.userName, 'Legion');
await page.waitToClick(selectors.clientWebAccess.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should update the email`, async() => {
await page.clearInput(selectors.clientWebAccess.email);
await page.write(selectors.clientWebAccess.email, 'legion@marvel.com');
await page.waitToClick(selectors.clientWebAccess.saveButton);
const message = await page.waitForSnackbar();
@ -45,30 +53,36 @@ describe('Client Edit web access path', () => {
it('should confirm web access name have been updated', async() => {
const result = await page.waitToGetProperty(selectors.clientWebAccess.userName, 'value');
expect(result).toEqual('Hulk');
expect(result).toEqual('Legion');
});
it('should confirm web access email have been updated', async() => {
const result = await page.waitToGetProperty(selectors.clientWebAccess.email, 'value');
expect(result).toEqual('legion@marvel.com');
});
it(`should navigate to the log section`, async() => {
await page.accessToSection('client.card.log');
});
it(`should confirm the last log is showing the updated client name and no modifications on the active checkbox`, async() => {
it(`should confirm the last log shows the updated client name and no modifications on active checkbox`, async() => {
let lastModificationPreviousValue = await page
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
let lastModificationCurrentValue = await page
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
expect(lastModificationPreviousValue).toEqual('name BruceBanner active false');
expect(lastModificationCurrentValue).toEqual('name Hulk active false');
expect(lastModificationPreviousValue).toEqual('name MaxEisenhardt active false');
expect(lastModificationCurrentValue).toEqual('name Legion active false');
});
it(`should confirm the penultimate log is showing the updated avtive field and no modifications on the client name`, async() => {
it(`should confirm the penultimate log shows the updated active and no modifications on client name`, async() => {
let penultimateModificationPreviousValue = await page
.waitToGetProperty(selectors.clientLog.penultimateModificationPreviousValue, 'innerText');
let penultimateModificationCurrentValue = await page
.waitToGetProperty(selectors.clientLog.penultimateModificationCurrentValue, 'innerText');
expect(penultimateModificationPreviousValue).toEqual('name BruceBanner active true');
expect(penultimateModificationCurrentValue).toEqual('name BruceBanner active false');
expect(penultimateModificationPreviousValue).toEqual('name MaxEisenhardt active true');
expect(penultimateModificationCurrentValue).toEqual('name MaxEisenhardt active false');
});
});

View File

@ -28,12 +28,12 @@ describe('Client defaulter path', () => {
const salesPersonName =
await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText');
expect(clientName).toEqual('Ororo Munroe');
expect(salesPersonName).toEqual('salesPersonNick');
expect(clientName).toEqual('Bruce Banner');
expect(salesPersonName).toEqual('developer');
});
it('should first observation not changed', async() => {
const expectedObservation = 'Madness, as you know, is like gravity, all it takes is a little push';
const expectedObservation = 'Meeting with Black Widow 21st 9am';
const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value');
expect(result).toContain(expectedObservation);

View File

@ -1,3 +1,4 @@
/* eslint max-len: ["error", { "code": 150 }]*/
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
@ -10,414 +11,105 @@ describe('Worker time control path', () => {
await page.loginAndModule('salesBoss', 'worker');
await page.accessToSearchResult('HankPym');
await page.accessToSection('worker.card.timeControl');
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
});
afterAll(async() => {
await browser.close();
});
describe('as salesBoss', () => {
describe('on Monday', () => {
it('should scan in Hank Pym', async() => {
const scanTime = '07:00';
const eightAm = '08:00';
const fourPm = '16:00';
const hankPymId = 1107;
it('should go to the next month', async() => {
const date = new Date();
date.setMonth(date.getMonth() + 1);
const month = date.toLocaleString('default', {month: 'long'});
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
const result = await page.waitToGetProperty(selectors.workerTimeControl.monthName, 'innerText');
expect(result).toContain(month);
});
it('should go to current month', async() => {
const date = new Date();
const month = date.toLocaleString('default', {month: 'long'});
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
const result = await page.waitToGetProperty(selectors.workerTimeControl.monthName, 'innerText');
expect(result).toContain(month);
});
it('should go 1 month in the past', async() => {
const date = new Date();
date.setMonth(date.getMonth() - 1);
const timestamp = Math.round(date.getTime() / 1000);
const month = date.toLocaleString('default', {month: 'long'});
await page.loginAndModule('salesBoss', 'worker');
await page.goto(`http://localhost:5000/#!/worker/${hankPymId}/time-control?timestamp=${timestamp}`);
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
const result = await page.waitToGetProperty(selectors.workerTimeControl.monthName, 'innerText');
expect(result).toContain(month);
});
it(`should return error when insert 'out' of first entry`, async() => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
await page.respondToDialog('accept');
const message = await page.waitForSnackbar();
expect(message.text).toBeDefined();
});
it(`should insert 'in' monday`, async() => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
expect(result).toEqual(eightAm);
});
it(`should scan out Hank Pym for break`, async() => {
const scanTime = '10:00';
it(`should insert 'out' monday`, async() => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
expect(result).toEqual(fourPm);
});
it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => {
const scanTime = '18:00';
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
it(`should check Hank Pym worked 8:20 hours`, async() => {
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '08:20 h.');
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '08:20 h.');
});
it(`should delete the wrong entry for Hank Pym`, async() => {
const wrongScanTime = '18:00';
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
it('should remove first entry of monday', async() => {
await page.waitForTextInElement(selectors.workerTimeControl.firstEntryOfMonday, eightAm);
await page.waitForTextInElement(selectors.workerTimeControl.secondEntryOfMonday, fourPm);
await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete);
await page.respondToDialog('accept');
const message = await page.waitForSnackbar();
expect(message.text).toContain('Entry removed');
});
it(`should scan out Hank Pym to leave early`, async() => {
const scanTime = '14:00';
it(`should be the 'out' the first entry of monday`, async() => {
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
expect(result).toEqual(fourPm);
});
it(`should add the break's scan in for Hank Pym and be in the right order`, async() => {
const scanTime = '10:20';
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
expect(result).toEqual('14:00');
});
it(`should the third entry be the scan in from break`, async() => {
const scanTime = '10:20';
const result = await page
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 6:40 hours`, async() => {
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '06:40 h.');
});
});
describe('on Tuesday', () => {
it('should happily scan in Hank Pym', async() => {
const scanTime = '08:00';
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should happily scan out Hank Pym for break`, async() => {
const scanTime = '10:00';
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should happily scan in Hank Pym from the break`, async() => {
const scanTime = '10:20';
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should happily scan out Hank Pym for the day`, async() => {
const scanTime = '16:00';
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 7:40 hours`, async() => {
await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '07:40 h.');
});
});
describe('on Wednesday', () => {
it('should cheerfully scan in Hank Pym', async() => {
const scanTime = '09:00';
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should cheerfully scan out Hank Pym for break`, async() => {
const scanTime = '10:00';
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should cheerfully scan in Hank Pym from the break`, async() => {
const scanTime = '10:20';
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should cheerfully scan out Hank Pym for the day`, async() => {
const scanTime = '17:00';
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 7:40 cheerfull hours`, async() => {
await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '07:40 h.');
});
});
describe('on Thursday', () => {
it('should joyfully scan in Hank Pym', async() => {
const scanTime = '09:59';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should joyfully scan out Hank Pym for break`, async() => {
const scanTime = '10:00';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should joyfully scan in Hank Pym from the break`, async() => {
const scanTime = '10:20';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should joyfully scan out Hank Pym for the day`, async() => {
const scanTime = '17:59';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 7:40 joyfull hours`, async() => {
await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '07:40 h.');
});
});
describe('on Friday', () => {
it('should smilingly scan in Hank Pym', async() => {
const scanTime = '07:30';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should smilingly scan out Hank Pym for break`, async() => {
const scanTime = '10:00';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should smilingly scan in Hank Pym from the break`, async() => {
const scanTime = '10:20';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should smilingly scan out Hank Pym for the day`, async() => {
const scanTime = '15:30';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 7:40 hours with a smile on his face`, async() => {
await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '07:40 h.');
});
});
});
describe('as HHRR', () => {
describe('on Saturday', () => {
it('should log in as hr and pick the worker module', async() => {
await page.loginAndModule('hr', 'worker');
});
it('should search for a worker and access to its summary', async() => {
await page.accessToSearchResult('HankPym');
await page.waitForState('worker.card.summary');
});
it('should access to the time control section', async() => {
await page.accessToSection('worker.card.timeControl');
await page.waitForState('worker.card.timeControl');
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
});
it('should lovingly scan in Hank Pym', async() => {
const scanTime = '06:00';
await page.waitForTimeout(1000); // without this timeout the dialog doesn't pop up
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should lovingly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
const scanTime = '13:40';
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 7:40 hours with all his will`, async() => {
await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '07:40 h.');
});
});
describe('on Sunday', () => {
it('should gladly scan in Hank Pym', async() => {
const scanTime = '05:00';
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should gladly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
const scanTime = '12:40';
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 7:40 glad hours`, async() => {
await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '07:40 h.');
});
it(`should check Hank Pym doesn't have hours set on the next months second week`, async() => {
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.');
});
it(`should check he didn't scan in this week yet`, async() => {
await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex);
await page.accessToSearchResult('salesBoss');
await page.accessToSection('worker.card.timeControl');
const wholeWeekHours = await page
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
expect(wholeWeekHours).toEqual('00:00 h.');
});
});
});
describe('after all this amazing week', () => {
it('should log in Hank', async() => {
await page.loginAndModule('HankPym', 'worker');
await page.accessToSearchResult('HankPym');
await page.accessToSection('worker.card.timeControl');
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
});
it('should check his weekly hours are alright', async() => {
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '52:40 h.');
});
it('should change week of month', async() => {
await page.waitToClick(selectors.workerTimeControl.thrirdWeekDay);
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '00:00 h.');
});
});

View File

@ -18,7 +18,7 @@ describe('Ticket expeditions and log path', () => {
});
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async() => {
await page.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton);
await page.waitToClick(selectors.ticketExpedition.thirdExpeditionRemoveButton);
await page.waitToClick(selectors.globalItems.acceptButton);
await page.reloadSection('ticket.card.expedition');

View File

@ -42,7 +42,7 @@ describe('Ticket Edit basic data path', () => {
expect(disabled).toBeFalsy();
});
it(`should check the zone is for Silla247`, async() => {
it(`should check the zone is for Gotham247`, async() => {
let zone = await page
.waitToGetProperty(selectors.ticketBasicData.zone, 'value');
@ -63,7 +63,7 @@ describe('Ticket Edit basic data path', () => {
let zone = await page
.waitToGetProperty(selectors.ticketBasicData.agency, 'value');
expect(zone).toContain('Silla247Expensive');
expect(zone).toContain('Gotham247Expensive');
});
it(`should click next`, async() => {
@ -92,7 +92,7 @@ describe('Ticket Edit basic data path', () => {
});
it(`should split ticket without negatives`, async() => {
const newAgency = 'Silla247';
const newAgency = 'Gotham247';
const newDate = new Date();
newDate.setDate(newDate.getDate() - 1);

View File

@ -80,7 +80,7 @@ describe('Ticket descriptor path', () => {
it('should confirm the ticket 11 was added on saturday', async() => {
await page.accessToSection('ticket.weekly.index');
const result = await page.waitToGetProperty(selectors.ticketsIndex.fifthhWeeklyTicket, 'value');
const result = await page.waitToGetProperty(selectors.ticketsIndex.fiveWeeklyTicket, 'value');
expect(result).toEqual('Saturday');
});
@ -108,7 +108,7 @@ describe('Ticket descriptor path', () => {
});
it('should update the agency then remove it afterwards', async() => {
await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Silla247');
await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Gotham247');
let message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');

View File

@ -75,59 +75,6 @@ describe('Ticket descriptor path', () => {
});
});
describe('Add stowaway', () => {
it('should search for a ticket', async() => {
await page.accessToSearchResult('16');
await page.waitForState('ticket.card.summary');
});
it('should open the add stowaway dialog', async() => {
await page.waitForFunction(() => {
let element = document.querySelector('vn-ticket-descriptor-menu');
return element.$ctrl.canShowStowaway === true;
});
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway);
await page.waitForSelector(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
const isVisible = await page.isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
expect(isVisible).toBeTruthy();
});
it('should add a ticket as stowaway', async() => {
await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should check the state of the stowaway ticket is embarked`, async() => {
await page.waitForState('ticket.card.summary');
const state = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
expect(state).toEqual('State Embarcando');
});
it(`should navigate back to the added ticket using the descriptors ship button`, async() => {
await page.waitToClick(selectors.ticketDescriptor.shipButton);
await page.waitForState('ticket.card.summary');
});
it('should delete the stowaway', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitForContentLoaded();
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton);
await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should confirm the ship buton doesn't exisist any more`, async() => {
await page.waitForSelector(selectors.ticketDescriptor.shipButton, {hidden: true});
});
});
describe('Make invoice', () => {
it('should login as administrative role then search for a ticket', async() => {
const invoiceableTicketId = '14';

View File

@ -23,9 +23,9 @@ describe('Ticket services path', () => {
await page.waitForClassPresent(selectors.ticketService.firstAddServiceTypeButton, 'disabled');
await page.waitToClick(selectors.ticketService.addServiceButton);
await page.waitForSelector(selectors.ticketService.firstAddServiceTypeButton);
const result = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton);
const disabled = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton);
expect(result).toBe(true);
expect(disabled).toBe(true);
});
it('should receive an error if you attempt to save a service without access rights', async() => {

View File

@ -6,7 +6,6 @@ describe('Ticket create path', () => {
let page;
let nextMonth = new Date();
nextMonth.setMonth(nextMonth.getMonth() + 1);
let stowawayTicketId;
beforeAll(async() => {
browser = await getBrowser();
@ -27,7 +26,7 @@ describe('Ticket create path', () => {
await page.autocompleteSearch(selectors.createTicketView.client, 'Clark Kent');
await page.pickDate(selectors.createTicketView.deliveryDate, nextMonth);
await page.autocompleteSearch(selectors.createTicketView.warehouse, 'Warehouse Two');
await page.autocompleteSearch(selectors.createTicketView.agency, 'Silla247');
await page.autocompleteSearch(selectors.createTicketView.agency, 'Gotham247');
await page.waitToClick(selectors.createTicketView.createButton);
const message = await page.waitForSnackbar();
@ -36,8 +35,6 @@ describe('Ticket create path', () => {
it('should check the url is now the summary of the ticket', async() => {
await page.waitForState('ticket.card.summary');
stowawayTicketId = await page.waitToGetProperty(selectors.ticketSummary.descriptorTicketId, 'innerText');
stowawayTicketId = stowawayTicketId.substring(1);
});
it('should again open the new ticket form', async() => {
@ -50,7 +47,7 @@ describe('Ticket create path', () => {
await page.autocompleteSearch(selectors.createTicketView.client, 'Clark Kent');
await page.pickDate(selectors.createTicketView.deliveryDate, nextMonth);
await page.autocompleteSearch(selectors.createTicketView.warehouse, 'Warehouse One');
await page.autocompleteSearch(selectors.createTicketView.agency, 'Silla247');
await page.autocompleteSearch(selectors.createTicketView.agency, 'Gotham247');
await page.waitToClick(selectors.createTicketView.createButton);
const message = await page.waitForSnackbar();
@ -61,15 +58,6 @@ describe('Ticket create path', () => {
await page.waitForState('ticket.card.summary');
});
it('should make the previously created ticket the stowaway of the current ticket', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway);
await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should delete the current ticket', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
@ -78,11 +66,4 @@ describe('Ticket create path', () => {
expect(message.text).toContain('Ticket deleted. You can undo this action within the first hour');
});
it('should search for the stowaway ticket of the previously deleted ticket', async() => {
await page.accessToSearchResult(stowawayTicketId);
const result = await page.countElement(selectors.ticketDescriptor.shipButton);
expect(result).toBe(0);
});
});

View File

@ -22,8 +22,6 @@ describe('Claim edit basic data path', () => {
it(`should edit claim state and observation fields`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado');
await page.clearTextarea(selectors.claimBasicData.observation);
await page.write(selectors.claimBasicData.observation, 'edited observation');
await page.clearInput(selectors.claimBasicData.packages);
await page.write(selectors.claimBasicData.packages, '2');
await page.waitToClick(selectors.claimBasicData.saveButton);
@ -59,13 +57,6 @@ describe('Claim edit basic data path', () => {
expect(hasToPickUpCheckbox).toBe('checked');
});
it('should confirm the claim observation was edited', async() => {
const result = await page
.waitToGetProperty(selectors.claimBasicData.observation, 'value');
expect(result).toEqual('edited observation');
});
it('should confirm the claim packages was edited', async() => {
const result = await page
.waitToGetProperty(selectors.claimBasicData.packages, 'value');
@ -75,8 +66,6 @@ describe('Claim edit basic data path', () => {
it(`should edit the claim to leave it untainted`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Pendiente');
await page.clearTextarea(selectors.claimBasicData.observation);
await page.write(selectors.claimBasicData.observation, 'Observation one');
await page.clearInput(selectors.claimBasicData.packages);
await page.write(selectors.claimBasicData.packages, '0');
await page.waitToClick(selectors.claimBasicData.saveButton);

View File

@ -37,7 +37,7 @@ describe('Claim summary path', () => {
});
it('should display the observation', async() => {
const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'value');
const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'innerText');
expect(result).toContain('Wisi forensibus mnesarchum in cum. Per id impetus abhorreant');
});

View File

@ -0,0 +1,46 @@
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
describe('Claim Add note path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('salesPerson', 'claim');
await page.accessToSearchResult('2');
await page.accessToSection('claim.card.note.index');
});
afterAll(async() => {
await browser.close();
});
it(`should reach the claim note index`, async() => {
await page.waitForState('claim.card.note.index');
});
it(`should click on the add new note button`, async() => {
await page.waitToClick(selectors.claimNote.addNoteFloatButton);
await page.waitForState('claim.card.note.create');
});
it(`should create a new note`, async() => {
await page.waitForSelector(selectors.claimNote.note);
await page.type(`${selectors.claimNote.note} textarea`, 'The delivery was unsuccessful');
await page.waitToClick(selectors.claimNote.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should redirect back to the claim notes page`, async() => {
await page.waitForState('claim.card.note.index');
});
it('should confirm the note was created', async() => {
const result = await page.waitToGetProperty(selectors.claimNote.firstNoteText, 'innerText');
expect(result).toEqual('The delivery was unsuccessful');
});
});

View File

@ -34,7 +34,7 @@ describe('Order summary path', () => {
it('should check the summary contains the order consignee', async() => {
const result = await page.waitToGetProperty(selectors.orderSummary.consignee, 'innerText');
expect(result).toEqual('address 26 - Silla (Province one)');
expect(result).toEqual('address 26 - Gotham (Province one)');
});
it('should check the summary contains the order subtotal', async() => {

View File

@ -9,7 +9,7 @@ describe('Route summary path', () => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'route');
await page.waitToClick('vn-route-index vn-tbody > a:nth-child(1)');
await page.waitToClick('vn-route-index vn-tbody > a:nth-child(7)');
});
afterAll(async() => {

View File

@ -29,7 +29,7 @@ describe('Entry descriptor path', () => {
it('should click the travels button to be redirected to the travels index filtered by the current agency', async() => {
await page.waitToClick(selectors.entryDescriptor.travelsQuicklink);
await page.expectURL('/travel/index');
await page.expectURL('agencyFk');
await page.expectURL('agencyModeFk');
});
it('should go back to the entry summary', async() => {

View File

@ -36,8 +36,7 @@ describe('Account create and basic data path', () => {
await page.waitForState('account.card.basicData');
});
it('should reload the section and check the name is as expected', async() => {
await page.reloadSection('account.card.basicData');
it('should check the name is as expected', async() => {
const result = await page.waitToGetProperty(selectors.accountBasicData.name, 'value');
expect(result).toEqual('Remy');
@ -103,25 +102,39 @@ describe('Account create and basic data path', () => {
});
});
// creating the account without the active property set to true seems to be creating an active user anyways
// describe('activate user', () => {
// it(`should check the inactive user icon is present in the descriptor`, async() => {
// await page.waitForSelector(selectors.accountDescriptor.activeUserIcon, {visible: true});
// });
describe('deactivate user', () => {
it(`should check the inactive user icon isn't present in the descriptor just yet`, async() => {
await page.waitForNumberOfElements(selectors.accountDescriptor.activeUserIcon, 0);
});
// it('should activate the user using the descriptor menu', async() => {
// await page.waitToClick(selectors.accountDescriptor.menuButton);
// await page.waitToClick(selectors.accountDescriptor.activateUser);
// await page.waitToClick(selectors.accountDescriptor.acceptButton);
// const message = await page.waitForSnackbar();
it('should deactivate the user using the descriptor menu', async() => {
await page.waitToClick(selectors.accountDescriptor.menuButton);
await page.waitToClick(selectors.accountDescriptor.deactivateUser);
await page.waitToClick(selectors.accountDescriptor.acceptButton);
const message = await page.waitForSnackbar();
// expect(message.text).toContain('user enabled?');
// });
expect(message.text).toContain('User deactivated!');
});
// it('should check the inactive user icon is not present anymore', async() => {
// await page.waitForNumberOfElements(selectors.accountDescriptor.activeUserIcon, 0);
// });
// });
it('should check the inactive user icon is now present', async() => {
await page.waitForNumberOfElements(selectors.accountDescriptor.activeUserIcon, 1);
});
});
describe('activate user', () => {
it('should activate the user using the descriptor menu', async() => {
await page.waitToClick(selectors.accountDescriptor.menuButton);
await page.waitToClick(selectors.accountDescriptor.activateUser);
await page.waitToClick(selectors.accountDescriptor.acceptButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('User activated!');
});
it('should check the inactive user icon is not present anymore', async() => {
await page.waitForNumberOfElements(selectors.accountDescriptor.activeUserIcon, 0);
});
});
describe('mail forwarding', () => {
it('should activate the mail forwarding and set the recipent email', async() => {

View File

@ -56,7 +56,7 @@ describe('Account Alias create and basic data path', () => {
expect(result).toContain('psykers');
});
it('should search for the IT alias group then access to the users section then check the role listed is the expected one', async() => {
it('should search IT alias then access the user section to check the role listed is the expected one', async() => {
await page.accessToSearchResult('IT');
await page.accessToSection('account.alias.card.users');
const rolesCount = await page.countElement(selectors.accountAliasUsers.anyResult);

View File

@ -15,8 +15,9 @@ export default function currency($translate) {
maximumFractionDigits: fractionSize
};
const lang = $translate.use() == 'es' ? 'de' : $translate.use();
if (typeof input == 'number') {
return new Intl.NumberFormat($translate.use(), options)
return new Intl.NumberFormat(lang, options)
.format(input);
}

View File

@ -10,6 +10,7 @@ export default class App {
constructor() {
this.loaderStatus = 0;
this.loading = false;
this.versionInterval = setInterval(this.getVersion.bind(this), 300000);
}
showMessage(message) {
@ -38,6 +39,21 @@ export default class App {
if (this.loaderStatus === 0)
this.loading = false;
}
getVersion() {
this.logger.$http.get('Applications/status');
}
setVersion(newVersion) {
if (newVersion) {
const currentVersion = localStorage.getItem('salix-version');
if (newVersion != currentVersion) {
this.hasNewVersion = true;
clearInterval(this.versionInterval);
}
localStorage.setItem('salix-version', newVersion);
}
}
}
ngModule.service('vnApp', App);

View File

@ -30,14 +30,17 @@ function interceptor($q, vnApp, vnToken, $translate) {
},
response(response) {
vnApp.popLoader();
const newVersion = response.headers('salix-version');
vnApp.setVersion(newVersion);
return response;
},
responseError(rejection) {
vnApp.popLoader();
let err = new HttpError(rejection.statusText);
const err = new HttpError(rejection.statusText);
Object.assign(err, rejection);
return $q.reject(err);
}
},
};
}
ngModule.factory('vnInterceptor', interceptor);

View File

@ -343,9 +343,6 @@
.icon-splur:before {
content: "\e970";
}
.icon-stowaway:before {
content: "\e94f";
}
.icon-supplier:before {
content: "\e925";
}

View File

@ -85,8 +85,6 @@
<glyph unicode="&#xe94b;" glyph-name="deaulter" d="M677.973-64c-30.72 35.84-61.867 70.827-91.307 107.52-40.96 51.2-80.64 103.253-121.173 154.88-16.64 21.333-21.76 20.48-30.72-4.693-13.227-36.693-25.6-73.387-40.107-109.653-5.12-12.8-13.227-26.88-24.32-34.56-51.627-34.987-104.107-69.12-157.867-100.693-10.667-6.4-30.72-5.547-41.813 0.853-8.107 4.693-12.373 23.893-11.093 35.84 0.853 8.96 11.093 19.627 19.627 25.6 39.253 26.453 78.933 51.627 119.040 76.8 18.347 11.52 30.293 26.027 35.84 47.787 12.373 48.213 27.307 95.573 39.253 143.36 8.533 33.707 26.88 58.88 56.32 77.227 40.533 25.173 80.64 52.053 120.747 78.507 6.4 4.267 10.24 11.52 15.36 17.493-7.253 2.56-14.933 7.253-22.187 6.827-75.52-6.4-151.467-13.227-226.987-20.48-2.133 0-4.693-0.853-6.827-0.853-22.613-1.707-39.253 10.24-40.96 29.867s12.373 33.707 35.413 35.84c45.227 4.267 90.88 8.96 136.107 12.8 65.707 5.547 131.84 10.667 197.547 15.36 26.027 1.707 53.76-21.76 67.413-55.467 9.813-23.893 5.12-46.080-18.347-65.28-49.92-40.107-100.693-78.933-151.040-118.187-23.040-17.92-23.893-23.467-6.4-46.507 58.453-78.080 116.48-156.587 174.933-234.667 27.307-36.693 25.173-50.773-12.373-75.52-5.12 0-9.813 0-14.080 0zM791.893 649.813c-43.093 1.28-76.373-31.573-77.227-75.52-0.853-44.373 29.44-76.8 72.107-77.653 45.227-1.28 77.653 29.44 78.080 73.813 0.427 45.227-29.44 78.080-72.96 79.36zM671.147 737.707c0-72.107-34.133-136.107-87.467-176.64l-235.52-21.76c-72.107 36.693-122.027 111.787-122.027 198.4 0 122.88 99.84 222.293 222.72 222.293 122.453 0 222.293-99.413 222.293-222.293zM592.213 680.533l-50.347 18.347c-2.133-8.533-5.12-16.213-9.813-22.613-5.12-6.4-10.24-11.947-16.213-17.067-5.973-4.267-12.373-8.107-19.2-11.093s-13.653-4.693-20.053-5.547c-17.92-2.987-33.707-0.427-48.64 6.827s-26.88 18.347-36.693 32.853l76.373 12.373 7.253 32.427-97.28-15.787c-1.28 5.547-2.987 11.093-3.84 16.64l-0.853 4.267 99.413 16.213 7.253 32.427-106.667-17.493c0.853 9.387 2.987 17.493 6.4 26.027 3.84 8.533 8.107 16.213 14.080 23.040 5.547 6.827 12.8 12.373 21.333 17.067s17.92 8.107 28.587 9.813c6.827 1.28 13.227 1.707 20.907 1.28s14.507-1.707 21.333-3.84c6.827-2.133 13.653-5.973 20.053-10.24 5.973-4.693 11.947-11.093 17.493-18.773l38.827 37.973c-13.227 17.92-30.293 31.147-52.053 39.253-21.76 8.533-46.080 10.667-73.387 6.4-19.627-2.987-36.267-9.387-51.2-17.92-14.507-8.533-26.88-19.2-37.547-32-10.667-12.373-18.773-26.027-23.893-40.96-5.547-14.507-8.96-29.867-9.813-45.653l-21.76-3.84-7.253-32.427 29.013 4.693 0.427-2.987c1.28-6.827 2.56-12.8 4.267-18.347l-23.467-3.84-8.107-32.427 43.52 7.253c6.827-13.653 15.787-26.027 26.027-36.693 10.24-11.52 22.187-20.48 35.413-27.733 13.227-7.68 27.307-12.8 42.667-15.787s31.573-3.413 47.36-0.853c12.373 2.133 24.32 5.12 35.84 10.667s22.613 11.52 32.853 19.2c10.24 8.107 18.347 16.64 26.027 26.453 6.827 9.387 12.373 20.48 15.36 32.427z" />
<glyph unicode="&#xe94c;" glyph-name="services" d="M951.467 217.6c0 8.533 0 21.333 0 29.867s0 21.333-4.267 29.867l64 51.2c4.267 4.267 8.533 12.8 4.267 21.333l-64 106.667c-4.267 8.533-12.8 8.533-17.067 8.533l-76.8-29.867c-17.067 12.8-34.133 21.333-51.2 29.867l-12.8 81.067c0 8.533-8.533 12.8-17.067 12.8h-123.733c-8.533 0-12.8-4.267-17.067-12.8l-12.8-81.067c-17.067-8.533-38.4-17.067-51.2-29.867l-76.8 29.867c-8.533 4.267-17.067 0-17.067-8.533l-64-106.667c-4.267-8.533-4.267-17.067 4.267-21.333l64-51.2c0-8.533-4.267-21.333-4.267-29.867s0-21.333 4.267-29.867l-55.467-51.2c-4.267-4.267-8.533-12.8-4.267-21.333l64-106.667c4.267-8.533 12.8-8.533 17.067-8.533l76.8 29.867c17.067-12.8 34.133-21.333 51.2-29.867l12.8-81.067c0-8.533 8.533-12.8 17.067-12.8h123.733c8.533 0 12.8 4.267 17.067 12.8l12.8 81.067c17.067 8.533 38.4 17.067 51.2 29.867l76.8-29.867c8.533-4.267 17.067 0 17.067 8.533l64 106.667c4.267 8.533 4.267 17.067-4.267 21.333 0 0-68.267 51.2-68.267 51.2zM721.067 132.267c-64 0-115.2 51.2-115.2 115.2s51.2 115.2 115.2 115.2 115.2-51.2 115.2-115.2c0-64-51.2-115.2-115.2-115.2zM345.6 174.933h-89.6v102.4h81.067c4.267 34.133 8.533 68.267 21.333 102.4h-102.4v102.4h162.133c34.133 42.667 72.533 76.8 119.467 102.4h-281.6v102.4h520.533v-59.733c51.2-8.533 102.4-25.6 145.067-51.2v281.6c0 55.467-46.933 102.4-102.4 102.4h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h302.933c-81.067 55.467-136.533 140.8-153.6 238.933z" />
<glyph unicode="&#xe94d;" glyph-name="albaran" d="M819.2 960h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h622.933c55.467 0 102.4 46.933 102.4 102.4v819.2c0 55.467-46.933 102.4-102.4 102.4zM358.4 174.933h-102.4v102.4h503.467v-102.4h-401.067zM256 379.733v102.4h503.467v-102.4h-503.467zM759.467 584.533h-503.467v102.4h503.467v-102.4z" />
<glyph unicode="&#xe94e;" glyph-name="solunion" d="M759.467 870.4v-136.533h-601.6c0 0-128-341.333 106.667-341.333s469.333 0 469.333 0 34.133 0 34.133-34.133-8.533-98.133-8.533-98.133h-541.867c0 0-247.467 29.867-204.8 320 0 0 8.533 140.8 72.533 298.667 0 0 21.333-8.533 85.333-8.533h588.8zM853.333 25.6c64 0 85.333-8.533 85.333-8.533 64 153.6 72.533 298.667 72.533 298.667 42.667 290.133-204.8 320-204.8 320h-541.867c0 0-8.533-64-8.533-98.133s34.133-34.133 34.133-34.133 238.933 0 469.333 0 106.667-341.333 106.667-341.333h-601.6v-136.533h588.8z" />
<glyph unicode="&#xe94f;" glyph-name="stowaway" d="M1006.933 452.267l-260.267 106.667 29.867 29.867c4.267 4.267 4.267 12.8 4.267 17.067-4.267 4.267-8.533 8.533-12.8 8.533h-157.867c0 93.867 76.8 157.867 174.933 157.867 4.267 0 8.533 4.267 12.8 8.533s4.267 8.533 0 17.067l-81.067 153.6c-4.267 0-12.8 4.267-17.067 4.267-46.933 0-93.867-17.067-132.267-42.667-21.333-17.067-42.667-38.4-55.467-59.733-12.8 21.333-29.867 42.667-55.467 59.733-34.133 12.8-81.067 34.133-128 34.133-4.267 0-12.8-4.267-12.8-8.533l-85.333-153.6c-4.267-4.267-4.267-4.267 0-12.8 4.267-4.267 8.533-8.533 12.8-8.533 98.133 0 174.933-59.733 174.933-153.6v0h-140.8c-4.267 0-12.8-4.267-12.8-8.533-8.533-4.267-4.267-17.067 0-21.333l21.333-21.333-277.333-110.933c-8.533-8.533-12.8-12.8-8.533-21.333 0-8.533 8.533-12.8 17.067-12.8v0l98.133 4.267-81.067-85.333c0-4.267-4.267-8.533 0-12.8 0-4.267 4.267-8.533 8.533-8.533l85.333-34.133v-179.2c0-8.533 4.267-12.8 8.533-12.8l358.4-145.067h8.533l358.4 145.067c4.267 4.267 8.533 8.533 8.533 12.8v179.2l85.333 34.133c4.267 0 8.533 4.267 8.533 8.533s0 8.533-4.267 12.8l-68.267 98.133 102.4-4.267c8.533 0 12.8 4.267 17.067 12.8 8.533 0 4.267 4.267-4.267 12.8zM110.933 456.533l196.267 76.8 8.533-8.533-166.4-64-38.4-4.267zM153.6 285.867v0l-68.267 34.133 68.267 98.133 328.533-132.267-68.267-98.133-260.267 98.133zM490.667-29.867l-328.533 132.267v153.6l243.2-98.133h12.8c0 0 0 0 4.267 0v0c0 0 4.267 0 4.267 4.267l64 85.333c0-4.267 0-277.333 0-277.333zM490.667 324.267l-298.667 115.2 149.333 64 153.6-157.867v-17.067h-4.267zM529.067 337.067l157.867 157.867 140.8-55.467-298.667-115.2c0 0 0 12.8 0 12.8zM849.067 102.4l-328.533-132.267v281.6l64-85.333c0 0 0-4.267 4.267-4.267v0h17.067l243.2 98.133v-157.867zM938.667 324.267l-324.267-132.267-68.267 98.133 328.533 132.267 64-98.133zM870.4 460.8l-157.867 64 12.8 8.533 187.733-76.8-42.667 4.267z" />
<glyph unicode="&#xe950;" glyph-name="agency-term" d="M789.333 266.667c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4c55.467 0 102.4 46.933 102.4 102.4 0 59.733-46.933 102.4-102.4 102.4zM789.333 113.067c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2c29.867 0 51.2-21.333 51.2-51.2 0-25.6-25.6-51.2-51.2-51.2zM251.733 266.667c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM251.733 113.067c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM1006.933 539.733l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-554.667c0-29.867 25.6-51.2 51.2-51.2h68.267c8.533 64 64 115.2 132.267 115.2 64 0 123.733-51.2 132.267-115.2h268.8c8.533 64 64 115.2 132.267 115.2s128-51.2 136.533-115.2h51.2c29.867 0 51.2 25.6 51.2 51.2v260.267c0 17.067-8.533 34.133-17.067 46.933v0zM725.333 684.8c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067zM509.013 556.373c0-113.92-92.16-206.080-206.080-206.080s-206.080 92.16-206.080 206.080 92.16 206.507 206.080 206.507 206.080-92.587 206.080-206.507zM342.613 494.080h-87.893l-15.36-40.107h-78.933l100.693 230.827h76.373l100.693-230.827h-80.213l-15.36 40.107zM321.28 550.4l-22.613 58.027-22.187-58.027h44.8z" />
<glyph unicode="&#xe951;" glyph-name="apps" d="M0 704h256v256h-256v-256zM384-64h256v256h-256v-256zM0-64h256v256h-256v-256zM0 320h256v256h-256v-256zM384 320h256v256h-256v-256zM768 960v-256h256v256h-256zM384 704h256v256h-256v-256zM768 320h256v256h-256v-256zM768-64h256v256h-256v-256z" />
<glyph unicode="&#xe952;" glyph-name="info" d="M512 960c-281.6 0-512-230.4-512-512s230.4-512 512-512 512 230.4 512 512-230.4 512-512 512zM563.2 192h-102.4v307.2h102.4v-307.2zM563.2 601.6h-102.4v102.4h102.4v-102.4z" />

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 157 KiB

View File

@ -21,6 +21,7 @@ export default function moduleImport(moduleName) {
case 'entry' : return import('entry/front');
case 'account' : return import('account/front');
case 'supplier' : return import('supplier/front');
case 'shelving' : return import('shelving/front');
case 'monitor' : return import('monitor/front');
}
}

View File

@ -19,6 +19,14 @@
</div>
<vn-slot name="topbar"></vn-slot>
<div class="side end">
<vn-icon-button
id="refresh"
icon="refresh"
ng-if="$ctrl.vnApp.hasNewVersion"
ng-click="$ctrl.refresh()"
class="refresh"
translate-attr="{title: 'There is a new version, click here to reload'}">
</vn-icon-button>
<vn-icon-button
id="apps"
icon="apps"
@ -39,7 +47,6 @@
translate-attr="{title: 'Account'}"
on-error-src/>
</button>
</div>
<vn-menu vn-id="apps-menu">
<vn-list class="modules-menu">

View File

@ -26,6 +26,10 @@ export class Layout extends Component {
const token = this.vnToken.token;
return `/api/Images/user/160x160/${userId}/download?access_token=${token}`;
}
refresh() {
window.location.reload();
}
}
Layout.$inject = ['$element', '$scope', 'vnModules'];

View File

@ -60,6 +60,9 @@ vn-layout {
font-size: 1.05rem;
padding: 0;
}
.vn-icon-button.refresh {
color: $color-alert;
}
}
& > vn-side-menu > .menu {
display: flex;

View File

@ -17,6 +17,7 @@ Go to module summary: Ir a la vista previa del módulo
Show summary: Mostrar vista previa
What is new: Novedades de la versión
Settings: Ajustes
There is a new version, click here to reload: Hay una nueva versión, pulse aquí para recargar
# Actions

View File

@ -13,6 +13,7 @@ import './modules/route/front/module.js';
import './modules/ticket/front/module.js';
import './modules/travel/front/module.js';
import './modules/worker/front/module.js';
import './modules/shelving/front/module.js';
core.run(vnInterceptor => {
vnInterceptor.setApiPath(null);

View File

@ -54,7 +54,6 @@
"You can't delete a confirmed order": "You can't delete a confirmed order",
"Value has an invalid format": "Value has an invalid format",
"The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one",
"Can't create stowaway for this ticket": "Can't create stowaway for this ticket",
"Swift / BIC can't be empty": "Swift / BIC can't be empty",
"Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
"Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
@ -70,7 +69,6 @@
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
"Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*",
"Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*",
"This ticket is not an stowaway anymore": "The ticket id [{{ticketId}}]({{{ticketUrl}}}) is not an stowaway anymore",
"Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
"Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member",
"Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}",
@ -123,5 +121,14 @@
"The worker has hours recorded that day": "The worker has hours recorded that day",
"isWithoutNegatives": "isWithoutNegatives",
"routeFk": "routeFk",
"Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data"
"Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data",
"Can't change the password of another worker": "Can't change the password of another worker",
"No hay un contrato en vigor": "There is no existing contract",
"No está permitido trabajar": "Not allowed to work",
"Dirección incorrecta": "Wrong direction",
"No se permite fichar a futuro": "It is not allowed to sign in the future",
"Descanso diario 12h.": "Daily rest 12h.",
"Fichadas impares": "Odd signs",
"Descanso diario 9h.": "Daily rest 9h.",
"Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h."
}

View File

@ -101,7 +101,6 @@
"Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
"Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
"You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
"Can't create stowaway for this ticket": "No se puede crear un polizon para este ticket",
"The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto",
"Invalid quantity": "Cantidad invalida",
"This postal code is not valid": "This postal code is not valid",
@ -138,7 +137,6 @@
"Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
"Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*",
"Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*",
"This ticket is not an stowaway anymore": "El ticket id [{{ticketId}}]({{{ticketUrl}}}) ha dejado de ser un polizón",
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
"Distance must be lesser than 1000": "La distancia debe ser inferior a 1000",
@ -226,5 +224,13 @@
"reference duplicated": "Referencia duplicada",
"This ticket is already a refund": "Este ticket ya es un abono",
"isWithoutNegatives": "isWithoutNegatives",
"routeFk": "routeFk"
"routeFk": "routeFk",
"Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador",
"No hay un contrato en vigor": "No hay un contrato en vigor",
"No se permite fichar a futuro": "No se permite fichar a futuro",
"No está permitido trabajar": "No está permitido trabajar",
"Fichadas impares": "Fichadas impares",
"Descanso diario 12h.": "Descanso diario 12h.",
"Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
"Dirección incorrecta": "Dirección incorrecta"
}

View File

@ -31,7 +31,8 @@
"loopback#token": {}
},
"auth:after": {
"./middleware/current-user": {}
"./middleware/current-user": {},
"./middleware/salix-version": {}
},
"parse": {
"body-parser#json":{}

View File

@ -0,0 +1,8 @@
const packageJson = require('../../../package.json');
module.exports = function(options) {
return function(req, res, next) {
res.set('Salix-Version', packageJson.version);
next();
};
};

View File

@ -1,6 +1,6 @@
module.exports = Self => {
Self.remoteMethodCtx('importToNewRefundTicket', {
description: 'Imports lines from claimBeginning to a new ticket with specific shipped, landed dates, agency and company',
description: 'Import lines of claimBeginning to new ticket with shipped, landed dates, agency and company',
accessType: 'WRITE',
accepts: [{
arg: 'id',

View File

@ -84,6 +84,20 @@ module.exports = Self => {
};
promises.push(Self.app.models.ClaimBeginning.find(filter, myOptions));
// Claim observations
filter = {
where: {claimFk: id},
include: [
{
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName']
}
}
]
};
promises.push(Self.app.models.ClaimObservation.find(filter, myOptions));
// Claim developments
filter = {
where: {claimFk: id},
@ -138,8 +152,9 @@ module.exports = Self => {
summary.isEditable = await Self.isEditable(ctx, id, myOptions);
[summary.claim] = res[0];
summary.salesClaimed = res[1];
summary.developments = res[2];
summary.actions = res[3];
summary.observations = res[2];
summary.developments = res[3];
summary.actions = res[4];
return summary;
};

View File

@ -19,6 +19,7 @@ describe('claim getSummary()', () => {
expect(keys).toContain('claim');
expect(keys).toContain('salesClaimed');
expect(keys).toContain('developments');
expect(keys).toContain('observations');
expect(keys).toContain('actions');
expect(keys).toContain('isEditable');

View File

@ -38,6 +38,9 @@
"ClaimLog": {
"dataSource": "vn"
},
"ClaimObservation": {
"dataSource": "vn"
},
"ClaimContainer": {
"dataSource": "claimStorage"
}

View File

@ -0,0 +1,43 @@
{
"name": "ClaimObservation",
"base": "Loggable",
"log": {
"model": "ClaimLog",
"relation": "claim"
},
"options": {
"mysql": {
"table": "claimObservation"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"claimFk": {
"type": "number",
"required": true
},
"text": {
"type": "string",
"required": true
},
"created": {
"type": "date"
}
},
"relations": {
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"claim": {
"type": "belongsTo",
"model": "Claim",
"foreignKey": "claimFk"
}
}
}

View File

@ -51,15 +51,6 @@
label="Packages received"
ng-model="$ctrl.claim.packages">
</vn-input-number>
</vn-horizontal>
<vn-horizontal>
<vn-textarea
label="Observation"
ng-model="$ctrl.claim.observation"
rule>
</vn-textarea>
</vn-horizontal>
<vn-horizontal>
<vn-check
class="vn-mr-md"
label="Pick up"

View File

@ -12,3 +12,5 @@ import './search-panel';
import './summary';
import './photos';
import './log';
import './note/index';
import './note/create';

View File

@ -6,6 +6,7 @@ Client Id: Id cliente
Claimed ticket: Ticket reclamado
Delete claim: Eliminar reclamación
Observation: Observación
Observations: Observaciones
Responsible: Responsable
Remove sale: Eliminar linea
Claim Id: Id reclamación

View File

@ -0,0 +1,30 @@
<vn-watcher
vn-id="watcher"
url="claimObservations"
id-field="id"
data="$ctrl.note"
insert-mode="true"
form="form">
</vn-watcher>
<form name="form" ng-submit="watcher.submitGo('claim.card.note.index')" class="vn-w-md">
<vn-card class="vn-pa-lg">
<vn-horizontal>
<vn-textarea
vn-one
label="Note"
ng-model="$ctrl.note.text"
vn-focus>
</vn-textarea>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit
ng-if="watcher.dataChanged()"
label="Save">
</vn-submit>
<vn-button
ng-click="$ctrl.cancel()"
label="Cancel">
</vn-button>
</vn-button-bar>
</form>

View File

@ -0,0 +1,22 @@
import ngModule from '../../module';
import Section from 'salix/components/section';
export default class Controller extends Section {
constructor($element, $) {
super($element, $);
this.note = {
claimFk: parseInt(this.$params.id),
workerFk: window.localStorage.currentUserWorkerId,
text: null
};
}
cancel() {
this.$state.go('claim.card.note.index', {id: this.$params.id});
}
}
ngModule.vnComponent('vnClaimNoteCreate', {
template: require('./index.html'),
controller: Controller
});

View File

@ -0,0 +1,32 @@
<vn-crud-model
vn-id="model"
url="ClaimObservations"
filter="$ctrl.filter"
where="{claimFk: $ctrl.$params.id}"
include="$ctrl.include"
data="notes"
auto-load="true">
</vn-crud-model>
<vn-data-viewer
model="model"
class="vn-w-md">
<vn-card class="vn-pa-md">
<div
ng-repeat="note in notes"
class="note vn-pa-sm border-solid border-radius vn-mb-md">
<vn-horizontal class="vn-mb-sm" style="color: #666">
<vn-one>{{::note.worker.firstName}} {{::note.worker.lastName}}</vn-one>
<vn-auto>{{::note.created | date:'dd/MM/yyyy HH:mm'}}</vn-auto>
</vn-horizontal>
<vn-horizontal class="text">
{{::note.text}}
</vn-horizontal>
</div>
</vn-card>
</vn-data-viewer>
<a vn-tooltip="New note"
ui-sref="claim.card.note.create({id: $ctrl.$params.id})"
vn-bind="+"
fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>

View File

@ -0,0 +1,25 @@
import ngModule from '../../module';
import Section from 'salix/components/section';
import './style.scss';
export default class Controller extends Section {
constructor($element, $) {
super($element, $);
this.filter = {
order: 'created DESC',
};
this.include = {
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName']
}
};
}
}
Controller.$inject = ['$element', '$scope'];
ngModule.vnComponent('vnClaimNote', {
template: require('./index.html'),
controller: Controller,
});

View File

@ -0,0 +1,5 @@
vn-client-note {
.note:last-child {
margin-bottom: 0;
}
}

View File

@ -12,6 +12,7 @@
{"state": "claim.card.basicData", "icon": "settings"},
{"state": "claim.card.detail", "icon": "icon-details"},
{"state": "claim.card.photos", "icon": "image"},
{"state": "claim.card.note.index", "icon": "insert_drive_file"},
{"state": "claim.card.development", "icon": "icon-traceability"},
{"state": "claim.card.action", "icon": "icon-actions"},
{"state": "claim.card.log", "icon": "history"}
@ -27,17 +28,20 @@
"abstract": true,
"component": "vn-claim",
"description": "Claims"
}, {
},
{
"url": "/index?q",
"state": "claim.index",
"component": "vn-claim-index",
"description": "Claims"
}, {
},
{
"url": "/:id",
"state": "claim.card",
"abstract": true,
"component": "vn-claim-card"
}, {
},
{
"url": "/summary",
"state": "claim.card.summary",
"component": "vn-claim-summary",
@ -45,7 +49,8 @@
"params": {
"claim": "$ctrl.claim"
}
}, {
},
{
"url": "/basic-data",
"state": "claim.card.basicData",
"component": "vn-claim-basic-data",
@ -54,7 +59,8 @@
"claim": "$ctrl.claim"
},
"acl": ["salesPerson"]
}, {
},
{
"url": "/detail",
"state": "claim.card.detail",
"component": "vn-claim-detail",
@ -63,7 +69,32 @@
"claim": "$ctrl.claim"
},
"acl": ["salesPerson"]
}, {
},
{
"url": "/note",
"state": "claim.card.note",
"component": "ui-view",
"abstract": true,
"acl": ["salesPerson"]
},
{
"url": "/index",
"state": "claim.card.note.index",
"component": "vn-claim-note",
"description": "Notes",
"params": {
"claim": "$ctrl.claim"
},
"acl": ["salesPerson"]
},
{
"url": "/create",
"state": "claim.card.note.create",
"component": "vn-claim-note-create",
"description": "New note",
"acl": ["salesPerson"]
},
{
"url": "/development",
"state": "claim.card.development",
"component": "vn-claim-development",
@ -72,7 +103,8 @@
"claim": "$ctrl.claim"
},
"acl": ["claimManager"]
}, {
},
{
"url": "/action",
"state": "claim.card.action",
"component": "vn-claim-action",
@ -81,7 +113,8 @@
"claim": "$ctrl.claim"
},
"acl": ["claimManager"]
}, {
},
{
"url": "/photos",
"state": "claim.card.photos",
"component": "vn-claim-photos",
@ -89,7 +122,8 @@
"params": {
"claim": "$ctrl.claim"
}
}, {
},
{
"url" : "/log",
"state": "claim.card.log",
"component": "vn-claim-log",

View File

@ -1,4 +1,5 @@
<vn-crud-model vn-id="model"
<vn-crud-model
vn-id="model"
url="ClaimDms"
filter="::$ctrl.filter"
data="photos">
@ -42,14 +43,31 @@
value="{{$ctrl.summary.claim.worker.user.nickname}}">
</vn-label-value>
</vn-one>
<vn-two>
<vn-textarea
vn-three
disabled="true"
label="Observation"
ng-model="$ctrl.summary.claim.observation">
</vn-textarea>
</vn-two>
<vn-auto>
<h4 ng-show="$ctrl.isSalesPerson && $ctrl.summary.observations.length">
<a
ui-sref="claim.card.note.index({id:$ctrl.claim.id})"
target="_self">
<span translate vn-tooltip="Go to">Observations</span>
</a>
</h4>
<h4
ng-show="!$ctrl.isSalesPerson && $ctrl.summary.observations.length"
translate>
Observations
</h4>
<div
ng-repeat="note in $ctrl.summary.observations"
class="note vn-pa-sm border-solid border-radius vn-mb-md">
<vn-horizontal class="vn-mb-sm" style="color: #666">
<vn-one>{{::note.worker.firstName}} {{::note.worker.lastName}}</vn-one>
<vn-auto>{{::note.created | date:'dd/MM/yyyy HH:mm'}}</vn-auto>
</vn-horizontal>
<vn-horizontal class="text">
{{::note.text}}
</vn-horizontal>
</div>
</vn-auto>
<vn-auto>
<h4 ng-show="$ctrl.isSalesPerson">
<a

View File

@ -51,6 +51,9 @@ module.exports = function(Self) {
Self.createReceipt = async(ctx, options) => {
const models = Self.app.models;
const args = ctx.args;
const date = new Date();
date.setHours(0, 0, 0, 0);
let tx;
const myOptions = {};
@ -92,8 +95,9 @@ module.exports = function(Self) {
throw new UserError('Invalid account');
await Self.rawSql(
`CALL vn.ledger_doCompensation(CURDATE(), ?, ?, ?, ?, ?, ?)`,
`CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`,
[
date,
args.compensationAccount,
args.bankFk,
accountingType.receiptDescription + originalClient.accountingAccount,
@ -106,9 +110,10 @@ module.exports = function(Self) {
} else if (accountingType.isAutoConciliated == true) {
const description = `${originalClient.id} : ${originalClient.socialName} - ${accountingType.receiptDescription}`;
const [xdiarioNew] = await Self.rawSql(
`SELECT xdiario_new(?, CURDATE(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ledger;`,
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ledger;`,
[
null,
date,
bank.account,
originalClient.accountingAccount,
description,
@ -126,9 +131,10 @@ module.exports = function(Self) {
);
await Self.rawSql(
`SELECT xdiario_new(?, CURDATE(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,
[
xdiarioNew.ledger,
date,
originalClient.accountingAccount,
bank.account,
description,

View File

@ -62,7 +62,7 @@ module.exports = function(Self) {
{
relation: 'account',
scope: {
fields: ['id', 'name', 'active']
fields: ['id', 'name', 'email', 'active']
}
},
{
@ -74,8 +74,10 @@ module.exports = function(Self) {
]
}, myOptions);
const query = `SELECT vn.clientGetDebt(?, CURDATE()) AS debt`;
const data = await Self.rawSql(query, [id], myOptions);
const date = new Date();
date.setHours(0, 0, 0, 0);
const query = `SELECT vn.clientGetDebt(?, ?) AS debt`;
const data = await Self.rawSql(query, [id, date], myOptions);
client.debt = data[0].debt;

View File

@ -25,8 +25,10 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const query = `SELECT vn.clientGetDebt(?, CURDATE()) AS debt`;
const [debt] = await Self.rawSql(query, [clientFk], myOptions);
const date = new Date();
date.setHours(0, 0, 0, 0);
const query = `SELECT vn.clientGetDebt(?, ?) AS debt`;
const [debt] = await Self.rawSql(query, [clientFk, date], myOptions);
return debt;
};

View File

@ -32,6 +32,8 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const date = new Date();
date.setHours(0, 0, 0, 0);
const ticket = await Self.app.models.Ticket.findById(ticketId, null, myOptions);
const query = `
SELECT
@ -50,12 +52,12 @@ module.exports = Self => {
JOIN vn.warehouse w ON t.warehouseFk = w.id
JOIN vn.address ad ON t.addressFk = ad.id
JOIN vn.province pr ON ad.provinceFk = pr.id
WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0
WHERE t.shipped >= ? AND t.clientFk = ? AND ts.alertLevel = 0
AND t.id <> ? AND t.warehouseFk = ?
ORDER BY t.shipped
LIMIT 10`;
return Self.rawSql(query, [id, ticketId, ticket.warehouseFk], myOptions);
return Self.rawSql(query, [date, id, ticketId, ticket.warehouseFk], myOptions);
};
};

View File

@ -0,0 +1,32 @@
module.exports = Self => {
Self.remoteMethod('setPassword', {
description: 'Sets the password of a non-worker client',
accepts: [
{
arg: 'id',
type: 'number',
description: 'The user id',
http: {source: 'path'}
}, {
arg: 'newPassword',
type: 'string',
description: 'The new password',
required: true
}
],
http: {
path: `/:id/setPassword`,
verb: 'PATCH'
}
});
Self.setPassword = async function(id, newPassword) {
const models = Self.app.models;
const isWorker = await models.Worker.findById(id);
if (isWorker)
throw new Error(`Can't change the password of another worker`);
await models.Account.setPassword(id, newPassword);
};
};

View File

@ -1,4 +1,4 @@
const { models } = require('vn-loopback/server/server');
const {models} = require('vn-loopback/server/server');
describe('client extendedListFilter()', () => {
it('should return the clients matching the filter with a limit of 20 rows', async() => {
@ -138,7 +138,7 @@ describe('client extendedListFilter()', () => {
try {
const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: 1}}, args: {city: 'Silla'}};
const ctx = {req: {accessToken: {userId: 1}}, args: {city: 'Gotham'}};
const filter = {};
const result = await models.Client.extendedListFilter(ctx, filter, options);
@ -146,7 +146,7 @@ describe('client extendedListFilter()', () => {
const randomResultClient = result[randomIndex];
expect(result.length).toBeGreaterThanOrEqual(20);
expect(randomResultClient.city.toLowerCase()).toEqual('silla');
expect(randomResultClient.city.toLowerCase()).toEqual('gotham');
await tx.rollback();
} catch (e) {

View File

@ -0,0 +1,27 @@
const models = require('vn-loopback/server/server').models;
describe('Client setPassword', () => {
it('should throw an error the setPassword target is not just a client but a worker', async() => {
let error;
try {
await models.Client.setPassword(1106, 'newPass?');
} catch (e) {
error = e;
}
expect(error.message).toEqual(`Can't change the password of another worker`);
});
it('should change the password of the client', async() => {
let error;
try {
await models.Client.setPassword(1101, 't0pl3v3l.p455w0rd!');
} catch (e) {
error = e;
}
expect(error).toBeUndefined();
});
});

View File

@ -120,7 +120,6 @@ describe('client summary()', () => {
const result = await models.Client.summary(clientId, options);
expect(result.recovery.id).toEqual(3);
await tx.rollback();
} catch (e) {
await tx.rollback();

View File

@ -0,0 +1,58 @@
const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context');
describe('Client updateUser', () => {
const employeeId = 1;
const activeCtx = {
accessToken: {userId: employeeId},
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
const ctx = {
req: {accessToken: {userId: employeeId}},
args: {name: 'test', active: true}
};
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
it('should throw an error the target user is not just a client but a worker', async() => {
let error;
try {
const clientID = 1106;
await models.Client.updateUser(ctx, clientID);
} catch (e) {
error = e;
}
expect(error.message).toEqual(`Can't update the user details of another worker`);
});
it('should update the user data', async() => {
let error;
const tx = await models.Client.beginTransaction({});
try {
const options = {transaction: tx};
const clientID = 1105;
await models.Client.updateUser(ctx, clientID, options);
const client = await models.Account.findById(clientID, null, options);
expect(client.name).toEqual('test');
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
expect(error).toBeUndefined();
});
});

View File

@ -122,7 +122,6 @@ module.exports = Self => {
return clientModel.findOne(filter, options);
}
async function getRecoveries(recoveryModel, clientId, options) {
const filter = {
where: {

View File

@ -95,6 +95,10 @@ module.exports = Self => {
{
arg: 'despiteOfClient',
type: 'number'
},
{
arg: 'hasIncoterms',
type: 'boolean'
}
],
returns: {

View File

@ -0,0 +1,61 @@
module.exports = Self => {
Self.remoteMethodCtx('updateUser', {
description: 'Updates the user information',
accepts: [
{
arg: 'id',
type: 'number',
description: 'The user id',
http: {source: 'path'}
},
{
arg: 'name',
type: 'string',
description: 'the user name'
},
{
arg: 'email',
type: 'string',
description: 'the user email'
},
{
arg: 'active',
type: 'boolean',
description: 'whether the user is active or not'
},
],
http: {
path: '/:id/updateUser',
verb: 'PATCH'
}
});
Self.updateUser = async function(ctx, id, options) {
const models = Self.app.models;
let tx;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await models.Account.beginTransaction({});
myOptions.transaction = tx;
}
try {
const isWorker = await models.Worker.findById(id, null, myOptions);
if (isWorker)
throw new Error(`Can't update the user details of another worker`);
const user = await models.Account.findById(id, null, myOptions);
await user.updateAttributes(ctx.args, myOptions);
if (tx) await tx.commit();
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -51,6 +51,8 @@ module.exports = Self => {
const stmts = [];
const date = new Date();
date.setHours(0, 0, 0, 0);
const stmt = new ParameterizedSQL(
`SELECT *
FROM (
@ -58,12 +60,12 @@ module.exports = Self => {
DISTINCT c.id clientFk,
c.name clientName,
c.salesPersonFk,
u.nickname salesPersonName,
u.name salesPersonName,
d.amount,
co.created,
co.text observation,
uw.id workerFk,
uw.nickname workerName,
uw.name workerName,
c.creditInsurance,
d.defaulterSinced
FROM vn.defaulter d
@ -72,10 +74,10 @@ module.exports = Self => {
LEFT JOIN account.user u ON u.id = c.salesPersonFk
LEFT JOIN account.user uw ON uw.id = co.workerFk
WHERE
d.created = CURDATE()
d.created = ?
AND d.amount > 0
ORDER BY co.created DESC) d`
);
, [date]);
stmt.merge(conn.makeWhere(filter.where));
stmt.merge(`GROUP BY d.clientFk`);

View File

@ -27,13 +27,15 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const date = new Date();
date.setHours(0, 0, 0, 0);
const query = `
SELECT count(*) AS hasActiveRecovery
FROM vn.recovery
WHERE clientFk = ?
AND IFNULL(finished,CURDATE()) >= CURDATE();
AND IFNULL(finished, ?) >= ?;
`;
const [result] = await Self.rawSql(query, [id], myOptions);
const [result] = await Self.rawSql(query, [id, date, date], myOptions);
return result.hasActiveRecovery != 0;
};

View File

@ -32,10 +32,10 @@
"model": "Sample",
"foreignKey": "typeFk"
},
"worker": {
"user": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
"model": "Account",
"foreignKey": "userFk"
},
"account": {
"type": "belongsTo",

View File

@ -8,30 +8,32 @@ const LoopBackContext = require('loopback-context');
module.exports = Self => {
// Methods
require('../methods/client/getCard')(Self);
require('../methods/client/createWithUser')(Self);
require('../methods/client/hasCustomerRole')(Self);
require('../methods/client/canCreateTicket')(Self);
require('../methods/client/isValidClient')(Self);
require('../methods/client/addressesPropagateRe')(Self);
require('../methods/client/canBeInvoiced')(Self);
require('../methods/client/canCreateTicket')(Self);
require('../methods/client/checkDuplicated')(Self);
require('../methods/client/confirmTransaction')(Self);
require('../methods/client/consumption')(Self);
require('../methods/client/createAddress')(Self);
require('../methods/client/createReceipt')(Self);
require('../methods/client/createWithUser')(Self);
require('../methods/client/extendedListFilter')(Self);
require('../methods/client/getAverageInvoiced')(Self);
require('../methods/client/getCard')(Self);
require('../methods/client/getDebt')(Self);
require('../methods/client/getMana')(Self);
require('../methods/client/getAverageInvoiced')(Self);
require('../methods/client/summary')(Self);
require('../methods/client/updateFiscalData')(Self);
require('../methods/client/getTransactions')(Self);
require('../methods/client/confirmTransaction')(Self);
require('../methods/client/canBeInvoiced')(Self);
require('../methods/client/uploadFile')(Self);
require('../methods/client/hasCustomerRole')(Self);
require('../methods/client/isValidClient')(Self);
require('../methods/client/lastActiveTickets')(Self);
require('../methods/client/sendSms')(Self);
require('../methods/client/createAddress')(Self);
require('../methods/client/setPassword')(Self);
require('../methods/client/summary')(Self);
require('../methods/client/updateAddress')(Self);
require('../methods/client/consumption')(Self);
require('../methods/client/createReceipt')(Self);
require('../methods/client/updateFiscalData')(Self);
require('../methods/client/updatePortfolio')(Self);
require('../methods/client/checkDuplicated')(Self);
require('../methods/client/extendedListFilter')(Self);
require('../methods/client/updateUser')(Self);
require('../methods/client/uploadFile')(Self);
// Validations
@ -446,7 +448,7 @@ module.exports = Self => {
const app = require('vn-loopback/server/server');
app.on('started', function() {
let account = app.models.Account;
const account = app.models.Account;
account.observe('before save', async ctx => {
if (ctx.isNewInstance) return;
@ -454,14 +456,17 @@ module.exports = Self => {
});
account.observe('after save', async ctx => {
let changes = ctx.data || ctx.instance;
const changes = ctx.data || ctx.instance;
if (!ctx.isNewInstance && changes) {
let oldData = ctx.hookState.oldInstance;
let hasChanges = oldData.name != changes.name || oldData.active != changes.active;
const oldData = ctx.hookState.oldInstance;
const hasChanges = oldData.name != changes.name || oldData.active != changes.active;
if (!hasChanges) return;
let userId = ctx.options.accessToken.userId;
let logRecord = {
const isClient = await Self.app.models.Client.count({id: oldData.id});
if (isClient) {
const loopBackContext = LoopBackContext.getCurrentContext();
const userId = loopBackContext.active.accessToken.userId;
const logRecord = {
originFk: oldData.id,
userFk: userId,
action: 'update',
@ -471,6 +476,7 @@ module.exports = Self => {
};
await Self.app.models.ClientLog.create(logRecord);
}
}
});
});
};

View File

@ -98,6 +98,9 @@
"hasCoreVnh": {
"type": "boolean"
},
"hasIncoterms": {
"type": "boolean"
},
"isTaxDataChecked":{
"type": "boolean"
},

View File

@ -3,6 +3,7 @@
url="Defaulters/filter"
filter="::$ctrl.filter"
limit="20"
order="amount DESC"
data="defaulters"
auto-load="true">
</vn-crud-model>
@ -70,13 +71,13 @@
</th>
<th
vn-tooltip="Last observation date"
field="created"
shrink-datetime>
<span translate>Last observation D.</span>
field="created">
<span translate>L. O. Date</span>
</th>
<th
vn-tooltip="Credit insurance"
field="creditInsurance" >
field="creditInsurance"
shrink>
<span translate>Credit I.</span>
</th>
<th field="defaulterSinced">
@ -124,13 +125,13 @@
ng-model="defaulter.observation">
</vn-textarea>
</td>
<td shrink-datetime>
<td shrink-date>
<span class="chip {{::$ctrl.chipColor(defaulter.created)}}">
{{::defaulter.created | date: 'dd/MM/yyyy'}}
</span>
</td>
<td>{{::defaulter.creditInsurance | currency: 'EUR': 2}}</td>
<td>{{::defaulter.defaulterSinced | date: 'dd/MM/yyyy'}}</td>
<td shrink>{{::defaulter.creditInsurance | currency: 'EUR': 2}}</td>
<td shrink-date>{{::defaulter.defaulterSinced | date: 'dd/MM/yyyy'}}</td>
</tr>
</tbody>
</table>

View File

@ -26,7 +26,7 @@ export default class Controller extends Section {
url: 'Workers/activeWithInheritedRole',
where: `{role: 'salesPerson'}`,
searchFunction: '{firstName: $search}',
showField: 'nickname',
showField: 'name',
valueField: 'id',
}
},
@ -35,7 +35,7 @@ export default class Controller extends Section {
autocomplete: {
url: 'Workers/activeWithInheritedRole',
searchFunction: '{firstName: $search}',
showField: 'nickname',
showField: 'name',
valueField: 'id',
}
},
@ -53,16 +53,8 @@ export default class Controller extends Section {
}
]
};
}
get balanceDueTotal() {
let balanceDueTotal = 0;
const defaulters = this.$.model.data || [];
for (let defaulter of defaulters)
balanceDueTotal += defaulter.amount;
return balanceDueTotal;
this.getBalanceDueTotal();
}
get checked() {
@ -76,6 +68,18 @@ export default class Controller extends Section {
return checkedLines;
}
getBalanceDueTotal() {
this.$http.get('Defaulters/filter')
.then(res => {
if (!res.data) return 0;
this.balanceDueTotal = res.data.reduce(
(accumulator, currentValue) => {
return accumulator + (currentValue['amount'] || 0);
}, 0);
});
}
chipColor(date) {
const day = 24 * 60 * 60 * 1000;
const today = new Date();

View File

@ -36,17 +36,6 @@ describe('client defaulter', () => {
});
});
describe('balanceDueTotal() getter', () => {
it('should return balance due total', () => {
const data = controller.$.model.data;
const expectedAmount = data[0].amount + data[1].amount + data[2].amount;
const result = controller.balanceDueTotal;
expect(result).toEqual(expectedAmount);
});
});
describe('chipColor()', () => {
it('should return undefined when the date is the present', () => {
let today = new Date();
@ -93,6 +82,7 @@ describe('client defaulter', () => {
const params = [{text: controller.defaulter.observation, clientFk: data[1].clientFk}];
jest.spyOn(controller.vnApp, 'showMessage');
$httpBackend.expect('GET', `Defaulters/filter`).respond(200);
$httpBackend.expect('POST', `ClientObservations`, params).respond(200, params);
controller.onResponse();
@ -115,5 +105,17 @@ describe('client defaulter', () => {
expect(expr).toEqual({'d.clientFk': '5'});
});
});
describe('getBalanceDueTotal()', () => {
it('should return balance due total', () => {
const defaulters = controller.$.model.data;
$httpBackend.when('GET', `Defaulters/filter`).respond(defaulters);
controller.getBalanceDueTotal();
$httpBackend.flush();
expect(controller.balanceDueTotal).toEqual(875);
});
});
});
});

View File

@ -3,7 +3,7 @@ Add observation to all selected clients: Añadir observación a {{total}} client
Balance D.: Saldo V.
Credit I.: Crédito A.
Last observation: Última observación
Last observation D.: Fecha última O.
L. O. Date: Fecha Ú. O.
Last observation date: Fecha última observación
Search client: Buscar clientes
Worker who made the last observation: Trabajador que ha realizado la última observación

View File

@ -162,7 +162,7 @@
<td>{{::client.province | dashIfEmpty}}</td>
<td>{{::client.city | dashIfEmpty}}</td>
<td>{{::client.postcode | dashIfEmpty}}</td>
<td>{{::client.email | dashIfEmpty}}</td>
<td class="vn-w-xs" title="{{::client.email}}">{{::client.email | dashIfEmpty}}</td>
<td>{{::client.created | date:'dd/MM/yyyy'}}</td>
<td>{{::client.businessType | dashIfEmpty}}</td>
<td>{{::client.payMethod | dashIfEmpty}}</td>

View File

@ -185,6 +185,14 @@
vn-acl="salesAssistant">
</vn-check>
</vn-horizontal>
<vn-horizontal>
<vn-check
vn-one
label="Incoterms authorization"
ng-model="$ctrl.client.hasIncoterms"
vn-acl="administrative">
</vn-check>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit

View File

@ -10,3 +10,4 @@ Sage tax type: Tipo de impuesto Sage
Sage transaction type: Tipo de transacción Sage
Previous client: Cliente anterior
In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente
Incoterms authorization: Autorización incoterms

View File

@ -50,22 +50,26 @@
"component": "vn-client",
"description": "Clients",
"acl": ["employee"]
}, {
},
{
"url": "/index?q",
"state": "client.index",
"component": "vn-client-index",
"description": "Clients"
}, {
},
{
"url": "/create",
"state": "client.create",
"component": "vn-client-create",
"description": "New client"
}, {
},
{
"url": "/:id?sendSMS&phone&message",
"state": "client.card",
"abstract": true,
"component": "vn-client-card"
}, {
},
{
"url": "/summary",
"state": "client.card.summary",
"component": "vn-client-summary",
@ -73,7 +77,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/basic-data",
"state": "client.card.basicData",
"component": "vn-client-basic-data",
@ -81,7 +86,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/fiscal-data",
"state": "client.card.fiscalData",
"component": "vn-client-fiscal-data",
@ -89,7 +95,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/billing-data",
"state": "client.card.billingData",
"component": "vn-client-billing-data",
@ -97,12 +104,14 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/address",
"state": "client.card.address",
"component": "ui-view",
"abstract": true
}, {
},
{
"url": "/index?q",
"state": "client.card.address.index",
"component": "vn-client-address-index",
@ -110,7 +119,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/create",
"state": "client.card.address.create",
"component": "vn-client-address-create",
@ -118,12 +128,14 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/:addressId/edit",
"state": "client.card.address.edit",
"component": "vn-client-address-edit",
"description": "Edit address"
}, {
},
{
"url": "/web-access",
"state": "client.card.webAccess",
"component": "vn-client-web-access",
@ -131,12 +143,14 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/note",
"state": "client.card.note",
"component": "ui-view",
"abstract": true
}, {
},
{
"url": "/index",
"state": "client.card.note.index",
"component": "vn-client-note",
@ -144,17 +158,20 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/create",
"state": "client.card.note.create",
"component": "vn-note-create",
"description": "New note"
}, {
},
{
"url": "/credit",
"abstract": true,
"state": "client.card.credit",
"component": "ui-view"
}, {
},
{
"url": "/index",
"state": "client.card.credit.index",
"component": "vn-client-credit-index",
@ -162,7 +179,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/create",
"state": "client.card.credit.create",
"component": "vn-client-credit-create",
@ -171,12 +189,14 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/greuge",
"abstract": true,
"state": "client.card.greuge",
"component": "ui-view"
}, {
},
{
"url": "/index",
"state": "client.card.greuge.index",
"component": "vn-client-greuge-index",
@ -184,7 +204,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/create",
"state": "client.card.greuge.create",
"component": "vn-client-greuge-create",
@ -193,17 +214,20 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/mandate",
"state": "client.card.mandate",
"component": "vn-client-mandate",
"description": "Mandates"
}, {
},
{
"url": "/balance",
"abstract": true,
"state": "client.card.balance",
"component": "ui-view"
}, {
},
{
"url": "/index",
"state": "client.card.balance.index",
"component": "vn-client-balance-index",
@ -211,7 +235,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/create?payed&companyFk&bankFk&payedAmount",
"state": "client.card.balance.create",
"component": "vn-client-balance-create",
@ -219,12 +244,14 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/recovery",
"abstract": true,
"state": "client.card.recovery",
"component": "ui-view"
}, {
},
{
"url": "/index",
"state": "client.card.recovery.index",
"component": "vn-client-recovery-index",
@ -232,7 +259,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/create",
"state": "client.card.recovery.create",
"component": "vn-client-recovery-create",
@ -240,12 +268,14 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/credit-insurance",
"abstract": true,
"state": "client.card.creditInsurance",
"component": "ui-view"
}, {
},
{
"url": "/index",
"state": "client.card.creditInsurance.index",
"component": "vn-client-credit-insurance-index",
@ -253,7 +283,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/create",
"state": "client.card.creditInsurance.create",
"component": "vn-client-credit-insurance-create",
@ -262,13 +293,15 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/insurance",
"abstract": true,
"state": "client.card.creditInsurance.insurance",
"component": "ui-view",
"acl": ["insurance"]
}, {
},
{
"url": "/:classificationId/index",
"state": "client.card.creditInsurance.insurance.index",
"component": "vn-client-credit-insurance-insurance-index",
@ -277,7 +310,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/:classificationId/create",
"state": "client.card.creditInsurance.insurance.create",
"component": "vn-client-credit-insurance-insurance-create",
@ -286,7 +320,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/contact",
"state": "client.card.contact",
"component": "vn-client-contact",
@ -294,12 +329,14 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/sample",
"abstract": true,
"state": "client.card.sample",
"component": "ui-view"
}, {
},
{
"url": "/index",
"state": "client.card.sample.index",
"component": "vn-client-sample-index",
@ -307,7 +344,8 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/create",
"state": "client.card.sample.create",
"component": "vn-client-sample-create",
@ -315,12 +353,14 @@
"params": {
"client": "$ctrl.client"
}
}, {
},
{
"url": "/web-payment",
"state": "client.card.webPayment",
"component": "vn-client-web-payment",
"description": "Web Payment"
}, {
},
{
"url" : "/log",
"state": "client.card.log",
"component": "vn-client-log",

Some files were not shown because too many files have changed in this diff Show More