From b471f5148292efe3d619b0cb9eaee93dded9e82a Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 31 Dec 2019 10:38:19 +0100 Subject: [PATCH 01/95] refactor --- db/dump/dumpedFixtures.sql | 3 +- .../back/methods/client/byNameOrEmail.js | 47 +++++++++++++ modules/client/back/models/client.js | 1 + modules/client/front/fiscal-data/index.html | 2 +- modules/client/front/fiscal-data/index.js | 66 +++++++------------ 5 files changed, 75 insertions(+), 44 deletions(-) create mode 100644 modules/client/back/methods/client/byNameOrEmail.js diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 687f05518..8893590a8 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -119,7 +119,8 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','WRITE','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'WorkerCalendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'WorkerCalendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','employee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(193,'Zone','editPrices','WRITE','ALLOW','ROLE','deliveryBoss'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','employee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','WRITE','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','WRITE','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'WorkerCalendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'WorkerCalendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','employee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(193,'Zone','editPrices','WRITE','ALLOW','ROLE','deliveryBoss'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','employee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'), +(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; diff --git a/modules/client/back/methods/client/byNameOrEmail.js b/modules/client/back/methods/client/byNameOrEmail.js new file mode 100644 index 000000000..71fd72782 --- /dev/null +++ b/modules/client/back/methods/client/byNameOrEmail.js @@ -0,0 +1,47 @@ +module.exports = Self => { + Self.remoteMethod('byNameOrEmail', { + description: 'Returns the client with the matching phone or email', + accessType: 'READ', + accepts: [{ + arg: 'email', + type: 'String', + description: 'Find my matching client email', + required: false + }, + { + arg: 'phone', + type: 'String', + description: 'Find my matching client phone', + required: false + }], + returns: { + type: 'number', + root: true + }, + http: { + path: `/byNameOrEmail`, + verb: 'GET' + } + }); + + Self.byNameOrEmail = async(email, phone) => { + const models = Self.app.models; + + let match; + match = await Self.findOne({ + where: { + email: email + } + }); + + if (match) return match; + + match = await models.UserPhone.findOne({ + where: { + phone: phone + } + }); + + return await Self.findById(match.userFk); + }; +}; diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 73626b408..552c99e18 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -24,6 +24,7 @@ module.exports = Self => { require('../methods/client/canBeInvoiced')(Self); require('../methods/client/uploadFile')(Self); require('../methods/client/lastActiveTickets')(Self); + require('../methods/client/byNameOrEmail')(Self); // Validations diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index 524873f86..be22556df 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -148,5 +148,5 @@ vn-id="propagate-isEqualizated" question="You changed the equalization tax" message="Do you want to spread the change?" - on-response="$ctrl.returnDialogEt($response)"> + on-accept="$ctrl.onAcceptEt()"> diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index 8a2d85109..57434b4eb 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -1,62 +1,44 @@ import ngModule from '../module'; +import Component from 'core/lib/component'; -export default class Controller { - constructor($scope, $http, vnApp, $translate) { - this.$ = $scope; - this.$http = $http; - this.vnApp = vnApp; - this.translate = $translate; - this.isEqualizated = undefined; - this.copyData(); - } - - $onChanges() { - this.copyData(); - } - - copyData() { - if (this.client) - this.isEqualizated = this.client.isEqualizated; - } - - buyerHaspermissions() { - if (!this.client) return true; - return !this.client.isTaxDataChecked; - } - +export default class Controller extends Component { onSubmit() { - if (this.isEqualizated != this.client.isEqualizated) { - this.oldHasToInvoiceByAddress = this.client.hasToInvoiceByAddress; + const orgData = this.$.watcher.orgData; + if (orgData.isEqualizated != this.client.isEqualizated) this.client.hasToInvoiceByAddress = false; + + if (!orgData.isTaxDataChecked && this.client.isTaxDataChecked) { + const serializedParams = {email: this.client.email, phone: 111}; + const query = `Clients/byNameOrEmail?filter=${serializedParams}`; + this.$http.get(query).then(res => { + console.log(res); + }); } - return this.$.watcher.submit().then( - () => this.checkEtChanges()); + return this.checkEtChanges().then( + () => this.$.watcher.submit()); } checkEtChanges() { - let equals = this.isEqualizated == this.client.isEqualizated; - this.isEqualizated = this.client.isEqualizated; + const orgData = this.$.watcher.orgData; + const equalizatedHasChanged = orgData.isEqualizated != this.client.isEqualizated; - if (!equals && !this.oldHasToInvoiceByAddress) + if (equalizatedHasChanged && !orgData.hasToInvoiceByAddress) this.$.propagateIsEqualizated.show(); - else if (!equals) - this.returnDialogEt('accept'); + else if (equalizatedHasChanged) + return this.onAcceptEt(); - delete this.oldHasToInvoiceByAddress; + return this.$q.resolve(); } - returnDialogEt(response) { - if (response === 'accept') { - this.$http.patch(`Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.isEqualizated}).then( - () => this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded')) - ); - } + onAcceptEt() { + const query = `Clients/${this.client.id}/addressesPropagateRe`; + return this.$http.patch(query, {isEqualizated: this.client.isEqualizated}).then( + () => this.vnApp.showMessage(this.$translate.instant('Equivalent tax spreaded')) + ); } } -Controller.$inject = ['$scope', '$http', 'vnApp', '$translate']; - ngModule.component('vnClientFiscalData', { template: require('./index.html'), controller: Controller, From dd9cd73dca0e6ecd4d6e549d0f73c237233a69bd Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 29 Jan 2020 14:54:07 +0100 Subject: [PATCH 02/95] #1798 Extensiones que trabajen sobre componentes --- e2e/helpers/extensions.js | 88 ++++++++++++------- e2e/helpers/selectors.js | 2 +- .../02-client-module/01_create_client.spec.js | 6 +- .../02_edit_basic_data.spec.js | 18 ++-- .../03_edit_fiscal_data.spec.js | 16 ++-- .../04_edit_billing_data.spec.js | 18 ++-- .../07_edit_web_access.spec.js | 2 +- .../02-client-module/10_add_greuge.spec.js | 2 +- .../12_lock_of_verified_data.spec.js | 6 +- e2e/paths/02-client-module/13_log.spec.js | 2 +- e2e/paths/02-client-module/14_balance.spec.js | 8 +- .../02-client-module/15_user_config.spec.js | 30 +++---- .../04-item-module/02_basic_data.spec.js | 14 +-- e2e/paths/04-item-module/03_tax.spec.js | 10 +-- e2e/paths/04-item-module/04_tags.spec.js | 18 ++-- e2e/paths/04-item-module/05_niche.spec.js | 16 ++-- e2e/paths/04-item-module/06_botanical.spec.js | 20 ++--- e2e/paths/04-item-module/07_barcode.spec.js | 4 +- .../08_create_and_clone.spec.js | 8 +- .../04-item-module/09_regularize.spec.js | 4 +- .../05-ticket-module/01_observations.spec.js | 4 +- .../05-ticket-module/04_packages.spec.js | 8 +- .../05_tracking_state.spec.js | 2 +- .../06_basic_data_steps.spec.js | 6 +- e2e/paths/05-ticket-module/09_weekly.spec.js | 4 +- .../05-ticket-module/13_services.spec.js | 8 +- .../15_create_ticket_from_client.spec.js | 4 +- .../06-claim-module/01_basic_data.spec.js | 15 ++-- .../06-claim-module/02_development.spec.js | 20 ++--- .../06-claim-module/04_claim_action.spec.js | 2 +- .../01_edit_basic_data.spec.js | 4 +- .../08-route-module/02_basic_data.spec.js | 8 +- 32 files changed, 203 insertions(+), 174 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 13ec7099b..045ca65c1 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -27,9 +27,9 @@ let actions = { let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]'; await this.waitToClick('#user'); - await this.wait(langSelector); - let lang = await this.waitToGetProperty(`${langSelector} input`, 'value'); + await this.waitForSelector(`${langSelector} input`, {}); + let lang = await this.waitToGetProperty(langSelector, 'value'); if (lang !== 'English') await this.autocompleteSearch(langSelector, 'English'); @@ -38,12 +38,12 @@ let actions = { }, doLogin: async function(userName, password = 'nightmare') { - await this.wait(`vn-login [ng-model="$ctrl.user"]`); - await this.clearInput(`vn-login [ng-model="$ctrl.user"]`); - await this.write(`vn-login [ng-model="$ctrl.user"]`, userName); - await this.clearInput(`vn-login [ng-model="$ctrl.password"]`); - await this.write(`vn-login [ng-model="$ctrl.password"]`, password); - await this.click('vn-login button[type=submit]'); + await this.waitForSelector(`vn-login vn-textfield[ng-model="$ctrl.user"]`, {visible: true}); + await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.user"]`); + await this.write(`vn-login vn-textfield[ng-model="$ctrl.user"]`, userName); + await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.password"]`); + await this.write(`vn-login vn-textfield[ng-model="$ctrl.password"]`, password); + await this.waitToClick('vn-login button[type=submit]'); }, login: async function(userName) { @@ -59,7 +59,7 @@ let actions = { } await this.doLogin(userName); - await this.wait(() => { + await this.waitForFunction(() => { return document.location.hash === '#!/'; }, {}); await this.changeLanguageToEnglish(); @@ -104,14 +104,14 @@ let actions = { }, clearTextarea: async function(selector) { - await this.wait(selector); + await this.waitForSelector(selector, {visible: true}); await this.evaluate(inputSelector => { - return document.querySelector(inputSelector).value = ''; + return document.querySelector(`${inputSelector} textarea`).value = ''; }, selector); }, clearInput: async function(selector) { - await this.wait(selector); + await this.waitForSelector(selector, {visible: true}); let field = await this.evaluate(selector => { return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field; }, selector); @@ -136,7 +136,7 @@ let actions = { }, waitPropertyLength: async function(selector, property, minLength) { - await this.wait((selector, property, minLength) => { + await this.waitForFunction((selector, property, minLength) => { const element = document.querySelector(selector); return element && element[property] != null && element[property] !== '' && element[property].length >= minLength; }, {}, selector, property, minLength); @@ -152,22 +152,27 @@ let actions = { }, waitToGetProperty: async function(selector, property) { + let builtSelector = selector; + if (property != 'innerText') + builtSelector = await this.selectorFormater(selector); + try { await this.waitForFunction((selector, property) => { const element = document.querySelector(selector); return element && element[property] != null && element[property] !== ''; - }, {}, selector, property); - return await this.getProperty(selector, property); + }, {}, builtSelector, property); + return await this.getProperty(builtSelector, property); } catch (error) { - throw new Error(`couldn't get property: ${property} of ${selector}`); + throw new Error(`couldn't get property: ${property} of ${builtSelector}, ${error}`); } }, write: async function(selector, text) { + let builtSelector = await this.selectorFormater(selector); await this.waitForSelector(selector, {}); - await this.type(`${selector} input`, text); - await this.waitForTextInInput(selector, text); + await this.type(builtSelector, text); + await this.waitForTextInField(selector, text); }, waitToClick: async function(selector) { @@ -280,11 +285,27 @@ let actions = { }, {}, selector, text); }, - waitForTextInInput: async function(selector, text) { - await this.wait(selector); - return await this.wait((selector, text) => { - return document.querySelector(`${selector} input`).value.toLowerCase().includes(text.toLowerCase()); - }, {}, selector, text); + selectorFormater: async function(selector) { + let builtSelector = `${selector} input`; + + if (selector.includes('vn-autocomplete')) + return builtSelector = `${selector} input`; + + if (selector.includes('vn-textarea')) + return builtSelector = `${selector} textarea`; + + if (selector.includes('vn-textfield')) + return builtSelector = `${selector} input`; + + return builtSelector; + }, + + waitForTextInField: async function(selector, text) { + let builtSelector = await this.selectorFormater(selector); + await this.waitForSelector(builtSelector); + return await this.waitForFunction((selector, text) => { + return document.querySelector(selector).value.toLowerCase().includes(text.toLowerCase()); + }, {}, builtSelector, text); }, waitForInnerText: async function(selector) { @@ -305,9 +326,13 @@ let actions = { }, waitForURL: async function(hashURL) { - await this.waitForFunction(expectedHash => { - return document.location.hash.includes(expectedHash); - }, {}, hashURL); + try { + await this.waitForFunction(expectedHash => { + return document.location.hash.includes(expectedHash); + }, {}, hashURL); + } catch (error) { + throw new Error(`failed to reach URL containing: ${hashURL}`); + } }, hideSnackbar: async function() { @@ -362,15 +387,16 @@ let actions = { }, autocompleteSearch: async function(selector, searchValue) { + let builtSelector = await this.selectorFormater(selector); try { - await this.waitToClick(`${selector} input`); + await this.waitToClick(builtSelector); await this.waitForSelector(selector => { document .querySelector(`${selector} vn-drop-down`).$ctrl.content .querySelectorAll('li'); }, selector); - await this.write(`.vn-drop-down.shown`, searchValue); + await this.type(`.vn-drop-down.shown`, searchValue); await this.waitForFunction((selector, searchValue) => { let element = document .querySelector(`${selector} vn-drop-down`).$ctrl.content @@ -381,11 +407,11 @@ let actions = { await this.keyboard.press('Enter'); await this.waitForFunction((selector, searchValue) => { - return document.querySelector(`${selector} input`).value.toLowerCase() + return document.querySelector(selector).value.toLowerCase() .includes(searchValue.toLowerCase()); - }, {}, selector, searchValue); + }, {}, builtSelector, searchValue); } catch (error) { - throw new Error(`${selector} failed to autocomplete ${searchValue}! ${error}`); + throw new Error(`${builtSelector} failed to autocomplete ${searchValue}! ${error}`); } await this.waitForMutation(`.vn-drop-down`, 'childList'); }, diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index f6bdcf1b7..32372b853 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -542,7 +542,7 @@ export default { claimBasicData: { claimStateAutocomplete: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]', responsabilityInputRange: 'vn-range', - observationInput: 'vn-textarea[ng-model="$ctrl.claim.observation"] textarea', + observationInput: 'vn-textarea[ng-model="$ctrl.claim.observation"]', saveButton: `button[type=submit]` }, claimDetail: { diff --git a/e2e/paths/02-client-module/01_create_client.spec.js b/e2e/paths/02-client-module/01_create_client.spec.js index 01a30da13..837b5aeb6 100644 --- a/e2e/paths/02-client-module/01_create_client.spec.js +++ b/e2e/paths/02-client-module/01_create_client.spec.js @@ -79,13 +79,13 @@ describe('Client create path', async() => { it(`should check for autocompleted city, province and country`, async() => { const clientCity = await page - .waitToGetProperty(`${selectors.createClientView.city} input`, 'value'); + .waitToGetProperty(selectors.createClientView.city, 'value'); const clientProvince = await page - .waitToGetProperty(`${selectors.createClientView.province} input`, 'value'); + .waitToGetProperty(selectors.createClientView.province, 'value'); const clientCountry = await page - .waitToGetProperty(`${selectors.createClientView.country} input`, 'value'); + .waitToGetProperty(selectors.createClientView.country, 'value'); expect(clientCity).toEqual('Valencia'); expect(clientProvince).toEqual('Province one'); diff --git a/e2e/paths/02-client-module/02_edit_basic_data.spec.js b/e2e/paths/02-client-module/02_edit_basic_data.spec.js index 94b617ed9..4bf2d0120 100644 --- a/e2e/paths/02-client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client-module/02_edit_basic_data.spec.js @@ -42,28 +42,28 @@ describe('Client Edit basicData path', () => { it('should confirm the name have been edited', async() => { await page.reloadSection('client.card.basicData'); - const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientBasicData.nameInput, 'value'); expect(result).toEqual('Ptonomy Wallace'); }); it('should confirm the contact name have been edited', async() => { const result = await page - .waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value'); + .waitToGetProperty(selectors.clientBasicData.contactInput, 'value'); expect(result).toEqual('David Haller'); }); it('should confirm the email have been edited', async() => { const result = await page - .waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value'); + .waitToGetProperty(selectors.clientBasicData.emailInput, 'value'); expect(result).toEqual('PWallace@verdnatura.es'); }); it('should confirm the channel have been selected', async() => { const result = await page - .waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.clientBasicData.channelAutocomplete, 'value'); expect(result).toEqual('Rumors on the streets'); }); @@ -102,35 +102,35 @@ describe('Client Edit basicData path', () => { it('should now confirm the name have been edited', async() => { await page.reloadSection('client.card.basicData'); - const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientBasicData.nameInput, 'value'); expect(result).toEqual('Ororo Munroe'); }); it('should now confirm the contact name have been edited', async() => { const result = await page - .waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value'); + .waitToGetProperty(selectors.clientBasicData.contactInput, 'value'); expect(result).toEqual('Black Panther'); }); it('should now confirm the email have been edited', async() => { const result = await page - .waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value'); + .waitToGetProperty(selectors.clientBasicData.emailInput, 'value'); expect(result).toEqual('Storm@verdnatura.es'); }); it('should confirm the sales person have been selected', async() => { const result = await page - .waitToGetProperty(`${selectors.clientBasicData.salesPersonAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.clientBasicData.salesPersonAutocomplete, 'value'); expect(result).toEqual('replenisherNick'); }); it('should now confirm the channel have been selected', async() => { const result = await page - .waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.clientBasicData.channelAutocomplete, 'value'); expect(result).toEqual('Metropolis newspaper'); }); diff --git a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js index 25127e314..d9e6e775c 100644 --- a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js @@ -167,44 +167,44 @@ describe('Client Edit fiscalData path', () => { it('should confirm its name have been edited', async() => { await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); expect(result).toEqual('SMASH'); }); it('should confirm the fiscal id have been edited', async() => { - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.fiscalIdInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value'); expect(result).toEqual('94980061C'); }); it('should confirm the address have been edited', async() => { - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.addressInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.addressInput, 'value'); expect(result).toEqual('Somewhere edited'); }); it('should confirm the postcode have been edited', async() => { - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.postcodeInput, 'value'); expect(result).toContain('46000'); }); it('should confirm the city have been autocompleted', async() => { - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.cityInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.cityInput, 'value'); expect(result).toEqual('Valencia'); }); it(`should confirm the province have been autocompleted`, async() => { - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.provinceAutocomplete, 'value'); expect(result).toEqual('Province one'); }); it('should confirm the country have been autocompleted', async() => { - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.countryAutocomplete, 'value'); expect(result).toEqual('España'); }); @@ -269,7 +269,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.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla'); + await page.waitForTextInField(selectors.clientAddresses.cityInput, 'Silla'); await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox); await page.waitToClick(selectors.clientAddresses.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js index 4b6d83651..529dd9e35 100644 --- a/e2e/paths/02-client-module/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client-module/04_edit_billing_data.spec.js @@ -21,7 +21,7 @@ describe('Client Edit billing data path', () => { await page.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM'); await page.clearInput(selectors.clientBillingData.dueDayInput); await page.write(selectors.clientBillingData.dueDayInput, '60'); - await page.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60'); + await page.waitForTextInField(selectors.clientBillingData.dueDayInput, '60'); await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox); await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox); await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox); @@ -37,14 +37,14 @@ describe('Client Edit billing data path', () => { await page.write(selectors.clientBillingData.newBankEntityCode, '9999'); await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT'); await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton); - await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'Gotham City Bank'); - let newcode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); + await page.waitForTextInField(selectors.clientBillingData.swiftBicAutocomplete, 'Gotham City Bank'); + let newcode = await page.waitToGetProperty(selectors.clientBillingData.swiftBicAutocomplete, 'value'); expect(newcode).toEqual('GTHMCT Gotham City Bank'); }); it(`should confirm the IBAN pay method was sucessfully saved`, async() => { - let payMethod = await page.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value'); + let payMethod = await page.waitToGetProperty(selectors.clientBillingData.payMethodAutocomplete, 'value'); expect(payMethod).toEqual('PayMethod with IBAN'); }); @@ -53,8 +53,8 @@ describe('Client Edit billing data path', () => { await page.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332'); await page.keyboard.press('Tab'); await page.keyboard.press('Tab'); - await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'caixesbb'); - let automaticCode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); + await page.waitForTextInField(selectors.clientBillingData.swiftBicAutocomplete, 'caixesbb'); + let automaticCode = await page.waitToGetProperty(selectors.clientBillingData.swiftBicAutocomplete, 'value'); expect(automaticCode).toEqual('CAIXESBB Caixa Bank'); }); @@ -69,19 +69,19 @@ describe('Client Edit billing data path', () => { }); it('should confirm the due day have been edited', async() => { - let dueDate = await page.waitToGetProperty(`${selectors.clientBillingData.dueDayInput} input`, 'value'); + let dueDate = await page.waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value'); expect(dueDate).toEqual('60'); }); it('should confirm the IBAN was saved', async() => { - let IBAN = await page.waitToGetProperty(`${selectors.clientBillingData.IBANInput} input`, 'value'); + let IBAN = await page.waitToGetProperty(selectors.clientBillingData.IBANInput, 'value'); expect(IBAN).toEqual('ES9121000418450200051332'); }); it('should confirm the swift / BIC code was saved', async() => { - let code = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value'); + let code = await page.waitToGetProperty(selectors.clientBillingData.swiftBicAutocomplete, 'value'); expect(code).toEqual('CAIXESBB Caixa Bank'); }); diff --git a/e2e/paths/02-client-module/07_edit_web_access.spec.js b/e2e/paths/02-client-module/07_edit_web_access.spec.js index 835c8c25e..b01f2a9d4 100644 --- a/e2e/paths/02-client-module/07_edit_web_access.spec.js +++ b/e2e/paths/02-client-module/07_edit_web_access.spec.js @@ -37,7 +37,7 @@ describe('Client Edit web access path', () => { }); it('should confirm web access name have been updated', async() => { - const result = await page.waitToGetProperty(`${selectors.clientWebAccess.userNameInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value'); expect(result).toEqual('Hulk'); }); diff --git a/e2e/paths/02-client-module/10_add_greuge.spec.js b/e2e/paths/02-client-module/10_add_greuge.spec.js index 3a127ab12..dcc8b9273 100644 --- a/e2e/paths/02-client-module/10_add_greuge.spec.js +++ b/e2e/paths/02-client-module/10_add_greuge.spec.js @@ -34,7 +34,7 @@ describe('Client Add greuge path', () => { it(`should create a new greuge with all its data`, async() => { await page.write(selectors.clientGreuge.amountInput, '999'); - await page.waitForTextInInput(selectors.clientGreuge.amountInput, '999'); + await page.waitForTextInField(selectors.clientGreuge.amountInput, '999'); await page.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!'); await page.waitToClick(selectors.clientGreuge.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js index ddb5f6d04..df4614f24 100644 --- a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js @@ -37,7 +37,7 @@ describe('Client lock verified data path', () => { it('should confirm the social name have been edited', async() => { await page.reloadSection('client.card.fiscalData'); - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); expect(result).toEqual('Captain America Civil War'); }); @@ -83,7 +83,7 @@ describe('Client lock verified data path', () => { it('should again confirm the social name have been edited', async() => { await page.reloadSection('client.card.fiscalData'); - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); expect(result).toEqual('Ant man and the Wasp'); }); @@ -137,7 +137,7 @@ describe('Client lock verified data path', () => { it('should now confirm the social name have been edited once and for all', async() => { await page.reloadSection('client.card.fiscalData'); - const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); expect(result).toEqual('new social name edition'); }); diff --git a/e2e/paths/02-client-module/13_log.spec.js b/e2e/paths/02-client-module/13_log.spec.js index 4b09b0500..03e1df49d 100644 --- a/e2e/paths/02-client-module/13_log.spec.js +++ b/e2e/paths/02-client-module/13_log.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -describe('Client log path', () => { +fdescribe('Client log path', () => { let browser; let page; beforeAll(async() => { diff --git a/e2e/paths/02-client-module/14_balance.spec.js b/e2e/paths/02-client-module/14_balance.spec.js index 37b118ef2..660704d54 100644 --- a/e2e/paths/02-client-module/14_balance.spec.js +++ b/e2e/paths/02-client-module/14_balance.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -describe('Client balance path', () => { +fdescribe('Client balance path', () => { let browser; let page; beforeAll(async() => { @@ -9,7 +9,7 @@ describe('Client balance path', () => { page = browser.page; await page.loginAndModule('administrative', 'client'); await page.accessToSearchResult('Petter Parker'); - }, 30000); + }); afterAll(async() => { await browser.close(); @@ -25,7 +25,7 @@ describe('Client balance path', () => { it('should access to the balance section to check the data shown matches the local settings', async() => { await page.accessToSection('client.card.balance.index'); - let result = await page.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value'); + let result = await page.waitToGetProperty(selectors.clientBalance.companyAutocomplete, 'value'); expect(result).toEqual('CCs'); }); @@ -63,7 +63,7 @@ describe('Client balance path', () => { it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => { await page.waitForSpinnerLoad(); let company = await page - .waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.clientBalance.companyAutocomplete, 'value'); let firstBalanceLine = await page .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); diff --git a/e2e/paths/02-client-module/15_user_config.spec.js b/e2e/paths/02-client-module/15_user_config.spec.js index cb91b1e37..48e9b7c9d 100644 --- a/e2e/paths/02-client-module/15_user_config.spec.js +++ b/e2e/paths/02-client-module/15_user_config.spec.js @@ -22,20 +22,20 @@ describe('User config', () => { await page.waitToClick(selectors.globalItems.userMenuButton); let userLocalWarehouse = await page - .getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value'); let userLocalBank = await page - .getProperty(`${selectors.globalItems.userLocalBank} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalBank, 'value'); let userLocalCompany = await page - .getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalCompany, 'value'); let userWarehouse = await page - .waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userWarehouse, 'value'); let userCompany = await page - .waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userCompany, 'value'); expect(userLocalWarehouse).toEqual(''); expect(userLocalBank).toEqual(''); @@ -53,19 +53,19 @@ describe('User config', () => { it('should open the user config form to check the settings', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); let userLocalWarehouse = await page - .getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value'); let userLocalBank = await page - .getProperty(`${selectors.globalItems.userLocalBank} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalBank, 'value'); let userLocalCompany = await page - .getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalCompany, 'value'); let userWarehouse = await page - .waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userWarehouse, 'value'); let userCompany = await page - .waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userCompany, 'value'); expect(userLocalWarehouse).toEqual(''); expect(userLocalBank).toEqual(''); @@ -92,19 +92,19 @@ describe('User config', () => { it('should again open the user config form to check the local settings', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); let userLocalWarehouse = await page - .waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value'); let userLocalBank = await page - .waitToGetProperty(`${selectors.globalItems.userLocalBank} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalBank, 'value'); let userLocalCompany = await page - .waitToGetProperty(`${selectors.globalItems.userLocalCompany} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalCompany, 'value'); let userWarehouse = await page - .waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userWarehouse, 'value'); let userCompany = await page - .waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userCompany, 'value'); expect(userLocalWarehouse).toContain('Warehouse Four'); expect(userLocalBank).toContain('Pay on receipt'); diff --git a/e2e/paths/04-item-module/02_basic_data.spec.js b/e2e/paths/04-item-module/02_basic_data.spec.js index ab4b224f0..a0ab8dc73 100644 --- a/e2e/paths/04-item-module/02_basic_data.spec.js +++ b/e2e/paths/04-item-module/02_basic_data.spec.js @@ -42,49 +42,49 @@ describe('Item Edit basic data path', () => { it(`should confirm the item name was edited`, async() => { await page.reloadSection('item.card.basicData'); await page.waitForContentLoaded(); - const result = await page.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value'); + const result = await page.waitToGetProperty(selectors.itemBasicData.nameInput, 'value'); expect(result).toEqual('Rose of Purity'); }); it(`should confirm the item type was edited`, async() => { const result = await page - .waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.typeAutocomplete, 'value'); expect(result).toEqual('Anthurium'); }); it(`should confirm the item intrastad was edited`, async() => { const result = await page - .waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.intrastatAutocomplete, 'value'); expect(result).toEqual('5080000 Coral y materiales similares'); }); it(`should confirm the item relevancy was edited`, async() => { const result = await page - .waitToGetProperty(`${selectors.itemBasicData.relevancyInput} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value'); expect(result).toEqual('1'); }); it(`should confirm the item origin was edited`, async() => { const result = await page - .waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.originAutocomplete, 'value'); expect(result).toEqual('Spain'); }); it(`should confirm the item expence was edited`, async() => { const result = await page - .waitToGetProperty(`${selectors.itemBasicData.expenseAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.expenseAutocomplete, 'value'); expect(result).toEqual('Alquiler VNH'); }); it(`should confirm the item long name was edited`, async() => { const result = await page - .waitToGetProperty(`${selectors.itemBasicData.longNameInput} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.longNameInput, 'value'); expect(result).toEqual('RS Rose of Purity'); }); diff --git a/e2e/paths/04-item-module/03_tax.spec.js b/e2e/paths/04-item-module/03_tax.spec.js index 3f3b387d4..9892f92e7 100644 --- a/e2e/paths/04-item-module/03_tax.spec.js +++ b/e2e/paths/04-item-module/03_tax.spec.js @@ -28,35 +28,35 @@ describe('Item edit tax path', () => { it(`should confirm the first item tax class was edited`, async() => { await page.reloadSection('item.card.tax'); - const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value'); + const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value'); expect(firstVatType).toEqual('General VAT'); }); it(`should confirm the second item tax class was edited`, async() => { const secondVatType = await page - .waitToGetProperty(`${selectors.itemTax.secondClassAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemTax.secondClassAutocomplete, 'value'); expect(secondVatType).toEqual('General VAT'); }); it(`should confirm the third item tax class was edited`, async() => { const thirdVatType = await page - .waitToGetProperty(`${selectors.itemTax.thirdClassAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemTax.thirdClassAutocomplete, 'value'); expect(thirdVatType).toEqual('General VAT'); }); it(`should edit the first class without saving the form`, async() => { await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT'); - const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value'); + const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value'); expect(firstVatType).toEqual('Reduced VAT'); }); it(`should now click the undo changes button and see the changes works`, async() => { await page.waitToClick(selectors.itemTax.undoChangesButton); - const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value'); + const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value'); expect(firstVatType).toEqual('General VAT'); }); diff --git a/e2e/paths/04-item-module/04_tags.spec.js b/e2e/paths/04-item-module/04_tags.spec.js index 1665d3bab..d25e63903 100644 --- a/e2e/paths/04-item-module/04_tags.spec.js +++ b/e2e/paths/04-item-module/04_tags.spec.js @@ -32,30 +32,30 @@ describe('Item create tags path', () => { it(`should confirm the fourth row data is the expected one`, async() => { await page.reloadSection('item.card.tags'); await page.wait('vn-item-tags'); - let result = await page.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value'); + let result = await page.waitToGetProperty(selectors.itemTags.fourthTagAutocomplete, 'value'); expect(result).toEqual('Ancho de la base'); result = await page - .waitToGetProperty(`${selectors.itemTags.fourthValueInput} input`, 'value'); + .waitToGetProperty(selectors.itemTags.fourthValueInput, 'value'); expect(result).toEqual('50'); result = await page - .waitToGetProperty(`${selectors.itemTags.fourthRelevancyInput} input`, 'value'); + .waitToGetProperty(selectors.itemTags.fourthRelevancyInput, 'value'); expect(result).toEqual('4'); }); it(`should confirm the fifth row data is the expected one`, async() => { let tag = await page - .waitToGetProperty(`${selectors.itemTags.fifthTagAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemTags.fifthTagAutocomplete, 'value'); let value = await page - .waitToGetProperty(`${selectors.itemTags.fifthValueInput} input`, 'value'); + .waitToGetProperty(selectors.itemTags.fifthValueInput, 'value'); let relevancy = await page - .waitToGetProperty(`${selectors.itemTags.fifthRelevancyInput} input`, 'value'); + .waitToGetProperty(selectors.itemTags.fifthRelevancyInput, 'value'); expect(tag).toEqual('Color'); expect(value).toEqual('Brown'); @@ -64,13 +64,13 @@ describe('Item create tags path', () => { it(`should confirm the sixth row data is the expected one`, async() => { let tag = await page - .waitToGetProperty(`${selectors.itemTags.sixthTagAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemTags.sixthTagAutocomplete, 'value'); let value = await page - .waitToGetProperty(`${selectors.itemTags.sixthValueInput} input`, 'value'); + .waitToGetProperty(selectors.itemTags.sixthValueInput, 'value'); let relevancy = await page - .waitToGetProperty(`${selectors.itemTags.sixthRelevancyInput} input`, 'value'); + .waitToGetProperty(selectors.itemTags.sixthRelevancyInput, 'value'); expect(tag).toEqual('Categoria'); expect(value).toEqual('+1 precission'); diff --git a/e2e/paths/04-item-module/05_niche.spec.js b/e2e/paths/04-item-module/05_niche.spec.js index 345b5eb8c..42c0652df 100644 --- a/e2e/paths/04-item-module/05_niche.spec.js +++ b/e2e/paths/04-item-module/05_niche.spec.js @@ -17,7 +17,7 @@ describe('Item create niche path', () => { }); it(`should click create a new niche and delete a former one`, async() => { - await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One'); + await page.waitForTextInField(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One'); await page.waitToClick(selectors.itemNiches.addNicheButton); await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton); await page.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two'); @@ -30,36 +30,36 @@ describe('Item create niche path', () => { it(`should confirm the first niche is the expected one`, async() => { await page.reloadSection('item.card.niche'); - await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One'); + await page.waitForTextInField(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One'); let result = await page - .waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemNiches.firstWarehouseAutocomplete, 'value'); expect(result).toEqual('Warehouse One'); result = await page - .waitToGetProperty(`${selectors.itemNiches.firstCodeInput} input`, 'value'); + .waitToGetProperty(selectors.itemNiches.firstCodeInput, 'value'); expect(result).toEqual('A1'); }); it(`should confirm the second niche is the expected one`, async() => { let result = await page - .waitToGetProperty(`${selectors.itemNiches.secondWarehouseAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemNiches.secondWarehouseAutocomplete, 'value'); expect(result).toEqual('Warehouse Three'); result = await page - .waitToGetProperty(`${selectors.itemNiches.secondCodeInput} input`, 'value'); + .waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value'); expect(result).toEqual('A3'); }); it(`should confirm the third niche is the expected one`, async() => { let result = await page - .waitToGetProperty(`${selectors.itemNiches.thirdWarehouseAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemNiches.thirdWarehouseAutocomplete, 'value'); expect(result).toEqual('Warehouse Two'); result = await page - .waitToGetProperty(`${selectors.itemNiches.thirdCodeInput} input`, 'value'); + .waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value'); expect(result).toEqual('A4'); }); diff --git a/e2e/paths/04-item-module/06_botanical.spec.js b/e2e/paths/04-item-module/06_botanical.spec.js index 407dd6fc7..c3b1955f7 100644 --- a/e2e/paths/04-item-module/06_botanical.spec.js +++ b/e2e/paths/04-item-module/06_botanical.spec.js @@ -28,24 +28,24 @@ describe('Item Create botanical path', () => { it(`should confirm the botanical for the item was created`, async() => { await page.reloadSection('item.card.botanical'); - await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata'); + await page.waitForTextInField(selectors.itemBotanical.botanicalInput, 'Cicuta maculata'); const result = await page - .waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value'); + .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value'); expect(result).toEqual('Cicuta maculata'); }); it(`should confirm the Genus for the item was created`, async() => { - await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abelia'); + await page.waitForTextInField(selectors.itemBotanical.genusAutocomplete, 'Abelia'); const result = await page - .waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBotanical.genusAutocomplete, 'value'); expect(result).toEqual('Abelia'); }); it(`should confirm the Species for the item was created`, async() => { const result = await page - .waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBotanical.speciesAutocomplete, 'value'); expect(result).toEqual('dealbata'); }); @@ -63,24 +63,24 @@ describe('Item Create botanical path', () => { it(`should confirm the botanical for the item was edited`, async() => { await page.reloadSection('item.card.botanical'); - await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp'); + await page.waitForTextInField(selectors.itemBotanical.botanicalInput, 'Herp Derp'); const result = await page - .waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value'); + .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value'); expect(result).toEqual('Herp Derp'); }); it(`should confirm the Genus for the item was edited`, async() => { - await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abies'); + await page.waitForTextInField(selectors.itemBotanical.genusAutocomplete, 'Abies'); const result = await page - .waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBotanical.genusAutocomplete, 'value'); expect(result).toEqual('Abies'); }); it(`should confirm the Species for the item was edited`, async() => { const result = await page - .waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBotanical.speciesAutocomplete, 'value'); expect(result).toEqual('decurrens'); }); diff --git a/e2e/paths/04-item-module/07_barcode.spec.js b/e2e/paths/04-item-module/07_barcode.spec.js index dfe16f384..5153b5519 100644 --- a/e2e/paths/04-item-module/07_barcode.spec.js +++ b/e2e/paths/04-item-module/07_barcode.spec.js @@ -28,9 +28,9 @@ describe('Item Create barcodes path', () => { it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => { await page.reloadSection('item.card.itemBarcode'); - await page.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5'); + await page.waitForTextInField(selectors.itemBarcodes.thirdCodeInput, '5'); const result = await page - .waitToGetProperty(`${selectors.itemBarcodes.thirdCodeInput} input`, 'value'); + .waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value'); expect(result).toEqual('5'); }); diff --git a/e2e/paths/04-item-module/08_create_and_clone.spec.js b/e2e/paths/04-item-module/08_create_and_clone.spec.js index 209e4f1cf..ea2290558 100644 --- a/e2e/paths/04-item-module/08_create_and_clone.spec.js +++ b/e2e/paths/04-item-module/08_create_and_clone.spec.js @@ -63,23 +63,23 @@ describe('Item Create/Clone path', () => { it('should confirm Infinity Gauntlet item was created', async() => { let result = await page - .waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.nameInput, 'value'); expect(result).toEqual('Infinity Gauntlet'); result = await page - .waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.typeAutocomplete, 'value'); expect(result).toEqual('Crisantemo'); result = await page - .waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.intrastatAutocomplete, 'value'); expect(result).toEqual('5080000 Coral y materiales similares'); result = await page - .waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.itemBasicData.originAutocomplete, 'value'); expect(result).toEqual('Holand'); }); diff --git a/e2e/paths/04-item-module/09_regularize.spec.js b/e2e/paths/04-item-module/09_regularize.spec.js index 4c023113c..88c09c83c 100644 --- a/e2e/paths/04-item-module/09_regularize.spec.js +++ b/e2e/paths/04-item-module/09_regularize.spec.js @@ -25,7 +25,7 @@ describe('Item regularize path', () => { it('should check the local settings were saved', async() => { const userLocalWarehouse = await page - .waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value'); + .waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value'); await page.keyboard.press('Escape'); await page.waitForSelector('.user-popover.vn-popover', {hidden: true}); @@ -55,7 +55,7 @@ describe('Item regularize path', () => { it('should open the regularize dialog and check the warehouse matches the local user settings', async() => { await page.waitToClick(selectors.itemDescriptor.moreMenu); await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton); - const result = await page.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value'); + const result = await page.waitToGetProperty(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'value'); expect(result).toEqual('Warehouse Four'); }); diff --git a/e2e/paths/05-ticket-module/01_observations.spec.js b/e2e/paths/05-ticket-module/01_observations.spec.js index 1215e6423..6aa5d845e 100644 --- a/e2e/paths/05-ticket-module/01_observations.spec.js +++ b/e2e/paths/05-ticket-module/01_observations.spec.js @@ -31,12 +31,12 @@ describe('Ticket Create notes path', () => { it('should confirm the note is the expected one', async() => { await page.reloadSection('ticket.card.observation'); const result = await page - .waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.ticketNotes.firstNoteTypeAutocomplete, 'value'); expect(result).toEqual('observation one'); const firstDescription = await page - .waitToGetProperty(`${selectors.ticketNotes.firstDescriptionInput} input`, 'value'); + .waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value'); expect(firstDescription).toEqual('description'); }); diff --git a/e2e/paths/05-ticket-module/04_packages.spec.js b/e2e/paths/05-ticket-module/04_packages.spec.js index a4b52c3a4..668317b53 100644 --- a/e2e/paths/05-ticket-module/04_packages.spec.js +++ b/e2e/paths/05-ticket-module/04_packages.spec.js @@ -56,15 +56,15 @@ describe('Ticket Create packages path', () => { it(`should confirm the first select is the expected one`, async() => { await page.reloadSection('ticket.card.package'); - await page.waitForTextInInput(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m'); - const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value'); + await page.waitForTextInField(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m'); + const result = await page.waitToGetProperty(selectors.ticketPackages.firstPackageAutocomplete, 'value'); expect(result).toEqual('7 : Container medical box 1m'); }); it(`should confirm the first quantity is just a number and the string part was ignored by the imput number`, async() => { - await page.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99'); - const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstQuantityInput} input`, 'value'); + await page.waitForTextInField(selectors.ticketPackages.firstQuantityInput, '-99'); + const result = await page.waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value'); expect(result).toEqual('-99'); }); diff --git a/e2e/paths/05-ticket-module/05_tracking_state.spec.js b/e2e/paths/05-ticket-module/05_tracking_state.spec.js index 339042e3b..74ca980d5 100644 --- a/e2e/paths/05-ticket-module/05_tracking_state.spec.js +++ b/e2e/paths/05-ticket-module/05_tracking_state.spec.js @@ -70,7 +70,7 @@ describe('Ticket Create new tracking state path', () => { it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => { await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado'); let result = await page - .waitToGetProperty(`${selectors.createStateView.workerAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.createStateView.workerAutocomplete, 'value'); expect(result).toEqual('salesPersonNick'); }); diff --git a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js index 01bd80fb9..f8b8d7a3d 100644 --- a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js @@ -44,7 +44,7 @@ describe('Ticket Edit basic data path', () => { it(`should check the zone is for Silla247`, async() => { let zone = await page - .waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.ticketBasicData.zoneAutocomplete, 'value'); expect(zone).toContain('Zone 247 A'); }); @@ -52,7 +52,7 @@ describe('Ticket Edit basic data path', () => { it(`should edit the ticket agency then check there are no zones for it`, async() => { await page.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement'); let zone = await page - .getProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.ticketBasicData.zoneAutocomplete, 'value'); expect(zone.length).toEqual(0); }); @@ -60,7 +60,7 @@ describe('Ticket Edit basic data path', () => { it(`should edit the ticket zone then check the agency is for the new zone`, async() => { await page.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A'); let zone = await page - .waitToGetProperty(`${selectors.ticketBasicData.agencyAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.ticketBasicData.agencyAutocomplete, 'value'); expect(zone).toContain('Silla247Expensive'); }); diff --git a/e2e/paths/05-ticket-module/09_weekly.spec.js b/e2e/paths/05-ticket-module/09_weekly.spec.js index 0734d2f7b..717d971f2 100644 --- a/e2e/paths/05-ticket-module/09_weekly.spec.js +++ b/e2e/paths/05-ticket-module/09_weekly.spec.js @@ -51,7 +51,7 @@ describe('Ticket descriptor path', () => { it('should confirm the ticket 11 was added to thursday', async() => { await page.accessToSection('ticket.weekly.index'); - const result = await page.waitToGetProperty(`${selectors.ticketsIndex.sixthWeeklyTicket} input`, 'value'); + const result = await page.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value'); expect(result).toEqual('Thursday'); }); @@ -107,7 +107,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.sixthWeeklyTicket} input`, 'value'); + const result = await page.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value'); expect(result).toEqual('Saturday'); }); diff --git a/e2e/paths/05-ticket-module/13_services.spec.js b/e2e/paths/05-ticket-module/13_services.spec.js index 05f00249b..70cc55e43 100644 --- a/e2e/paths/05-ticket-module/13_services.spec.js +++ b/e2e/paths/05-ticket-module/13_services.spec.js @@ -95,28 +95,28 @@ describe('Ticket services path', () => { it('should confirm the service description was created correctly', async() => { await page.reloadSection('ticket.card.service'); const result = await page - .waitToGetProperty(`${selectors.ticketService.firstServiceTypeAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.ticketService.firstServiceTypeAutocomplete, 'value'); expect(result).toEqual('Documentos'); }); it('should confirm the service quantity was created correctly', async() => { const result = await page - .waitToGetProperty(`${selectors.ticketService.firstQuantityInput} input`, 'value'); + .waitToGetProperty(selectors.ticketService.firstQuantityInput, 'value'); expect(result).toEqual('1'); }); it('should confirm the service price was created correctly', async() => { const result = await page - .waitToGetProperty(`${selectors.ticketService.firstPriceInput} input`, 'value'); + .waitToGetProperty(selectors.ticketService.firstPriceInput, 'value'); expect(result).toEqual('999'); }); it('should confirm the service VAT was created correctly', async() => { const result = await page - .waitToGetProperty(`${selectors.ticketService.firstVatTypeAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.ticketService.firstVatTypeAutocomplete, 'value'); expect(result).toEqual('General VAT'); }); diff --git a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js b/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js index 2b7e15a92..1fe5a8228 100644 --- a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js +++ b/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js @@ -27,10 +27,10 @@ describe('Ticket create from client path', () => { it('should check if the client details are the expected ones', async() => { const client = await page - .waitToGetProperty(`${selectors.createTicketView.clientAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.createTicketView.clientAutocomplete, 'value'); const address = await page - .waitToGetProperty(`${selectors.createTicketView.addressAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.createTicketView.addressAutocomplete, 'value'); expect(client).toContain('Petter Parker'); diff --git a/e2e/paths/06-claim-module/01_basic_data.spec.js b/e2e/paths/06-claim-module/01_basic_data.spec.js index f19cc28f0..d256e2039 100644 --- a/e2e/paths/06-claim-module/01_basic_data.spec.js +++ b/e2e/paths/06-claim-module/01_basic_data.spec.js @@ -8,19 +8,22 @@ describe('Claim edit basic data path', () => { beforeAll(async() => { browser = await getBrowser(); page = browser.page; - await page.loginAndModule('salesAssistant', 'claim'); - await page.accessToSearchResult('1'); - await page.accessToSection('claim.card.basicData'); }); afterAll(async() => { await browser.close(); }); + it(`should log in as salesAssistant then reach basic data of the target claim`, async() => { + await page.loginAndModule('salesAssistant', 'claim'); + await page.accessToSearchResult('1'); + await page.accessToSection('claim.card.basicData'); + }); + it(`should edit claim state and observation fields`, async() => { await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado'); await page.clearTextarea(selectors.claimBasicData.observationInput); - await page.type(selectors.claimBasicData.observationInput, 'edited observation'); + await page.write(selectors.claimBasicData.observationInput, 'edited observation'); await page.waitToClick(selectors.claimBasicData.saveButton); const result = await page.waitForLastSnackbar(); @@ -37,7 +40,7 @@ describe('Claim edit basic data path', () => { it('should confirm the claim state was edited', async() => { await page.reloadSection('claim.card.basicData'); await page.wait(selectors.claimBasicData.claimStateAutocomplete); - const result = await page.waitToGetProperty(`${selectors.claimBasicData.claimStateAutocomplete} input`, 'value'); + const result = await page.waitToGetProperty(selectors.claimBasicData.claimStateAutocomplete, 'value'); expect(result).toEqual('Gestionado'); }); @@ -52,7 +55,7 @@ describe('Claim edit basic data path', () => { it(`should edit the claim to leave it untainted`, async() => { await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente'); await page.clearTextarea(selectors.claimBasicData.observationInput); - await page.type(selectors.claimBasicData.observationInput, 'Observation one'); + await page.write(selectors.claimBasicData.observationInput, 'Observation one'); await page.waitToClick(selectors.claimBasicData.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/06-claim-module/02_development.spec.js b/e2e/paths/06-claim-module/02_development.spec.js index 9e7dbbe36..388d198aa 100644 --- a/e2e/paths/06-claim-module/02_development.spec.js +++ b/e2e/paths/06-claim-module/02_development.spec.js @@ -54,19 +54,19 @@ describe('Claim development', () => { it('should confirm the first development is the expected one', async() => { await page.reloadSection('claim.card.development'); const reason = await page - .waitToGetProperty(`${selectors.claimDevelopment.firstClaimReasonAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'value'); const result = await page - .waitToGetProperty(`${selectors.claimDevelopment.firstClaimResultAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimResultAutocomplete, 'value'); const responsible = await page - .waitToGetProperty(`${selectors.claimDevelopment.firstClaimResponsibleAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'value'); const worker = await page - .waitToGetProperty(`${selectors.claimDevelopment.firstClaimWorkerAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'value'); const redelivery = await page - .waitToGetProperty(`${selectors.claimDevelopment.firstClaimRedeliveryAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'value'); expect(reason).toEqual('Calor'); expect(result).toEqual('Cocido'); @@ -77,19 +77,19 @@ describe('Claim development', () => { it('should confirm the second development is the expected one', async() => { const reason = await page - .waitToGetProperty(`${selectors.claimDevelopment.secondClaimReasonAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'value'); const result = await page - .waitToGetProperty(`${selectors.claimDevelopment.secondClaimResultAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimResultAutocomplete, 'value'); const responsible = await page - .waitToGetProperty(`${selectors.claimDevelopment.secondClaimResponsibleAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'value'); const worker = await page - .waitToGetProperty(`${selectors.claimDevelopment.secondClaimWorkerAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'value'); const redelivery = await page - .waitToGetProperty(`${selectors.claimDevelopment.secondClaimRedeliveryAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'value'); expect(reason).toEqual('Baja calidad'); expect(result).toEqual('Deshidratacion'); diff --git a/e2e/paths/06-claim-module/04_claim_action.spec.js b/e2e/paths/06-claim-module/04_claim_action.spec.js index 996cf5e11..460cd49ae 100644 --- a/e2e/paths/06-claim-module/04_claim_action.spec.js +++ b/e2e/paths/06-claim-module/04_claim_action.spec.js @@ -49,7 +49,7 @@ describe('Claim action path', () => { it('should refresh the view to check the remaining line is the expected one', async() => { await page.reloadSection('claim.card.action'); - const result = await page.waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value'); + const result = await page.waitToGetProperty(selectors.claimAction.firstLineDestination, 'value'); expect(result).toEqual('Bueno'); }); diff --git a/e2e/paths/07-order-module/01_edit_basic_data.spec.js b/e2e/paths/07-order-module/01_edit_basic_data.spec.js index 1dd89b4b7..eae49d802 100644 --- a/e2e/paths/07-order-module/01_edit_basic_data.spec.js +++ b/e2e/paths/07-order-module/01_edit_basic_data.spec.js @@ -101,14 +101,14 @@ describe('Order edit basic data path', () => { it('should now confirm the client have been edited', async() => { await page.reloadSection('order.card.basicData'); const result = await page - .waitToGetProperty(`${selectors.orderBasicData.clientAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.orderBasicData.clientAutocomplete, 'value'); expect(result).toEqual('104: Tony Stark'); }); it('should now confirm the agency have been edited', async() => { const result = await page - .waitToGetProperty(`${selectors.orderBasicData.agencyAutocomplete} input`, 'value'); + .waitToGetProperty(selectors.orderBasicData.agencyAutocomplete, 'value'); expect(result).toEqual('7: Silla247'); }); diff --git a/e2e/paths/08-route-module/02_basic_data.spec.js b/e2e/paths/08-route-module/02_basic_data.spec.js index 29b205172..5f329f4eb 100644 --- a/e2e/paths/08-route-module/02_basic_data.spec.js +++ b/e2e/paths/08-route-module/02_basic_data.spec.js @@ -35,26 +35,26 @@ describe('Route basic Data path', () => { it('should confirm the worker was edited', async() => { await page.reloadSection('route.card.basicData'); - const worker = await page.waitToGetProperty(`${selectors.routeBasicData.workerAutoComplete} input`, 'value'); + const worker = await page.waitToGetProperty(selectors.routeBasicData.workerAutoComplete, 'value'); expect(worker).toEqual('adminBoss - adminBossNick'); }); it('should confirm the vehicle was edited', async() => { - const vehicle = await page.waitToGetProperty(`${selectors.routeBasicData.vehicleAutoComplete} input`, 'value'); + const vehicle = await page.waitToGetProperty(selectors.routeBasicData.vehicleAutoComplete, 'value'); expect(vehicle).toEqual('1111-IMK'); }); it('should confirm the km start was edited', async() => { - const kmStart = await page.waitToGetProperty(`${selectors.routeBasicData.kmStartInput} input`, 'value'); + const kmStart = await page.waitToGetProperty(selectors.routeBasicData.kmStartInput, 'value'); expect(kmStart).toEqual('1'); }); it('should confirm the km end was edited', async() => { - const kmEnd = await page.waitToGetProperty(`${selectors.routeBasicData.kmEndInput} input`, 'value'); + const kmEnd = await page.waitToGetProperty(selectors.routeBasicData.kmEndInput, 'value'); expect(kmEnd).toEqual('2'); }); From 8bdb0a60329463bf9a71dd99cf6d5346a0ea8251 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 30 Jan 2020 11:23:13 +0100 Subject: [PATCH 03/95] removed fdescribe --- e2e/paths/02-client-module/13_log.spec.js | 2 +- e2e/paths/02-client-module/14_balance.spec.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/e2e/paths/02-client-module/13_log.spec.js b/e2e/paths/02-client-module/13_log.spec.js index 03e1df49d..4b09b0500 100644 --- a/e2e/paths/02-client-module/13_log.spec.js +++ b/e2e/paths/02-client-module/13_log.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Client log path', () => { +describe('Client log path', () => { let browser; let page; beforeAll(async() => { diff --git a/e2e/paths/02-client-module/14_balance.spec.js b/e2e/paths/02-client-module/14_balance.spec.js index 660704d54..ccbf19057 100644 --- a/e2e/paths/02-client-module/14_balance.spec.js +++ b/e2e/paths/02-client-module/14_balance.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Client balance path', () => { +describe('Client balance path', () => { let browser; let page; beforeAll(async() => { @@ -17,6 +17,7 @@ fdescribe('Client balance path', () => { it('should now edit the local user config data', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); + await page.waitForContentLoaded(); await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs'); let result = await page.waitForLastSnackbar(); From cbd43253e021631257b02f6b98dcce89ce4bc46f Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 3 Feb 2020 15:55:11 +0100 Subject: [PATCH 04/95] 1795 and 1798 refactors --- e2e/helpers/extensions.js | 22 +- e2e/helpers/selectors.js | 360 +++++++++--------- .../02-client-module/01_create_client.spec.js | 4 +- .../02_edit_basic_data.spec.js | 56 +-- .../03_edit_fiscal_data.spec.js | 60 +-- .../04_edit_billing_data.spec.js | 30 +- .../02-client-module/05_add_address.spec.js | 20 +- .../06_add_address_notes.spec.js | 12 +- .../07_edit_web_access.spec.js | 8 +- .../02-client-module/08_add_notes.spec.js | 4 +- .../02-client-module/09_add_credit.spec.js | 4 +- .../02-client-module/10_add_greuge.spec.js | 8 +- .../12_lock_of_verified_data.spec.js | 28 +- e2e/paths/02-client-module/13_log.spec.js | 4 +- e2e/paths/02-client-module/14_balance.spec.js | 21 +- .../02-client-module/15_user_config.spec.js | 42 +- e2e/paths/03-worker-module/01_pbx.spec.js | 7 +- .../03-worker-module/02_time_control.spec.js | 50 +-- e2e/paths/04-item-module/01_summary.spec.js | 6 +- .../04-item-module/02_basic_data.spec.js | 34 +- e2e/paths/04-item-module/03_tax.spec.js | 18 +- e2e/paths/04-item-module/04_tags.spec.js | 26 +- e2e/paths/04-item-module/05_niche.spec.js | 20 +- e2e/paths/04-item-module/06_botanical.spec.js | 34 +- e2e/paths/04-item-module/07_barcode.spec.js | 6 +- .../08_create_and_clone.spec.js | 26 +- .../04-item-module/09_regularize.spec.js | 24 +- e2e/paths/04-item-module/11_item_log.spec.js | 8 +- .../01-sale/01_list_sales.spec.js | 1 - .../01-sale/02_edit_sale.spec.js | 8 +- .../05-ticket-module/01_observations.spec.js | 9 +- .../05-ticket-module/04_packages.spec.js | 20 +- .../05_tracking_state.spec.js | 11 +- .../06_basic_data_steps.spec.js | 25 +- e2e/paths/05-ticket-module/09_weekly.spec.js | 6 +- e2e/paths/05-ticket-module/10_request.spec.js | 8 +- e2e/paths/05-ticket-module/11_diary.spec.js | 4 +- .../05-ticket-module/12_descriptor.spec.js | 10 +- .../05-ticket-module/13_services.spec.js | 22 +- .../05-ticket-module/14_create_ticket.spec.js | 12 +- .../15_create_ticket_from_client.spec.js | 5 +- .../06-claim-module/01_basic_data.spec.js | 18 +- .../06-claim-module/02_development.spec.js | 40 +- e2e/paths/06-claim-module/03_detail.spec.js | 2 +- .../01_edit_basic_data.spec.js | 29 +- e2e/paths/07-order-module/02_catalog.spec.js | 14 +- e2e/paths/08-route-module/01_create.spec.js | 14 +- .../08-route-module/02_basic_data.spec.js | 26 +- .../01_descriptor.spec.js | 10 +- 49 files changed, 619 insertions(+), 617 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 045ca65c1..782756df3 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -143,12 +143,19 @@ let actions = { return await this.getProperty(selector, property); }, - waitPropertyValue: async function(selector, property, status) { - await this.waitForSelector(selector); - return await this.waitForFunction((selector, property, status) => { - const element = document.querySelector(selector); - return element[property] === status; - }, {}, selector, property, status); + expectPropertyValue: async function(selector, property, value) { + let builtSelector = selector; + if (property != 'innerText') + builtSelector = await this.selectorFormater(selector); + + try { + return await this.waitForFunction((selector, property, value) => { + const element = document.querySelector(selector); + return element[property] == value; + }, {}, builtSelector, property, value); + } catch (error) { + throw new Error(`${value} wasn't the value of ${builtSelector}, ${error}`); + } }, waitToGetProperty: async function(selector, property) { @@ -351,7 +358,7 @@ let actions = { }, waitForLastSnackbar: async function() { - await this.wait(2000); // this needs a refactor to be somehow dynamic ie: page.waitForResponse(urlOrPredicate[, options]) or something to fire waitForLastShape once the request is completed + await this.waitFor(1000); // this needs a refactor to be somehow dynamic ie: page.waitForResponse(urlOrPredicate[, options]) or something to fire waitForLastShape once the request is completed await this.waitForSpinnerLoad(); return await this.waitForLastShape('vn-snackbar .shown .text'); }, @@ -384,6 +391,7 @@ let actions = { return navButton.click(); }, sectionRoute); await this.waitForNavigation({waitUntil: ['networkidle0']}); + await this.waitForContentLoaded(); }, autocompleteSearch: async function(selector, searchValue) { diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index b0fee5591..8d215446c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -21,25 +21,25 @@ export default { acceptButton: '.vn-confirm.shown button[response=accept]' }, clientsIndex: { - searchClientInput: 'vn-topbar', + topbarSearch: 'vn-topbar', searchButton: 'vn-searchbar vn-icon[icon="search"]', searchResult: 'vn-client-index .vn-item', createClientButton: `vn-float-button`, othersButton: 'vn-left-menu li[name="Others"] > a' }, createClientView: { - name: `vn-client-create [ng-model="$ctrl.client.name"]`, - taxNumber: 'vn-client-create [ng-model="$ctrl.client.fi"]', - socialName: 'vn-client-create [ng-model="$ctrl.client.socialName"]', - street: 'vn-client-create [ng-model="$ctrl.client.street"]', - postcode: 'vn-client-create [ng-model="$ctrl.client.postcode"]', - city: 'vn-client-create [ng-model="$ctrl.client.city"]', - province: `vn-autocomplete[ng-model="$ctrl.client.provinceFk"]`, - country: `vn-autocomplete[ng-model="$ctrl.client.countryFk"]`, - userName: 'vn-client-create [ng-model="$ctrl.client.userName"]', - email: 'vn-client-create [ng-model="$ctrl.client.email"]', - salesPersonAutocomplete: `vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]`, - createButton: `button[type=submit]`, + name: 'vn-client-create vn-textfield[ng-model="$ctrl.client.name"]', + taxNumber: 'vn-client-create vn-textfield[ng-model="$ctrl.client.fi"]', + socialName: 'vn-client-create vn-textfield[ng-model="$ctrl.client.socialName"]', + street: 'vn-client-create vn-textfield[ng-model="$ctrl.client.street"]', + postcode: 'vn-client-create vn-textfield[ng-model="$ctrl.client.postcode"]', + city: 'vn-client-create vn-textfield[ng-model="$ctrl.client.city"]', + province: 'vn-client-create vn-autocomplete[ng-model="$ctrl.client.provinceFk"]', + country: 'vn-client-create vn-autocomplete[ng-model="$ctrl.client.countryFk"]', + userName: 'vn-client-create vn-textfield[ng-model="$ctrl.client.userName"]', + email: 'vn-client-create vn-textfield[ng-model="$ctrl.client.email"]', + salesPerson: 'vn-client-create vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', + createButton: 'vn-client-create button[type=submit]', cancelButton: 'vn-button[href="#!/client/index"]' }, clientDescriptor: { @@ -48,77 +48,75 @@ export default { }, clientBasicData: { basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]', - nameInput: 'vn-client-basic-data [ng-model="$ctrl.client.name"]', - contactInput: 'vn-client-basic-data [ng-model="$ctrl.client.contact"]', - phoneInput: 'vn-client-basic-data [ng-model="$ctrl.client.phone"]', - mobileInput: 'vn-client-basic-data [ng-model="$ctrl.client.mobile"]', - emailInput: 'vn-client-basic-data [ng-model="$ctrl.client.email"]', - salesPersonAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', - channelAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]', - saveButton: `button[type=submit]` + name: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.name"]', + contact: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.contact"]', + email: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.email"]', + salesPerson: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', + channel: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]', + saveButton: 'vn-client-basic-data button[type=submit]' }, clientFiscalData: { fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]', - socialNameInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.socialName"]', - fiscalIdInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.fi"]', - equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]', + socialName: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.socialName"]', + fiscalId: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.fi"]', + equalizationTax: 'vn-client-fiscal-data vn-check[ng-model="$ctrl.client.isEqualizated"]', acceptPropagationButton: '.vn-confirm.shown button[response=accept]', - addressInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.street"]', - postcodeInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.postcode"]', - cityInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.city"]', - provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.provinceFk"]', - countryAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.countryFk"]', - activeCheckbox: 'vn-check[label="Active"]', - frozenCheckbox: 'vn-check[label="Frozen"]', - invoiceByAddressCheckbox: 'vn-check[label="Invoice by address"]', - verifiedDataCheckbox: 'vn-check[label="Verified data"]', - hasToInvoiceCheckbox: 'vn-check[label="Has to invoice"]', - invoiceByMailCheckbox: 'vn-check[label="Invoice by mail"]', - viesCheckbox: 'vn-check[label="Vies"]', - saveButton: `button[type=submit]`, + address: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.street"]', + postcode: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.postcode"]', + city: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.city"]', + province: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.provinceFk"]', + country: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.countryFk"]', + activeCheckbox: 'vn-client-fiscal-data vn-check[label="Active"]', + frozenCheckbox: 'vn-client-fiscal-data vn-check[label="Frozen"]', + invoiceByAddressCheckbox: 'vn-client-fiscal-data vn-check[label="Invoice by address"]', + verifiedDataCheckbox: 'vn-client-fiscal-data vn-check[label="Verified data"]', + hasToInvoiceCheckbox: 'vn-client-fiscal-data vn-check[label="Has to invoice"]', + invoiceByMailCheckbox: 'vn-client-fiscal-data vn-check[label="Invoice by mail"]', + viesCheckbox: 'vn-client-fiscal-data vn-check[label="Vies"]', + saveButton: 'button[type=submit]', watcher: 'vn-client-fiscal-data vn-watcher' }, clientBillingData: { - payMethodAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]', - IBANInput: 'vn-client-billing-data [ng-model="$ctrl.client.iban"]', - dueDayInput: 'vn-client-billing-data [ng-model="$ctrl.client.dueDay"]', + payMethod: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]', + IBAN: 'vn-client-billing-data vn-textfield[ng-model="$ctrl.client.iban"]', + dueDay: 'vn-client-billing-data vn-input-number[ng-model="$ctrl.client.dueDay"]', receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]', receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]', receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]', - swiftBicAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]', + swiftBic: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]', clearswiftBicButton: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"] .icons > vn-icon[icon=clear]', newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button', - newBankEntityName: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.name"]', - newBankEntityBIC: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.bic"]', - newBankEntityCode: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.id"]', + newBankEntityName: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newBankEntity.name"]', + newBankEntityBIC: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newBankEntity.bic"]', + newBankEntityCode: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newBankEntity.id"]', acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]', saveButton: `button[type=submit]`, watcher: 'vn-client-billing-data vn-watcher' }, clientAddresses: { addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]', - createAddress: `vn-client-address-index vn-float-button`, - defaultCheckboxInput: 'vn-check[label="Default"]', - consigneeInput: '[ng-model="$ctrl.address.nickname"]', - streetAddressInput: '[ng-model="$ctrl.address.street"]', - postcodeInput: '[ng-model="$ctrl.address.postalCode"]', - cityInput: '[ng-model="$ctrl.address.city"]', - provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceId"]', - agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeId"]', - phoneInput: '[ng-model="$ctrl.address.phone"]', - mobileInput: '[ng-model="$ctrl.address.mobile"]', + createAddress: 'vn-client-address-index vn-float-button', + defaultCheckbox: 'vn-check[label="Default"]', + consignee: 'vn-textfield[ng-model="$ctrl.address.nickname"]', + streetAddress: 'vn-textfield[ng-model="$ctrl.address.street"]', + postcode: 'vn-textfield[ng-model="$ctrl.address.postalCode"]', + city: 'vn-textfield[ng-model="$ctrl.address.city"]', + province: 'vn-autocomplete[ng-model="$ctrl.address.provinceId"]', + agency: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeId"]', + phone: 'vn-textfield[ng-model="$ctrl.address.phone"]', + mobileInput: 'vn-textfield[ng-model="$ctrl.address.mobile"]', defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]', - incotermsAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.incotermsId"]', - customsAgentAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.customsAgentId"]', + incoterms: 'vn-autocomplete[ng-model="$ctrl.address.incotermsId"]', + customsAgent: 'vn-autocomplete[ng-model="$ctrl.address.customsAgentId"]', secondMakeDefaultStar: 'vn-client-address-index vn-card div:nth-child(2) vn-icon-button[icon="star_border"]', firstEditAddress: 'vn-client-address-index div:nth-child(1) > a', secondEditAddress: 'vn-client-address-index div:nth-child(2) > a', activeCheckbox: 'vn-check[label="Enabled"]', equalizationTaxCheckbox: 'vn-client-address-edit vn-check[label="Is equalizated"]', - firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.observationTypeFk"]', - firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.description"]', - secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.observationTypeFk"]', - secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.description"]', + firstObservationType: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) vn-autocomplete[ng-model="observation.observationTypeFk"]', + firstObservationDescription: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) vn-textfield[ng-model="observation.description"]', + secondObservationType: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) vn-autocomplete[ng-model="observation.observationTypeFk"]', + secondObservationDescription: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) vn-textfield[ng-model="observation.description"]', addObservationButton: 'vn-client-address-edit div[name="observations"] vn-icon-button[icon="add_circle"]', saveButton: 'button[type=submit]', cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]', @@ -128,26 +126,26 @@ export default { clientWebAccess: { webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]', enableWebAccessCheckbox: 'vn-check[label="Enable web access"]', - userNameInput: 'vn-client-web-access [ng-model="$ctrl.account.name"]', + userName: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.name"]', saveButton: 'button[type=submit]' }, clientNotes: { addNoteFloatButton: 'vn-float-button', - noteInput: '[ng-model="$ctrl.note.text"]', + note: 'vn-textarea[ng-model="$ctrl.note.text"]', saveButton: 'button[type=submit]', firstNoteText: 'vn-client-note .text' }, clientCredit: { addCreditFloatButton: 'vn-float-button', - creditInput: 'vn-client-credit-create [ng-model="$ctrl.client.credit"]', - saveButton: 'button[type=submit]', - firstCreditText: 'vn-client-credit-index vn-card vn-table vn-tbody > vn-tr' + credit: 'vn-client-credit-create vn-input-number[ng-model="$ctrl.client.credit"]', + firstCreditText: 'vn-client-credit-index vn-card vn-table vn-tbody > vn-tr', + saveButton: 'button[type=submit]' }, clientGreuge: { addGreugeFloatButton: 'vn-float-button', - amountInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.amount"]', - descriptionInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.description"]', - typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.greuge.greugeTypeFk"]', + amount: 'vn-client-greuge-create vn-input-number[ng-model="$ctrl.greuge.amount"]', + description: 'vn-client-greuge-create vn-textfield[ng-model="$ctrl.greuge.description"]', + type: 'vn-autocomplete[ng-model="$ctrl.greuge.greugeTypeFk"]', saveButton: 'button[type=submit]', firstGreugeText: 'vn-client-greuge-index vn-card vn-table vn-tbody > vn-tr' }, @@ -166,10 +164,10 @@ export default { }, clientBalance: { balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]', - companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', + company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', newPaymentButton: `vn-float-button`, newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', - newPaymentAmountInput: '.vn-dialog.shown [ng-model="$ctrl.receipt.amountPaid"]', + newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"]', saveButton: '.vn-dialog.shown vn-button[label="Save"]', firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' @@ -191,7 +189,7 @@ export default { searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]', searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]', acceptClonationAlertButton: '.vn-confirm.shown [response="accept"]', - searchItemInput: 'vn-searchbar', + topbarSearch: 'vn-topbar', searchButton: 'vn-searchbar vn-icon[icon="search"]', closeItemSummaryPreview: '.vn-popup.shown', fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="menu"]', @@ -213,10 +211,10 @@ export default { saveFieldsButton: '.vn-dialog.shown vn-horizontal:nth-child(16) > vn-button > button' }, itemCreateView: { - temporalName: 'vn-item-create [ng-model="$ctrl.item.provisionalName"]', - typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]', - intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]', - originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', + temporalName: 'vn-item-create vn-textfield[ng-model="$ctrl.item.provisionalName"]', + type: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]', + intrastat: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]', + origin: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', createButton: 'button[type=submit]', cancelButton: 'vn-button[ui-sref="item.index"]' }, @@ -224,8 +222,8 @@ export default { goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]', moreMenu: 'vn-item-descriptor vn-icon-menu[icon=more_vert]', moreMenuRegularizeButton: '.vn-drop-down.shown li[name="Regularize stock"]', - regularizeQuantityInput: '.vn-dialog.shown [ng-model="$ctrl.quantity"]', - regularizeWarehouseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.warehouseFk"]', + regularizeQuantity: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.quantity"]', + regularizeWarehouse: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.warehouseFk"]', editButton: 'vn-item-descriptor vn-float-button[icon="edit"]', regularizeSaveButton: '.vn-dialog.shown tpl-buttons > button', inactiveIcon: 'vn-item-descriptor vn-icon[icon="icon-unavailable"]', @@ -234,13 +232,13 @@ export default { itemBasicData: { basicDataButton: 'vn-left-menu a[ui-sref="item.card.basicData"]', goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', - typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]', - intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]', - nameInput: 'vn-item-basic-data [ng-model="$ctrl.item.name"]', - relevancyInput: 'vn-item-basic-data [ng-model="$ctrl.item.relevancy"]', - originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', - expenseAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.expenseFk"]', - longNameInput: 'vn-textfield[ng-model="$ctrl.item.longName"]', + type: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]', + intrastat: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]', + name: 'vn-item-basic-data vn-textfield[ng-model="$ctrl.item.name"]', + relevancy: 'vn-item-basic-data vn-input-number[ng-model="$ctrl.item.relevancy"]', + origin: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', + expense: 'vn-autocomplete[ng-model="$ctrl.item.expenseFk"]', + longName: 'vn-textfield[ng-model="$ctrl.item.longName"]', isActiveCheckbox: 'vn-check[label="Active"]', priceInKgCheckbox: 'vn-check[label="Price in kg"]', submitBasicDataButton: `button[type=submit]` @@ -248,50 +246,50 @@ export default { itemTags: { goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', tagsButton: 'vn-left-menu a[ui-sref="item.card.tags"]', - fourthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(4) > vn-autocomplete[ng-model="itemTag.tagFk"]', - fourthValueInput: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.value"]', - fourthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.priority"]', + fourthTag: 'vn-item-tags vn-horizontal:nth-child(4) > vn-autocomplete[ng-model="itemTag.tagFk"]', + fourthValue: 'vn-item-tags vn-horizontal:nth-child(4) vn-textfield[ng-model="itemTag.value"]', + fourthRelevancy: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.priority"]', fourthRemoveTagButton: 'vn-item-tags vn-horizontal:nth-child(4) vn-icon-button[icon="delete"]', - fifthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[ng-model="itemTag.tagFk"]', - fifthValueInput: 'vn-item-tags vn-horizontal:nth-child(5) [ng-model="itemTag.value"]', - fifthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(5) [ng-model="itemTag.priority"]', - sixthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[ng-model="itemTag.tagFk"]', - sixthValueInput: 'vn-item-tags vn-horizontal:nth-child(6) [ng-model="itemTag.value"]', - sixthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(6) [ng-model="itemTag.priority"]', - seventhTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(7) > vn-autocomplete[ng-model="itemTag.tagFk"]', - seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.value"]', - seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.priority"]', + fifthTag: 'vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[ng-model="itemTag.tagFk"]', + fifthValue: 'vn-item-tags vn-horizontal:nth-child(5) vn-textfield[ng-model="itemTag.value"]', + fifthRelevancy: 'vn-item-tags vn-horizontal:nth-child(5) vn-textfield[ng-model="itemTag.priority"]', + sixthTag: 'vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[ng-model="itemTag.tagFk"]', + sixthValue: 'vn-item-tags vn-horizontal:nth-child(6) vn-textfield[ng-model="itemTag.value"]', + sixthRelevancy: 'vn-item-tags vn-horizontal:nth-child(6) vn-textfield[ng-model="itemTag.priority"]', + seventhTag: 'vn-item-tags vn-horizontal:nth-child(7) > vn-autocomplete[ng-model="itemTag.tagFk"]', + seventhValue: 'vn-item-tags vn-horizontal:nth-child(7) vn-textfield[ng-model="itemTag.value"]', + seventhRelevancy: 'vn-item-tags vn-horizontal:nth-child(7) vn-textfield[ng-model="itemTag.priority"]', addItemTagButton: 'vn-item-tags vn-icon-button[icon="add_circle"]', submitItemTagsButton: 'vn-item-tags button[type=submit]' }, itemTax: { undoChangesButton: 'vn-item-tax vn-button-bar > vn-button[label="Undo changes"]', - firstClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(1) > vn-autocomplete[ng-model="tax.taxClassFk"]', - secondClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="tax.taxClassFk"]', - thirdClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="tax.taxClassFk"]', + firstClass: 'vn-item-tax vn-horizontal:nth-child(1) > vn-autocomplete[ng-model="tax.taxClassFk"]', + secondClass: 'vn-item-tax vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="tax.taxClassFk"]', + thirdClass: 'vn-item-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="tax.taxClassFk"]', submitTaxButton: 'vn-item-tax button[type=submit]' }, itemBarcodes: { addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]', - thirdCodeInput: 'vn-item-barcode vn-horizontal:nth-child(3) [ng-model="barcode.code"]', + thirdCode: 'vn-item-barcode vn-horizontal:nth-child(3) vn-textfield[ng-model="barcode.code"]', submitBarcodesButton: 'vn-item-barcode button[type=submit]', firstCodeRemoveButton: 'vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]' }, itemNiches: { addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]', - firstWarehouseAutocomplete: 'vn-item-niche vn-autocomplete[ng-model="niche.warehouseFk"]', - firstCodeInput: 'vn-item-niche vn-horizontal:nth-child(1) [ng-model="niche.code"]', - secondWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="niche.warehouseFk"]', - secondCodeInput: 'vn-item-niche vn-horizontal:nth-child(2) [ng-model="niche.code"]', + firstWarehouse: 'vn-item-niche vn-autocomplete[ng-model="niche.warehouseFk"]', + firstCode: 'vn-item-niche vn-horizontal:nth-child(1) vn-textfield[ng-model="niche.code"]', + secondWarehouse: 'vn-item-niche vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="niche.warehouseFk"]', + secondCode: 'vn-item-niche vn-horizontal:nth-child(2) vn-textfield[ng-model="niche.code"]', secondNicheRemoveButton: 'vn-item-niche vn-horizontal:nth-child(2) > vn-none > vn-icon-button[icon="delete"]', - thirdWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="niche.warehouseFk"]', - thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) [ng-model="niche.code"]', + thirdWarehouse: 'vn-item-niche vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="niche.warehouseFk"]', + thirdCode: 'vn-item-niche vn-horizontal:nth-child(3) vn-textfield[ng-model="niche.code"]', submitNichesButton: 'vn-item-niche button[type=submit]' }, itemBotanical: { - botanicalInput: 'vn-item-botanical vn-horizontal:nth-child(1) [ng-model="$ctrl.botanical.botanical"]', - genusAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]', - speciesAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]', + botanical: 'vn-item-botanical vn-horizontal:nth-child(1) vn-textfield[ng-model="$ctrl.botanical.botanical"]', + genus: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]', + species: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]', submitBotanicalButton: `vn-item-botanical button[type=submit]` }, itemSummary: { @@ -306,7 +304,7 @@ export default { secondTicketId: 'vn-item-diary vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > span', firstBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(1) > vn-td.balance', fourthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(4) > vn-td.balance', - warehouseAutocomplete: 'vn-item-diary vn-autocomplete[ng-model="$ctrl.warehouseFk"]', + warehouse: 'vn-item-diary vn-autocomplete[ng-model="$ctrl.warehouseFk"]', }, itemLog: { anyLineCreated: 'vn-item-log > vn-log vn-tbody > vn-tr', @@ -330,29 +328,27 @@ export default { }, ticketsIndex: { openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]', - advancedSearchInvoiceOut: 'vn-ticket-search-panel [ng-model="filter.refFk"]', + advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"]', newTicketButton: 'vn-ticket-index > a', searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr', searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr', searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)', - searchTicketInput: 'vn-searchbar', - searchWeeklyClearInput: 'vn-searchbar vn-icon[icon=clear]', + topbarSearch: 'vn-searchbar', advancedSearchButton: 'vn-ticket-search-panel button[type=submit]', searchButton: 'vn-searchbar vn-icon[icon="search"]', searchWeeklyButton: 'vn-searchbar vn-icon[icon="search"]', moreMenu: 'vn-ticket-index vn-icon-menu[icon=more_vert]', - menuWeeklyTickets: 'vn-left-menu [ui-sref="ticket.weekly.index"]', sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6)', 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"]', acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]' }, createTicketView: { - clientAutocomplete: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.clientId"]', - addressAutocomplete: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.addressId"]', - deliveryDateInput: 'vn-ticket-create vn-date-picker[ng-model="$ctrl.landed"]', - warehouseAutocomplete: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.warehouseId"]', - agencyAutocomplete: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.agencyModeId"]', + client: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.clientId"]', + address: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.addressId"]', + deliveryDate: 'vn-ticket-create vn-date-picker[ng-model="$ctrl.landed"]', + warehouse: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.warehouseId"]', + agency: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.agencyModeId"]', createButton: `button[type=submit]` }, ticketDescriptor: { @@ -367,7 +363,7 @@ export default { moreMenuMakeInvoice: '.vn-drop-down.shown li[name="Make invoice"]', moreMenuChangeShippedHour: '.vn-drop-down.shown li[name="Change shipped hour"]', changeShippedHourDialog: '.vn-dialog.shown', - changeShippedHourInput: '.vn-dialog.shown [ng-model="$ctrl.newShipped"]', + 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)', @@ -381,8 +377,8 @@ export default { ticketNotes: { firstNoteRemoveButton: 'vn-icon[icon="delete"]', addNoteButton: 'vn-icon[icon="add_circle"]', - firstNoteTypeAutocomplete: 'vn-autocomplete[ng-model="observation.observationTypeFk"]', - firstDescriptionInput: 'vn-ticket-observation [ng-model="observation.description"]', + firstNoteType: 'vn-autocomplete[ng-model="observation.observationTypeFk"]', + firstDescription: 'vn-ticket-observation vn-textfield[ng-model="observation.description"]', submitNotesButton: 'button[type=submit]' }, ticketExpedition: { @@ -393,8 +389,8 @@ export default { }, ticketPackages: { packagesButton: 'vn-left-menu a[ui-sref="ticket.card.package"]', - firstPackageAutocomplete: 'vn-autocomplete[label="Package"]', - firstQuantityInput: 'vn-ticket-package vn-horizontal:nth-child(1) [ng-model="package.quantity"]', + firstPackage: 'vn-autocomplete[label="Package"]', + firstQuantity: 'vn-ticket-package vn-horizontal:nth-child(1) vn-input-number[ng-model="package.quantity"]', firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]', addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]', clearPackageAutocompleteButton: 'vn-autocomplete[label="Package"] .icons > vn-icon[icon=clear]', @@ -461,21 +457,18 @@ export default { }, ticketTracking: { trackingButton: 'vn-left-menu a[ui-sref="ticket.card.tracking.index"]', - createStateButton: `vn-float-button`, - stateAutocomplete: 'vn-ticket-tracking-edit vn-autocomplete[ng-model="$ctrl.stateFk"]', - saveButton: `button[type=submit]`, + createStateButton: 'vn-float-button', + saveButton: 'button[type=submit]', cancelButton: 'vn-ticket-tracking-edit vn-button[ui-sref="ticket.card.tracking.index"]' }, ticketBasicData: { basicDataButton: 'vn-left-menu a[ui-sref="ticket.card.basicData.stepOne"]', - clientAutocomplete: 'vn-autocomplete[ng-model="$ctrl.clientFk"]', - addressAutocomplete: 'vn-autocomplete[ng-model="$ctrl.ticket.addressFk"]', - agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.agencyModeId"]', - zoneAutocomplete: 'vn-autocomplete[ng-model="$ctrl.zoneId"]', + agency: 'vn-autocomplete[ng-model="$ctrl.agencyModeId"]', + zone: 'vn-autocomplete[ng-model="$ctrl.zoneId"]', nextStepButton: 'vn-step-control .buttons > section:last-child vn-button', finalizeButton: 'vn-step-control .buttons > section:last-child button[type=submit]', stepTwoTotalPriceDif: 'vn-ticket-basic-data-step-two vn-tfoot > vn-tr > :nth-child(6)', - chargesReasonAutocomplete: 'vn-autocomplete[ng-model="$ctrl.ticket.option"]', + chargesReason: 'vn-autocomplete[ng-model="$ctrl.ticket.option"]', }, ticketComponents: { base: 'vn-ticket-components [name="base-sum"]' @@ -484,9 +477,9 @@ export default { addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button', request: 'vn-ticket-request-index vn-table vn-tr', descriptionInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.description"]', - atenderAutocomplete: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.attenderFk"]', - quantityInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.quantity"]', - priceInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.price"]', + atender: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.attenderFk"]', + quantity: 'vn-ticket-request-create vn-input-number[ng-model="$ctrl.ticketRequest.quantity"]', + price: 'vn-ticket-request-create vn-input-number[ng-model="$ctrl.ticketRequest.price"]', firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)', saveButton: 'vn-ticket-request-create button[type=submit]', firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2) vn-textfield', @@ -501,20 +494,20 @@ export default { ticketService: { addServiceButton: 'vn-ticket-service vn-icon-button[vn-tooltip="Add service"] > button', firstAddServiceTypeButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]', - firstServiceTypeAutocomplete: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]', - firstQuantityInput: 'vn-ticket-service [ng-model="service.quantity"]', - firstPriceInput: 'vn-ticket-service [ng-model="service.price"]', - firstVatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]', + firstServiceType: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]', + firstQuantity: 'vn-ticket-service vn-input-number[ng-model="service.quantity"]', + firstPrice: 'vn-ticket-service vn-input-number[ng-model="service.price"]', + firstVatType: 'vn-ticket-service vn-autocomplete[label="Tax class"]', fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]', - newServiceTypeNameInput: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"]', - newServiceTypeExpenseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newServiceType.expenseFk"]', + newServiceTypeName: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"]', + newServiceTypeExpense: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newServiceType.expenseFk"]', serviceLine: 'vn-ticket-service > form > vn-card > vn-one:nth-child(2) > vn-horizontal', saveServiceButton: `button[type=submit]`, saveServiceTypeButton: '.vn-dialog.shown tpl-buttons > button' }, createStateView: { - stateAutocomplete: 'vn-autocomplete[ng-model="$ctrl.stateFk"]', - workerAutocomplete: 'vn-autocomplete[ng-model="$ctrl.workerFk"]', + state: 'vn-autocomplete[ng-model="$ctrl.stateFk"]', + worker: 'vn-autocomplete[ng-model="$ctrl.workerFk"]', clearStateInputButton: 'vn-autocomplete[ng-model="$ctrl.stateFk"] .icons > vn-icon[icon=clear]', saveStateButton: `button[type=submit]` }, @@ -531,7 +524,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"] textarea', + observation: 'vn-claim-summary vn-textarea[ng-model="$ctrl.summary.claim.observation"]', firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(4) 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', @@ -542,14 +535,14 @@ export default { firstActionTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor' }, claimBasicData: { - claimStateAutocomplete: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]', + claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]', responsabilityInputRange: 'vn-range', - observationInput: 'vn-textarea[ng-model="$ctrl.claim.observation"]', + observation: 'vn-textarea[ng-model="$ctrl.claim.observation"]', saveButton: `button[type=submit]` }, claimDetail: { secondItemDiscount: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(6) > span', - discountInput: '.vn-popover.shown [ng-model="$ctrl.newDiscount"]', + discount: '.vn-popover.shown vn-input-number[ng-model="$ctrl.newDiscount"]', discoutPopoverMana: '.vn-popover.shown .content > div > vn-horizontal > h5', addItemButton: 'vn-claim-detail a vn-float-button', firstClaimableSaleFromTicket: '.vn-dialog.shown vn-tbody > vn-tr', @@ -560,16 +553,16 @@ export default { claimDevelopment: { addDevelopmentButton: 'vn-claim-development > vn-vertical > vn-card > vn-vertical > vn-one > vn-icon-button > button > vn-icon', firstDeleteDevelopmentButton: 'vn-claim-development > vn-vertical > vn-card > vn-vertical > form > vn-horizontal:nth-child(2) > vn-icon-button > button > vn-icon', - firstClaimReasonAutocomplete: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimReasonFk"]', - firstClaimResultAutocomplete: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimResultFk"]', - firstClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]', - firstClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.workerFk"]', - firstClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]', - secondClaimReasonAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimReasonFk"]', - secondClaimResultAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResultFk"]', - secondClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]', - secondClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.workerFk"]', - secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]', + firstClaimReason: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimReasonFk"]', + firstClaimResult: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimResultFk"]', + firstClaimResponsible: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]', + firstClaimWorker: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.workerFk"]', + firstClaimRedelivery: 'vn-claim-development vn-horizontal:nth-child(1) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]', + secondClaimReason: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimReasonFk"]', + secondClaimResult: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResultFk"]', + secondClaimResponsible: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]', + secondClaimWorker: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.workerFk"]', + secondClaimRedelivery: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]', saveDevelopmentButton: 'button[type=submit]' }, claimAction: { @@ -593,31 +586,29 @@ export default { acceptNavigationButton: '.vn-confirm.shown button[response=accept]' }, createOrderView: { - clientAutocomplete: 'vn-autocomplete[label="Client"]', - addressAutocomplete: 'vn-autocomplete[label="Address"]', - agencyAutocomplete: 'vn-autocomplete[label="Agency"]', + client: 'vn-autocomplete[label="Client"]', + agency: 'vn-autocomplete[label="Agency"]', landedDatePicker: 'vn-date-picker[label="Landed"]', createButton: 'button[type=submit]', cancelButton: 'vn-button[href="#!/client/index"]' }, orderCatalog: { - orderByAutocomplete: 'vn-autocomplete[label="Order by"]', plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]', - typeAutocomplete: 'vn-autocomplete[data="$ctrl.itemTypes"]', - itemIdInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.itemId"]', - itemTagValueInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.value"]', + type: 'vn-autocomplete[data="$ctrl.itemTypes"]', + itemId: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.itemId"]', + itemTagValue: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.value"]', openTagSearch: 'vn-catalog-filter > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i', - tagAutocomplete: 'vn-order-catalog-search-panel vn-autocomplete[ng-model="filter.tagFk"]', - tagValueInput: 'vn-order-catalog-search-panel [ng-model="filter.value"]', + tag: 'vn-order-catalog-search-panel vn-autocomplete[ng-model="filter.tagFk"]', + tagValue: 'vn-order-catalog-search-panel vn-textfield[ng-model="filter.value"]', searchTagButton: 'vn-order-catalog-search-panel button[type=submit]', thirdFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(3) vn-icon[icon=cancel]', fourthFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(4) vn-icon[icon=cancel]', }, orderBasicData: { - clientAutocomplete: 'vn-autocomplete[label="Client"]', - addressAutocomplete: 'vn-autocomplete[label="Address"]', - agencyAutocomplete: 'vn-autocomplete[label="Agency"]', - observationInput: 'vn-textarea[label="Observation"] textarea', + client: 'vn-autocomplete[label="Client"]', + address: 'vn-autocomplete[label="Address"]', + agency: 'vn-autocomplete[label="Agency"]', + observation: 'vn-textarea[label="Observation"]', saveButton: `button[type=submit]`, acceptButton: '.vn-confirm.shown button[response="accept"]' }, @@ -631,11 +622,11 @@ export default { addNewRouteButton: 'vn-route-index > a[ui-sref="route.create"]' }, createRouteView: { - workerAutocomplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.workerFk"]', + worker: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.workerFk"]', createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]', - vehicleAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', - agencyAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]', - descriptionInput: 'vn-route-create [ng-model="$ctrl.route.description"]', + vehicleAuto: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', + agency: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]', + description: 'vn-route-create [ng-model="$ctrl.route.description"]', submitButton: 'vn-route-create button[type=submit]' }, routeDescriptor: { @@ -645,14 +636,13 @@ export default { routeId: 'vn-route-summary > vn-card > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(1) > section > span' }, routeBasicData: { - workerAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]', - vehicleAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', - agencyAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]', - kmStartInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmStart"]', - kmEndInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmEnd"]', - createdDateInput: 'vn-route-basic-data vn-date-picker[ng-model="$ctrl.route.created"]', - startedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.started"]', - finishedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.finished"]', + worker: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]', + vehicle: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', + kmStart: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmStart"]', + kmEnd: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmEnd"]', + createdDate: 'vn-route-basic-data vn-date-picker[ng-model="$ctrl.route.created"]', + startedHour: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.started"]', + finishedHour: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.finished"]', saveButton: 'vn-route-basic-data button[type=submit]' }, routeTickets: { @@ -667,11 +657,11 @@ export default { confirmButton: '.vn-confirm.shown button[response="accept"]' }, workerPbx: { - extensionInput: 'vn-worker-pbx [ng-model="$ctrl.worker.sip.extension"]', + extension: 'vn-worker-pbx vn-textfield[ng-model="$ctrl.worker.sip.extension"]', saveButton: 'vn-worker-pbx button[type=submit]' }, workerTimeControl: { - timeDialogInput: '.vn-dialog.shown [ng-model="$ctrl.newTime"]', + timeDialog: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newTime"]', 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', @@ -723,7 +713,7 @@ export default { acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]' }, invoiceOutIndex: { - searchInvoiceOutInput: 'vn-searchbar', + topbarSearch: 'vn-searchbar', searchButton: 'vn-searchbar vn-icon[icon="search"]', searchResult: 'vn-invoice-out-index vn-card > vn-table > div > vn-tbody > a.vn-tr', }, diff --git a/e2e/paths/02-client-module/01_create_client.spec.js b/e2e/paths/02-client-module/01_create_client.spec.js index f09a07265..4fe76c959 100644 --- a/e2e/paths/02-client-module/01_create_client.spec.js +++ b/e2e/paths/02-client-module/01_create_client.spec.js @@ -15,7 +15,7 @@ describe('Client create path', async() => { }); it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => { - await page.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers'); + await page.write(selectors.clientsIndex.topbarSearch, 'Carol Danvers'); await page.waitToClick(selectors.clientsIndex.searchButton); await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0); const result = await page.countElement(selectors.clientsIndex.searchResult); @@ -42,7 +42,7 @@ describe('Client create path', async() => { await page.write(selectors.createClientView.taxNumber, '74451390E'); await page.write(selectors.createClientView.userName, 'CaptainMarvel'); await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es'); - await page.autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher'); + await page.autocompleteSearch(selectors.createClientView.salesPerson, 'replenisher'); await page.waitToClick(selectors.createClientView.createButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/02_edit_basic_data.spec.js b/e2e/paths/02-client-module/02_edit_basic_data.spec.js index 4bf2d0120..6be3f4baa 100644 --- a/e2e/paths/02-client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client-module/02_edit_basic_data.spec.js @@ -18,22 +18,22 @@ describe('Client Edit basicData path', () => { describe('as employee', () => { it('should not be able to change the salesPerson', async() => { - await page.wait(selectors.clientBasicData.nameInput); + await page.wait(selectors.clientBasicData.name); const result = await page.evaluate(selector => { return document.querySelector(selector).disabled; - }, `${selectors.clientBasicData.salesPersonAutocomplete} input`); + }, `${selectors.clientBasicData.salesPerson} input`); expect(result).toBeTruthy(); }); it('should edit the client basic data but leave salesPerson untainted', async() => { - await page.clearInput(selectors.clientBasicData.nameInput); - await page.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace'); - await page.clearInput(selectors.clientBasicData.contactInput); - await page.write(selectors.clientBasicData.contactInput, 'David Haller'); - await page.clearInput(selectors.clientBasicData.emailInput); - await page.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es'); - await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets'); + await page.clearInput(selectors.clientBasicData.name); + await page.write(selectors.clientBasicData.name, 'Ptonomy Wallace'); + await page.clearInput(selectors.clientBasicData.contact); + await page.write(selectors.clientBasicData.contact, 'David Haller'); + await page.clearInput(selectors.clientBasicData.email); + await page.write(selectors.clientBasicData.email, 'PWallace@verdnatura.es'); + await page.autocompleteSearch(selectors.clientBasicData.channel, 'Rumors on the streets'); await page.waitToClick(selectors.clientBasicData.saveButton); const result = await page.waitForLastSnackbar(); @@ -42,28 +42,28 @@ describe('Client Edit basicData path', () => { it('should confirm the name have been edited', async() => { await page.reloadSection('client.card.basicData'); - const result = await page.waitToGetProperty(selectors.clientBasicData.nameInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientBasicData.name, 'value'); expect(result).toEqual('Ptonomy Wallace'); }); it('should confirm the contact name have been edited', async() => { const result = await page - .waitToGetProperty(selectors.clientBasicData.contactInput, 'value'); + .waitToGetProperty(selectors.clientBasicData.contact, 'value'); expect(result).toEqual('David Haller'); }); it('should confirm the email have been edited', async() => { const result = await page - .waitToGetProperty(selectors.clientBasicData.emailInput, 'value'); + .waitToGetProperty(selectors.clientBasicData.email, 'value'); expect(result).toEqual('PWallace@verdnatura.es'); }); it('should confirm the channel have been selected', async() => { const result = await page - .waitToGetProperty(selectors.clientBasicData.channelAutocomplete, 'value'); + .waitToGetProperty(selectors.clientBasicData.channel, 'value'); expect(result).toEqual('Rumors on the streets'); }); @@ -77,23 +77,23 @@ describe('Client Edit basicData path', () => { }); it('should be able to change the salesPerson', async() => { - await page.wait(selectors.clientBasicData.nameInput); + await page.wait(selectors.clientBasicData.name); const result = await page.evaluate(selector => { return document.querySelector(selector).disabled; - }, `${selectors.clientBasicData.salesPersonAutocomplete} input`); + }, `${selectors.clientBasicData.salesPerson} input`); expect(result).toBeFalsy(); }); it('should edit the client basic data including salesPerson', async() => { - await page.clearInput(selectors.clientBasicData.nameInput); - await page.write(selectors.clientBasicData.nameInput, 'Ororo Munroe'); - await page.clearInput(selectors.clientBasicData.contactInput); - await page.write(selectors.clientBasicData.contactInput, 'Black Panther'); - await page.clearInput(selectors.clientBasicData.emailInput); - await page.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es'); - await page.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick'); - await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper'); + await page.clearInput(selectors.clientBasicData.name); + await page.write(selectors.clientBasicData.name, 'Ororo Munroe'); + await page.clearInput(selectors.clientBasicData.contact); + await page.write(selectors.clientBasicData.contact, 'Black Panther'); + await page.clearInput(selectors.clientBasicData.email); + await page.write(selectors.clientBasicData.email, 'Storm@verdnatura.es'); + await page.autocompleteSearch(selectors.clientBasicData.salesPerson, 'replenisherNick'); + await page.autocompleteSearch(selectors.clientBasicData.channel, 'Metropolis newspaper'); await page.waitToClick(selectors.clientBasicData.saveButton); const result = await page.waitForLastSnackbar(); @@ -102,35 +102,35 @@ describe('Client Edit basicData path', () => { it('should now confirm the name have been edited', async() => { await page.reloadSection('client.card.basicData'); - const result = await page.waitToGetProperty(selectors.clientBasicData.nameInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientBasicData.name, 'value'); expect(result).toEqual('Ororo Munroe'); }); it('should now confirm the contact name have been edited', async() => { const result = await page - .waitToGetProperty(selectors.clientBasicData.contactInput, 'value'); + .waitToGetProperty(selectors.clientBasicData.contact, 'value'); expect(result).toEqual('Black Panther'); }); it('should now confirm the email have been edited', async() => { const result = await page - .waitToGetProperty(selectors.clientBasicData.emailInput, 'value'); + .waitToGetProperty(selectors.clientBasicData.email, 'value'); expect(result).toEqual('Storm@verdnatura.es'); }); it('should confirm the sales person have been selected', async() => { const result = await page - .waitToGetProperty(selectors.clientBasicData.salesPersonAutocomplete, 'value'); + .waitToGetProperty(selectors.clientBasicData.salesPerson, 'value'); expect(result).toEqual('replenisherNick'); }); it('should now confirm the channel have been selected', async() => { const result = await page - .waitToGetProperty(selectors.clientBasicData.channelAutocomplete, 'value'); + .waitToGetProperty(selectors.clientBasicData.channel, 'value'); expect(result).toEqual('Metropolis newspaper'); }); diff --git a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js index d9e6e775c..854f41f5b 100644 --- a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js @@ -58,26 +58,26 @@ describe('Client Edit fiscalData path', () => { }); it(`should edit the fiscal data but fail as the fiscal id ain't valid`, async() => { - await page.wait(selectors.clientFiscalData.socialNameInput); - await page.clearInput(selectors.clientFiscalData.socialNameInput); - await page.write(selectors.clientFiscalData.socialNameInput, 'SMASH'); - await page.clearInput(selectors.clientFiscalData.fiscalIdInput); - await page.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!'); - await page.clearInput(selectors.clientFiscalData.addressInput); - await page.write(selectors.clientFiscalData.addressInput, 'Somewhere edited'); - await page.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España'); - await page.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one'); - await page.clearInput(selectors.clientFiscalData.cityInput); - await page.write(selectors.clientFiscalData.cityInput, 'Valencia'); - await page.clearInput(selectors.clientFiscalData.postcodeInput); - await page.write(selectors.clientFiscalData.postcodeInput, '46000'); + await page.wait(selectors.clientFiscalData.socialName); + await page.clearInput(selectors.clientFiscalData.socialName); + await page.write(selectors.clientFiscalData.socialName, 'SMASH'); + await page.clearInput(selectors.clientFiscalData.fiscalId); + await page.write(selectors.clientFiscalData.fiscalId, 'INVALID!'); + await page.clearInput(selectors.clientFiscalData.address); + await page.write(selectors.clientFiscalData.address, 'Somewhere edited'); + await page.autocompleteSearch(selectors.clientFiscalData.country, 'España'); + await page.autocompleteSearch(selectors.clientFiscalData.province, 'Province one'); + await page.clearInput(selectors.clientFiscalData.city); + await page.write(selectors.clientFiscalData.city, 'Valencia'); + await page.clearInput(selectors.clientFiscalData.postcode); + await page.write(selectors.clientFiscalData.postcode, '46000'); await page.waitToClick(selectors.clientFiscalData.activeCheckbox); await page.waitToClick(selectors.clientFiscalData.frozenCheckbox); await page.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox); await page.waitToClick(selectors.clientFiscalData.viesCheckbox); await page.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox); await page.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox); - await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox); + await page.waitToClick(selectors.clientFiscalData.equalizationTax); await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -86,8 +86,8 @@ describe('Client Edit fiscalData path', () => { }, 15000); it(`should edit the fiscal this time with a valid fiscal id`, async() => { - await page.clearInput(selectors.clientFiscalData.fiscalIdInput); - await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C'); + await page.clearInput(selectors.clientFiscalData.fiscalId); + await page.write(selectors.clientFiscalData.fiscalId, '94980061C'); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -103,8 +103,8 @@ describe('Client Edit fiscalData path', () => { it('should receive an error if the fiscal id contains A or B at the beginning', async() => { await page.waitToClick(selectors.clientFiscalData.viesCheckbox); - await page.clearInput(selectors.clientFiscalData.fiscalIdInput); - await page.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C'); + await page.clearInput(selectors.clientFiscalData.fiscalId); + await page.write(selectors.clientFiscalData.fiscalId, 'A94980061C'); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -112,8 +112,8 @@ describe('Client Edit fiscalData path', () => { }); it('should finally edit the fixcal data correctly as VIES isnt checked and fiscal id is valid for EQtax', async() => { - await page.clearInput(selectors.clientFiscalData.fiscalIdInput); - await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C'); + await page.clearInput(selectors.clientFiscalData.fiscalId); + await page.write(selectors.clientFiscalData.fiscalId, '94980061C'); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -151,7 +151,7 @@ describe('Client Edit fiscalData path', () => { it('should navigate back to fiscal data and uncheck EQtax then check VIES', async() => { await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); await page.waitToClick(selectors.clientFiscalData.viesCheckbox); - await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox); + await page.waitToClick(selectors.clientFiscalData.equalizationTax); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -167,44 +167,44 @@ describe('Client Edit fiscalData path', () => { it('should confirm its name have been edited', async() => { await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); - const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); expect(result).toEqual('SMASH'); }); it('should confirm the fiscal id have been edited', async() => { - const result = await page.waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.fiscalId, 'value'); expect(result).toEqual('94980061C'); }); it('should confirm the address have been edited', async() => { - const result = await page.waitToGetProperty(selectors.clientFiscalData.addressInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.address, 'value'); expect(result).toEqual('Somewhere edited'); }); it('should confirm the postcode have been edited', async() => { - const result = await page.waitToGetProperty(selectors.clientFiscalData.postcodeInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.postcode, 'value'); expect(result).toContain('46000'); }); it('should confirm the city have been autocompleted', async() => { - const result = await page.waitToGetProperty(selectors.clientFiscalData.cityInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.city, 'value'); expect(result).toEqual('Valencia'); }); it(`should confirm the province have been autocompleted`, async() => { - const result = await page.waitToGetProperty(selectors.clientFiscalData.provinceAutocomplete, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.province, 'value'); expect(result).toEqual('Province one'); }); it('should confirm the country have been autocompleted', async() => { - const result = await page.waitToGetProperty(selectors.clientFiscalData.countryAutocomplete, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.country, 'value'); expect(result).toEqual('España'); }); @@ -246,7 +246,7 @@ describe('Client Edit fiscalData path', () => { }); it('should confirm Equalization tax checkbox is unchecked', async() => { - const result = await page.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox); + const result = await page.checkboxState(selectors.clientFiscalData.equalizationTax); expect(result).toBe('unchecked'); }); @@ -269,7 +269,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.cityInput, 'Silla'); + await page.waitForTextInField(selectors.clientAddresses.city, 'Silla'); await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox); await page.waitToClick(selectors.clientAddresses.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js index 529dd9e35..b757940be 100644 --- a/e2e/paths/02-client-module/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client-module/04_edit_billing_data.spec.js @@ -17,11 +17,11 @@ describe('Client Edit billing data path', () => { }); it(`should attempt to edit the billing data without an IBAN but fail`, async() => { - await page.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN'); - await page.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM'); - await page.clearInput(selectors.clientBillingData.dueDayInput); - await page.write(selectors.clientBillingData.dueDayInput, '60'); - await page.waitForTextInField(selectors.clientBillingData.dueDayInput, '60'); + await page.autocompleteSearch(selectors.clientBillingData.payMethod, 'PayMethod with IBAN'); + await page.autocompleteSearch(selectors.clientBillingData.swiftBic, 'BBKKESMMMMM'); + await page.clearInput(selectors.clientBillingData.dueDay); + await page.write(selectors.clientBillingData.dueDay, '60'); + await page.waitForTextInField(selectors.clientBillingData.dueDay, '60'); await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox); await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox); await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox); @@ -37,30 +37,30 @@ describe('Client Edit billing data path', () => { await page.write(selectors.clientBillingData.newBankEntityCode, '9999'); await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT'); await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton); - await page.waitForTextInField(selectors.clientBillingData.swiftBicAutocomplete, 'Gotham City Bank'); - let newcode = await page.waitToGetProperty(selectors.clientBillingData.swiftBicAutocomplete, 'value'); + await page.waitForTextInField(selectors.clientBillingData.swiftBic, 'Gotham City Bank'); + let newcode = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value'); expect(newcode).toEqual('GTHMCT Gotham City Bank'); }); it(`should confirm the IBAN pay method was sucessfully saved`, async() => { - let payMethod = await page.waitToGetProperty(selectors.clientBillingData.payMethodAutocomplete, 'value'); + let payMethod = await page.waitToGetProperty(selectors.clientBillingData.payMethod, 'value'); expect(payMethod).toEqual('PayMethod with IBAN'); }); it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => { - await page.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332'); + await page.write(selectors.clientBillingData.IBAN, 'ES9121000418450200051332'); await page.keyboard.press('Tab'); await page.keyboard.press('Tab'); - await page.waitForTextInField(selectors.clientBillingData.swiftBicAutocomplete, 'caixesbb'); - let automaticCode = await page.waitToGetProperty(selectors.clientBillingData.swiftBicAutocomplete, 'value'); + await page.waitForTextInField(selectors.clientBillingData.swiftBic, 'caixesbb'); + let automaticCode = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value'); expect(automaticCode).toEqual('CAIXESBB Caixa Bank'); }); it(`should save the form with all its new data`, async() => { - await page.waitForContentLoaded(); + await page.waitFor(3000); await page.waitForWatcherData(selectors.clientBillingData.watcher); await page.waitToClick(selectors.clientBillingData.saveButton); let snackbarMessage = await page.waitForLastSnackbar(); @@ -69,19 +69,19 @@ describe('Client Edit billing data path', () => { }); it('should confirm the due day have been edited', async() => { - let dueDate = await page.waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value'); + let dueDate = await page.waitToGetProperty(selectors.clientBillingData.dueDay, 'value'); expect(dueDate).toEqual('60'); }); it('should confirm the IBAN was saved', async() => { - let IBAN = await page.waitToGetProperty(selectors.clientBillingData.IBANInput, 'value'); + let IBAN = await page.waitToGetProperty(selectors.clientBillingData.IBAN, 'value'); expect(IBAN).toEqual('ES9121000418450200051332'); }); it('should confirm the swift / BIC code was saved', async() => { - let code = await page.waitToGetProperty(selectors.clientBillingData.swiftBicAutocomplete, 'value'); + let code = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value'); expect(code).toEqual('CAIXESBB Caixa Bank'); }); diff --git a/e2e/paths/02-client-module/05_add_address.spec.js b/e2e/paths/02-client-module/05_add_address.spec.js index 8eb4a86bf..43b663ae6 100644 --- a/e2e/paths/02-client-module/05_add_address.spec.js +++ b/e2e/paths/02-client-module/05_add_address.spec.js @@ -25,12 +25,12 @@ describe('Client Add address path', () => { }); it('should receive an error after clicking save button as consignee, street and town fields are empty', async() => { - await page.waitToClick(selectors.clientAddresses.defaultCheckboxInput); - await page.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province five'); - await page.write(selectors.clientAddresses.cityInput, 'Valencia'); - await page.write(selectors.clientAddresses.postcodeInput, '46000'); - await page.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement'); - await page.write(selectors.clientAddresses.phoneInput, '999887744'); + await page.waitToClick(selectors.clientAddresses.defaultCheckbox); + await page.autocompleteSearch(selectors.clientAddresses.province, 'Province five'); + await page.write(selectors.clientAddresses.city, 'Valencia'); + await page.write(selectors.clientAddresses.postcode, '46000'); + await page.autocompleteSearch(selectors.clientAddresses.agency, 'Entanglement'); + await page.write(selectors.clientAddresses.phone, '999887744'); await page.write(selectors.clientAddresses.mobileInput, '999887744'); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -40,8 +40,8 @@ describe('Client Add address path', () => { it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => { - await page.write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner'); - await page.write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York'); + 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); const result = await page.waitForLastSnackbar(); @@ -49,7 +49,7 @@ describe('Client Add address path', () => { }); it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => { - await page.autocompleteSearch(selectors.clientAddresses.incotermsAutocomplete, 'Free Alongside Ship'); + await page.autocompleteSearch(selectors.clientAddresses.incoterms, 'Free Alongside Ship'); await page.waitToClick(selectors.clientAddresses.saveButton); const result = await page.waitForLastSnackbar(); @@ -57,7 +57,7 @@ describe('Client Add address path', () => { }); it(`should create a new address with all it's data`, async() => { - await page.autocompleteSearch(selectors.clientAddresses.customsAgentAutocomplete, 'Agent one'); + await page.autocompleteSearch(selectors.clientAddresses.customsAgent, 'Agent one'); await page.waitToClick(selectors.clientAddresses.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/06_add_address_notes.spec.js b/e2e/paths/02-client-module/06_add_address_notes.spec.js index c19de91b8..59e2bf5fb 100644 --- a/e2e/paths/02-client-module/06_add_address_notes.spec.js +++ b/e2e/paths/02-client-module/06_add_address_notes.spec.js @@ -27,7 +27,7 @@ describe('Client add address notes path', () => { it('should not save a description without observation type', async() => { await page.waitToClick(selectors.clientAddresses.addObservationButton); - await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description'); + await page.write(selectors.clientAddresses.firstObservationDescription, 'first description'); await page.waitToClick(selectors.clientAddresses.saveButton); const result = await page.waitForLastSnackbar(); @@ -35,8 +35,8 @@ describe('Client add address notes path', () => { }); it('should not save an observation type without description', async() => { - await page.clearInput(selectors.clientAddresses.firstObservationDescriptionInput); - await page.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial'); + await page.clearInput(selectors.clientAddresses.firstObservationDescription); + await page.autocompleteSearch(selectors.clientAddresses.firstObservationType, 'comercial'); await page.waitToClick(selectors.clientAddresses.saveButton); const result = await page.waitForLastSnackbar(); @@ -44,10 +44,10 @@ describe('Client add address notes path', () => { }); it('should create two new observations', async() => { - await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description'); + await page.write(selectors.clientAddresses.firstObservationDescription, 'first description'); await page.waitToClick(selectors.clientAddresses.addObservationButton); - await page.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one'); - await page.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description'); + await page.autocompleteSearch(selectors.clientAddresses.secondObservationType, 'observation one'); + await page.write(selectors.clientAddresses.secondObservationDescription, 'second description'); await page.waitToClick(selectors.clientAddresses.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/07_edit_web_access.spec.js b/e2e/paths/02-client-module/07_edit_web_access.spec.js index b01f2a9d4..f9b023716 100644 --- a/e2e/paths/02-client-module/07_edit_web_access.spec.js +++ b/e2e/paths/02-client-module/07_edit_web_access.spec.js @@ -18,8 +18,8 @@ describe('Client Edit web access path', () => { it(`should uncheck the Enable web access checkbox and update the name`, async() => { await page.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox); - await page.clearInput(selectors.clientWebAccess.userNameInput); - await page.write(selectors.clientWebAccess.userNameInput, 'Hulk'); + await page.clearInput(selectors.clientWebAccess.userName); + await page.write(selectors.clientWebAccess.userName, 'Hulk'); await page.waitToClick(selectors.clientWebAccess.saveButton); const result = await page.waitForLastSnackbar(); @@ -28,7 +28,7 @@ describe('Client Edit web access path', () => { it('should confirm web access is now unchecked', async() => { await page.waitToClick(selectors.clientBasicData.basicDataButton); - await page.wait(selectors.clientBasicData.nameInput); + await page.wait(selectors.clientBasicData.name); await page.waitToClick(selectors.clientsIndex.othersButton); await page.waitToClick(selectors.clientWebAccess.webAccessButton); const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox); @@ -37,7 +37,7 @@ describe('Client Edit web access path', () => { }); it('should confirm web access name have been updated', async() => { - const result = await page.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientWebAccess.userName, 'value'); expect(result).toEqual('Hulk'); }); diff --git a/e2e/paths/02-client-module/08_add_notes.spec.js b/e2e/paths/02-client-module/08_add_notes.spec.js index 6a9ae26f0..44b876cd9 100644 --- a/e2e/paths/02-client-module/08_add_notes.spec.js +++ b/e2e/paths/02-client-module/08_add_notes.spec.js @@ -25,8 +25,8 @@ describe('Client Add notes path', () => { }); it(`should create a note`, async() => { - await page.waitFor(selectors.clientNotes.noteInput); - await page.type(`${selectors.clientNotes.noteInput} textarea`, 'Meeting with Black Widow 21st 9am'); + await page.waitFor(selectors.clientNotes.note); + await page.type(`${selectors.clientNotes.note} textarea`, 'Meeting with Black Widow 21st 9am'); await page.waitToClick(selectors.clientNotes.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/09_add_credit.spec.js b/e2e/paths/02-client-module/09_add_credit.spec.js index 3f8aa0912..b90c629f5 100644 --- a/e2e/paths/02-client-module/09_add_credit.spec.js +++ b/e2e/paths/02-client-module/09_add_credit.spec.js @@ -26,8 +26,8 @@ describe('Client Add credit path', () => { it(`should edit the credit`, async() => { await page.waitForContentLoaded(); - await page.clearInput(selectors.clientCredit.creditInput); - await page.write(selectors.clientCredit.creditInput, '999'); + await page.clearInput(selectors.clientCredit.credit); + await page.write(selectors.clientCredit.credit, '999'); await page.waitToClick(selectors.clientCredit.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/10_add_greuge.spec.js b/e2e/paths/02-client-module/10_add_greuge.spec.js index dcc8b9273..86407f3c6 100644 --- a/e2e/paths/02-client-module/10_add_greuge.spec.js +++ b/e2e/paths/02-client-module/10_add_greuge.spec.js @@ -25,7 +25,7 @@ describe('Client Add greuge path', () => { }); it(`should receive an error if all fields are empty but date and type on submit`, async() => { - await page.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff'); + await page.autocompleteSearch(selectors.clientGreuge.type, 'Diff'); await page.waitToClick(selectors.clientGreuge.saveButton); const result = await page.waitForLastSnackbar(); @@ -33,9 +33,9 @@ describe('Client Add greuge path', () => { }); it(`should create a new greuge with all its data`, async() => { - await page.write(selectors.clientGreuge.amountInput, '999'); - await page.waitForTextInField(selectors.clientGreuge.amountInput, '999'); - await page.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!'); + await page.write(selectors.clientGreuge.amount, '999'); + await page.waitForTextInField(selectors.clientGreuge.amount, '999'); + await page.write(selectors.clientGreuge.description, 'new armor for Batman!'); await page.waitToClick(selectors.clientGreuge.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js index df4614f24..06db0a672 100644 --- a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js @@ -26,9 +26,9 @@ describe('Client lock verified data path', () => { }); it('should edit the social name', async() => { - await page.wait(selectors.clientFiscalData.socialNameInput); - await page.clearInput(selectors.clientFiscalData.socialNameInput); - await page.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War'); + await page.wait(selectors.clientFiscalData.socialName); + await page.clearInput(selectors.clientFiscalData.socialName); + await page.write(selectors.clientFiscalData.socialName, 'Captain America Civil War'); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -37,7 +37,7 @@ describe('Client lock verified data path', () => { it('should confirm the social name have been edited', async() => { await page.reloadSection('client.card.fiscalData'); - const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); expect(result).toEqual('Captain America Civil War'); }); @@ -72,9 +72,9 @@ describe('Client lock verified data path', () => { }); it('should again edit the social name', async() => { - await page.wait(selectors.clientFiscalData.socialNameInput); - await page.clearInput(selectors.clientFiscalData.socialNameInput); - await page.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp'); + await page.wait(selectors.clientFiscalData.socialName); + await page.clearInput(selectors.clientFiscalData.socialName); + await page.write(selectors.clientFiscalData.socialName, 'Ant man and the Wasp'); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -83,7 +83,7 @@ describe('Client lock verified data path', () => { it('should again confirm the social name have been edited', async() => { await page.reloadSection('client.card.fiscalData'); - const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); expect(result).toEqual('Ant man and the Wasp'); }); @@ -103,8 +103,8 @@ describe('Client lock verified data path', () => { }); it('should not be able to save change throwing a verified data error', async() => { - await page.clearInput(selectors.clientFiscalData.socialNameInput); - await page.write(selectors.clientFiscalData.socialNameInput, 'This wont happen'); + await page.clearInput(selectors.clientFiscalData.socialName); + await page.write(selectors.clientFiscalData.socialName, 'This wont happen'); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -127,8 +127,8 @@ describe('Client lock verified data path', () => { }); it('should now edit the social name', async() => { - await page.clearInput(selectors.clientFiscalData.socialNameInput); - await page.write(selectors.clientFiscalData.socialNameInput, 'new social name edition'); + await page.clearInput(selectors.clientFiscalData.socialName); + await page.write(selectors.clientFiscalData.socialName, 'new social name edition'); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -137,7 +137,7 @@ describe('Client lock verified data path', () => { it('should now confirm the social name have been edited once and for all', async() => { await page.reloadSection('client.card.fiscalData'); - const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); + const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); expect(result).toEqual('new social name edition'); }); @@ -158,7 +158,7 @@ describe('Client lock verified data path', () => { }); it('should confirm the form is enabled for salesPerson', async() => { - await page.wait(selectors.clientFiscalData.socialNameInput); + await page.wait(selectors.clientFiscalData.socialName); const result = await page.evaluate(selector => { return document.querySelector(selector).disabled; }, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div'); diff --git a/e2e/paths/02-client-module/13_log.spec.js b/e2e/paths/02-client-module/13_log.spec.js index 4b09b0500..a24c7cf4e 100644 --- a/e2e/paths/02-client-module/13_log.spec.js +++ b/e2e/paths/02-client-module/13_log.spec.js @@ -17,8 +17,8 @@ describe('Client log path', () => { }); it('should update the clients name', async() => { - await page.clearInput(selectors.clientBasicData.nameInput); - await page.write(selectors.clientBasicData.nameInput, 'this is a test'); + await page.clearInput(selectors.clientBasicData.name); + await page.write(selectors.clientBasicData.name, 'this is a test'); await page.waitToClick(selectors.clientBasicData.saveButton); let result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/14_balance.spec.js b/e2e/paths/02-client-module/14_balance.spec.js index ccbf19057..9d5ff471a 100644 --- a/e2e/paths/02-client-module/14_balance.spec.js +++ b/e2e/paths/02-client-module/14_balance.spec.js @@ -26,7 +26,7 @@ describe('Client balance path', () => { it('should access to the balance section to check the data shown matches the local settings', async() => { await page.accessToSection('client.card.balance.index'); - let result = await page.waitToGetProperty(selectors.clientBalance.companyAutocomplete, 'value'); + let result = await page.waitToGetProperty(selectors.clientBalance.company, 'value'); expect(result).toEqual('CCs'); }); @@ -50,10 +50,9 @@ describe('Client balance path', () => { }); it('should create a new payment that clears the debt', async() => { - await Promise.all([ - page.waitToClick(selectors.clientBalance.newPaymentButton), - page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true}) - ]); + await page.waitToClick(selectors.clientBalance.newPaymentButton); + await page.waitForContentLoaded(); + await page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true}); await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt'); await page.waitToClick(selectors.clientBalance.saveButton); let result = await page.waitForLastSnackbar(); @@ -64,7 +63,7 @@ describe('Client balance path', () => { it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => { await page.waitForSpinnerLoad(); let company = await page - .waitToGetProperty(selectors.clientBalance.companyAutocomplete, 'value'); + .waitToGetProperty(selectors.clientBalance.company, 'value'); let firstBalanceLine = await page .waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText'); @@ -77,8 +76,8 @@ describe('Client balance path', () => { it('should create a new payment that sets the balance to positive value', async() => { await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :( - await page.clearInput(selectors.clientBalance.newPaymentAmountInput); - await page.write(selectors.clientBalance.newPaymentAmountInput, '100'); + await page.clearInput(selectors.clientBalance.newPaymentAmount); + await page.write(selectors.clientBalance.newPaymentAmount, '100'); await page.waitToClick(selectors.clientBalance.saveButton); let result = await page.waitForLastSnackbar(); @@ -96,8 +95,8 @@ describe('Client balance path', () => { await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :( await page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true}); - await page.clearInput(selectors.clientBalance.newPaymentAmountInput); - await page.write(selectors.clientBalance.newPaymentAmountInput, '-150'); + await page.clearInput(selectors.clientBalance.newPaymentAmount); + await page.write(selectors.clientBalance.newPaymentAmount, '-150'); await page.waitToClick(selectors.clientBalance.saveButton); let result = await page.waitForLastSnackbar(); @@ -123,7 +122,7 @@ describe('Client balance path', () => { }); it('should now search for the user Petter Parker', async() => { - await page.write(selectors.clientsIndex.searchClientInput, 'Petter Parker'); + await page.write(selectors.clientsIndex.topbarSearch, 'Petter Parker'); await page.waitToClick(selectors.clientsIndex.searchButton); await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1); let resultCount = await page.countElement(selectors.clientsIndex.searchResult); diff --git a/e2e/paths/02-client-module/15_user_config.spec.js b/e2e/paths/02-client-module/15_user_config.spec.js index 48e9b7c9d..6f76c73ca 100644 --- a/e2e/paths/02-client-module/15_user_config.spec.js +++ b/e2e/paths/02-client-module/15_user_config.spec.js @@ -16,20 +16,22 @@ describe('User config', () => { describe('as salesPerson', () => { it('should login', async() => { await page.login('salesPerson'); + await page.waitForContentLoaded(); }); it('should now open the user config form to check the settings', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); + await page.waitFor(1000); - let userLocalWarehouse = await page - .waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value'); + let expectedLocalWarehouse = await page + .expectPropertyValue(selectors.globalItems.userLocalWarehouse, 'value', ''); - let userLocalBank = await page - .waitToGetProperty(selectors.globalItems.userLocalBank, 'value'); + let expectedLocalBank = await page + .expectPropertyValue(selectors.globalItems.userLocalBank, 'value', ''); - let userLocalCompany = await page - .waitToGetProperty(selectors.globalItems.userLocalCompany, 'value'); + let expectedLocalCompany = await page + .expectPropertyValue(selectors.globalItems.userLocalCompany, 'value', ''); let userWarehouse = await page .waitToGetProperty(selectors.globalItems.userWarehouse, 'value'); @@ -37,9 +39,9 @@ describe('User config', () => { let userCompany = await page .waitToGetProperty(selectors.globalItems.userCompany, 'value'); - expect(userLocalWarehouse).toEqual(''); - expect(userLocalBank).toEqual(''); - expect(userLocalCompany).toEqual(''); + expect(expectedLocalWarehouse).toBeTruthy(); + expect(expectedLocalBank).toBeTruthy(); + expect(expectedLocalCompany).toBeTruthy(); expect(userWarehouse).toEqual('Warehouse Three'); expect(userCompany).toEqual('VNH'); }); @@ -48,18 +50,21 @@ describe('User config', () => { describe('as employee', () => { it('should log in', async() => { await page.login('employee'); + await page.waitForContentLoaded(); }); it('should open the user config form to check the settings', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); - let userLocalWarehouse = await page - .waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value'); + await page.waitFor(1000); + let expectedLocalWarehouse = await page + .expectPropertyValue(selectors.globalItems.userLocalWarehouse, 'value', ''); - let userLocalBank = await page - .waitToGetProperty(selectors.globalItems.userLocalBank, 'value'); - let userLocalCompany = await page - .waitToGetProperty(selectors.globalItems.userLocalCompany, 'value'); + let expectedLocalBank = await page + .expectPropertyValue(selectors.globalItems.userLocalBank, 'value', ''); + + let expectedLocalCompany = await page + .expectPropertyValue(selectors.globalItems.userLocalCompany, 'value', ''); let userWarehouse = await page .waitToGetProperty(selectors.globalItems.userWarehouse, 'value'); @@ -67,9 +72,9 @@ describe('User config', () => { let userCompany = await page .waitToGetProperty(selectors.globalItems.userCompany, 'value'); - expect(userLocalWarehouse).toEqual(''); - expect(userLocalBank).toEqual(''); - expect(userLocalCompany).toEqual(''); + expect(expectedLocalWarehouse).toBeTruthy(); + expect(expectedLocalBank).toBeTruthy(); + expect(expectedLocalCompany).toBeTruthy(); expect(userWarehouse).toEqual('Warehouse Two'); expect(userCompany).toEqual('CCs'); }); @@ -87,6 +92,7 @@ describe('User config', () => { describe('as salesPerson 2nd run', () => { it('should log in once more', async() => { await page.login('salesPerson'); + await page.waitForContentLoaded(); }); it('should again open the user config form to check the local settings', async() => { diff --git a/e2e/paths/03-worker-module/01_pbx.spec.js b/e2e/paths/03-worker-module/01_pbx.spec.js index 7b0de917c..83849a5dd 100644 --- a/e2e/paths/03-worker-module/01_pbx.spec.js +++ b/e2e/paths/03-worker-module/01_pbx.spec.js @@ -17,8 +17,7 @@ describe('Worker pbx path', () => { }); it('should receive an error when the extension exceeds 4 characters', async() => { - await page.waitForContentLoaded(); - await page.write(selectors.workerPbx.extensionInput, '55555'); + await page.write(selectors.workerPbx.extension, '55555'); await page.waitToClick(selectors.workerPbx.saveButton); const result = await page.waitForLastSnackbar(); @@ -26,8 +25,8 @@ describe('Worker pbx path', () => { }); it('should sucessfully save the changes', async() => { - await page.clearInput(selectors.workerPbx.extensionInput); - await page.write(selectors.workerPbx.extensionInput, '4444'); + await page.clearInput(selectors.workerPbx.extension); + await page.write(selectors.workerPbx.extension, '4444'); await page.waitToClick(selectors.workerPbx.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/03-worker-module/02_time_control.spec.js b/e2e/paths/03-worker-module/02_time_control.spec.js index 6f5815665..6624f25eb 100644 --- a/e2e/paths/03-worker-module/02_time_control.spec.js +++ b/e2e/paths/03-worker-module/02_time_control.spec.js @@ -23,7 +23,7 @@ xdescribe('Worker time control path', () => { const scanTime = '07:00'; await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText'); @@ -34,7 +34,7 @@ xdescribe('Worker time control path', () => { const scanTime = '10:00'; await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText'); @@ -45,7 +45,7 @@ xdescribe('Worker time control path', () => { const scanTime = '18:00'; await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); @@ -67,7 +67,7 @@ xdescribe('Worker time control path', () => { const scanTime = '14:00'; await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); @@ -78,7 +78,7 @@ xdescribe('Worker time control path', () => { const scanTime = '10:20'; await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText'); @@ -108,7 +108,7 @@ xdescribe('Worker time control path', () => { const scanTime = '08:00'; await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText'); @@ -119,7 +119,7 @@ xdescribe('Worker time control path', () => { const scanTime = '10:00'; await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText'); @@ -130,7 +130,7 @@ xdescribe('Worker time control path', () => { const scanTime = '10:20'; await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText'); @@ -141,7 +141,7 @@ xdescribe('Worker time control path', () => { const scanTime = '16:00'; await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText'); @@ -161,7 +161,7 @@ xdescribe('Worker time control path', () => { const scanTime = '09:00'; await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText'); @@ -172,7 +172,7 @@ xdescribe('Worker time control path', () => { const scanTime = '10:00'; await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText'); @@ -183,7 +183,7 @@ xdescribe('Worker time control path', () => { const scanTime = '10:20'; await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText'); @@ -194,7 +194,7 @@ xdescribe('Worker time control path', () => { const scanTime = '17:00'; await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText'); @@ -214,7 +214,7 @@ xdescribe('Worker time control path', () => { const scanTime = '09:59'; await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText'); @@ -224,7 +224,7 @@ xdescribe('Worker time control path', () => { 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.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText'); @@ -234,7 +234,7 @@ xdescribe('Worker time control path', () => { 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.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText'); @@ -244,7 +244,7 @@ xdescribe('Worker time control path', () => { 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.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText'); @@ -263,7 +263,7 @@ xdescribe('Worker time control path', () => { it('should smilingly scan in Hank Pym', async() => { const scanTime = '07:30'; await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText'); @@ -273,7 +273,7 @@ xdescribe('Worker time control path', () => { 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.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText'); @@ -283,7 +283,7 @@ xdescribe('Worker time control path', () => { 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.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText'); @@ -293,7 +293,7 @@ xdescribe('Worker time control path', () => { 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.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText'); @@ -324,7 +324,7 @@ xdescribe('Worker time control path', () => { it('should lovingly scan in Hank Pym', async() => { const scanTime = '06:00'; await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText'); @@ -334,7 +334,7 @@ xdescribe('Worker time control path', () => { 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.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText'); @@ -353,7 +353,7 @@ xdescribe('Worker time control path', () => { it('should gladly scan in Hank Pym', async() => { const scanTime = '05:00'; await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText'); @@ -363,7 +363,7 @@ xdescribe('Worker time control path', () => { 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.timeDialogInput, scanTime); + await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); await page.waitToClick(selectors.workerTimeControl.confirmButton); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText'); diff --git a/e2e/paths/04-item-module/01_summary.spec.js b/e2e/paths/04-item-module/01_summary.spec.js index f08900142..2e32f85e2 100644 --- a/e2e/paths/04-item-module/01_summary.spec.js +++ b/e2e/paths/04-item-module/01_summary.spec.js @@ -15,8 +15,8 @@ describe('Item summary path', () => { }); it('should search for an item', async() => { - await page.clearInput(selectors.itemsIndex.searchItemInput); - await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m'); + await page.clearInput(selectors.itemsIndex.topbarSearch); + await page.write(selectors.itemsIndex.topbarSearch, 'Ranged weapon longbow 2m'); await page.waitToClick(selectors.itemsIndex.searchButton); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); const result = await page.countElement(selectors.itemsIndex.searchResult); @@ -76,7 +76,7 @@ describe('Item summary path', () => { it('should search for other item', async() => { await page.clearInput('vn-searchbar'); await page.waitToClick(selectors.itemsIndex.searchButton); - await page.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm'); + await page.write(selectors.itemsIndex.topbarSearch, 'Melee weapon combat fist 15cm'); await page.waitToClick(selectors.itemsIndex.searchButton); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); const result = await page.countElement(selectors.itemsIndex.searchResult); diff --git a/e2e/paths/04-item-module/02_basic_data.spec.js b/e2e/paths/04-item-module/02_basic_data.spec.js index a0ab8dc73..2b3ff9d51 100644 --- a/e2e/paths/04-item-module/02_basic_data.spec.js +++ b/e2e/paths/04-item-module/02_basic_data.spec.js @@ -21,16 +21,16 @@ describe('Item Edit basic data path', () => { }); it(`should edit the item basic data`, async() => { - await page.clearInput(selectors.itemBasicData.nameInput); - await page.write(selectors.itemBasicData.nameInput, 'Rose of Purity'); - await page.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium'); - await page.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares'); - await page.clearInput(selectors.itemBasicData.relevancyInput); - await page.write(selectors.itemBasicData.relevancyInput, '1'); - await page.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain'); - await page.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH'); - await page.clearInput(selectors.itemBasicData.longNameInput); - await page.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity'); + await page.clearInput(selectors.itemBasicData.name); + await page.write(selectors.itemBasicData.name, 'Rose of Purity'); + await page.autocompleteSearch(selectors.itemBasicData.type, 'Anthurium'); + await page.autocompleteSearch(selectors.itemBasicData.intrastat, 'Coral y materiales similares'); + await page.clearInput(selectors.itemBasicData.relevancy); + await page.write(selectors.itemBasicData.relevancy, '1'); + await page.autocompleteSearch(selectors.itemBasicData.origin, 'Spain'); + await page.autocompleteSearch(selectors.itemBasicData.expense, 'Alquiler VNH'); + await page.clearInput(selectors.itemBasicData.longName); + await page.write(selectors.itemBasicData.longName, 'RS Rose of Purity'); await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox); await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); @@ -42,49 +42,49 @@ describe('Item Edit basic data path', () => { it(`should confirm the item name was edited`, async() => { await page.reloadSection('item.card.basicData'); await page.waitForContentLoaded(); - const result = await page.waitToGetProperty(selectors.itemBasicData.nameInput, 'value'); + const result = await page.waitToGetProperty(selectors.itemBasicData.name, 'value'); expect(result).toEqual('Rose of Purity'); }); it(`should confirm the item type was edited`, async() => { const result = await page - .waitToGetProperty(selectors.itemBasicData.typeAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBasicData.type, 'value'); expect(result).toEqual('Anthurium'); }); it(`should confirm the item intrastad was edited`, async() => { const result = await page - .waitToGetProperty(selectors.itemBasicData.intrastatAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBasicData.intrastat, 'value'); expect(result).toEqual('5080000 Coral y materiales similares'); }); it(`should confirm the item relevancy was edited`, async() => { const result = await page - .waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value'); + .waitToGetProperty(selectors.itemBasicData.relevancy, 'value'); expect(result).toEqual('1'); }); it(`should confirm the item origin was edited`, async() => { const result = await page - .waitToGetProperty(selectors.itemBasicData.originAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBasicData.origin, 'value'); expect(result).toEqual('Spain'); }); it(`should confirm the item expence was edited`, async() => { const result = await page - .waitToGetProperty(selectors.itemBasicData.expenseAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBasicData.expense, 'value'); expect(result).toEqual('Alquiler VNH'); }); it(`should confirm the item long name was edited`, async() => { const result = await page - .waitToGetProperty(selectors.itemBasicData.longNameInput, 'value'); + .waitToGetProperty(selectors.itemBasicData.longName, 'value'); expect(result).toEqual('RS Rose of Purity'); }); diff --git a/e2e/paths/04-item-module/03_tax.spec.js b/e2e/paths/04-item-module/03_tax.spec.js index 9892f92e7..ef2d68096 100644 --- a/e2e/paths/04-item-module/03_tax.spec.js +++ b/e2e/paths/04-item-module/03_tax.spec.js @@ -17,9 +17,9 @@ describe('Item edit tax path', () => { }); it(`should add the item tax to all countries`, async() => { - await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT'); - await page.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT'); - await page.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT'); + await page.autocompleteSearch(selectors.itemTax.firstClass, 'General VAT'); + await page.autocompleteSearch(selectors.itemTax.secondClass, 'General VAT'); + await page.autocompleteSearch(selectors.itemTax.thirdClass, 'General VAT'); await page.waitToClick(selectors.itemTax.submitTaxButton); const result = await page.waitForLastSnackbar(); @@ -28,35 +28,35 @@ describe('Item edit tax path', () => { it(`should confirm the first item tax class was edited`, async() => { await page.reloadSection('item.card.tax'); - const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value'); + const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value'); expect(firstVatType).toEqual('General VAT'); }); it(`should confirm the second item tax class was edited`, async() => { const secondVatType = await page - .waitToGetProperty(selectors.itemTax.secondClassAutocomplete, 'value'); + .waitToGetProperty(selectors.itemTax.secondClass, 'value'); expect(secondVatType).toEqual('General VAT'); }); it(`should confirm the third item tax class was edited`, async() => { const thirdVatType = await page - .waitToGetProperty(selectors.itemTax.thirdClassAutocomplete, 'value'); + .waitToGetProperty(selectors.itemTax.thirdClass, 'value'); expect(thirdVatType).toEqual('General VAT'); }); it(`should edit the first class without saving the form`, async() => { - await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT'); - const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value'); + await page.autocompleteSearch(selectors.itemTax.firstClass, 'Reduced VAT'); + const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value'); expect(firstVatType).toEqual('Reduced VAT'); }); it(`should now click the undo changes button and see the changes works`, async() => { await page.waitToClick(selectors.itemTax.undoChangesButton); - const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value'); + const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value'); expect(firstVatType).toEqual('General VAT'); }); diff --git a/e2e/paths/04-item-module/04_tags.spec.js b/e2e/paths/04-item-module/04_tags.spec.js index d25e63903..098ac75eb 100644 --- a/e2e/paths/04-item-module/04_tags.spec.js +++ b/e2e/paths/04-item-module/04_tags.spec.js @@ -19,10 +19,10 @@ describe('Item create tags path', () => { it(`should create a new tag and delete a former one`, async() => { await page.waitToClick(selectors.itemTags.fourthRemoveTagButton); await page.waitToClick(selectors.itemTags.addItemTagButton); - await page.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base'); - await page.write(selectors.itemTags.seventhValueInput, '50'); - await page.clearInput(selectors.itemTags.seventhRelevancyInput); - await page.write(selectors.itemTags.seventhRelevancyInput, '4'); + await page.autocompleteSearch(selectors.itemTags.seventhTag, 'Ancho de la base'); + await page.write(selectors.itemTags.seventhValue, '50'); + await page.clearInput(selectors.itemTags.seventhRelevancy); + await page.write(selectors.itemTags.seventhRelevancy, '4'); await page.waitToClick(selectors.itemTags.submitItemTagsButton); const result = await page.waitForLastSnackbar(); @@ -32,30 +32,30 @@ describe('Item create tags path', () => { it(`should confirm the fourth row data is the expected one`, async() => { await page.reloadSection('item.card.tags'); await page.wait('vn-item-tags'); - let result = await page.waitToGetProperty(selectors.itemTags.fourthTagAutocomplete, 'value'); + let result = await page.waitToGetProperty(selectors.itemTags.fourthTag, 'value'); expect(result).toEqual('Ancho de la base'); result = await page - .waitToGetProperty(selectors.itemTags.fourthValueInput, 'value'); + .waitToGetProperty(selectors.itemTags.fourthValue, 'value'); expect(result).toEqual('50'); result = await page - .waitToGetProperty(selectors.itemTags.fourthRelevancyInput, 'value'); + .waitToGetProperty(selectors.itemTags.fourthRelevancy, 'value'); expect(result).toEqual('4'); }); it(`should confirm the fifth row data is the expected one`, async() => { let tag = await page - .waitToGetProperty(selectors.itemTags.fifthTagAutocomplete, 'value'); + .waitToGetProperty(selectors.itemTags.fifthTag, 'value'); let value = await page - .waitToGetProperty(selectors.itemTags.fifthValueInput, 'value'); + .waitToGetProperty(selectors.itemTags.fifthValue, 'value'); let relevancy = await page - .waitToGetProperty(selectors.itemTags.fifthRelevancyInput, 'value'); + .waitToGetProperty(selectors.itemTags.fifthRelevancy, 'value'); expect(tag).toEqual('Color'); expect(value).toEqual('Brown'); @@ -64,13 +64,13 @@ describe('Item create tags path', () => { it(`should confirm the sixth row data is the expected one`, async() => { let tag = await page - .waitToGetProperty(selectors.itemTags.sixthTagAutocomplete, 'value'); + .waitToGetProperty(selectors.itemTags.sixthTag, 'value'); let value = await page - .waitToGetProperty(selectors.itemTags.sixthValueInput, 'value'); + .waitToGetProperty(selectors.itemTags.sixthValue, 'value'); let relevancy = await page - .waitToGetProperty(selectors.itemTags.sixthRelevancyInput, 'value'); + .waitToGetProperty(selectors.itemTags.sixthRelevancy, 'value'); expect(tag).toEqual('Categoria'); expect(value).toEqual('+1 precission'); diff --git a/e2e/paths/04-item-module/05_niche.spec.js b/e2e/paths/04-item-module/05_niche.spec.js index 42c0652df..4da8ed5fe 100644 --- a/e2e/paths/04-item-module/05_niche.spec.js +++ b/e2e/paths/04-item-module/05_niche.spec.js @@ -17,11 +17,11 @@ describe('Item create niche path', () => { }); it(`should click create a new niche and delete a former one`, async() => { - await page.waitForTextInField(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One'); + await page.waitForTextInField(selectors.itemNiches.firstWarehouse, 'Warehouse One'); await page.waitToClick(selectors.itemNiches.addNicheButton); await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton); - await page.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two'); - await page.write(selectors.itemNiches.thirdCodeInput, 'A4'); + await page.autocompleteSearch(selectors.itemNiches.thirdWarehouse, 'Warehouse Two'); + await page.write(selectors.itemNiches.thirdCode, 'A4'); await page.waitToClick(selectors.itemNiches.submitNichesButton); const result = await page.waitForLastSnackbar(); @@ -30,36 +30,36 @@ describe('Item create niche path', () => { it(`should confirm the first niche is the expected one`, async() => { await page.reloadSection('item.card.niche'); - await page.waitForTextInField(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One'); + await page.waitForTextInField(selectors.itemNiches.firstWarehouse, 'Warehouse One'); let result = await page - .waitToGetProperty(selectors.itemNiches.firstWarehouseAutocomplete, 'value'); + .waitToGetProperty(selectors.itemNiches.firstWarehouse, 'value'); expect(result).toEqual('Warehouse One'); result = await page - .waitToGetProperty(selectors.itemNiches.firstCodeInput, 'value'); + .waitToGetProperty(selectors.itemNiches.firstCode, 'value'); expect(result).toEqual('A1'); }); it(`should confirm the second niche is the expected one`, async() => { let result = await page - .waitToGetProperty(selectors.itemNiches.secondWarehouseAutocomplete, 'value'); + .waitToGetProperty(selectors.itemNiches.secondWarehouse, 'value'); expect(result).toEqual('Warehouse Three'); result = await page - .waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value'); + .waitToGetProperty(selectors.itemNiches.secondCode, 'value'); expect(result).toEqual('A3'); }); it(`should confirm the third niche is the expected one`, async() => { let result = await page - .waitToGetProperty(selectors.itemNiches.thirdWarehouseAutocomplete, 'value'); + .waitToGetProperty(selectors.itemNiches.thirdWarehouse, 'value'); expect(result).toEqual('Warehouse Two'); result = await page - .waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value'); + .waitToGetProperty(selectors.itemNiches.thirdCode, 'value'); expect(result).toEqual('A4'); }); diff --git a/e2e/paths/04-item-module/06_botanical.spec.js b/e2e/paths/04-item-module/06_botanical.spec.js index c3b1955f7..edcc94f28 100644 --- a/e2e/paths/04-item-module/06_botanical.spec.js +++ b/e2e/paths/04-item-module/06_botanical.spec.js @@ -17,9 +17,9 @@ describe('Item Create botanical path', () => { }); it(`should create a new botanical for the item`, async() => { - await page.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata'); - await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia'); - await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata'); + await page.write(selectors.itemBotanical.botanical, 'Cicuta maculata'); + await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abelia'); + await page.autocompleteSearch(selectors.itemBotanical.species, 'dealbata'); await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); const result = await page.waitForLastSnackbar(); @@ -28,33 +28,33 @@ describe('Item Create botanical path', () => { it(`should confirm the botanical for the item was created`, async() => { await page.reloadSection('item.card.botanical'); - await page.waitForTextInField(selectors.itemBotanical.botanicalInput, 'Cicuta maculata'); + await page.waitForTextInField(selectors.itemBotanical.botanical, 'Cicuta maculata'); const result = await page - .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value'); + .waitToGetProperty(selectors.itemBotanical.botanical, 'value'); expect(result).toEqual('Cicuta maculata'); }); it(`should confirm the Genus for the item was created`, async() => { - await page.waitForTextInField(selectors.itemBotanical.genusAutocomplete, 'Abelia'); + await page.waitForTextInField(selectors.itemBotanical.genus, 'Abelia'); const result = await page - .waitToGetProperty(selectors.itemBotanical.genusAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBotanical.genus, 'value'); expect(result).toEqual('Abelia'); }); it(`should confirm the Species for the item was created`, async() => { const result = await page - .waitToGetProperty(selectors.itemBotanical.speciesAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBotanical.species, 'value'); expect(result).toEqual('dealbata'); }); it(`should edit botanical for the item`, async() => { - await page.clearInput(selectors.itemBotanical.botanicalInput); - await page.write(selectors.itemBotanical.botanicalInput, 'Herp Derp'); - await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies'); - await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens'); + await page.clearInput(selectors.itemBotanical.botanical); + await page.write(selectors.itemBotanical.botanical, 'Herp Derp'); + await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abies'); + await page.autocompleteSearch(selectors.itemBotanical.species, 'decurrens'); await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); const result = await page.waitForLastSnackbar(); @@ -63,24 +63,24 @@ describe('Item Create botanical path', () => { it(`should confirm the botanical for the item was edited`, async() => { await page.reloadSection('item.card.botanical'); - await page.waitForTextInField(selectors.itemBotanical.botanicalInput, 'Herp Derp'); + await page.waitForTextInField(selectors.itemBotanical.botanical, 'Herp Derp'); const result = await page - .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value'); + .waitToGetProperty(selectors.itemBotanical.botanical, 'value'); expect(result).toEqual('Herp Derp'); }); it(`should confirm the Genus for the item was edited`, async() => { - await page.waitForTextInField(selectors.itemBotanical.genusAutocomplete, 'Abies'); + await page.waitForTextInField(selectors.itemBotanical.genus, 'Abies'); const result = await page - .waitToGetProperty(selectors.itemBotanical.genusAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBotanical.genus, 'value'); expect(result).toEqual('Abies'); }); it(`should confirm the Species for the item was edited`, async() => { const result = await page - .waitToGetProperty(selectors.itemBotanical.speciesAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBotanical.species, 'value'); expect(result).toEqual('decurrens'); }); diff --git a/e2e/paths/04-item-module/07_barcode.spec.js b/e2e/paths/04-item-module/07_barcode.spec.js index 5153b5519..7750b4b6d 100644 --- a/e2e/paths/04-item-module/07_barcode.spec.js +++ b/e2e/paths/04-item-module/07_barcode.spec.js @@ -19,7 +19,7 @@ describe('Item Create barcodes path', () => { it(`should click create a new code and delete a former one`, async() => { await page.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton); await page.waitToClick(selectors.itemBarcodes.addBarcodeButton); - await page.write(selectors.itemBarcodes.thirdCodeInput, '5'); + await page.write(selectors.itemBarcodes.thirdCode, '5'); await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton); const result = await page.waitForLastSnackbar(); @@ -28,9 +28,9 @@ describe('Item Create barcodes path', () => { it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => { await page.reloadSection('item.card.itemBarcode'); - await page.waitForTextInField(selectors.itemBarcodes.thirdCodeInput, '5'); + await page.waitForTextInField(selectors.itemBarcodes.thirdCode, '5'); const result = await page - .waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value'); + .waitToGetProperty(selectors.itemBarcodes.thirdCode, 'value'); expect(result).toEqual('5'); }); diff --git a/e2e/paths/04-item-module/08_create_and_clone.spec.js b/e2e/paths/04-item-module/08_create_and_clone.spec.js index ea2290558..ca70fc47d 100644 --- a/e2e/paths/04-item-module/08_create_and_clone.spec.js +++ b/e2e/paths/04-item-module/08_create_and_clone.spec.js @@ -16,8 +16,8 @@ describe('Item Create/Clone path', () => { describe('create', () => { it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => { - await page.clearInput(selectors.itemsIndex.searchItemInput); - await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet'); + await page.clearInput(selectors.itemsIndex.topbarSearch); + await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet'); await page.waitToClick(selectors.itemsIndex.searchButton); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0); const result = await page.countElement(selectors.itemsIndex.searchResult); @@ -52,9 +52,9 @@ describe('Item Create/Clone path', () => { it('should create the Infinity Gauntlet item', async() => { await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet'); - await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo'); - await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares'); - await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand'); + await page.autocompleteSearch(selectors.itemCreateView.type, 'Crisantemo'); + await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares'); + await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand'); await page.waitToClick(selectors.itemCreateView.createButton); const result = await page.waitForLastSnackbar(); @@ -63,23 +63,23 @@ describe('Item Create/Clone path', () => { it('should confirm Infinity Gauntlet item was created', async() => { let result = await page - .waitToGetProperty(selectors.itemBasicData.nameInput, 'value'); + .waitToGetProperty(selectors.itemBasicData.name, 'value'); expect(result).toEqual('Infinity Gauntlet'); result = await page - .waitToGetProperty(selectors.itemBasicData.typeAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBasicData.type, 'value'); expect(result).toEqual('Crisantemo'); result = await page - .waitToGetProperty(selectors.itemBasicData.intrastatAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBasicData.intrastat, 'value'); expect(result).toEqual('5080000 Coral y materiales similares'); result = await page - .waitToGetProperty(selectors.itemBasicData.originAutocomplete, 'value'); + .waitToGetProperty(selectors.itemBasicData.origin, 'value'); expect(result).toEqual('Holand'); }); @@ -96,8 +96,8 @@ describe('Item Create/Clone path', () => { }); it(`should search for the item Infinity Gauntlet`, async() => { - await page.clearInput(selectors.itemsIndex.searchItemInput); - await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet'); + await page.clearInput(selectors.itemsIndex.topbarSearch); + await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet'); await page.waitToClick(selectors.itemsIndex.searchButton); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); const result = await page.countElement(selectors.itemsIndex.searchResult); @@ -117,8 +117,8 @@ describe('Item Create/Clone path', () => { it('should search for the item Infinity Gauntlet and find two', async() => { await page.waitToClick(selectors.itemTags.goToItemIndexButton); - await page.clearInput(selectors.itemsIndex.searchItemInput); - await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet'); + await page.clearInput(selectors.itemsIndex.topbarSearch); + await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet'); await page.waitToClick(selectors.itemsIndex.searchButton); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2); const result = await page.countElement(selectors.itemsIndex.searchResult); diff --git a/e2e/paths/04-item-module/09_regularize.spec.js b/e2e/paths/04-item-module/09_regularize.spec.js index 88c09c83c..17c9136ac 100644 --- a/e2e/paths/04-item-module/09_regularize.spec.js +++ b/e2e/paths/04-item-module/09_regularize.spec.js @@ -34,8 +34,8 @@ describe('Item regularize path', () => { }); it('should search for an specific item', async() => { - await page.clearInput(selectors.itemsIndex.searchItemInput); - await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm'); + await page.clearInput(selectors.itemsIndex.topbarSearch); + await page.write(selectors.itemsIndex.topbarSearch, 'Ranged weapon pistol 9mm'); await page.waitToClick(selectors.itemsIndex.searchButton); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); const resultCount = await page.countElement(selectors.itemsIndex.searchResult); @@ -55,14 +55,14 @@ describe('Item regularize path', () => { it('should open the regularize dialog and check the warehouse matches the local user settings', async() => { await page.waitToClick(selectors.itemDescriptor.moreMenu); await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton); - const result = await page.waitToGetProperty(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'value'); + const result = await page.waitToGetProperty(selectors.itemDescriptor.regularizeWarehouse, 'value'); expect(result).toEqual('Warehouse Four'); }); it('should regularize the item', async() => { - await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100'); - await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One'); + await page.write(selectors.itemDescriptor.regularizeQuantity, '100'); + await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouse, 'Warehouse One'); await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton); const result = await page.waitForLastSnackbar(); @@ -92,7 +92,7 @@ describe('Item regularize path', () => { it('should search for the ticket with alias missing', async() => { await page.keyboard.press('Escape'); - await page.write(selectors.ticketsIndex.searchTicketInput, 'missing'); + await page.write(selectors.ticketsIndex.topbarSearch, 'missing'); await page.keyboard.press('Enter'); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); const result = await page.countElement(selectors.ticketsIndex.searchResult); @@ -128,15 +128,15 @@ describe('Item regularize path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.itemsButton); - await page.wait(selectors.itemsIndex.searchItemInput); + await page.wait(selectors.itemsIndex.topbarSearch); const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/item/index'); }); it('should search for the item once again', async() => { - await page.clearInput(selectors.itemsIndex.searchItemInput); - await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm'); + await page.clearInput(selectors.itemsIndex.topbarSearch); + await page.write(selectors.itemsIndex.topbarSearch, 'Ranged weapon pistol 9mm'); await page.waitToClick(selectors.itemsIndex.searchButton); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); const resultCount = await page.countElement(selectors.itemsIndex.searchResult); @@ -156,8 +156,8 @@ describe('Item regularize path', () => { it('should regularize the item once more', async() => { await page.waitToClick(selectors.itemDescriptor.moreMenu); await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton); - await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100'); - await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One'); + await page.write(selectors.itemDescriptor.regularizeQuantity, '100'); + await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouse, 'Warehouse One'); await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton); const result = await page.waitForLastSnackbar(); @@ -178,7 +178,7 @@ describe('Item regularize path', () => { }); it('should search for the ticket with id 25 once again', async() => { - await page.write(selectors.ticketsIndex.searchTicketInput, '25'); + await page.write(selectors.ticketsIndex.topbarSearch, '25'); await page.waitToClick(selectors.ticketsIndex.searchButton); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); const result = await page.countElement(selectors.ticketsIndex.searchResult); diff --git a/e2e/paths/04-item-module/11_item_log.spec.js b/e2e/paths/04-item-module/11_item_log.spec.js index 8c75ed0c1..0de362565 100644 --- a/e2e/paths/04-item-module/11_item_log.spec.js +++ b/e2e/paths/04-item-module/11_item_log.spec.js @@ -15,7 +15,7 @@ describe('Item log path', () => { }); it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => { - await page.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact'); + await page.write(selectors.itemsIndex.topbarSearch, 'Knowledge artifact'); await page.waitToClick(selectors.itemsIndex.searchButton); await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0); const result = await page.countElement(selectors.itemsIndex.searchResult); @@ -33,9 +33,9 @@ describe('Item log path', () => { it('should create the Knowledge artifact item', async() => { await page.write(selectors.itemCreateView.temporalName, 'Knowledge artifact'); - await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo'); - await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares'); - await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand'); + await page.autocompleteSearch(selectors.itemCreateView.type, 'Crisantemo'); + await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares'); + await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand'); await page.waitToClick(selectors.itemCreateView.createButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js b/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js index aefdaa4cb..766ca1a18 100644 --- a/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js +++ b/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js @@ -18,7 +18,6 @@ describe('Ticket List sale path', () => { }); it('should confirm the first ticket sale contains the colour tag', async() => { - await page.waitForContentLoaded(); const value = await page .waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText'); diff --git a/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js index 3ef2b1c3d..f2265797c 100644 --- a/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js @@ -21,7 +21,7 @@ xdescribe('Ticket Edit sale path', () => { it(`should click on the first sale claim icon to navigate over there`, async() => { const url = await nightmare .waitToClick(selectors.ticketSales.firstSaleClaimIcon) - .wait(selectors.claimBasicData.claimStateAutocomplete) + .wait(selectors.claimBasicData.claimState) .parsedUrl(); expect(url.hash).toEqual('#!/claim/2/basic-data'); @@ -32,7 +32,7 @@ xdescribe('Ticket Edit sale path', () => { .waitToClick(selectors.globalItems.applicationsMenuButton) .wait(selectors.globalItems.applicationsMenuVisible) .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) + .wait(selectors.ticketsIndex.topbarSearch) .parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); @@ -196,7 +196,7 @@ xdescribe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketSales.thirdSaleCheckbox) .waitToClick(selectors.ticketSales.moreMenu) .waitToClick(selectors.ticketSales.moreMenuCreateClaim) - .wait(selectors.claimBasicData.claimStateAutocomplete) + .wait(selectors.claimBasicData.claimState) .parsedUrl(); expect(url.hash).toContain('basic-data'); @@ -228,7 +228,7 @@ xdescribe('Ticket Edit sale path', () => { .waitToClick(selectors.globalItems.applicationsMenuButton) .wait(selectors.globalItems.applicationsMenuVisible) .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) + .wait(selectors.ticketsIndex.topbarSearch) .parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); diff --git a/e2e/paths/05-ticket-module/01_observations.spec.js b/e2e/paths/05-ticket-module/01_observations.spec.js index 6aa5d845e..b343bcfeb 100644 --- a/e2e/paths/05-ticket-module/01_observations.spec.js +++ b/e2e/paths/05-ticket-module/01_observations.spec.js @@ -18,10 +18,9 @@ describe('Ticket Create notes path', () => { }); it('should create a new note', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketNotes.addNoteButton); - await page.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one'); - await page.write(selectors.ticketNotes.firstDescriptionInput, 'description'); + await page.autocompleteSearch(selectors.ticketNotes.firstNoteType, 'observation one'); + await page.write(selectors.ticketNotes.firstDescription, 'description'); await page.waitToClick(selectors.ticketNotes.submitNotesButton); const result = await page.waitForLastSnackbar(); @@ -31,12 +30,12 @@ describe('Ticket Create notes path', () => { it('should confirm the note is the expected one', async() => { await page.reloadSection('ticket.card.observation'); const result = await page - .waitToGetProperty(selectors.ticketNotes.firstNoteTypeAutocomplete, 'value'); + .waitToGetProperty(selectors.ticketNotes.firstNoteType, 'value'); expect(result).toEqual('observation one'); const firstDescription = await page - .waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value'); + .waitToGetProperty(selectors.ticketNotes.firstDescription, 'value'); expect(firstDescription).toEqual('description'); }); diff --git a/e2e/paths/05-ticket-module/04_packages.spec.js b/e2e/paths/05-ticket-module/04_packages.spec.js index 668317b53..fd2945877 100644 --- a/e2e/paths/05-ticket-module/04_packages.spec.js +++ b/e2e/paths/05-ticket-module/04_packages.spec.js @@ -20,7 +20,7 @@ describe('Ticket Create packages path', () => { it(`should attempt create a new package but receive an error if package is blank`, async() => { await page.waitToClick(selectors.ticketPackages.firstRemovePackageButton); await page.waitToClick(selectors.ticketPackages.addPackageButton); - await page.write(selectors.ticketPackages.firstQuantityInput, '99'); + await page.write(selectors.ticketPackages.firstQuantity, '99'); await page.waitToClick(selectors.ticketPackages.savePackagesButton); const result = await page.waitForLastSnackbar(); @@ -28,8 +28,8 @@ describe('Ticket Create packages path', () => { }); it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => { - await page.clearInput(selectors.ticketPackages.firstQuantityInput); - await page.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m'); + await page.clearInput(selectors.ticketPackages.firstQuantity); + await page.autocompleteSearch(selectors.ticketPackages.firstPackage, 'Container medical box 1m'); await page.waitToClick(selectors.ticketPackages.savePackagesButton); const result = await page.waitForLastSnackbar(); @@ -40,14 +40,14 @@ describe('Ticket Create packages path', () => { const result = await page .evaluate(selector => { return document.querySelector(`${selector} input`).checkValidity(); - }, selectors.ticketPackages.firstQuantityInput); + }, selectors.ticketPackages.firstQuantity); expect(result).toBeTruthy(); }); it(`should create a new package with correct data`, async() => { - await page.clearInput(selectors.ticketPackages.firstQuantityInput); - await page.write(selectors.ticketPackages.firstQuantityInput, '-99'); + await page.clearInput(selectors.ticketPackages.firstQuantity); + await page.write(selectors.ticketPackages.firstQuantity, '-99'); await page.waitToClick(selectors.ticketPackages.savePackagesButton); const result = await page.waitForLastSnackbar(); @@ -56,15 +56,15 @@ describe('Ticket Create packages path', () => { it(`should confirm the first select is the expected one`, async() => { await page.reloadSection('ticket.card.package'); - await page.waitForTextInField(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m'); - const result = await page.waitToGetProperty(selectors.ticketPackages.firstPackageAutocomplete, 'value'); + await page.waitForTextInField(selectors.ticketPackages.firstPackage, 'Container medical box 1m'); + const result = await page.waitToGetProperty(selectors.ticketPackages.firstPackage, 'value'); expect(result).toEqual('7 : Container medical box 1m'); }); it(`should confirm the first quantity is just a number and the string part was ignored by the imput number`, async() => { - await page.waitForTextInField(selectors.ticketPackages.firstQuantityInput, '-99'); - const result = await page.waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value'); + await page.waitForTextInField(selectors.ticketPackages.firstQuantity, '-99'); + const result = await page.waitToGetProperty(selectors.ticketPackages.firstQuantity, 'value'); expect(result).toEqual('-99'); }); diff --git a/e2e/paths/05-ticket-module/05_tracking_state.spec.js b/e2e/paths/05-ticket-module/05_tracking_state.spec.js index 74ca980d5..b6f39bf31 100644 --- a/e2e/paths/05-ticket-module/05_tracking_state.spec.js +++ b/e2e/paths/05-ticket-module/05_tracking_state.spec.js @@ -19,9 +19,8 @@ describe('Ticket Create new tracking state path', () => { }); it('should access to the create state view by clicking the create floating button', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketTracking.createStateButton); - await page.waitForSelector(selectors.createStateView.stateAutocomplete, {visible: true}); + await page.waitForSelector(selectors.createStateView.state, {visible: true}); let url = await page.parsedUrl(); expect(url.hash).toContain('tracking/edit'); @@ -35,7 +34,7 @@ describe('Ticket Create new tracking state path', () => { }); it(`should create a new state`, async() => { - await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?'); + await page.autocompleteSearch(selectors.createStateView.state, '¿Fecha?'); await page.waitToClick(selectors.createStateView.saveStateButton); let result = await page.waitForLastSnackbar(); @@ -60,7 +59,7 @@ describe('Ticket Create new tracking state path', () => { it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => { await page.waitFor(1500); - await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado'); + await page.autocompleteSearch(selectors.createStateView.state, 'Encajado'); await page.waitToClick(selectors.createStateView.saveStateButton); let result = await page.waitForLastSnackbar(); @@ -68,9 +67,9 @@ describe('Ticket Create new tracking state path', () => { }); it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => { - await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado'); + await page.autocompleteSearch(selectors.createStateView.state, 'asignado'); let result = await page - .waitToGetProperty(selectors.createStateView.workerAutocomplete, 'value'); + .waitToGetProperty(selectors.createStateView.worker, 'value'); expect(result).toEqual('salesPersonNick'); }); diff --git a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js index f8b8d7a3d..670d42627 100644 --- a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js @@ -18,10 +18,10 @@ describe('Ticket Edit basic data path', () => { }); it(`should confirm the zone autocomplete is disabled unless your role is productionBoss`, async() => { - await page.waitForSelector(selectors.ticketBasicData.zoneAutocomplete, {}); + await page.waitForSelector(selectors.ticketBasicData.zone, {}); const disabled = await page.evaluate(selector => { return document.querySelector(selector).disabled; - }, `${selectors.ticketBasicData.zoneAutocomplete} input`); + }, `${selectors.ticketBasicData.zone} input`); expect(disabled).toBeTruthy(); }); @@ -34,33 +34,34 @@ describe('Ticket Edit basic data path', () => { it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => { await page.waitForSpinnerLoad(); - await page.wait(selectors.ticketBasicData.zoneAutocomplete); + await page.wait(selectors.ticketBasicData.zone); const disabled = await page.evaluate(selector => { return document.querySelector(selector).disabled; - }, `${selectors.ticketBasicData.zoneAutocomplete} input`); + }, `${selectors.ticketBasicData.zone} input`); expect(disabled).toBeFalsy(); }); it(`should check the zone is for Silla247`, async() => { let zone = await page - .waitToGetProperty(selectors.ticketBasicData.zoneAutocomplete, 'value'); + .waitToGetProperty(selectors.ticketBasicData.zone, 'value'); expect(zone).toContain('Zone 247 A'); }); it(`should edit the ticket agency then check there are no zones for it`, async() => { - await page.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement'); - let zone = await page - .waitToGetProperty(selectors.ticketBasicData.zoneAutocomplete, 'value'); + await page.autocompleteSearch(selectors.ticketBasicData.agency, 'Entanglement'); + await page.waitFor(1000); + let emptyZone = await page + .expectPropertyValue(selectors.ticketBasicData.zone, 'value', ''); - expect(zone.length).toEqual(0); + expect(emptyZone).toBeTruthy(); }); it(`should edit the ticket zone then check the agency is for the new zone`, async() => { - await page.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A'); + await page.autocompleteSearch(selectors.ticketBasicData.zone, 'Zone expensive A'); let zone = await page - .waitToGetProperty(selectors.ticketBasicData.agencyAutocomplete, 'value'); + .waitToGetProperty(selectors.ticketBasicData.agency, 'value'); expect(zone).toContain('Silla247Expensive'); }); @@ -89,7 +90,7 @@ describe('Ticket Edit basic data path', () => { }); it(`should select a new reason for the changes made then click on finalize`, async() => { - await page.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket'); + await page.autocompleteSearch(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket'); await page.waitToClick(selectors.ticketBasicData.finalizeButton); await page.waitForURL('summary'); let url = await page.parsedUrl(); diff --git a/e2e/paths/05-ticket-module/09_weekly.spec.js b/e2e/paths/05-ticket-module/09_weekly.spec.js index 717d971f2..d41398bdd 100644 --- a/e2e/paths/05-ticket-module/09_weekly.spec.js +++ b/e2e/paths/05-ticket-module/09_weekly.spec.js @@ -69,7 +69,7 @@ describe('Ticket descriptor path', () => { it('should now search for the ticket 11', async() => { await page.waitForContentLoaded(); - await page.write(selectors.ticketsIndex.searchTicketInput, '11'); + await page.write(selectors.ticketsIndex.topbarSearch, '11'); await page.waitToClick(selectors.ticketsIndex.searchButton); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); const result = await page.countElement(selectors.ticketsIndex.searchResult); @@ -99,7 +99,7 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - await page.wait(selectors.ticketsIndex.searchTicketInput); + await page.wait(selectors.ticketsIndex.topbarSearch); const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); @@ -113,7 +113,7 @@ describe('Ticket descriptor path', () => { }); it('should now search for the weekly ticket 11', async() => { - await page.write(selectors.ticketsIndex.searchTicketInput, '11'); + await page.write(selectors.ticketsIndex.topbarSearch, '11'); await page.waitToClick(selectors.ticketsIndex.searchButton); await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1); const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult); diff --git a/e2e/paths/05-ticket-module/10_request.spec.js b/e2e/paths/05-ticket-module/10_request.spec.js index f4fea9c2b..e3f1f59e4 100644 --- a/e2e/paths/05-ticket-module/10_request.spec.js +++ b/e2e/paths/05-ticket-module/10_request.spec.js @@ -20,9 +20,9 @@ describe('Ticket purchase request path', () => { it(`should add a new request`, async() => { await page.waitToClick(selectors.ticketRequests.addRequestButton); await page.write(selectors.ticketRequests.descriptionInput, 'New stuff'); - await page.write(selectors.ticketRequests.quantityInput, '99'); - await page.autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick'); - await page.write(selectors.ticketRequests.priceInput, '999'); + await page.write(selectors.ticketRequests.quantity, '99'); + await page.autocompleteSearch(selectors.ticketRequests.atender, 'buyerNick'); + await page.write(selectors.ticketRequests.price, '999'); await page.waitToClick(selectors.ticketRequests.saveButton); const result = await page.waitForLastSnackbar(); @@ -38,7 +38,7 @@ describe('Ticket purchase request path', () => { it(`should confirm the new request was added`, async() => { await page.reloadSection('ticket.card.request.index'); - const result = await page.waitToGetProperty(`${selectors.ticketRequests.firstDescription} input`, 'value'); + const result = await page.waitToGetProperty(selectors.ticketRequests.firstDescription, 'value'); expect(result).toEqual('New stuff'); }); diff --git a/e2e/paths/05-ticket-module/11_diary.spec.js b/e2e/paths/05-ticket-module/11_diary.spec.js index 363901050..6f470e07f 100644 --- a/e2e/paths/05-ticket-module/11_diary.spec.js +++ b/e2e/paths/05-ticket-module/11_diary.spec.js @@ -17,7 +17,7 @@ xdescribe('Ticket diary path', () => { }); it('should search for a specific ticket', async() => { - await page.write(selectors.ticketsIndex.searchTicketInput, '1'); + await page.write(selectors.ticketsIndex.topbarSearch, '1'); await page.waitToClick(selectors.ticketsIndex.searchButton); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); const result = await page.countElement(selectors.ticketsIndex.searchResult); @@ -59,7 +59,7 @@ xdescribe('Ticket diary path', () => { }); it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => { - await page.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two'); + await page.autocompleteSearch(selectors.itemDiary.warehouse, 'Warehouse Two'); const result = await page .waitToGetProperty(selectors.itemDiary.firstBalance, 'className'); diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket-module/12_descriptor.spec.js index dec11dfa2..c01785165 100644 --- a/e2e/paths/05-ticket-module/12_descriptor.spec.js +++ b/e2e/paths/05-ticket-module/12_descriptor.spec.js @@ -17,7 +17,7 @@ describe('Ticket descriptor path', () => { describe('Delete ticket', () => { it('should search for an specific ticket', async() => { - await page.write(selectors.ticketsIndex.searchTicketInput, '18'); + await page.write(selectors.ticketsIndex.topbarSearch, '18'); await page.waitToClick(selectors.ticketsIndex.searchButton); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); const result = await page.countElement(selectors.ticketsIndex.searchResult); @@ -38,7 +38,7 @@ describe('Ticket descriptor path', () => { await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour); - await page.pickTime(selectors.ticketDescriptor.changeShippedHourInput, '08:15'); + await page.pickTime(selectors.ticketDescriptor.changeShippedHour, '08:15'); await page.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton); const result = await page.waitForLastSnackbar(); @@ -68,7 +68,7 @@ describe('Ticket descriptor path', () => { }); it(`should search for the deleted ticket and check it's date`, async() => { - await page.write(selectors.ticketsIndex.searchTicketInput, '18'); + await page.write(selectors.ticketsIndex.topbarSearch, '18'); await page.waitToClick(selectors.ticketsIndex.searchButton); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); await page.wait(selectors.ticketsIndex.searchResultDate); @@ -80,8 +80,8 @@ describe('Ticket descriptor path', () => { describe('add stowaway', () => { it('should search for a ticket', async() => { - await page.clearInput(selectors.ticketsIndex.searchTicketInput); - await page.write(selectors.ticketsIndex.searchTicketInput, '16'); + await page.clearInput(selectors.ticketsIndex.topbarSearch); + await page.write(selectors.ticketsIndex.topbarSearch, '16'); await page.waitToClick(selectors.ticketsIndex.searchButton); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); const result = await page.countElement(selectors.ticketsIndex.searchResult); diff --git a/e2e/paths/05-ticket-module/13_services.spec.js b/e2e/paths/05-ticket-module/13_services.spec.js index 70cc55e43..4a1e12505 100644 --- a/e2e/paths/05-ticket-module/13_services.spec.js +++ b/e2e/paths/05-ticket-module/13_services.spec.js @@ -29,8 +29,8 @@ describe('Ticket services path', () => { }, 15000); it('should receive an error if you attempt to save a service without access rights', async() => { - await page.clearInput(selectors.ticketService.firstPriceInput); - await page.write(selectors.ticketService.firstPriceInput, '999'); + await page.clearInput(selectors.ticketService.firstPrice); + await page.write(selectors.ticketService.firstPrice, '999'); await page.waitToClick(selectors.ticketService.saveServiceButton); const result = await page.waitForLastSnackbar(); @@ -54,7 +54,7 @@ describe('Ticket services path', () => { await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketService.addServiceButton); const result = await page - .isVisible(selectors.ticketService.firstServiceTypeAutocomplete); + .isVisible(selectors.ticketService.firstServiceType); expect(result).toBeTruthy(); }); @@ -69,7 +69,7 @@ describe('Ticket services path', () => { it('should click on the add new service type to open the dialog', async() => { await page.waitToClick(selectors.ticketService.firstAddServiceTypeButton); await page.wait('.vn-dialog.shown'); - const result = await page.isVisible(selectors.ticketService.newServiceTypeNameInput); + const result = await page.isVisible(selectors.ticketService.newServiceTypeName); expect(result).toBeTruthy(); }); @@ -82,10 +82,10 @@ describe('Ticket services path', () => { }); it('should create a new service type then add price then create the service', async() => { - await page.write(selectors.ticketService.newServiceTypeNameInput, 'Documentos'); - await page.autocompleteSearch(selectors.ticketService.newServiceTypeExpenseAutocomplete, 'Retencion'); + await page.write(selectors.ticketService.newServiceTypeName, 'Documentos'); + await page.autocompleteSearch(selectors.ticketService.newServiceTypeExpense, 'Retencion'); await page.waitToClick(selectors.ticketService.saveServiceTypeButton); - await page.write(selectors.ticketService.firstPriceInput, '999'); + await page.write(selectors.ticketService.firstPrice, '999'); await page.waitToClick(selectors.ticketService.saveServiceButton); const result = await page.waitForLastSnackbar(); @@ -95,28 +95,28 @@ describe('Ticket services path', () => { it('should confirm the service description was created correctly', async() => { await page.reloadSection('ticket.card.service'); const result = await page - .waitToGetProperty(selectors.ticketService.firstServiceTypeAutocomplete, 'value'); + .waitToGetProperty(selectors.ticketService.firstServiceType, 'value'); expect(result).toEqual('Documentos'); }); it('should confirm the service quantity was created correctly', async() => { const result = await page - .waitToGetProperty(selectors.ticketService.firstQuantityInput, 'value'); + .waitToGetProperty(selectors.ticketService.firstQuantity, 'value'); expect(result).toEqual('1'); }); it('should confirm the service price was created correctly', async() => { const result = await page - .waitToGetProperty(selectors.ticketService.firstPriceInput, 'value'); + .waitToGetProperty(selectors.ticketService.firstPrice, 'value'); expect(result).toEqual('999'); }); it('should confirm the service VAT was created correctly', async() => { const result = await page - .waitToGetProperty(selectors.ticketService.firstVatTypeAutocomplete, 'value'); + .waitToGetProperty(selectors.ticketService.firstVatType, 'value'); expect(result).toEqual('General VAT'); }); diff --git a/e2e/paths/05-ticket-module/14_create_ticket.spec.js b/e2e/paths/05-ticket-module/14_create_ticket.spec.js index 843658c94..9e68db9fd 100644 --- a/e2e/paths/05-ticket-module/14_create_ticket.spec.js +++ b/e2e/paths/05-ticket-module/14_create_ticket.spec.js @@ -17,18 +17,18 @@ describe('Ticket create path', () => { it('should open the new ticket form', async() => { await page.waitToClick(selectors.ticketsIndex.newTicketButton); - await page.wait(selectors.createTicketView.clientAutocomplete); + await page.wait(selectors.createTicketView.client); const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/create'); }); it('should succeed to create a ticket', async() => { - await page.autocompleteSearch(selectors.createTicketView.clientAutocomplete, 'Tony Stark'); - await page.autocompleteSearch(selectors.createTicketView.addressAutocomplete, 'Tony Stark'); - await page.datePicker(selectors.createTicketView.deliveryDateInput, 1, null); - await page.autocompleteSearch(selectors.createTicketView.warehouseAutocomplete, 'Warehouse One'); - await page.autocompleteSearch(selectors.createTicketView.agencyAutocomplete, 'Silla247'); + await page.autocompleteSearch(selectors.createTicketView.client, 'Tony Stark'); + await page.autocompleteSearch(selectors.createTicketView.address, 'Tony Stark'); + await page.datePicker(selectors.createTicketView.deliveryDate, 1, null); + await page.autocompleteSearch(selectors.createTicketView.warehouse, 'Warehouse One'); + await page.autocompleteSearch(selectors.createTicketView.agency, 'Silla247'); await page.waitToClick(selectors.createTicketView.createButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js b/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js index 1fe5a8228..4f7090bd3 100644 --- a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js +++ b/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js @@ -17,6 +17,7 @@ describe('Ticket create from client path', () => { }); it('should click the create simple ticket on the descriptor menu', async() => { + await page.waitForContentLoaded(); await page.waitToClick(selectors.clientDescriptor.moreMenu); await page.waitToClick(selectors.clientDescriptor.simpleTicketButton); await page.waitForURL('#!/ticket/create?clientFk=102'); @@ -27,10 +28,10 @@ describe('Ticket create from client path', () => { it('should check if the client details are the expected ones', async() => { const client = await page - .waitToGetProperty(selectors.createTicketView.clientAutocomplete, 'value'); + .waitToGetProperty(selectors.createTicketView.client, 'value'); const address = await page - .waitToGetProperty(selectors.createTicketView.addressAutocomplete, 'value'); + .waitToGetProperty(selectors.createTicketView.address, 'value'); expect(client).toContain('Petter Parker'); diff --git a/e2e/paths/06-claim-module/01_basic_data.spec.js b/e2e/paths/06-claim-module/01_basic_data.spec.js index d256e2039..e2116b2ee 100644 --- a/e2e/paths/06-claim-module/01_basic_data.spec.js +++ b/e2e/paths/06-claim-module/01_basic_data.spec.js @@ -21,9 +21,9 @@ describe('Claim edit basic data path', () => { }); it(`should edit claim state and observation fields`, async() => { - await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado'); - await page.clearTextarea(selectors.claimBasicData.observationInput); - await page.write(selectors.claimBasicData.observationInput, 'edited observation'); + await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado'); + await page.clearTextarea(selectors.claimBasicData.observation); + await page.write(selectors.claimBasicData.observation, 'edited observation'); await page.waitToClick(selectors.claimBasicData.saveButton); const result = await page.waitForLastSnackbar(); @@ -39,23 +39,23 @@ describe('Claim edit basic data path', () => { it('should confirm the claim state was edited', async() => { await page.reloadSection('claim.card.basicData'); - await page.wait(selectors.claimBasicData.claimStateAutocomplete); - const result = await page.waitToGetProperty(selectors.claimBasicData.claimStateAutocomplete, 'value'); + await page.wait(selectors.claimBasicData.claimState); + const result = await page.waitToGetProperty(selectors.claimBasicData.claimState, 'value'); expect(result).toEqual('Gestionado'); }); it('should confirm the claim observation was edited', async() => { const result = await page - .waitToGetProperty(selectors.claimBasicData.observationInput, 'value'); + .waitToGetProperty(selectors.claimBasicData.observation, 'value'); expect(result).toEqual('edited observation'); }); it(`should edit the claim to leave it untainted`, async() => { - await page.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente'); - await page.clearTextarea(selectors.claimBasicData.observationInput); - await page.write(selectors.claimBasicData.observationInput, 'Observation one'); + await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Pendiente'); + await page.clearTextarea(selectors.claimBasicData.observation); + await page.write(selectors.claimBasicData.observation, 'Observation one'); await page.waitToClick(selectors.claimBasicData.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/06-claim-module/02_development.spec.js b/e2e/paths/06-claim-module/02_development.spec.js index 388d198aa..8f8f98b16 100644 --- a/e2e/paths/06-claim-module/02_development.spec.js +++ b/e2e/paths/06-claim-module/02_development.spec.js @@ -20,11 +20,11 @@ describe('Claim development', () => { it('should delete a development and create a new one', async() => { await page.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton); await page.waitToClick(selectors.claimDevelopment.addDevelopmentButton); - await page.autocompleteSearch(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'Baja calidad'); - await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResultAutocomplete, 'Deshidratacion'); - await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'Calidad general'); - await page.autocompleteSearch(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'deliveryNick'); - await page.autocompleteSearch(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'Reparto'); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimReason, 'Baja calidad'); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResult, 'Deshidratacion'); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsible, 'Calidad general'); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimWorker, 'deliveryNick'); + await page.autocompleteSearch(selectors.claimDevelopment.secondClaimRedelivery, 'Reparto'); await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton); const result = await page.waitForLastSnackbar(); @@ -40,11 +40,11 @@ describe('Claim development', () => { it('should edit a development', async() => { await page.reloadSection('claim.card.development'); - await page.autocompleteSearch(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'Calor'); - await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResultAutocomplete, 'Cocido'); - await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'Calidad general'); - await page.autocompleteSearch(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'adminAssistantNick'); - await page.autocompleteSearch(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'Cliente'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimReason, 'Calor'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResult, 'Cocido'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsible, 'Calidad general'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimWorker, 'adminAssistantNick'); + await page.autocompleteSearch(selectors.claimDevelopment.firstClaimRedelivery, 'Cliente'); await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton); const result = await page.waitForLastSnackbar(); @@ -54,19 +54,19 @@ describe('Claim development', () => { it('should confirm the first development is the expected one', async() => { await page.reloadSection('claim.card.development'); const reason = await page - .waitToGetProperty(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimReason, 'value'); const result = await page - .waitToGetProperty(selectors.claimDevelopment.firstClaimResultAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimResult, 'value'); const responsible = await page - .waitToGetProperty(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimResponsible, 'value'); const worker = await page - .waitToGetProperty(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimWorker, 'value'); const redelivery = await page - .waitToGetProperty(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.firstClaimRedelivery, 'value'); expect(reason).toEqual('Calor'); expect(result).toEqual('Cocido'); @@ -77,19 +77,19 @@ describe('Claim development', () => { it('should confirm the second development is the expected one', async() => { const reason = await page - .waitToGetProperty(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimReason, 'value'); const result = await page - .waitToGetProperty(selectors.claimDevelopment.secondClaimResultAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimResult, 'value'); const responsible = await page - .waitToGetProperty(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimResponsible, 'value'); const worker = await page - .waitToGetProperty(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimWorker, 'value'); const redelivery = await page - .waitToGetProperty(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'value'); + .waitToGetProperty(selectors.claimDevelopment.secondClaimRedelivery, 'value'); expect(reason).toEqual('Baja calidad'); expect(result).toEqual('Deshidratacion'); diff --git a/e2e/paths/06-claim-module/03_detail.spec.js b/e2e/paths/06-claim-module/03_detail.spec.js index e62a2981f..71b09e29b 100644 --- a/e2e/paths/06-claim-module/03_detail.spec.js +++ b/e2e/paths/06-claim-module/03_detail.spec.js @@ -64,7 +64,7 @@ xdescribe('Claim detail', () => { it('should edit de second item claimed discount', async() => { await page.waitToClick(selectors.claimDetail.secondItemDiscount); - await page.write(selectors.claimDetail.discountInput, '100'); + await page.write(selectors.claimDetail.discount, '100'); await page.keyboard.press('Enter'); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/07-order-module/01_edit_basic_data.spec.js b/e2e/paths/07-order-module/01_edit_basic_data.spec.js index eae49d802..e4c20cbe2 100644 --- a/e2e/paths/07-order-module/01_edit_basic_data.spec.js +++ b/e2e/paths/07-order-module/01_edit_basic_data.spec.js @@ -21,8 +21,8 @@ describe('Order edit basic data path', () => { describe('when confirmed order', () => { it('should not be able to change the client', async() => { - await page.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark'); - await page.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark'); + await page.autocompleteSearch(selectors.orderBasicData.client, 'Tony Stark'); + await page.autocompleteSearch(selectors.orderBasicData.address, 'Tony Stark'); await page.waitToClick(selectors.orderBasicData.saveButton); const result = await page.waitForLastSnackbar(); @@ -40,7 +40,7 @@ describe('Order edit basic data path', () => { await page.accessToSearchResult(orderId); await page.accessToSection('order.card.basicData'); await page.waitForContentLoaded(); - await page.waitForSelector(selectors.orderBasicData.observationInput, {visible: true}); + await page.waitForSelector(selectors.orderBasicData.observation, {visible: true}); await page.waitForURL('basic-data'); const url = await page.parsedUrl(); @@ -48,7 +48,8 @@ describe('Order edit basic data path', () => { }); it('should not be able to change anything', async() => { - await page.type(selectors.orderBasicData.observationInput, 'observation'); + await page.waitForContentLoaded(); + await page.write(selectors.orderBasicData.observation, 'observation'); await page.waitToClick(selectors.orderBasicData.saveButton); const result = await page.waitForLastSnackbar(); @@ -69,9 +70,9 @@ describe('Order edit basic data path', () => { }); it('should now create a new one', async() => { - await page.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Jessica Jones'); + await page.autocompleteSearch(selectors.createOrderView.client, 'Jessica Jones'); await page.datePicker(selectors.createOrderView.landedDatePicker, 0, today); - await page.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'Other agency'); + await page.autocompleteSearch(selectors.createOrderView.agency, 'Other agency'); await page.waitToClick(selectors.createOrderView.createButton); await page.waitForURL('/catalog'); const url = await page.parsedUrl(); @@ -81,17 +82,17 @@ describe('Order edit basic data path', () => { it('should navigate to the basic data section of the new order', async() => { await page.accessToSection('order.card.basicData'); - await page.wait(selectors.orderBasicData.observationInput); + await page.wait(selectors.orderBasicData.observation); const url = await page.parsedUrl(); expect(url.hash).toContain('/basic-data'); }); it('should be able to modify all the properties', async() => { - await page.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark'); - await page.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark'); - await page.autocompleteSearch(selectors.orderBasicData.agencyAutocomplete, 'Silla247'); - await page.type(selectors.orderBasicData.observationInput, 'my observation'); + await page.autocompleteSearch(selectors.orderBasicData.client, 'Tony Stark'); + await page.autocompleteSearch(selectors.orderBasicData.address, 'Tony Stark'); + await page.autocompleteSearch(selectors.orderBasicData.agency, 'Silla247'); + await page.write(selectors.orderBasicData.observation, 'my observation'); await page.waitToClick(selectors.orderBasicData.saveButton); const result = await page.waitForLastSnackbar(); @@ -101,21 +102,21 @@ describe('Order edit basic data path', () => { it('should now confirm the client have been edited', async() => { await page.reloadSection('order.card.basicData'); const result = await page - .waitToGetProperty(selectors.orderBasicData.clientAutocomplete, 'value'); + .waitToGetProperty(selectors.orderBasicData.client, 'value'); expect(result).toEqual('104: Tony Stark'); }); it('should now confirm the agency have been edited', async() => { const result = await page - .waitToGetProperty(selectors.orderBasicData.agencyAutocomplete, 'value'); + .waitToGetProperty(selectors.orderBasicData.agency, 'value'); expect(result).toEqual('7: Silla247'); }); it('should now confirm the observations have been edited', async() => { const result = await page - .waitToGetProperty(selectors.orderBasicData.observationInput, 'value'); + .waitToGetProperty(selectors.orderBasicData.observation, 'value'); expect(result).toEqual('my observation'); }); diff --git a/e2e/paths/07-order-module/02_catalog.spec.js b/e2e/paths/07-order-module/02_catalog.spec.js index 430eba007..cbd8585b0 100644 --- a/e2e/paths/07-order-module/02_catalog.spec.js +++ b/e2e/paths/07-order-module/02_catalog.spec.js @@ -26,9 +26,9 @@ describe('Order catalog', () => { it('should create a new order', async() => { let today = new Date().getDate(); - await page.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Tony Stark'); + await page.autocompleteSearch(selectors.createOrderView.client, 'Tony Stark'); await page.datePicker(selectors.createOrderView.landedDatePicker, 0, today); - await page.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'Other agency'); + await page.autocompleteSearch(selectors.createOrderView.agency, 'Other agency'); await page.waitToClick(selectors.createOrderView.createButton); await page.waitForURL('/catalog'); const url = await page.parsedUrl(); @@ -40,7 +40,7 @@ describe('Order catalog', () => { it('should add the realm and type filters and obtain results', async() => { await page.waitForContentLoaded(); await page.waitToClick(selectors.orderCatalog.plantRealmButton); - await page.autocompleteSearch(selectors.orderCatalog.typeAutocomplete, 'Anthurium'); + await page.autocompleteSearch(selectors.orderCatalog.type, 'Anthurium'); await page.waitForNumberOfElements('section.product', 4); const result = await page.countElement('section.product'); @@ -48,7 +48,7 @@ describe('Order catalog', () => { }); it('should search for the item tag value +1 and find two results', async() => { - await page.write(selectors.orderCatalog.itemTagValueInput, '+1'); + await page.write(selectors.orderCatalog.itemTagValue, '+1'); await page.keyboard.press('Enter'); await page.waitForNumberOfElements('section.product', 2); const result = await page.countElement('section.product'); @@ -58,8 +58,8 @@ describe('Order catalog', () => { it('should search for the item tag categoria +1 and find two results', async() => { await page.waitToClick(selectors.orderCatalog.openTagSearch); - await page.autocompleteSearch(selectors.orderCatalog.tagAutocomplete, 'categoria'); - await page.write(selectors.orderCatalog.tagValueInput, '+1'); + await page.autocompleteSearch(selectors.orderCatalog.tag, 'categoria'); + await page.write(selectors.orderCatalog.tagValue, '+1'); await page.waitToClick(selectors.orderCatalog.searchTagButton); await page.waitForNumberOfElements('section.product', 1); const result = await page.countElement('section.product'); @@ -78,7 +78,7 @@ describe('Order catalog', () => { }); it('should search for an item by id', async() => { - await page.write(selectors.orderCatalog.itemIdInput, '2'); + await page.write(selectors.orderCatalog.itemId, '2'); await page.keyboard.press('Enter'); await page.waitForNumberOfElements('section.product', 1); const result = await page.countElement('section.product'); diff --git a/e2e/paths/08-route-module/01_create.spec.js b/e2e/paths/08-route-module/01_create.spec.js index 74b5d9173..656cc0bc3 100644 --- a/e2e/paths/08-route-module/01_create.spec.js +++ b/e2e/paths/08-route-module/01_create.spec.js @@ -19,14 +19,14 @@ describe('Route create path', () => { it('should click on the add new route button and open the creation form', async() => { await page.waitForContentLoaded(); await page.waitToClick(selectors.routeIndex.addNewRouteButton); - await page.wait(selectors.createRouteView.workerAutocomplete); + await page.wait(selectors.createRouteView.worker); const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/route/create'); }); it(`should attempt to create a new route but fail since employee has no access rights`, async() => { - await page.write(selectors.createRouteView.descriptionInput, 'faster faster!!'); + await page.write(selectors.createRouteView.description, 'faster faster!!'); await page.waitToClick(selectors.createRouteView.submitButton); const result = await page.waitForLastSnackbar(); @@ -43,18 +43,18 @@ describe('Route create path', () => { it('should again click on the add new route button and open the creation form', async() => { await page.waitToClick(selectors.routeIndex.addNewRouteButton); - await page.wait(selectors.createRouteView.workerAutocomplete); + await page.wait(selectors.createRouteView.worker); const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/route/create'); }); it(`should create a new route`, async() => { - await page.autocompleteSearch(selectors.createRouteView.workerAutocomplete, 'teamManagerNick'); + await page.autocompleteSearch(selectors.createRouteView.worker, 'teamManagerNick'); await page.datePicker(selectors.createRouteView.createdDatePicker, 0, null); - await page.autocompleteSearch(selectors.createRouteView.vehicleAutoComplete, '4444-IMK'); - await page.autocompleteSearch(selectors.createRouteView.agencyAutoComplete, 'Teleportation device'); - await page.write(selectors.createRouteView.descriptionInput, 'faster faster!!'); + await page.autocompleteSearch(selectors.createRouteView.vehicleAuto, '4444-IMK'); + await page.autocompleteSearch(selectors.createRouteView.agency, 'Teleportation device'); + await page.write(selectors.createRouteView.description, 'faster faster!!'); await page.waitToClick(selectors.createRouteView.submitButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/08-route-module/02_basic_data.spec.js b/e2e/paths/08-route-module/02_basic_data.spec.js index 5f329f4eb..7828b3827 100644 --- a/e2e/paths/08-route-module/02_basic_data.spec.js +++ b/e2e/paths/08-route-module/02_basic_data.spec.js @@ -18,15 +18,15 @@ describe('Route basic Data path', () => { }); it('should edit the route basic data', async() => { - await page.autocompleteSearch(selectors.routeBasicData.workerAutoComplete, 'adminBossNick'); - await page.autocompleteSearch(selectors.routeBasicData.vehicleAutoComplete, '1111-IMK'); - await page.datePicker(selectors.routeBasicData.createdDateInput, 1, null); - await page.clearInput(selectors.routeBasicData.kmStartInput); - await page.write(selectors.routeBasicData.kmStartInput, '1'); - await page.clearInput(selectors.routeBasicData.kmEndInput); - await page.write(selectors.routeBasicData.kmEndInput, '2'); - await page.type(`${selectors.routeBasicData.startedHourInput} input`, '0800'); - await page.type(`${selectors.routeBasicData.finishedHourInput} input`, '1230'); + await page.autocompleteSearch(selectors.routeBasicData.worker, 'adminBossNick'); + await page.autocompleteSearch(selectors.routeBasicData.vehicle, '1111-IMK'); + await page.datePicker(selectors.routeBasicData.createdDate, 1, null); + await page.clearInput(selectors.routeBasicData.kmStart); + await page.write(selectors.routeBasicData.kmStart, '1'); + await page.clearInput(selectors.routeBasicData.kmEnd); + await page.write(selectors.routeBasicData.kmEnd, '2'); + await page.type(`${selectors.routeBasicData.startedHour} input`, '0800'); + await page.type(`${selectors.routeBasicData.finishedHour} input`, '1230'); await page.waitToClick(selectors.routeBasicData.saveButton); const result = await page.waitForLastSnackbar(); @@ -35,26 +35,26 @@ describe('Route basic Data path', () => { it('should confirm the worker was edited', async() => { await page.reloadSection('route.card.basicData'); - const worker = await page.waitToGetProperty(selectors.routeBasicData.workerAutoComplete, 'value'); + const worker = await page.waitToGetProperty(selectors.routeBasicData.worker, 'value'); expect(worker).toEqual('adminBoss - adminBossNick'); }); it('should confirm the vehicle was edited', async() => { - const vehicle = await page.waitToGetProperty(selectors.routeBasicData.vehicleAutoComplete, 'value'); + const vehicle = await page.waitToGetProperty(selectors.routeBasicData.vehicle, 'value'); expect(vehicle).toEqual('1111-IMK'); }); it('should confirm the km start was edited', async() => { - const kmStart = await page.waitToGetProperty(selectors.routeBasicData.kmStartInput, 'value'); + const kmStart = await page.waitToGetProperty(selectors.routeBasicData.kmStart, 'value'); expect(kmStart).toEqual('1'); }); it('should confirm the km end was edited', async() => { - const kmEnd = await page.waitToGetProperty(selectors.routeBasicData.kmEndInput, 'value'); + const kmEnd = await page.waitToGetProperty(selectors.routeBasicData.kmEnd, 'value'); expect(kmEnd).toEqual('2'); }); diff --git a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js b/e2e/paths/09-invoice-out-module/01_descriptor.spec.js index a98d2eb02..f26eaa47a 100644 --- a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js +++ b/e2e/paths/09-invoice-out-module/01_descriptor.spec.js @@ -30,7 +30,7 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); - await page.wait(selectors.invoiceOutIndex.searchInvoiceOutInput); + await page.wait(selectors.invoiceOutIndex.topbarSearch); await page.waitForURL('#!/invoice-out/index'); const url = await page.parsedUrl(); @@ -39,7 +39,7 @@ describe('InvoiceOut descriptor path', () => { it('should search for the target invoiceOut', async() => { await page.waitForContentLoaded(); - await page.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222'); + await page.write(selectors.invoiceOutIndex.topbarSearch, 'T2222222'); await page.waitToClick(selectors.invoiceOutIndex.searchButton); await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1); const result = await page.countElement(selectors.invoiceOutIndex.searchResult); @@ -71,7 +71,7 @@ describe('InvoiceOut descriptor path', () => { }); it(`should search for the deleted invouceOut to find no results`, async() => { - await page.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222'); + await page.write(selectors.invoiceOutIndex.topbarSearch, 'T2222222'); await page.waitToClick(selectors.invoiceOutIndex.searchButton); await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0); const result = await page.countElement(selectors.invoiceOutIndex.searchResult); @@ -83,7 +83,7 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - await page.wait(selectors.ticketsIndex.searchTicketInput); + await page.wait(selectors.ticketsIndex.topbarSearch); const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/ticket/index'); @@ -105,7 +105,7 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); - await page.wait(selectors.invoiceOutIndex.searchInvoiceOutInput); + await page.wait(selectors.invoiceOutIndex.topbarSearch); const url = await page.parsedUrl(); expect(url.hash).toEqual('#!/invoice-out/index'); From 89dc8e27e037a856474fef9c0363f88d14e58107 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Tue, 4 Feb 2020 11:20:05 +0100 Subject: [PATCH 05/95] update models --- modules/worker/back/model-config.json | 4 ++-- .../{holiday-detail.json => calendar-holidays-name.json} | 6 +++--- .../{holiday-type.json => calendar-holidays-type.json} | 4 ++-- modules/worker/back/models/holiday.json | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) rename modules/worker/back/models/{holiday-detail.json => calendar-holidays-name.json} (79%) rename modules/worker/back/models/{holiday-type.json => calendar-holidays-type.json} (84%) diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index 4948231b9..5b9136f68 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -8,10 +8,10 @@ "Holiday": { "dataSource": "vn" }, - "HolidayDetail": { + "CalendarHolidaysName": { "dataSource": "vn" }, - "HolidayType": { + "CalendarHolidaysType": { "dataSource": "vn" }, "WorkCenter": { diff --git a/modules/worker/back/models/holiday-detail.json b/modules/worker/back/models/calendar-holidays-name.json similarity index 79% rename from modules/worker/back/models/holiday-detail.json rename to modules/worker/back/models/calendar-holidays-name.json index 86874a02e..d04ef9c74 100644 --- a/modules/worker/back/models/holiday-detail.json +++ b/modules/worker/back/models/calendar-holidays-name.json @@ -1,9 +1,9 @@ { - "name": "HolidayDetail", + "name": "CalendarHolidaysName", "base": "VnModel", "options": { "mysql": { - "table": "holidayDetail" + "table": "calendarHolidaysName" } }, "properties": { @@ -11,7 +11,7 @@ "id": true, "type": "Number" }, - "description": { + "name": { "type": "String" } }, diff --git a/modules/worker/back/models/holiday-type.json b/modules/worker/back/models/calendar-holidays-type.json similarity index 84% rename from modules/worker/back/models/holiday-type.json rename to modules/worker/back/models/calendar-holidays-type.json index 6e40a62c7..a83dbc13c 100644 --- a/modules/worker/back/models/holiday-type.json +++ b/modules/worker/back/models/calendar-holidays-type.json @@ -1,9 +1,9 @@ { - "name": "HolidayType", + "name": "CalendarHolidaysType", "base": "VnModel", "options": { "mysql": { - "table": "holidayType" + "table": "calendarHolidaysType" } }, "properties": { diff --git a/modules/worker/back/models/holiday.json b/modules/worker/back/models/holiday.json index 678910f0a..a820c0d51 100644 --- a/modules/worker/back/models/holiday.json +++ b/modules/worker/back/models/holiday.json @@ -22,12 +22,12 @@ "relations": { "detail": { "type": "belongsTo", - "model": "HolidayDetail", + "model": "CalendarHolidaysName", "foreignKey": "holidayDetailFk" }, "type": { "type": "belongsTo", - "model": "HolidayType", + "model": "CalendarHolidaysType", "foreignKey": "holidayTypeFk" }, "workCenter": { From 5b0bb5dc7302b68a97eaef06cbfc7e420a8e2904 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 4 Feb 2020 11:25:15 +0100 Subject: [PATCH 06/95] updated e2e --- e2e/helpers/selectors.js | 1 + .../03_edit_fiscal_data.spec.js | 7 +- .../12_lock_of_verified_data.spec.js | 1 + .../back/methods/client/byNameOrEmail.js | 47 ------ .../client/specs/updateFiscalData.spec.js | 46 ++---- .../back/methods/client/updateFiscalData.js | 137 +++++++++++++----- modules/client/back/models/client.js | 1 - modules/client/front/fiscal-data/index.html | 9 +- modules/client/front/fiscal-data/index.js | 74 +++++++--- .../client/front/fiscal-data/index.spec.js | 89 +++++++++++- .../client/front/fiscal-data/locale/en.yml | 1 + .../client/front/fiscal-data/locale/es.yml | 4 +- 12 files changed, 275 insertions(+), 142 deletions(-) delete mode 100644 modules/client/back/methods/client/byNameOrEmail.js create mode 100644 modules/client/front/fiscal-data/locale/en.yml diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 95f7610ba..34f21eff4 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -63,6 +63,7 @@ export default { fiscalIdInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.fi"]', equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]', acceptPropagationButton: '.vn-confirm.shown button[response=accept]', + acceptDuplicationButton: '.vn-confirm.shown button[response=accept]', addressInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.street"]', postcodeInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.postcode"]', cityInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.city"]', diff --git a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js index 25127e314..b1b92d288 100644 --- a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js @@ -80,6 +80,7 @@ describe('Client Edit fiscalData path', () => { await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox); await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox); await page.waitToClick(selectors.clientFiscalData.saveButton); + await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton); const result = await page.waitForLastSnackbar(); expect(result).toEqual('Invalid Tax number'); @@ -89,6 +90,7 @@ describe('Client Edit fiscalData path', () => { await page.clearInput(selectors.clientFiscalData.fiscalIdInput); await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C'); await page.waitToClick(selectors.clientFiscalData.saveButton); + await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton); const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); @@ -151,6 +153,7 @@ describe('Client Edit fiscalData path', () => { it('should navigate back to fiscal data and uncheck EQtax then check VIES', async() => { await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); await page.waitToClick(selectors.clientFiscalData.viesCheckbox); + await page.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox); await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox); await page.waitToClick(selectors.clientFiscalData.saveButton); const result = await page.waitForLastSnackbar(); @@ -239,10 +242,10 @@ describe('Client Edit fiscalData path', () => { expect(result).toBe('unchecked'); }); - it('should confirm invoice by address checkbox is unchecked', async() => { + it('should confirm invoice by address checkbox is checked', async() => { const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox); - expect(result).toBe('unchecked'); + expect(result).toBe('checked'); }); it('should confirm Equalization tax checkbox is unchecked', async() => { diff --git a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js index ddb5f6d04..651970292 100644 --- a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js @@ -59,6 +59,7 @@ describe('Client lock verified data path', () => { it('should check the Verified data checkbox', async() => { await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox); await page.waitToClick(selectors.clientFiscalData.saveButton); + await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton); const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); diff --git a/modules/client/back/methods/client/byNameOrEmail.js b/modules/client/back/methods/client/byNameOrEmail.js deleted file mode 100644 index 71fd72782..000000000 --- a/modules/client/back/methods/client/byNameOrEmail.js +++ /dev/null @@ -1,47 +0,0 @@ -module.exports = Self => { - Self.remoteMethod('byNameOrEmail', { - description: 'Returns the client with the matching phone or email', - accessType: 'READ', - accepts: [{ - arg: 'email', - type: 'String', - description: 'Find my matching client email', - required: false - }, - { - arg: 'phone', - type: 'String', - description: 'Find my matching client phone', - required: false - }], - returns: { - type: 'number', - root: true - }, - http: { - path: `/byNameOrEmail`, - verb: 'GET' - } - }); - - Self.byNameOrEmail = async(email, phone) => { - const models = Self.app.models; - - let match; - match = await Self.findOne({ - where: { - email: email - } - }); - - if (match) return match; - - match = await models.UserPhone.findOne({ - where: { - phone: phone - } - }); - - return await Self.findById(match.userFk); - }; -}; diff --git a/modules/client/back/methods/client/specs/updateFiscalData.spec.js b/modules/client/back/methods/client/specs/updateFiscalData.spec.js index 90136cec7..a2b8f3d58 100644 --- a/modules/client/back/methods/client/specs/updateFiscalData.spec.js +++ b/modules/client/back/methods/client/specs/updateFiscalData.spec.js @@ -1,56 +1,40 @@ const app = require('vn-loopback/server/server'); describe('Client updateFiscalData', () => { + const clientId = 101; afterAll(async done => { - let ctxOfAdmin = {req: {accessToken: {userId: 5}}}; - let validparams = {postcode: 46460}; - let idWithDataChecked = 101; + const clientId = 101; + const ctx = {req: {accessToken: {userId: 5}}}; + ctx.args = {postcode: 46460}; - await app.models.Client.updateFiscalData(ctxOfAdmin, validparams, idWithDataChecked); + await app.models.Client.updateFiscalData(ctx, clientId); done(); }); it('should return an error if the user is not administrative and the isTaxDataChecked value is true', async() => { + const ctx = {req: {accessToken: {userId: 1}}}; + ctx.args = {}; + let error; - - let ctxOfNoAdmin = {req: {accessToken: {userId: 1}}}; - let params = []; - let idWithDataChecked = 101; - - await app.models.Client.updateFiscalData(ctxOfNoAdmin, params, idWithDataChecked) + await app.models.Client.updateFiscalData(ctx, clientId) .catch(e => { error = e; }); - expect(error.toString()).toContain(`You can't make changes on a client with verified data`); - }); - - it('should return an error if the user is administrative and the isTaxDataChecked value is true BUT the params aint valid', async() => { - let error; - - let ctxOfAdmin = {req: {accessToken: {userId: 5}}}; - let invalidparams = {invalid: 'param for update'}; - let idWithDataChecked = 101; - - await app.models.Client.updateFiscalData(ctxOfAdmin, invalidparams, idWithDataChecked) - .catch(e => { - error = e; - }); - - expect(error.toString()).toContain(`You don't have enough privileges to do that`); + expect(error.message).toBeDefined(); }); it('should update the client fiscal data and return the count if changes made', async() => { - let ctxOfAdmin = {req: {accessToken: {userId: 5}}}; - let validparams = {postcode: 46680}; - let idWithDataChecked = 101; + const ctx = {req: {accessToken: {userId: 5}}}; + ctx.args = {postcode: 46680}; - let client = await app.models.Client.findById(idWithDataChecked); + + const client = await app.models.Client.findById(clientId); expect(client.postcode).toEqual('46460'); - let result = await app.models.Client.updateFiscalData(ctxOfAdmin, validparams, idWithDataChecked); + const result = await app.models.Client.updateFiscalData(ctx, clientId); expect(result.postcode).toEqual('46680'); }); diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index 0f7810ed2..c1bd218d2 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -1,21 +1,87 @@ let UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('updateFiscalData', { - description: 'Updates billing data of a client', + Self.remoteMethod('updateFiscalData', { + description: 'Updates fiscal data of a client', accessType: 'WRITE', accepts: [{ - arg: 'data', + arg: 'ctx', type: 'Object', - required: true, - description: 'Params to update', - http: {source: 'body'} - }, { + http: {source: 'context'} + }, + { arg: 'id', - type: 'string', - required: true, - description: 'Model id', + type: 'Number', + description: 'The client id', http: {source: 'path'} + }, + { + arg: 'socialName', + type: 'String' + }, + { + arg: 'fi', + type: 'String' + }, + { + arg: 'street', + type: 'String' + }, + { + arg: 'postcode', + type: 'String' + }, + { + arg: 'city', + type: 'String' + }, + { + arg: 'countryFk', + type: 'Number' + }, + { + arg: 'provinceFk', + type: 'Number' + }, + { + arg: 'hasToInvoiceByAddress', + type: 'Boolean' + }, + { + arg: 'hasToInvoice', + type: 'Boolean' + }, + { + arg: 'isActive', + type: 'Boolean' + }, + { + arg: 'isFreezed', + type: 'Boolean' + }, + { + arg: 'isVies', + type: 'Boolean' + }, + { + arg: 'isToBeMailed', + type: 'Boolean' + }, + { + arg: 'isEqualizated', + type: 'Boolean' + }, + { + arg: 'isTaxDataVerified', + type: 'Boolean' + }, + { + arg: 'isTaxDataChecked', + type: 'Boolean' + }, + { + arg: 'despiteOfClient', + type: 'Number' }], returns: { arg: 'res', @@ -28,41 +94,34 @@ module.exports = Self => { } }); - Self.updateFiscalData = async(ctx, params, id) => { - let userId = ctx.req.accessToken.userId; - let isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant'); - let [taxData] = await Self.app.models.Client.find({where: {id: id}, fields: ['isTaxDataChecked']}); + Self.updateFiscalData = async(ctx, clientId) => { + const models = Self.app.models; + const args = ctx.args; + const userId = ctx.req.accessToken.userId; + const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant'); - if (!isSalesAssistant && taxData.isTaxDataChecked) + const client = await models.Client.findById(clientId); + + if (!isSalesAssistant && client.isTaxDataChecked) throw new UserError(`You can't make changes on a client with verified data`); - let validUpdateParams = [ - 'socialName', - 'fi', - 'street', - 'postcode', - 'city', - 'countryFk', - 'provinceFk', - 'isActive', - 'isFreezed', - 'hasToInvoice', - 'isVies', - 'isToBeMailed', - 'hasToInvoiceByAddress', - 'isEqualizated', - 'isTaxDataVerified', - 'isTaxDataChecked' - ]; + if (args.despiteOfClient) { + const logRecord = { + originFk: clientId, + userFk: userId, + action: 'update', + changedModel: 'Client', + changedModelId: clientId, + description: `Cliente comprobado a pesar de que existe el cliente id ${args.despiteOfClient}` + }; - for (const key in params) { - if (validUpdateParams.indexOf(key) === -1) - throw new UserError(`You don't have enough privileges to do that`); + await models.ClientLog.create(logRecord); } - params.id = id; + // Remove unwanted properties + delete args.ctx; + delete args.id; - let client = await Self.app.models.Client.findById(id); - return await client.updateAttributes(params); + return client.updateAttributes(args); }; }; diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 216506e34..367e0f0eb 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -24,7 +24,6 @@ module.exports = Self => { require('../methods/client/canBeInvoiced')(Self); require('../methods/client/uploadFile')(Self); require('../methods/client/lastActiveTickets')(Self); - require('../methods/client/findByPhoneOrEmail')(Self); require('../methods/client/sendSms')(Self); require('../methods/client/createAddress')(Self); require('../methods/client/updateAddress')(Self); diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index be22556df..3bbc48630 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -2,6 +2,7 @@ @@ -129,7 +130,8 @@ vn-one label="Is equalizated" ng-model="$ctrl.client.isEqualizated" - info="In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not."> + info="In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not." + on-change="$ctrl.onChangeEqualizated(value)"> + + diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index 57434b4eb..9e2be7241 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -4,30 +4,47 @@ import Component from 'core/lib/component'; export default class Controller extends Component { onSubmit() { const orgData = this.$.watcher.orgData; - if (orgData.isEqualizated != this.client.isEqualizated) - this.client.hasToInvoiceByAddress = false; - - if (!orgData.isTaxDataChecked && this.client.isTaxDataChecked) { - const serializedParams = {email: this.client.email, phone: 111}; - const query = `Clients/byNameOrEmail?filter=${serializedParams}`; - this.$http.get(query).then(res => { - console.log(res); - }); - } - - return this.checkEtChanges().then( - () => this.$.watcher.submit()); + delete this.client.despiteOfClient; + if (!orgData.isTaxDataChecked && this.client.isTaxDataChecked) + this.checkExistingClient(); + else this.save(); } - checkEtChanges() { - const orgData = this.$.watcher.orgData; - const equalizatedHasChanged = orgData.isEqualizated != this.client.isEqualizated; + checkExistingClient() { + const filterObj = { + where: { + and: [ + {or: [{email: this.client.email}, {phone: this.client.phone}]}, + {id: {neq: this.client.id}} + ] + } + }; - if (equalizatedHasChanged && !orgData.hasToInvoiceByAddress) + const $t = this.$translate.instant; + const filter = encodeURIComponent(JSON.stringify(filterObj)); + const query = `Clients/findOne?filter=${filter}`; + this.$http.get(query).then(res => { + if (res.data.id) { + const params = {clientId: res.data.id}; + const question = $t('Found a client with this phone or email', params, null, null, 'sanitizeParameters'); + + this.client.despiteOfClient = params.clientId; + this.$.confirmDuplicatedClient.question = question; + this.$.confirmDuplicatedClient.show(); + } + }); + } + + checkEtChanges(orgData) { + const equalizatedHasChanged = orgData.isEqualizated != this.client.isEqualizated; + const hasToInvoiceByAddress = orgData.hasToInvoiceByAddress || this.client.hasToInvoiceByAddress; + + if (equalizatedHasChanged && hasToInvoiceByAddress) this.$.propagateIsEqualizated.show(); else if (equalizatedHasChanged) return this.onAcceptEt(); + return this.$q.resolve(); } @@ -37,6 +54,29 @@ export default class Controller extends Component { () => this.vnApp.showMessage(this.$translate.instant('Equivalent tax spreaded')) ); } + + onAcceptDuplication() { + this.save(); + + return true; + } + + save() { + const orgData = this.$.watcher.orgData; + const clonedOrgData = JSON.parse(JSON.stringify(orgData)); + return this.$.watcher.submit().then( + () => this.checkEtChanges(clonedOrgData)); + } + + onChangeEqualizated(value) { + const orgData = this.$.watcher.orgData; + if (value === true) + this.client.hasToInvoiceByAddress = false; + else if (orgData.hasToInvoiceByAddress) + this.client.hasToInvoiceByAddress = true; + + this.$.$apply(); + } } ngModule.component('vnClientFiscalData', { diff --git a/modules/client/front/fiscal-data/index.spec.js b/modules/client/front/fiscal-data/index.spec.js index 5b5c5eab8..1e92426ec 100644 --- a/modules/client/front/fiscal-data/index.spec.js +++ b/modules/client/front/fiscal-data/index.spec.js @@ -1,9 +1,11 @@ import './index'; +import watcher from 'core/mocks/watcher'; describe('Client', () => { describe('Component vnClientFiscalData', () => { let $httpBackend; let $scope; + let $element; let controller; beforeEach(ngModule('client')); @@ -11,16 +13,97 @@ describe('Client', () => { beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); - controller = $componentController('vnClientFiscalData', {$scope}); + $scope.watcher = watcher; + $scope.watcher.orgData = {id: 101, isEqualizated: false, isTaxDataChecked: false}; + $element = angular.element(''); + controller = $componentController('vnClientFiscalData', {$element, $scope}); controller.card = {reload: () => {}}; + controller.client = { + id: 101, + email: 'batman@gothamcity.com', + phone: '1111111111', + isEqualizated: false, + isTaxDataChecked: false + }; })); - describe('returnDialogEt()', () => { + describe('onSubmit()', () => { + it('should call the save() method directly', () => { + spyOn(controller, 'save'); + + controller.onSubmit(); + + expect(controller.save).toHaveBeenCalledWith(); + }); + + it('should call the checkExistingClient() if the isTaxDataChecked property is checked', () => { + spyOn(controller, 'save'); + spyOn(controller, 'checkExistingClient'); + + controller.client.isTaxDataChecked = true; + controller.onSubmit(); + + expect(controller.save).not.toHaveBeenCalledWith(); + expect(controller.checkExistingClient).toHaveBeenCalledWith(); + }); + }); + + describe('checkExistingClient()', () => { + it('should show a save confirmation when a duplicated client is found and then set the despiteOfClient property', () => { + controller.$.confirmDuplicatedClient = {show: () => {}}; + spyOn(controller.$.confirmDuplicatedClient, 'show'); + const filterObj = { + where: { + and: [ + {or: [{email: controller.client.email}, {phone: controller.client.phone}]}, + {id: {neq: controller.client.id}} + ] + } + }; + const expectedClient = {id: 102}; + const filter = encodeURIComponent(JSON.stringify(filterObj)); + $httpBackend.expect('GET', `Clients/findOne?filter=${filter}`).respond(expectedClient); + controller.checkExistingClient(); + $httpBackend.flush(); + + expect(controller.$.confirmDuplicatedClient.show).toHaveBeenCalledWith(); + expect(controller.client.despiteOfClient).toEqual(102); + }); + }); + + describe('checkEtChanges()', () => { + it(`should show a propagation confirmation if isEqualizated property is changed and invoice by address is checked`, () => { + controller.$.propagateIsEqualizated = {show: () => {}}; + spyOn(controller.$.propagateIsEqualizated, 'show'); + + const orgData = $scope.watcher.orgData; + orgData.hasToInvoiceByAddress = true; + controller.client.isEqualizated = true; + + controller.checkEtChanges(orgData); + + expect(controller.$.propagateIsEqualizated.show).toHaveBeenCalledWith(); + }); + + it(`should call to the onAcceptEt() method if isEqualizated property is changed and invoice by address isn't checked`, () => { + spyOn(controller, 'onAcceptEt'); + + const orgData = $scope.watcher.orgData; + orgData.hasToInvoiceByAddress = false; + controller.client.isEqualizated = true; + + controller.checkEtChanges(orgData); + + expect(controller.onAcceptEt).toHaveBeenCalledWith(); + }); + }); + + describe('onAcceptEt()', () => { it('should request to patch the propagation of tax status', () => { controller.client = {id: 123, isEqualizated: false}; $httpBackend.when('PATCH', `Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done'); $httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}); - controller.returnDialogEt('accept'); + controller.onAcceptEt(); $httpBackend.flush(); }); }); diff --git a/modules/client/front/fiscal-data/locale/en.yml b/modules/client/front/fiscal-data/locale/en.yml new file mode 100644 index 000000000..14bd6d18f --- /dev/null +++ b/modules/client/front/fiscal-data/locale/en.yml @@ -0,0 +1 @@ +Found a client with this phone or email: The client with id {{clientId}} already has this phone or email.
¿Do you want to continue? \ No newline at end of file diff --git a/modules/client/front/fiscal-data/locale/es.yml b/modules/client/front/fiscal-data/locale/es.yml index 4cadd236f..087dd76d6 100644 --- a/modules/client/front/fiscal-data/locale/es.yml +++ b/modules/client/front/fiscal-data/locale/es.yml @@ -3,4 +3,6 @@ You changed the equalization tax: Has cambiado el recargo de equivalencia Do you want to spread the change?: ¿Deseas propagar el cambio a sus consignatarios? Frozen: Congelado In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.: Para facturar no se consulta este campo, sino el RE de consignatario. Al modificar este campo si no esta marcada la casilla Facturar por consignatario, se propagará automáticamente el cambio a todos los consignatarios, en caso contrario preguntará al usuario si quiere o no propagar. -You can use letters and spaces: Se pueden utilizar letras y espacios \ No newline at end of file +You can use letters and spaces: Se pueden utilizar letras y espacios +Found a client with this data: Se ha encontrado un cliente con estos datos +Found a client with this phone or email: El cliente con id {{clientId}} ya tiene este teléfono o email.
¿Quieres continuar? \ No newline at end of file From 494b14bab4cd8407215ce2891a5e392a42b19636 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 4 Feb 2020 12:28:01 +0100 Subject: [PATCH 07/95] added translation --- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 3 ++- modules/client/back/methods/client/updateFiscalData.js | 6 +++++- modules/client/front/fiscal-data/index.js | 1 - 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 2ea2b1a3a..23717ba8f 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -63,5 +63,6 @@ "MESSAGE_CHANGED_PAYMETHOD": "I have changed the pay method for client [{{clientName}} (#{{clientId}})]({{{url}}})", "MESSAGE_CLAIM_ITEM_REGULARIZE": "I sent *{{quantity}}* units of [{{concept}} (#{{itemId}})]({{{itemUrl}}}) to {{nickname}} coming from ticket id [#{{ticketId}}]({{{ticketUrl}}})", "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" + "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}}" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index a3490b372..d2f2882bc 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -124,5 +124,6 @@ "MESSAGE_BOUGHT_UNITS": "Se ha comprado {{quantity}} unidades de {{concept}} (#{{itemId}}) para el ticket id [#{{ticketId}}]({{{url}}})", "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} (#{{clientId}})]({{{url}}}) a *{{credit}} €*", "MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} (#{{clientId}})]({{{url}}})", - "MESSAGE_CLAIM_ITEM_REGULARIZE": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a {{nickname}} provenientes del ticket id [#{{ticketId}}]({{{ticketUrl}}})" + "MESSAGE_CLAIM_ITEM_REGULARIZE": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a {{nickname}} provenientes del ticket id [#{{ticketId}}]({{{ticketUrl}}})", + "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}" } \ No newline at end of file diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index c1bd218d2..e27a6f456 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -99,6 +99,7 @@ module.exports = Self => { const args = ctx.args; const userId = ctx.req.accessToken.userId; const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant'); + const $t = ctx.req.__; const client = await models.Client.findById(clientId); @@ -106,13 +107,16 @@ module.exports = Self => { throw new UserError(`You can't make changes on a client with verified data`); if (args.despiteOfClient) { + const translatedDescription = $t(`Client checked as validated despite of duplication`, { + clientId: args.despiteOfClient + }); const logRecord = { originFk: clientId, userFk: userId, action: 'update', changedModel: 'Client', changedModelId: clientId, - description: `Cliente comprobado a pesar de que existe el cliente id ${args.despiteOfClient}` + description: translatedDescription }; await models.ClientLog.create(logRecord); diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index 9e2be7241..98773de75 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -44,7 +44,6 @@ export default class Controller extends Component { else if (equalizatedHasChanged) return this.onAcceptEt(); - return this.$q.resolve(); } From 041c4966d61ef533fff32828823fd746b2403dee Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 4 Feb 2020 12:29:04 +0100 Subject: [PATCH 08/95] changed line --- modules/client/back/methods/client/updateFiscalData.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index e27a6f456..4bc6fda9b 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -107,16 +107,15 @@ module.exports = Self => { throw new UserError(`You can't make changes on a client with verified data`); if (args.despiteOfClient) { - const translatedDescription = $t(`Client checked as validated despite of duplication`, { - clientId: args.despiteOfClient - }); const logRecord = { originFk: clientId, userFk: userId, action: 'update', changedModel: 'Client', changedModelId: clientId, - description: translatedDescription + description: $t(`Client checked as validated despite of duplication`, { + clientId: args.despiteOfClient + }) }; await models.ClientLog.create(logRecord); From 6f2cd4b4464bdec70ef339f53540406e8e7436ce Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 4 Feb 2020 16:21:10 +0100 Subject: [PATCH 09/95] expectURL ext plus refactors --- e2e/helpers/extensions.js | 33 +++++++++---------- e2e/helpers/puppeteer.js | 9 ++++- e2e/helpers/selectors.js | 2 +- e2e/paths/01-login/01_login.spec.js | 4 +-- .../02-client-module/01_create_client.spec.js | 13 ++++---- .../03_edit_fiscal_data.spec.js | 15 ++++----- .../02-client-module/05_add_address.spec.js | 15 ++++----- .../06_add_address_notes.spec.js | 5 ++- .../02-client-module/08_add_notes.spec.js | 5 ++- .../02-client-module/09_add_credit.spec.js | 5 ++- .../02-client-module/10_add_greuge.spec.js | 5 ++- .../12_lock_of_verified_data.spec.js | 4 +-- e2e/paths/02-client-module/13_log.spec.js | 5 ++- e2e/paths/02-client-module/14_balance.spec.js | 17 ++++------ e2e/paths/04-item-module/01_summary.spec.js | 5 ++- .../08_create_and_clone.spec.js | 25 ++++++-------- .../04-item-module/09_regularize.spec.js | 33 ++++++++----------- e2e/paths/04-item-module/11_item_log.spec.js | 15 ++++----- .../05_tracking_state.spec.js | 9 +++-- .../06_basic_data_steps.spec.js | 15 ++++----- e2e/paths/05-ticket-module/09_weekly.spec.js | 22 +++++-------- e2e/paths/05-ticket-module/10_request.spec.js | 5 ++- e2e/paths/05-ticket-module/11_diary.spec.js | 10 +++--- .../05-ticket-module/12_descriptor.spec.js | 24 ++++++-------- .../05-ticket-module/13_services.spec.js | 7 ++-- .../05-ticket-module/14_create_ticket.spec.js | 10 +++--- .../15_create_ticket_from_client.spec.js | 5 ++- e2e/paths/05-ticket-module/16_summary.spec.js | 10 +++--- .../06-claim-module/01_basic_data.spec.js | 5 ++- .../06-claim-module/02_development.spec.js | 5 ++- e2e/paths/06-claim-module/03_detail.spec.js | 10 +++--- e2e/paths/06-claim-module/05_summary.spec.js | 5 ++- .../06-claim-module/06_descriptor.spec.js | 15 ++++----- .../01_edit_basic_data.spec.js | 20 +++++------ e2e/paths/07-order-module/02_catalog.spec.js | 13 ++++---- e2e/paths/07-order-module/03_lines.spec.js | 9 ++--- e2e/paths/08-route-module/01_create.spec.js | 15 ++++----- .../01_descriptor.spec.js | 30 ++++++++--------- e2e/smokes/01_client_path.spec.js | 10 +++--- 39 files changed, 201 insertions(+), 268 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 782756df3..fb0dd2d0c 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -13,8 +13,15 @@ let actions = { return exists; }, - parsedUrl: async function() { - return new URL(await this.url()); + expectURL: async function(expectedHash) { + try { + await this.waitForFunction(expectedHash => { + return document.location.hash.includes(expectedHash); + }, {}, expectedHash); + } catch (error) { + throw new Error(`failed to reach URL containing: ${expectedHash}`); + } + return true; }, waitUntilNotPresent: async function(selector) { @@ -48,7 +55,7 @@ let actions = { login: async function(userName) { try { - await this.waitForURL('#!/login'); + await this.expectURL('#!/login'); } catch (e) { await this.goto(`${defaultURL}/#!/login`); let dialog = await this.evaluate(() => { @@ -72,7 +79,7 @@ let actions = { let selector = `vn-home a[ui-sref="${moduleName}.index"]`; await this.waitToClick(selector); - await this.waitForURL(snakeName); + await this.expectURL(snakeName); }, loginAndModule: async function(userName, moduleName) { @@ -265,7 +272,7 @@ let actions = { waitForNumberOfElements: async function(selector, count) { return await this.waitForFunction((selector, count) => { - return document.querySelectorAll(selector).length === count; + return document.querySelectorAll(selector).length == count; }, {}, selector, count); }, @@ -286,8 +293,8 @@ let actions = { }, waitForTextInElement: async function(selector, text) { - await this.wait(selector); - return await this.wait((selector, text) => { + await this.waitForSelector(selector); + return await this.waitForFunction((selector, text) => { return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase()); }, {}, selector, text); }, @@ -332,16 +339,6 @@ let actions = { }, selector); }, - waitForURL: async function(hashURL) { - try { - await this.waitForFunction(expectedHash => { - return document.location.hash.includes(expectedHash); - }, {}, hashURL); - } catch (error) { - throw new Error(`failed to reach URL containing: ${hashURL}`); - } - }, - hideSnackbar: async function() { await this.waitToClick('#shapes .shown button'); }, @@ -460,7 +457,7 @@ let actions = { }, isDisabled: async function(selector) { - await this.wait(selector); + await this.waitForSelector(selector); return await this.evaluate(selector => { let element = document.querySelector(selector); return element.$ctrl.disabled; diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index 01496be20..b21aac9b2 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -4,18 +4,25 @@ import {extendPage} from './extensions'; import {url as defaultURL} from './config'; export async function getBrowser() { + let headless = true; const browser = await Puppeteer.launch({ args: [ '--no-sandbox', `--window-size=${ 1920 },${ 1080 }` ], defaultViewport: null, - headless: false, + headless: headless, slowMo: 0, // slow down by ms }); let page = (await browser.pages())[0]; page = extendPage(page); page.setDefaultTimeout(5000); + // if (headless) { + // await page.setExtraHTTPHeaders({ + // 'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8' + // }); + // } + // await page.setCacheEnabled(false); await page.goto(defaultURL, {waitUntil: 'networkidle0'}); return {page, close: browser.close.bind(browser)}; } diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 8d215446c..f36e90f32 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -502,7 +502,7 @@ export default { newServiceTypeName: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"]', newServiceTypeExpense: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newServiceType.expenseFk"]', serviceLine: 'vn-ticket-service > form > vn-card > vn-one:nth-child(2) > vn-horizontal', - saveServiceButton: `button[type=submit]`, + saveServiceButton: 'button[type=submit]', saveServiceTypeButton: '.vn-dialog.shown tpl-buttons > button' }, createStateView: { diff --git a/e2e/paths/01-login/01_login.spec.js b/e2e/paths/01-login/01_login.spec.js index ff9752b2b..abb022011 100644 --- a/e2e/paths/01-login/01_login.spec.js +++ b/e2e/paths/01-login/01_login.spec.js @@ -36,8 +36,8 @@ describe('Login path', async() => { it('should log in', async() => { await page.doLogin('employee', 'nightmare'); await page.waitForNavigation(); - let url = await page.parsedUrl(); + let url = await page.expectURL('#!/'); - expect(url.hash).toEqual('#!/'); + expect(url).toBe(true); }); }); diff --git a/e2e/paths/02-client-module/01_create_client.spec.js b/e2e/paths/02-client-module/01_create_client.spec.js index 4fe76c959..29525df49 100644 --- a/e2e/paths/02-client-module/01_create_client.spec.js +++ b/e2e/paths/02-client-module/01_create_client.spec.js @@ -26,9 +26,9 @@ describe('Client create path', async() => { it('should now access to the create client view by clicking the create-client floating button', async() => { await page.waitToClick(selectors.clientsIndex.createClientButton); await page.wait(selectors.createClientView.createButton); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/client/create'); - expect(url.hash).toEqual('#!/client/create'); + expect(url).toBe(true); }); it('should receive an error when clicking the create button having all the form fields empty', async() => { @@ -107,17 +107,16 @@ describe('Client create path', async() => { await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.clientsButton); await page.wait(selectors.clientsIndex.createClientButton); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/client/index'); - expect(url.hash).toEqual('#!/client/index'); + expect(url).toBe(true); }); it(`should search for the user Carol Danvers to confirm it exists`, async() => { await page.waitForContentLoaded(); await page.accessToSearchResult('Carol Danvers'); - await page.waitForURL('#!/client/114/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/client/114/summary'); - expect(url.hash).toEqual('#!/client/114/summary'); + expect(url).toBe(true); }); }); diff --git a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js index 854f41f5b..34fc5a9c7 100644 --- a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js @@ -36,10 +36,9 @@ describe('Client Edit fiscalData path', () => { it(`should click on the fiscal data button`, async() => { await page.waitToClick(selectors.clientFiscalData.fiscalDataButton); - await page.waitForURL('fiscal-data'); - const url = await page.parsedUrl(); + let url = await page.expectURL('fiscal-data'); - expect(url.hash).toContain('fiscal-data'); + expect(url).toBe(true); }); it('should not be able to edit the verified data checkbox', async() => { @@ -123,10 +122,9 @@ describe('Client Edit fiscalData path', () => { // confirm all addresses have now EQtax checked step 1 it(`should click on the addresses button to access to the client's addresses`, async() => { await page.waitToClick(selectors.clientAddresses.addressesButton); - await page.waitForURL('/address/index'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/address/index'); - expect(url.hash).toContain('/address/index'); + expect(url).toBe(true); }); // confirm all addresses have now EQtax checked step 2 @@ -260,10 +258,9 @@ describe('Client Edit fiscalData path', () => { // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1 it(`should click on the addresses button to access to the client's addresses`, async() => { await page.waitToClick(selectors.clientAddresses.addressesButton); - await page.waitForURL('/address/index'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/address/index'); - expect(url.hash).toContain('/address/index'); + expect(url).toBe(true); }); // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2 diff --git a/e2e/paths/02-client-module/05_add_address.spec.js b/e2e/paths/02-client-module/05_add_address.spec.js index 43b663ae6..af4ccf5d6 100644 --- a/e2e/paths/02-client-module/05_add_address.spec.js +++ b/e2e/paths/02-client-module/05_add_address.spec.js @@ -18,10 +18,9 @@ describe('Client Add address path', () => { it(`should click on the add new address button to access to the new address form`, async() => { await page.waitToClick(selectors.clientAddresses.createAddress); - await page.waitForURL('address/create'); - const url = await page.parsedUrl(); + let url = await page.expectURL('address/create'); - expect(url.hash).toContain('address/create'); + expect(url).toBe(true); }); it('should receive an error after clicking save button as consignee, street and town fields are empty', async() => { @@ -87,10 +86,9 @@ describe('Client Add address path', () => { it(`should click on the edit icon of the default address`, async() => { await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand'); await page.waitToClick(selectors.clientAddresses.firstEditAddress); - await page.waitForURL('/edit'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/edit'); - expect(url.hash).toContain('/edit'); + expect(url).toBe(true); }); it(`should click on the active checkbox and receive an error to save it because it is the default address`, async() => { @@ -105,9 +103,8 @@ describe('Client Add address path', () => { it(`should go back to the addreses section by clicking the cancel button`, async() => { await page.waitToClick(selectors.clientAddresses.cancelEditAddressButton); await page.waitToClick('.vn-confirm.shown button[response="accept"]'); - await page.waitForURL('address/index'); - const url = await page.parsedUrl(); + let url = await page.expectURL('address/index'); - expect(url.hash).toContain('address/index'); + expect(url).toBe(true); }); }); diff --git a/e2e/paths/02-client-module/06_add_address_notes.spec.js b/e2e/paths/02-client-module/06_add_address_notes.spec.js index 59e2bf5fb..58a949698 100644 --- a/e2e/paths/02-client-module/06_add_address_notes.spec.js +++ b/e2e/paths/02-client-module/06_add_address_notes.spec.js @@ -19,10 +19,9 @@ describe('Client add address notes path', () => { it(`should click on the edit icon of the default address`, async() => { await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street'); await page.waitToClick(selectors.clientAddresses.firstEditAddress); - await page.waitForURL('/edit'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/edit'); - expect(url.hash).toContain('/edit'); + expect(url).toBe(true); }); it('should not save a description without observation type', async() => { diff --git a/e2e/paths/02-client-module/08_add_notes.spec.js b/e2e/paths/02-client-module/08_add_notes.spec.js index 44b876cd9..8f1a9244d 100644 --- a/e2e/paths/02-client-module/08_add_notes.spec.js +++ b/e2e/paths/02-client-module/08_add_notes.spec.js @@ -18,10 +18,9 @@ describe('Client Add notes path', () => { it(`should click on the add note button`, async() => { await page.waitToClick(selectors.clientNotes.addNoteFloatButton); - await page.waitForURL('/note/create'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/note/create'); - expect(url.hash).toContain('/note/create'); + expect(url).toBe(true); }); it(`should create a note`, async() => { diff --git a/e2e/paths/02-client-module/09_add_credit.spec.js b/e2e/paths/02-client-module/09_add_credit.spec.js index b90c629f5..1cb06fb36 100644 --- a/e2e/paths/02-client-module/09_add_credit.spec.js +++ b/e2e/paths/02-client-module/09_add_credit.spec.js @@ -18,10 +18,9 @@ describe('Client Add credit path', () => { it(`should click on the add credit button`, async() => { await page.waitToClick(selectors.clientCredit.addCreditFloatButton); - await page.waitForURL('/credit/create'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/credit/create'); - expect(url.hash).toContain('/credit/create'); + expect(url).toBe(true); }); it(`should edit the credit`, async() => { diff --git a/e2e/paths/02-client-module/10_add_greuge.spec.js b/e2e/paths/02-client-module/10_add_greuge.spec.js index 86407f3c6..c934a42f1 100644 --- a/e2e/paths/02-client-module/10_add_greuge.spec.js +++ b/e2e/paths/02-client-module/10_add_greuge.spec.js @@ -18,10 +18,9 @@ describe('Client Add greuge path', () => { it(`should click on the add greuge button`, async() => { await page.waitToClick(selectors.clientGreuge.addGreugeFloatButton); - await page.waitForURL('greuge/create'); - const url = await page.parsedUrl(); + let url = await page.expectURL('greuge/create'); - expect(url.hash).toContain('greuge/create'); + expect(url).toBe(true); }); it(`should receive an error if all fields are empty but date and type on submit`, async() => { diff --git a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js index 06db0a672..bb6b8b51a 100644 --- a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js @@ -113,12 +113,12 @@ describe('Client lock verified data path', () => { }); describe('as salesAssistant', () => { - beforeAll(async() => { + it('should log in as salesAssistant then get to the client fiscal data', async() => { await page.forceReloadSection('client.card.fiscalData'); await page.loginAndModule('salesAssistant', 'client'); await page.accessToSearchResult('Hank Pym'); await page.accessToSection('client.card.fiscalData'); - }); + }, 20000); it('should confirm verified data button is enabled for salesAssistant', async() => { const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); diff --git a/e2e/paths/02-client-module/13_log.spec.js b/e2e/paths/02-client-module/13_log.spec.js index a24c7cf4e..462d66347 100644 --- a/e2e/paths/02-client-module/13_log.spec.js +++ b/e2e/paths/02-client-module/13_log.spec.js @@ -27,10 +27,9 @@ describe('Client log path', () => { it('should navigate to the log section', async() => { await page.waitToClick(selectors.clientLog.logButton); - await page.waitForURL('log'); - let url = await page.parsedUrl(); + let url = await page.expectURL('log'); - expect(url.hash).toContain('log'); + expect(url).toBe(true); }); it('should check the previous value of the last logged change', async() => { diff --git a/e2e/paths/02-client-module/14_balance.spec.js b/e2e/paths/02-client-module/14_balance.spec.js index 9d5ff471a..d70d11508 100644 --- a/e2e/paths/02-client-module/14_balance.spec.js +++ b/e2e/paths/02-client-module/14_balance.spec.js @@ -42,17 +42,14 @@ describe('Client balance path', () => { it('should click the new payment button', async() => { await page.keyboard.press('Escape'); await page.reloadSection('client.card.balance.index'); - await page.waitForURL('/balance'); + let url = await page.expectURL('/balance'); - let url = await page.parsedUrl(); - - expect(url.hash).toContain('/balance'); + expect(url).toBe(true); }); it('should create a new payment that clears the debt', async() => { await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitForContentLoaded(); - await page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true}); await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt'); await page.waitToClick(selectors.clientBalance.saveButton); let result = await page.waitForLastSnackbar(); @@ -116,12 +113,13 @@ describe('Client balance path', () => { await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.clientsButton); await page.wait(selectors.clientsIndex.createClientButton); - let url = await page.parsedUrl(); + let url = await page.expectURL('#!/client/index'); - expect(url.hash).toEqual('#!/client/index'); + expect(url).toBe(true); }); it('should now search for the user Petter Parker', async() => { + await page.waitForContentLoaded(); await page.write(selectors.clientsIndex.topbarSearch, 'Petter Parker'); await page.waitToClick(selectors.clientsIndex.searchButton); await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1); @@ -135,10 +133,9 @@ describe('Client balance path', () => { await page.waitToClick(selectors.clientsIndex.searchResult); await page.waitForContentLoaded(); await page.waitToClick(selectors.clientBalance.balanceButton); - await page.waitForURL('/balance'); - let url = await page.parsedUrl(); + let url = await page.expectURL('/balance'); - expect(url.hash).toContain('/balance'); + expect(url).toBe(true); }); it('should not be able to click the new payment button as it isnt present', async() => { diff --git a/e2e/paths/04-item-module/01_summary.spec.js b/e2e/paths/04-item-module/01_summary.spec.js index 2e32f85e2..0196e0930 100644 --- a/e2e/paths/04-item-module/01_summary.spec.js +++ b/e2e/paths/04-item-module/01_summary.spec.js @@ -131,10 +131,9 @@ describe('Item summary path', () => { it(`should navigate to the one of the items detailed section`, async() => { await page.waitToClick(selectors.itemsIndex.searchResult); - await page.waitForURL('summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('summary'); - expect(url.hash).toContain('summary'); + expect(url).toBe(true); }); it(`should check the descritor edit button is not visible for employee`, async() => { diff --git a/e2e/paths/04-item-module/08_create_and_clone.spec.js b/e2e/paths/04-item-module/08_create_and_clone.spec.js index ca70fc47d..7d6a8e54d 100644 --- a/e2e/paths/04-item-module/08_create_and_clone.spec.js +++ b/e2e/paths/04-item-module/08_create_and_clone.spec.js @@ -27,27 +27,24 @@ describe('Item Create/Clone path', () => { it('should access to the create item view by clicking the create floating button', async() => { await page.waitToClick(selectors.itemsIndex.createItemButton); - await page.wait(selectors.itemCreateView.createButton); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/item/create'); - expect(url.hash).toEqual('#!/item/create'); + expect(url).toBe(true); }); it('should return to the item index by clickig the cancel button', async() => { await page.waitToClick(selectors.itemCreateView.cancelButton); - await page.wait(selectors.itemsIndex.createItemButton); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/item/index'); - expect(url.hash).toEqual('#!/item/index'); + expect(url).toBe(true); }); it('should now access to the create item view by clicking the create floating button', async() => { await page.waitForContentLoaded(); await page.waitToClick(selectors.itemsIndex.createItemButton); - await page.wait(selectors.itemCreateView.createButton); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/item/create'); - expect(url.hash).toEqual('#!/item/create'); + expect(url).toBe(true); }); it('should create the Infinity Gauntlet item', async() => { @@ -89,10 +86,9 @@ describe('Item Create/Clone path', () => { it('should return to the items index by clicking the return to items button', async() => { await page.waitToClick(selectors.itemBasicData.goToItemIndexButton); await page.wait(selectors.itemsIndex.createItemButton); - await page.waitForURL('#!/item/index'); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/item/index'); - expect(url.hash).toContain('#!/item/index'); + expect(url).toBe(true); }); it(`should search for the item Infinity Gauntlet`, async() => { @@ -109,10 +105,9 @@ describe('Item Create/Clone path', () => { await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet'); await page.waitToClick(selectors.itemsIndex.searchResultCloneButton); await page.waitToClick(selectors.itemsIndex.acceptClonationAlertButton); - await page.waitForURL('tags'); - const url = await page.parsedUrl(); + let url = await page.expectURL('tags'); - expect(url.hash).toContain('tags'); + expect(url).toBe(true); }); it('should search for the item Infinity Gauntlet and find two', async() => { diff --git a/e2e/paths/04-item-module/09_regularize.spec.js b/e2e/paths/04-item-module/09_regularize.spec.js index 17c9136ac..76e92f8a6 100644 --- a/e2e/paths/04-item-module/09_regularize.spec.js +++ b/e2e/paths/04-item-module/09_regularize.spec.js @@ -46,10 +46,9 @@ describe('Item regularize path', () => { it(`should click on the search result to access to the item tax`, async() => { await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm'); await page.waitToClick(selectors.itemsIndex.searchResult); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it('should open the regularize dialog and check the warehouse matches the local user settings', async() => { @@ -76,9 +75,9 @@ describe('Item regularize path', () => { page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}), page.waitToClick(selectors.globalItems.ticketsButton) ]); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/ticket/index'); - expect(url.hash).toEqual('#!/ticket/index'); + expect(url).toBe(true); }); it('should clear the user local settings now', async() => { @@ -103,10 +102,9 @@ describe('Item regularize path', () => { it(`should click on the search result to access to the ticket summary`, async() => { await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing'); await page.waitToClick(selectors.ticketsIndex.searchResult); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it(`should check the ticket sale quantity is showing a negative value`, async() => { @@ -128,10 +126,9 @@ describe('Item regularize path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.itemsButton); - await page.wait(selectors.itemsIndex.topbarSearch); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/item/index'); - expect(url.hash).toEqual('#!/item/index'); + expect(url).toBe(true); }); it('should search for the item once again', async() => { @@ -147,10 +144,9 @@ describe('Item regularize path', () => { it(`should click on the search result to access to the item tax`, async() => { await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm'); await page.waitToClick(selectors.itemsIndex.searchResult); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it('should regularize the item once more', async() => { @@ -172,9 +168,9 @@ describe('Item regularize path', () => { page.waitToClick(selectors.globalItems.ticketsButton) ]); await page.waitForTransitionEnd('vn-searchbar'); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/ticket/index'); - expect(url.hash).toEqual('#!/ticket/index'); + expect(url).toBe(true); }); it('should search for the ticket with id 25 once again', async() => { @@ -189,10 +185,9 @@ describe('Item regularize path', () => { it(`should now click on the search result to access to the ticket summary`, async() => { await page.waitForTextInElement(selectors.ticketsIndex.searchResult, '25'); await page.waitToClick(selectors.ticketsIndex.searchResult); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it(`should check the ticket contains now two sales`, async() => { diff --git a/e2e/paths/04-item-module/11_item_log.spec.js b/e2e/paths/04-item-module/11_item_log.spec.js index 0de362565..213365c12 100644 --- a/e2e/paths/04-item-module/11_item_log.spec.js +++ b/e2e/paths/04-item-module/11_item_log.spec.js @@ -25,10 +25,9 @@ describe('Item log path', () => { it('should access to the create item view by clicking the create floating button', async() => { await page.waitToClick(selectors.itemsIndex.createItemButton); - await page.wait(selectors.itemCreateView.createButton); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/item/create'); - expect(url.hash).toEqual('#!/item/create'); + expect(url).toBe(true); }); it('should create the Knowledge artifact item', async() => { @@ -45,19 +44,17 @@ describe('Item log path', () => { it('should return to the items index by clicking the return to items button', async() => { await page.waitToClick(selectors.itemBasicData.goToItemIndexButton); await page.wait(selectors.itemsIndex.createItemButton); - await page.waitForURL('#!/item/index'); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/item/index'); - expect(url.hash).toContain('#!/item/index'); + expect(url).toBe(true); }); it(`should search for the created item and navigate to it's log section`, async() => { await page.accessToSearchResult('Knowledge artifact'); await page.accessToSection('item.card.log'); - await page.waitForURL('/log'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/log'); - expect(url.hash).toContain('/log'); + expect(url).toBe(true); }); it(`should confirm the log is showing 5 entries`, async() => { diff --git a/e2e/paths/05-ticket-module/05_tracking_state.spec.js b/e2e/paths/05-ticket-module/05_tracking_state.spec.js index b6f39bf31..108e8776f 100644 --- a/e2e/paths/05-ticket-module/05_tracking_state.spec.js +++ b/e2e/paths/05-ticket-module/05_tracking_state.spec.js @@ -21,9 +21,9 @@ describe('Ticket Create new tracking state path', () => { it('should access to the create state view by clicking the create floating button', async() => { await page.waitToClick(selectors.ticketTracking.createStateButton); await page.waitForSelector(selectors.createStateView.state, {visible: true}); - let url = await page.parsedUrl(); + let url = await page.expectURL('tracking/edit'); - expect(url.hash).toContain('tracking/edit'); + expect(url).toBe(true); }); it(`should attempt create a new state but receive an error if state is empty`, async() => { @@ -51,10 +51,9 @@ describe('Ticket Create new tracking state path', () => { it('should now access to the create state view by clicking the create floating button', async() => { await page.waitToClick(selectors.ticketTracking.createStateButton); - await page.waitForURL('tracking/edit'); - let url = await page.parsedUrl(); + let url = await page.expectURL('tracking/edit'); - expect(url.hash).toContain('tracking/edit'); + expect(url).toBe(true); }); it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => { diff --git a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js index 670d42627..f677625cd 100644 --- a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js @@ -68,10 +68,9 @@ describe('Ticket Edit basic data path', () => { it(`should click next`, async() => { await page.waitToClick(selectors.ticketBasicData.nextStepButton); - await page.waitForURL('data/step-two'); - let url = await page.parsedUrl(); + let url = await page.expectURL('data/step-two'); - expect(url.hash).toContain('data/step-two'); + expect(url).toBe(true); }); it(`should have a price diference`, async() => { @@ -83,18 +82,16 @@ describe('Ticket Edit basic data path', () => { it(`should then click next to move on to step three`, async() => { await page.waitToClick(selectors.ticketBasicData.nextStepButton); - await page.waitForURL('data/step-three'); - let url = await page.parsedUrl(); + let url = await page.expectURL('data/step-three'); - expect(url.hash).toContain('data/step-three'); + expect(url).toBe(true); }); it(`should select a new reason for the changes made then click on finalize`, async() => { await page.autocompleteSearch(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket'); await page.waitToClick(selectors.ticketBasicData.finalizeButton); - await page.waitForURL('summary'); - let url = await page.parsedUrl(); + let url = await page.expectURL('summary'); - expect(url.hash).toContain('summary'); + expect(url).toBe(true); }); }); diff --git a/e2e/paths/05-ticket-module/09_weekly.spec.js b/e2e/paths/05-ticket-module/09_weekly.spec.js index d41398bdd..e88018ad5 100644 --- a/e2e/paths/05-ticket-module/09_weekly.spec.js +++ b/e2e/paths/05-ticket-module/09_weekly.spec.js @@ -42,11 +42,9 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - await page.waitForContentLoaded(); + let url = await page.expectURL('#!/ticket/index'); - const url = await page.parsedUrl(); - - expect(url.hash).toEqual('#!/ticket/index'); + expect(url).toBe(true); }); it('should confirm the ticket 11 was added to thursday', async() => { @@ -60,11 +58,9 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - await page.waitForURL('#!/ticket/index'); + let url = await page.expectURL('#!/ticket/index'); - const url = await page.parsedUrl(); - - expect(url.hash).toEqual('#!/ticket/index'); + expect(url).toBe(true); }); it('should now search for the ticket 11', async() => { @@ -79,10 +75,9 @@ describe('Ticket descriptor path', () => { it(`should click on the search result to access to the ticket`, async() => { await page.waitToClick(selectors.ticketsIndex.searchResult); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it('should add the ticket to saturday turn using the descriptor more menu', async() => { @@ -99,10 +94,9 @@ describe('Ticket descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - await page.wait(selectors.ticketsIndex.topbarSearch); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/ticket/index'); - expect(url.hash).toEqual('#!/ticket/index'); + expect(url).toBe(true); }); it('should confirm the ticket 11 was added on saturday', async() => { diff --git a/e2e/paths/05-ticket-module/10_request.spec.js b/e2e/paths/05-ticket-module/10_request.spec.js index e3f1f59e4..ce2c3a324 100644 --- a/e2e/paths/05-ticket-module/10_request.spec.js +++ b/e2e/paths/05-ticket-module/10_request.spec.js @@ -30,10 +30,9 @@ describe('Ticket purchase request path', () => { }); it(`should have been redirected to the request index`, async() => { - await page.waitForURL('/request'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/request'); - expect(url.hash).toContain('/request'); + expect(url).toBe(true); }); it(`should confirm the new request was added`, async() => { diff --git a/e2e/paths/05-ticket-module/11_diary.spec.js b/e2e/paths/05-ticket-module/11_diary.spec.js index 6f470e07f..b529ee1ff 100644 --- a/e2e/paths/05-ticket-module/11_diary.spec.js +++ b/e2e/paths/05-ticket-module/11_diary.spec.js @@ -28,20 +28,18 @@ xdescribe('Ticket diary path', () => { it(`should click on the search result to access to the ticket summary`, async() => { await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave'); await page.waitToClick(selectors.ticketsIndex.searchResult); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => { await page.waitToClick(selectors.ticketSummary.firstSaleItemId); await page.waitForTransitionEnd('.vn-popover'); await page.waitToClick(selectors.ticketSummary.popoverDiaryButton); - await page.waitForURL('/diary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/diary'); - expect(url.hash).toContain('/diary'); + expect(url).toBe(true); }); it(`should check the second line id is marked as message`, async() => { diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket-module/12_descriptor.spec.js index c01785165..6e3864b48 100644 --- a/e2e/paths/05-ticket-module/12_descriptor.spec.js +++ b/e2e/paths/05-ticket-module/12_descriptor.spec.js @@ -28,10 +28,9 @@ describe('Ticket descriptor path', () => { it(`should click on the search result to access to the ticket summary`, async() => { await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Cerebro'); await page.waitToClick(selectors.ticketsIndex.searchResult); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it(`should update the shipped hour using the descriptor menu`, async() => { @@ -62,9 +61,9 @@ describe('Ticket descriptor path', () => { }); it('should have been relocated to the ticket index', async() => { - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/ticket/index'); - expect(url.hash).toEqual('#!/ticket/index'); + expect(url).toBe(true); }); it(`should search for the deleted ticket and check it's date`, async() => { @@ -92,10 +91,9 @@ describe('Ticket descriptor path', () => { it(`should now click on the search result to access to the ticket summary`, async() => { await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Many Places'); await page.waitToClick(selectors.ticketsIndex.searchResult); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it('should open the add stowaway dialog', async() => { @@ -126,10 +124,9 @@ describe('Ticket descriptor path', () => { it(`should navigate back to the added ticket using the descriptors ship button`, async() => { await page.waitToClick(selectors.ticketDescriptor.shipButton); - await page.waitForURL('#!/ticket/17/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/ticket/17/summary'); - expect(url.hash).toContain('#!/ticket/17/summary'); + expect(url).toBe(true); }); it('should delete the stowaway', async() => { @@ -153,10 +150,9 @@ describe('Ticket descriptor path', () => { await page.loginAndModule('adminBoss', 'ticket'); await page.accessToSearchResult(invoiceableTicketId); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL(`ticket/${invoiceableTicketId}/summary`); - expect(url.hash).toContain(`ticket/${invoiceableTicketId}/summary`); + expect(url).toBe(true); }); it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => { diff --git a/e2e/paths/05-ticket-module/13_services.spec.js b/e2e/paths/05-ticket-module/13_services.spec.js index 4a1e12505..cafc5f27c 100644 --- a/e2e/paths/05-ticket-module/13_services.spec.js +++ b/e2e/paths/05-ticket-module/13_services.spec.js @@ -44,10 +44,9 @@ describe('Ticket services path', () => { await page.loginAndModule('administrative', 'ticket'); await page.accessToSearchResult(editableTicketId); await page.accessToSection('ticket.card.service'); - await page.waitForURL('/service'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/service'); - expect(url.hash).toContain('/service'); + expect(url).toBe(true); }); it('should click on the add button to prepare the form to create a new service', async() => { @@ -86,6 +85,7 @@ describe('Ticket services path', () => { await page.autocompleteSearch(selectors.ticketService.newServiceTypeExpense, 'Retencion'); await page.waitToClick(selectors.ticketService.saveServiceTypeButton); await page.write(selectors.ticketService.firstPrice, '999'); + await page.waitFor(1000); // time needed for the button to be clickable await page.waitToClick(selectors.ticketService.saveServiceButton); const result = await page.waitForLastSnackbar(); @@ -124,6 +124,7 @@ describe('Ticket services path', () => { it('should delete the service', async() => { await page.waitToClick(selectors.ticketService.fistDeleteServiceButton); await page.waitForNumberOfElements(selectors.ticketService.serviceLine, 0); + await page.waitFor(1000); // without this wait it fails to click the save button await page.waitToClick(selectors.ticketService.saveServiceButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/05-ticket-module/14_create_ticket.spec.js b/e2e/paths/05-ticket-module/14_create_ticket.spec.js index 9e68db9fd..e501ea0ef 100644 --- a/e2e/paths/05-ticket-module/14_create_ticket.spec.js +++ b/e2e/paths/05-ticket-module/14_create_ticket.spec.js @@ -17,10 +17,9 @@ describe('Ticket create path', () => { it('should open the new ticket form', async() => { await page.waitToClick(selectors.ticketsIndex.newTicketButton); - await page.wait(selectors.createTicketView.client); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/ticket/create'); - expect(url.hash).toEqual('#!/ticket/create'); + expect(url).toBe(true); }); it('should succeed to create a ticket', async() => { @@ -36,9 +35,8 @@ describe('Ticket create path', () => { }); it('should check the url is now the summary of the ticket', async() => { - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); }); diff --git a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js b/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js index 4f7090bd3..80bb217fb 100644 --- a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js +++ b/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js @@ -20,10 +20,9 @@ describe('Ticket create from client path', () => { await page.waitForContentLoaded(); await page.waitToClick(selectors.clientDescriptor.moreMenu); await page.waitToClick(selectors.clientDescriptor.simpleTicketButton); - await page.waitForURL('#!/ticket/create?clientFk=102'); - const url = await page.parsedUrl(); + let url = await page.expectURL('clientFk=102'); - expect(url.hash).toContain('clientFk=102'); + expect(url).toBe(true); }); it('should check if the client details are the expected ones', async() => { diff --git a/e2e/paths/05-ticket-module/16_summary.spec.js b/e2e/paths/05-ticket-module/16_summary.spec.js index 17c1ca71d..e7c6507d7 100644 --- a/e2e/paths/05-ticket-module/16_summary.spec.js +++ b/e2e/paths/05-ticket-module/16_summary.spec.js @@ -18,10 +18,9 @@ describe('Ticket Summary path', () => { it('should navigate to the target ticket summary section', async() => { await page.loginAndModule('employee', 'ticket'); await page.accessToSearchResult(ticketId); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it(`should display details from the ticket and it's client on the top of the header`, async() => { @@ -76,10 +75,9 @@ describe('Ticket Summary path', () => { it('should log in as production then navigate to the summary of the same ticket', async() => { await page.loginAndModule('production', 'ticket'); await page.accessToSearchResult(ticketId); - await page.waitForURL('/summary'); - let url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it('should click on the SET OK button', async() => { diff --git a/e2e/paths/06-claim-module/01_basic_data.spec.js b/e2e/paths/06-claim-module/01_basic_data.spec.js index e2116b2ee..9718fb583 100644 --- a/e2e/paths/06-claim-module/01_basic_data.spec.js +++ b/e2e/paths/06-claim-module/01_basic_data.spec.js @@ -31,10 +31,9 @@ describe('Claim edit basic data path', () => { }); it(`should have been redirected to the next section of claims as the role is salesAssistant`, async() => { - await page.waitForURL('/detail'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/detail'); - expect(url.hash).toContain('/detail'); + expect(url).toBe(true); }); it('should confirm the claim state was edited', async() => { diff --git a/e2e/paths/06-claim-module/02_development.spec.js b/e2e/paths/06-claim-module/02_development.spec.js index 8f8f98b16..351dee50f 100644 --- a/e2e/paths/06-claim-module/02_development.spec.js +++ b/e2e/paths/06-claim-module/02_development.spec.js @@ -32,10 +32,9 @@ describe('Claim development', () => { }, 15000); it(`should redirect to the next section of claims as the role is salesAssistant`, async() => { - await page.waitForURL('/action'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/action'); - expect(url.hash).toContain('/action'); + expect(url).toBe(true); }); it('should edit a development', async() => { diff --git a/e2e/paths/06-claim-module/03_detail.spec.js b/e2e/paths/06-claim-module/03_detail.spec.js index 71b09e29b..cf758919e 100644 --- a/e2e/paths/06-claim-module/03_detail.spec.js +++ b/e2e/paths/06-claim-module/03_detail.spec.js @@ -56,10 +56,9 @@ xdescribe('Claim detail', () => { await page.loginAndModule('salesAssistant', 'claim'); await page.accessToSearchResult('1'); await page.accessToSection('claim.card.detail'); - await page.waitForURL('/detail'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/detail'); - expect(url.hash).toContain('/detail'); + expect(url).toBe(true); }); it('should edit de second item claimed discount', async() => { @@ -100,10 +99,9 @@ xdescribe('Claim detail', () => { }); it(`should have been redirected to the next section in claims`, async() => { - await page.waitForURL('/development'); - const url = await page.parsedUrl(); + let url = await page.expectURL('development'); - expect(url.hash).toContain('development'); + expect(url).toBe(true); }); it('should navigate back to claim.detail to confirm the claim contains now two items', async() => { diff --git a/e2e/paths/06-claim-module/05_summary.spec.js b/e2e/paths/06-claim-module/05_summary.spec.js index 71f8b7252..a9d97533c 100644 --- a/e2e/paths/06-claim-module/05_summary.spec.js +++ b/e2e/paths/06-claim-module/05_summary.spec.js @@ -18,10 +18,9 @@ describe('claim Summary path', () => { it('should navigate to the target claim summary section', async() => { await page.loginAndModule('employee', 'claim'); await page.accessToSearchResult(claimId); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it(`should display details from the claim and it's client on the top of the header`, async() => { diff --git a/e2e/paths/06-claim-module/06_descriptor.spec.js b/e2e/paths/06-claim-module/06_descriptor.spec.js index 83dbec5fd..8e6b3fd05 100644 --- a/e2e/paths/06-claim-module/06_descriptor.spec.js +++ b/e2e/paths/06-claim-module/06_descriptor.spec.js @@ -18,10 +18,9 @@ describe('claim Descriptor path', () => { it('should now navigate to the target claim summary section', async() => { await page.loginAndModule('employee', 'claim'); await page.accessToSearchResult(claimId); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it(`should not be able to see the delete claim button of the descriptor more menu`, async() => { @@ -33,10 +32,9 @@ describe('claim Descriptor path', () => { it(`should log in as salesAssistant and navigate to the target claim`, async() => { await page.loginAndModule('salesAssistant', 'claim'); await page.accessToSearchResult(claimId); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it(`should be able to see the delete claim button of the descriptor more menu`, async() => { @@ -53,10 +51,9 @@ describe('claim Descriptor path', () => { }); it(`should have been relocated to the claim index`, async() => { - await page.waitForURL('/claim/index'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/claim/index'); - expect(url.hash).toContain('/claim/index'); + expect(url).toBe(true); }); it(`should search for the deleted claim to find no results`, async() => { diff --git a/e2e/paths/07-order-module/01_edit_basic_data.spec.js b/e2e/paths/07-order-module/01_edit_basic_data.spec.js index e4c20cbe2..2cbee95f7 100644 --- a/e2e/paths/07-order-module/01_edit_basic_data.spec.js +++ b/e2e/paths/07-order-module/01_edit_basic_data.spec.js @@ -41,10 +41,9 @@ describe('Order edit basic data path', () => { await page.accessToSection('order.card.basicData'); await page.waitForContentLoaded(); await page.waitForSelector(selectors.orderBasicData.observation, {visible: true}); - await page.waitForURL('basic-data'); - const url = await page.parsedUrl(); + let url = await page.expectURL(`#!/order/${orderId}/basic-data`); - expect(url.hash).toEqual(`#!/order/${orderId}/basic-data`); + expect(url).toBe(true); }); it('should not be able to change anything', async() => { @@ -63,10 +62,9 @@ describe('Order edit basic data path', () => { await page.waitToClick(selectors.orderBasicData.acceptButton); await page.waitForContentLoaded(); await page.waitToClick(selectors.ordersIndex.createOrderButton); - await page.waitForURL('#!/order/create'); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/order/create'); - expect(url.hash).toContain('#!/order/create'); + expect(url).toBe(true); }); it('should now create a new one', async() => { @@ -74,18 +72,16 @@ describe('Order edit basic data path', () => { await page.datePicker(selectors.createOrderView.landedDatePicker, 0, today); await page.autocompleteSearch(selectors.createOrderView.agency, 'Other agency'); await page.waitToClick(selectors.createOrderView.createButton); - await page.waitForURL('/catalog'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/catalog'); - expect(url.hash).toContain('/catalog'); + expect(url).toBe(true); }); it('should navigate to the basic data section of the new order', async() => { await page.accessToSection('order.card.basicData'); - await page.wait(selectors.orderBasicData.observation); - const url = await page.parsedUrl(); + let url = await page.expectURL('/basic-data'); - expect(url.hash).toContain('/basic-data'); + expect(url).toBe(true); }); it('should be able to modify all the properties', async() => { diff --git a/e2e/paths/07-order-module/02_catalog.spec.js b/e2e/paths/07-order-module/02_catalog.spec.js index cbd8585b0..d67dd3c92 100644 --- a/e2e/paths/07-order-module/02_catalog.spec.js +++ b/e2e/paths/07-order-module/02_catalog.spec.js @@ -17,10 +17,9 @@ describe('Order catalog', () => { it('should open the create new order form', async() => { await page.waitToClick(selectors.ordersIndex.createOrderButton); - await page.waitForURL('order/create'); - const url = await page.parsedUrl(); + let url = await page.expectURL('order/create'); - expect(url.hash).toContain('order/create'); + expect(url).toBe(true); }); it('should create a new order', async() => { @@ -30,16 +29,15 @@ describe('Order catalog', () => { await page.datePicker(selectors.createOrderView.landedDatePicker, 0, today); await page.autocompleteSearch(selectors.createOrderView.agency, 'Other agency'); await page.waitToClick(selectors.createOrderView.createButton); - await page.waitForURL('/catalog'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/catalog'); - - expect(url.hash).toContain('/catalog'); + expect(url).toBe(true); }); it('should add the realm and type filters and obtain results', async() => { await page.waitForContentLoaded(); await page.waitToClick(selectors.orderCatalog.plantRealmButton); + await page.waitForContentLoaded(); await page.autocompleteSearch(selectors.orderCatalog.type, 'Anthurium'); await page.waitForNumberOfElements('section.product', 4); const result = await page.countElement('section.product'); @@ -70,6 +68,7 @@ describe('Order catalog', () => { it('should remove the tag filters and have 4 results', async() => { await page.waitForContentLoaded(); await page.waitToClick(selectors.orderCatalog.fourthFilterRemoveButton); + await page.waitForContentLoaded(); await page.waitToClick(selectors.orderCatalog.thirdFilterRemoveButton); await page.waitForNumberOfElements('.product', 4); const result = await page.countElement('section.product'); diff --git a/e2e/paths/07-order-module/03_lines.spec.js b/e2e/paths/07-order-module/03_lines.spec.js index 99c8a221b..21fceac44 100644 --- a/e2e/paths/07-order-module/03_lines.spec.js +++ b/e2e/paths/07-order-module/03_lines.spec.js @@ -40,10 +40,11 @@ describe('Order lines', () => { it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => { await page.waitToClick(selectors.orderLine.confirmOrder); - await page.waitForURL('ticket/index'); - const url = await page.parsedUrl(); - expect(url.hash).toContain('ticket/index'); - expect(url.hash).toContain('clientFk'); + let hashPartOne = await page.expectURL('ticket/index'); + let hashPartTwo = await page.expectURL('clientFk'); + + expect(hashPartOne).toBe(true); + expect(hashPartTwo).toBe(true); }); }); diff --git a/e2e/paths/08-route-module/01_create.spec.js b/e2e/paths/08-route-module/01_create.spec.js index 656cc0bc3..14d5273b3 100644 --- a/e2e/paths/08-route-module/01_create.spec.js +++ b/e2e/paths/08-route-module/01_create.spec.js @@ -19,10 +19,9 @@ describe('Route create path', () => { it('should click on the add new route button and open the creation form', async() => { await page.waitForContentLoaded(); await page.waitToClick(selectors.routeIndex.addNewRouteButton); - await page.wait(selectors.createRouteView.worker); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/route/create'); - expect(url.hash).toEqual('#!/route/create'); + expect(url).toBe(true); }); it(`should attempt to create a new route but fail since employee has no access rights`, async() => { @@ -43,10 +42,9 @@ describe('Route create path', () => { it('should again click on the add new route button and open the creation form', async() => { await page.waitToClick(selectors.routeIndex.addNewRouteButton); - await page.wait(selectors.createRouteView.worker); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/route/create'); - expect(url.hash).toEqual('#!/route/create'); + expect(url).toBe(true); }); it(`should create a new route`, async() => { @@ -62,10 +60,9 @@ describe('Route create path', () => { }); it(`should confirm the redirection to the created route summary`, async() => { - await page.wait(selectors.routeSummary.routeId); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); }); }); diff --git a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js b/e2e/paths/09-invoice-out-module/01_descriptor.spec.js index f26eaa47a..a51ae9d8f 100644 --- a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js +++ b/e2e/paths/09-invoice-out-module/01_descriptor.spec.js @@ -31,10 +31,9 @@ describe('InvoiceOut descriptor path', () => { await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); await page.wait(selectors.invoiceOutIndex.topbarSearch); - await page.waitForURL('#!/invoice-out/index'); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/invoice-out/index'); - expect(url.hash).toEqual('#!/invoice-out/index'); + expect(url).toBe(true); }); it('should search for the target invoiceOut', async() => { @@ -49,10 +48,9 @@ describe('InvoiceOut descriptor path', () => { it(`should click on the search result to access to the invoiceOut summary`, async() => { await page.accessToSearchResult('T2222222'); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it('should delete the invoiceOut using the descriptor more menu', async() => { @@ -65,9 +63,9 @@ describe('InvoiceOut descriptor path', () => { }); it('should have been relocated to the invoiceOut index', async() => { - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/invoice-out/index'); - expect(url.hash).toEqual('#!/invoice-out/index'); + expect(url).toBe(true); }); it(`should search for the deleted invouceOut to find no results`, async() => { @@ -83,10 +81,9 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.ticketsButton); - await page.wait(selectors.ticketsIndex.topbarSearch); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/ticket/index'); - expect(url.hash).toEqual('#!/ticket/index'); + expect(url).toBe(true); }); it('should search for tickets with an specific invoiceOut to find no results', async() => { @@ -105,19 +102,17 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); - await page.wait(selectors.invoiceOutIndex.topbarSearch); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/invoice-out/index'); - expect(url.hash).toEqual('#!/invoice-out/index'); + expect(url).toBe(true); }); it(`should search and access to the invoiceOut summary`, async() => { await page.waitForContentLoaded(); await page.accessToSearchResult('T1111111'); - await page.waitForURL('/summary'); - const url = await page.parsedUrl(); + let url = await page.expectURL('/summary'); - expect(url.hash).toContain('/summary'); + expect(url).toBe(true); }); it(`should check the invoiceOut is booked in the summary data`, async() => { @@ -147,6 +142,7 @@ describe('InvoiceOut descriptor path', () => { let expectedDate = `${day}/${month}/${today.getFullYear()}`; + await page.waitForContentLoaded(); const result = await page .waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText'); diff --git a/e2e/smokes/01_client_path.spec.js b/e2e/smokes/01_client_path.spec.js index 4ac4d331d..6c106b2eb 100644 --- a/e2e/smokes/01_client_path.spec.js +++ b/e2e/smokes/01_client_path.spec.js @@ -16,18 +16,16 @@ describe('create client path', () => { it('should access to the create client view by clicking the create-client floating button', async() => { await page.waitToClick(selectors.clientsIndex.createClientButton); - await page.wait(selectors.createClientView.createButton); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/client/create'); - expect(url.hash).toEqual('#!/client/create'); + expect(url).toBe(true); }); it('should cancel the client creation to go back to clients index', async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.waitToClick(selectors.globalItems.clientsButton); - await page.wait(selectors.clientsIndex.createClientButton); - const url = await page.parsedUrl(); + let url = await page.expectURL('#!/client/index'); - expect(url.hash).toEqual('#!/client/index'); + expect(url).toBe(true); }); }); From bee814f6a637251dbfc98a30cc5e408628e3afd8 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 5 Feb 2020 08:23:23 +0100 Subject: [PATCH 10/95] #2069 bug-fix ticket scope days --- modules/ticket/front/index/index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index 9cf1c5483..41ebe655b 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -51,14 +51,13 @@ export default class Controller { onSearch(params) { if (params) { - let newParams = params; - if (params.scopeDays) { - const scopeDates = this.getScopeDates(params.scopeDays); - Object.assign(newParams, scopeDates); - } else if (Object.entries(params).length == 0) - newParams = this.getScopeDates(1); + if (typeof(params.scopeDays) === 'number') + Object.assign(params, this.getScopeDates(params.scopeDays)); + // Set default params to 0 scope days + else if (Object.entries(params).length == 0) + params = this.getScopeDates(1); - this.$.model.applyFilter(null, newParams); + this.$.model.applyFilter(null, params); } else this.$.model.clear(); } From 218ed38b5413dd147fbc7c3a9d1acbc58842c946 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 5 Feb 2020 08:24:29 +0100 Subject: [PATCH 11/95] changed comment --- modules/ticket/front/index/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index 41ebe655b..05dc23c08 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -53,7 +53,7 @@ export default class Controller { if (params) { if (typeof(params.scopeDays) === 'number') Object.assign(params, this.getScopeDates(params.scopeDays)); - // Set default params to 0 scope days + // Set default params to 1 scope days else if (Object.entries(params).length == 0) params = this.getScopeDates(1); From 9546c4c01644383b38d88fe98fce4d64237a7801 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 5 Feb 2020 08:43:46 +0100 Subject: [PATCH 12/95] #1909 fusionar waitForURL y parsedUrl --- e2e/helpers/puppeteer.js | 8 +------- e2e/helpers/selectors.js | 2 +- e2e/paths/02-client-module/03_edit_fiscal_data.spec.js | 4 ++-- e2e/paths/02-client-module/04_edit_billing_data.spec.js | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index b21aac9b2..def1a3a83 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -4,7 +4,7 @@ import {extendPage} from './extensions'; import {url as defaultURL} from './config'; export async function getBrowser() { - let headless = true; + let headless = false; const browser = await Puppeteer.launch({ args: [ '--no-sandbox', @@ -17,12 +17,6 @@ export async function getBrowser() { let page = (await browser.pages())[0]; page = extendPage(page); page.setDefaultTimeout(5000); - // if (headless) { - // await page.setExtraHTTPHeaders({ - // 'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8' - // }); - // } - // await page.setCacheEnabled(false); await page.goto(defaultURL, {waitUntil: 'networkidle0'}); return {page, close: browser.close.bind(browser)}; } diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 270005e7e..03225f8d8 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -59,7 +59,7 @@ export default { fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]', socialName: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.socialName"]', fiscalId: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.fi"]', - equalizationTax: 'vn-client-fiscal-data vn-check[ng-model="$ctrl.client.isEqualizated"]', + equalizationTaxCheckbox: 'vn-client-fiscal-data vn-check[ng-model="$ctrl.client.isEqualizated"]', acceptPropagationButton: '.vn-confirm.shown button[response=accept]', address: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.street"]', postcode: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.postcode"]', diff --git a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js index 0dc78d098..d39f196cb 100644 --- a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js @@ -76,7 +76,7 @@ describe('Client Edit fiscalData path', () => { await page.waitToClick(selectors.clientFiscalData.viesCheckbox); await page.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox); await page.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox); - await page.waitToClick(selectors.clientFiscalData.equalizationTax); + await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox); await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox); await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton); @@ -247,7 +247,7 @@ describe('Client Edit fiscalData path', () => { }); it('should confirm Equalization tax checkbox is unchecked', async() => { - const result = await page.checkboxState(selectors.clientFiscalData.equalizationTax); + const result = await page.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox); expect(result).toBe('unchecked'); }); diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js index b757940be..5ee308f7e 100644 --- a/e2e/paths/02-client-module/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client-module/04_edit_billing_data.spec.js @@ -60,7 +60,7 @@ describe('Client Edit billing data path', () => { }); it(`should save the form with all its new data`, async() => { - await page.waitFor(3000); + // await page.waitFor(3000); await page.waitForWatcherData(selectors.clientBillingData.watcher); await page.waitToClick(selectors.clientBillingData.saveButton); let snackbarMessage = await page.waitForLastSnackbar(); From 2484c83b3272407297fac47a68de7b0120f27fa6 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 5 Feb 2020 09:01:00 +0100 Subject: [PATCH 13/95] headless mode enables --- e2e/helpers/puppeteer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index def1a3a83..4bb755743 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -4,7 +4,7 @@ import {extendPage} from './extensions'; import {url as defaultURL} from './config'; export async function getBrowser() { - let headless = false; + let headless = true; const browser = await Puppeteer.launch({ args: [ '--no-sandbox', From dc515531c687b8edb5e49190435eca9b6d14b916 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 5 Feb 2020 09:08:55 +0100 Subject: [PATCH 14/95] gulp task arg enabled --- e2e/helpers/puppeteer.js | 2 +- gulpfile.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index 4bb755743..351a26669 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -4,7 +4,7 @@ import {extendPage} from './extensions'; import {url as defaultURL} from './config'; export async function getBrowser() { - let headless = true; + let headless = !process.env.E2E_SHOW; const browser = await Puppeteer.launch({ args: [ '--no-sandbox', diff --git a/gulpfile.js b/gulpfile.js index 7864290e4..853fcf2d4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -161,6 +161,9 @@ function e2eSingleRun() { const jasmine = require('gulp-jasmine'); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; + if (argv.show || argv.s) + process.env.E2E_SHOW = true; + const specFiles = [ `${__dirname}/e2e/paths/01*/*[sS]pec.js`, `${__dirname}/e2e/paths/02*/*[sS]pec.js`, @@ -557,6 +560,7 @@ module.exports = { backTest, backTestDocker, e2e, + e2eSingleRun, smokes, smokesOnly, i, @@ -573,5 +577,4 @@ module.exports = { dockerStart, dockerWait, backendStatus, - e2eSingleRun }; From 76fc5a3311bb93ff1c6c3adaf77c43e56817cd88 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 5 Feb 2020 12:44:14 +0100 Subject: [PATCH 15/95] #1944 ticket.summary --- .../route/front/descriptor-popover/index.html | 12 ++ .../route/front/descriptor-popover/index.js | 130 ++++++++++++++++++ .../route/front/descriptor-popover/style.scss | 9 ++ modules/route/front/index.js | 1 + modules/ticket/front/routes.json | 2 +- modules/ticket/front/summary/index.html | 11 +- modules/ticket/front/summary/index.js | 15 ++ 7 files changed, 176 insertions(+), 4 deletions(-) create mode 100644 modules/route/front/descriptor-popover/index.html create mode 100644 modules/route/front/descriptor-popover/index.js create mode 100644 modules/route/front/descriptor-popover/style.scss diff --git a/modules/route/front/descriptor-popover/index.html b/modules/route/front/descriptor-popover/index.html new file mode 100644 index 000000000..a0295c138 --- /dev/null +++ b/modules/route/front/descriptor-popover/index.html @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/modules/route/front/descriptor-popover/index.js b/modules/route/front/descriptor-popover/index.js new file mode 100644 index 000000000..2458a94ac --- /dev/null +++ b/modules/route/front/descriptor-popover/index.js @@ -0,0 +1,130 @@ +import ngModule from '../module'; +import Component from 'core/lib/component'; +import './style.scss'; + +class Controller extends Component { + constructor($element, $scope, $http, $timeout, $q) { + super($element, $scope); + this.$timeout = $timeout; + this.$http = $http; + this.$q = $q; + this.route = null; + this._quicklinks = {}; + } + + set routeFk(id) { + if (id == this._routeFk) return; + + this._routeFk = id; + this.route = null; + this.getCard(); + } + + get routeFk() { + return this._routeFk; + } + + set route(value) { + this._route = value; + this.$timeout(() => this.$.popover.relocate()); + } + + get route() { + return this._route; + } + + get quicklinks() { + return this._quicklinks; + } + + set quicklinks(value = {}) { + Object.keys(value).forEach(key => { + this._quicklinks[key] = value[key]; + }); + } + + show() { + this.$.popover.parent = this.parent; + this.$.popover.show(); + } + + getCard() { + if (this.canceler) + this.canceler.resolve(); + + this.canceler = this.$q.defer(); + + let query = `Routes/findOne`; + + let filter = { + fields: [ + 'id', + 'workerFk', + 'agencyModeFk', + 'created', + 'm3', + 'warehouseFk', + 'description', + 'vehicleFk', + 'kmStart', + 'kmEnd', + 'started', + 'finished', + 'cost', + 'zoneFk' + ], + include: [ + { + relation: 'agencyMode', + scope: { + fields: ['id', 'name'] + } + }, { + relation: 'vehicle', + scope: { + fields: ['id', 'm3'] + } + }, { + relation: 'zone', + scope: { + fields: ['id', 'name'] + } + }, + { + relation: 'worker', + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['id'], + include: { + relation: 'emailUser', + scope: { + fields: ['email'] + } + } + } + } + } + } + ] + }; + this.$http.get(query, {params: {filter}}).then(res => { + this.route = res.data; + this.$.$applyAsync(() => { + this.$.popover.relocate(); + }); + }); + } +} +Controller.$inject = ['$element', '$scope', '$http', '$timeout', '$q']; + +ngModule.component('vnRouteDescriptorPopover', { + template: require('./index.html'), + controller: Controller, + bindings: { + routeFk: '<', + quicklinks: '<' + } +}); diff --git a/modules/route/front/descriptor-popover/style.scss b/modules/route/front/descriptor-popover/style.scss new file mode 100644 index 000000000..0c84ff2fe --- /dev/null +++ b/modules/route/front/descriptor-popover/style.scss @@ -0,0 +1,9 @@ +vn-route-descriptor-popover { + vn-route-descriptor { + display: block; + width: 16em; + & > vn-card{ + margin: 0!important; + } + } +} diff --git a/modules/route/front/index.js b/modules/route/front/index.js index ce8e80e95..7c2a17483 100644 --- a/modules/route/front/index.js +++ b/modules/route/front/index.js @@ -4,6 +4,7 @@ import './main'; import './index/'; import './search-panel'; import './descriptor'; +import './descriptor-popover'; import './summary'; import './card'; import './create'; diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index be142a2ac..af0683ee1 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -3,7 +3,7 @@ "name": "Tickets", "icon": "icon-ticket", "validations": true, - "dependencies": ["worker", "item", "client"], + "dependencies": ["worker", "item", "client", "route"], "menus": { "main": [ {"state": "ticket.index", "icon": "icon-ticket"}, diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 7bbff4f28..decb01023 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -42,9 +42,11 @@ value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy'}}"> - + {{$ctrl.summary.routeFk}} - + @@ -199,7 +201,6 @@ - + + diff --git a/modules/ticket/front/summary/index.js b/modules/ticket/front/summary/index.js index 0cfa5614f..010110340 100644 --- a/modules/ticket/front/summary/index.js +++ b/modules/ticket/front/summary/index.js @@ -36,6 +36,21 @@ class Controller { }); } + showRouteDescriptor(event) { + this.routeQuicklinks = { + btnThree: { + icon: 'icon-delivery', + state: `route.card.summary({ + id: ${this.summary.routeFk}, + })`, + tooltip: 'Route summary' + } + }; + this.$scope.routeDescriptor.routeFk = this.summary.routeFk; + this.$scope.routeDescriptor.parent = event.target; + this.$scope.routeDescriptor.show(); + } + showDescriptor(event, itemFk) { this.quicklinks = { btnThree: { From 06c3580bc4f1533346f98ad0f47334a72553e7ce Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 5 Feb 2020 13:37:36 +0100 Subject: [PATCH 16/95] #1944 ticket.summary --- .../route/front/descriptor-popover/index.js | 2 +- .../front/descriptor-popover/index.spec.js | 77 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 modules/route/front/descriptor-popover/index.spec.js diff --git a/modules/route/front/descriptor-popover/index.js b/modules/route/front/descriptor-popover/index.js index 2458a94ac..7d5cd3d91 100644 --- a/modules/route/front/descriptor-popover/index.js +++ b/modules/route/front/descriptor-popover/index.js @@ -54,7 +54,7 @@ class Controller extends Component { this.canceler = this.$q.defer(); - let query = `Routes/findOne`; + let query = 'Routes/findOne'; let filter = { fields: [ diff --git a/modules/route/front/descriptor-popover/index.spec.js b/modules/route/front/descriptor-popover/index.spec.js new file mode 100644 index 000000000..d8e21c730 --- /dev/null +++ b/modules/route/front/descriptor-popover/index.spec.js @@ -0,0 +1,77 @@ +import './index'; + +describe('vnRouteDescriptorPopover', () => { + let $httpBackend; + let $scope; + let controller; + let $element; + let $timeout; + + beforeEach(ngModule('route')); + + beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$timeout_) => { + $httpBackend = _$httpBackend_; + $timeout = _$timeout_; + $element = angular.element(`
`); + $scope = $rootScope.$new(); + $scope.popover = {relocate: () => {}, show: () => {}}; + controller = $componentController('vnRouteDescriptorPopover', {$scope, $element}); + })); + + describe('routeFk()', () => { + it(`should do nothing if the received id isn't a new one`, () => { + controller.route = 'I exist!'; + controller._routeFk = 1; + spyOn(controller, 'getCard'); + controller.routeFk = 1; + + expect(controller.route).toEqual('I exist!'); + expect(controller._routeFk).toEqual(1); + expect(controller.getCard).not.toHaveBeenCalled(); + }); + + it(`should set the received id, set the route null and then call getCard()`, () => { + controller.route = `Please don't`; + controller._routeFk = 1; + spyOn(controller, 'getCard'); + controller.routeFk = 999; + + expect(controller.route).toBeNull(); + expect(controller._routeFk).toEqual(999); + expect(controller.getCard).toHaveBeenCalledWith(); + }); + }); + + describe('route()', () => { + it(`should save the client on the controller and then call relocate()`, () => { + spyOn(controller.$.popover, 'relocate'); + let route = `i'm the route!`; + controller.route = route; + $timeout.flush(); + + expect(controller.route).toEqual(route); + expect(controller.$.popover.relocate).toHaveBeenCalledWith(); + }); + }); + + describe('show()', () => { + it(`should call the popover show() mothod`, () => { + spyOn(controller.$.popover, 'show'); + controller.show(); + + expect(controller.$.popover.show).toHaveBeenCalledWith(); + }); + }); + + describe('getCard()', () => { + it(`should perform a get query to store the client data into the controller`, () => { + let response = {the: 'route'}; + + $httpBackend.whenRoute('GET', 'Routes/findOne').respond(response); + controller.routeFk = 1; + $httpBackend.flush(); + + expect(controller.route).toEqual(response); + }); + }); +}); From deb6d8e730d8b8cdc5a84ded03a2ebfca78d4a76 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 5 Feb 2020 14:14:02 +0100 Subject: [PATCH 17/95] #1944 ticket.summary e2e selector updated --- e2e/helpers/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 03225f8d8..0399f7b17 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -314,7 +314,7 @@ export default { ticketSummary: { header: 'vn-ticket-summary > vn-card > h5', state: 'vn-ticket-summary vn-label-value[label="State"] > section > span', - route: 'vn-ticket-summary vn-label-value[label="Route"] > section > span > a', + route: 'vn-ticket-summary vn-label-value[label="Route"] > section > span > span', total: 'vn-ticket-summary vn-one.taxes > p:nth-child(3) > strong', sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr', firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span', From 8193b0ffc0b68622c1e989cd8cdc3106fd497d01 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Thu, 6 Feb 2020 07:37:41 +0100 Subject: [PATCH 18/95] update ticket.filter --- modules/ticket/back/methods/ticket/filter.js | 36 +++++++++++++++++++ .../back/methods/ticket/specs/filter.spec.js | 27 ++++++++++++++ modules/ticket/front/search-panel/index.html | 20 +++++++---- 3 files changed, 77 insertions(+), 6 deletions(-) diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index a3c17ecc4..5fea43fbd 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -63,6 +63,10 @@ module.exports = Self => { arg: 'myTeam', type: 'Boolean', description: `Whether to show only tickets for the current logged user team (For now it shows only the current user tickets)` + }, { + arg: 'problems', + type: 'Boolean', + description: `Whether to show only tickets with problems` }, { arg: 'mine', type: 'Boolean', @@ -239,6 +243,38 @@ module.exports = Self => { FROM tmp.filter f LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = f.id LEFT JOIN tmp.ticketTotal tt ON tt.ticketFk = f.id`); + + + let condition; + let hasProblem; + let range; + let hasWhere; + switch (ctx.args.problems) { + case true: + condition = `or`; + hasProblem = true; + range = 0; + hasWhere = true; + break; + + case false: + condition = `and`; + hasProblem = null; + range = null; + hasWhere = true; + break; + } + + let problems = {[condition]: [ + {'tp.isFreezed': hasProblem}, + {'tp.risk': hasProblem}, + {'tp.hasTicketRequest': hasProblem}, + {'tp.isAvailable': range} + ]}; + + if (hasWhere) + stmt.merge(conn.makeWhere(problems)); + stmt.merge(conn.makeOrderBy(filter.order)); let ticketsIndex = stmts.push(stmt); diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index 357ef2bdb..7e5e1c126 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -10,4 +10,31 @@ describe('ticket filter()', () => { expect(ticketId).toEqual(24); }); + + it('should return the tickets matching the problems on true', async() => { + let ctx = {req: {accessToken: {userId: 9}}, args: {problems: true}}; + + let filter = {}; + let result = await app.models.Ticket.filter(ctx, filter); + + expect(result.length).toEqual(4); + }); + + it('should return the tickets matching the problems on false', async() => { + let ctx = {req: {accessToken: {userId: 9}}, args: {problems: false}}; + + let filter = {}; + let result = await app.models.Ticket.filter(ctx, filter); + + expect(result.length).toEqual(20); + }); + + it('should return the tickets matching the problems on null', async() => { + let ctx = {req: {accessToken: {userId: 9}}, args: {problems: null}}; + + let filter = {}; + let result = await app.models.Ticket.filter(ctx, filter); + + expect(result.length).toEqual(24); + }); }); diff --git a/modules/ticket/front/search-panel/index.html b/modules/ticket/front/search-panel/index.html index 27b8cbe99..ae5e152c6 100644 --- a/modules/ticket/front/search-panel/index.html +++ b/modules/ticket/front/search-panel/index.html @@ -91,12 +91,6 @@ - - + + + + + + From 610c21f23d06e7cab10496b9697d9f4907159da3 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 6 Feb 2020 07:39:00 +0100 Subject: [PATCH 19/95] corrected a typo --- modules/route/front/descriptor-popover/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/route/front/descriptor-popover/index.spec.js b/modules/route/front/descriptor-popover/index.spec.js index d8e21c730..be33d366d 100644 --- a/modules/route/front/descriptor-popover/index.spec.js +++ b/modules/route/front/descriptor-popover/index.spec.js @@ -55,7 +55,7 @@ describe('vnRouteDescriptorPopover', () => { }); describe('show()', () => { - it(`should call the popover show() mothod`, () => { + it(`should call the popover show() method`, () => { spyOn(controller.$.popover, 'show'); controller.show(); From e3b1a4b58aad9e834b90237edf4eff2444db2f9e Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 6 Feb 2020 07:41:51 +0100 Subject: [PATCH 20/95] 2076 - Item tags refactor --- front/core/components/button/index.js | 3 + .../core/components/crud-model/crud-model.js | 56 +++++++++++++------ loopback/common/models/vn-model.js | 19 +++++-- modules/item/front/tags/index.html | 18 +++--- 4 files changed, 63 insertions(+), 33 deletions(-) diff --git a/front/core/components/button/index.js b/front/core/components/button/index.js index 17710967a..96d68c23b 100644 --- a/front/core/components/button/index.js +++ b/front/core/components/button/index.js @@ -9,6 +9,7 @@ export default class Button extends FormInput { this.initTabIndex(); this.element.addEventListener('keyup', e => this.onKeyup(e)); this.element.addEventListener('click', e => this.onClick(e)); + this.button = this.element.querySelector('button'); } $onInit() { @@ -21,6 +22,8 @@ export default class Button extends FormInput { switch (event.key) { case ' ': case 'Enter': + if (this.button) + return this.button.click(); return this.element.click(); } } diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 9a260a690..563444ddf 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -128,31 +128,37 @@ export default class CrudModel extends ModelProxy { } /** - * Returns an object with the unsaved changes made to the model. + * Saves current changes on the server. * - * @return {Object} The current changes + * @return {Promise} The save request promise */ - getChanges() { + save() { if (!this.isChanged) return null; let deletes = []; let updates = []; let creates = []; + let orgDeletes = []; + let orgUpdates = []; + let orgCreates = []; let pk = this.primaryKey; - for (let row of this.removed) + for (let row of this.removed) { deletes.push(row.$orgRow[pk]); + orgDeletes.push(row); + } - for (let row of this._data) { + for (let row of this.data) { if (row.$isNew) { let data = {}; for (let prop in row) { if (prop.charAt(0) !== '$') data[prop] = row[prop]; } - creates.push(data); + creates.push(row); + orgCreates.push(row); } else if (row.$oldData) { let data = {}; for (let prop in row.$oldData) @@ -161,6 +167,7 @@ export default class CrudModel extends ModelProxy { data, where: {[pk]: row.$orgRow[pk]} }); + orgUpdates.push(row); } } @@ -171,23 +178,36 @@ export default class CrudModel extends ModelProxy { changes[prop] = undefined; } - return changes; - } - - /** - * Saves current changes on the server. - * - * @return {Promise} The save request promise - */ - save() { - let changes = this.getChanges(); - if (!changes) return this.$q.resolve(); let url = this.saveUrl ? this.saveUrl : `${this._url}/crud`; return this.$http.post(url, changes) - .then(() => { + .then(res => { + const newData = res.data; + const created = newData.created; + const updated = newData.updated; + + // Apply new data to created instances + for (let i = 0; i < orgCreates.length; i++) { + const row = orgCreates[i]; + row[pk] = created[i][pk]; + + for (let prop in row) { + if (prop.charAt(0) !== '$') + row[prop] = created[i][prop]; + } + } + + // Apply new data to updated instances + for (let i = 0; i < orgUpdates.length; i++) { + const row = orgUpdates[i]; + for (let prop in row) { + if (prop.charAt(0) !== '$') + row[prop] = updated[i][prop]; + } + } + this.applyChanges(); super.save(); }); diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js index c6f535b7a..d535606e0 100644 --- a/loopback/common/models/vn-model.js +++ b/loopback/common/models/vn-model.js @@ -50,7 +50,11 @@ module.exports = function(Self) { description: `Instances to create`, type: ['Object'] } - ] + ], + returns: { + type: ['object'], + root: true + } }); }, @@ -60,27 +64,34 @@ module.exports = function(Self) { try { let options = {transaction: tx}; + let deleted; if (deletes) { let promises = []; for (let id of deletes) promises.push(this.destroyById(id, options)); - await Promise.all(promises); + deleted = await Promise.all(promises); } + + let updated; if (updates) { let promises = []; for (let update of updates) promises.push(this.upsertWithWhere(update.where, update.data, options)); - await Promise.all(promises); + updated = await Promise.all(promises); } + + let created; if (creates && creates.length) { try { - await this.create(creates, options); + created = await this.create(creates, options); } catch (error) { throw error[error.length - 1]; } } await tx.commit(); + + return {deleted, created, updated}; } catch (error) { await tx.rollback(); throw error; diff --git a/modules/item/front/tags/index.html b/modules/item/front/tags/index.html index b7b61107d..834d4c977 100644 --- a/modules/item/front/tags/index.html +++ b/modules/item/front/tags/index.html @@ -22,16 +22,14 @@
- + rule> - + value-field="{{$ctrl.sourceTables[itemTag.id].field}}" + rule> - - + Date: Thu, 6 Feb 2020 09:33:36 +0100 Subject: [PATCH 21/95] refactor table holidayType and holidayDetail --- modules/worker/back/methods/holiday/getByWarehouse.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/worker/back/methods/holiday/getByWarehouse.js b/modules/worker/back/methods/holiday/getByWarehouse.js index a56b5166e..8a7fd8be3 100644 --- a/modules/worker/back/methods/holiday/getByWarehouse.js +++ b/modules/worker/back/methods/holiday/getByWarehouse.js @@ -23,11 +23,11 @@ module.exports = Self => { beginningYear.setHours(0, 0, 0, 0); let holidays = await Self.rawSql( - `SELECT lh.dated, lhl.description, lht.name, w.id + `SELECT lh.dated, chn.name, cht.name, w.id FROM vn.holiday lh JOIN vn.workCenter w ON w.id = lh.workcenterFk - LEFT JOIN vn.holidayDetail lhl ON lhl.id = lh.holidayDetailFk - LEFT JOIN vn.holidayType lht ON lht.id = lh.holidayTypeFk + LEFT JOIN vn.calendarHolidaysName chn ON chn.id = lh.holidayDetailFk + LEFT JOIN vn.calendarHolidaysType cht ON cht.id = lh.holidayTypeFk WHERE w.warehouseFk = ? AND lh.dated >= ?`, [warehouseFk, beginningYear]); return holidays.map(holiday => { From f53217bc716cd12169319a7c563bddf4e37d308d Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 6 Feb 2020 10:31:39 +0100 Subject: [PATCH 22/95] updated selector --- e2e/helpers/selectors.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0399f7b17..003d5830e 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -253,13 +253,13 @@ export default { fourthRemoveTagButton: 'vn-item-tags vn-horizontal:nth-child(4) vn-icon-button[icon="delete"]', fifthTag: 'vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[ng-model="itemTag.tagFk"]', fifthValue: 'vn-item-tags vn-horizontal:nth-child(5) vn-textfield[ng-model="itemTag.value"]', - fifthRelevancy: 'vn-item-tags vn-horizontal:nth-child(5) vn-textfield[ng-model="itemTag.priority"]', + fifthRelevancy: 'vn-item-tags vn-horizontal:nth-child(5) vn-input-number[ng-model="itemTag.priority"]', sixthTag: 'vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[ng-model="itemTag.tagFk"]', sixthValue: 'vn-item-tags vn-horizontal:nth-child(6) vn-textfield[ng-model="itemTag.value"]', - sixthRelevancy: 'vn-item-tags vn-horizontal:nth-child(6) vn-textfield[ng-model="itemTag.priority"]', + sixthRelevancy: 'vn-item-tags vn-horizontal:nth-child(6) vn-input-number[ng-model="itemTag.priority"]', seventhTag: 'vn-item-tags vn-horizontal:nth-child(7) > vn-autocomplete[ng-model="itemTag.tagFk"]', seventhValue: 'vn-item-tags vn-horizontal:nth-child(7) vn-textfield[ng-model="itemTag.value"]', - seventhRelevancy: 'vn-item-tags vn-horizontal:nth-child(7) vn-textfield[ng-model="itemTag.priority"]', + seventhRelevancy: 'vn-item-tags vn-horizontal:nth-child(7) vn-input-number[ng-model="itemTag.priority"]', addItemTagButton: 'vn-item-tags vn-icon-button[icon="add_circle"]', submitItemTagsButton: 'vn-item-tags button[type=submit]' }, From b77f32a733cac20ed3d1a55e01108c414edf3b4f Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 6 Feb 2020 10:43:46 +0100 Subject: [PATCH 23/95] requested changes --- front/core/components/crud-model/crud-model.js | 13 +------------ loopback/common/models/vn-model.js | 6 +----- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 563444ddf..ef5c346b9 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -184,9 +184,7 @@ export default class CrudModel extends ModelProxy { let url = this.saveUrl ? this.saveUrl : `${this._url}/crud`; return this.$http.post(url, changes) .then(res => { - const newData = res.data; - const created = newData.created; - const updated = newData.updated; + const created = res.data; // Apply new data to created instances for (let i = 0; i < orgCreates.length; i++) { @@ -199,15 +197,6 @@ export default class CrudModel extends ModelProxy { } } - // Apply new data to updated instances - for (let i = 0; i < orgUpdates.length; i++) { - const row = orgUpdates[i]; - for (let prop in row) { - if (prop.charAt(0) !== '$') - row[prop] = updated[i][prop]; - } - } - this.applyChanges(); super.save(); }); diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js index d535606e0..592392666 100644 --- a/loopback/common/models/vn-model.js +++ b/loopback/common/models/vn-model.js @@ -64,20 +64,16 @@ module.exports = function(Self) { try { let options = {transaction: tx}; - let deleted; if (deletes) { let promises = []; for (let id of deletes) promises.push(this.destroyById(id, options)); - deleted = await Promise.all(promises); } - let updated; if (updates) { let promises = []; for (let update of updates) promises.push(this.upsertWithWhere(update.where, update.data, options)); - updated = await Promise.all(promises); } let created; @@ -91,7 +87,7 @@ module.exports = function(Self) { await tx.commit(); - return {deleted, created, updated}; + return created; } catch (error) { await tx.rollback(); throw error; From bb09fc97463565b0574b89a15a1c484d50774efd Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Thu, 6 Feb 2020 11:50:32 +0100 Subject: [PATCH 24/95] update ticket.isEditable --- .../ticket/back/methods/state/isEditable.js | 3 +- .../methods/state/specs/isEditable.spec.js | 37 +++++++++++++------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/modules/ticket/back/methods/state/isEditable.js b/modules/ticket/back/methods/state/isEditable.js index 00b4f4c4f..34d86aad1 100644 --- a/modules/ticket/back/methods/state/isEditable.js +++ b/modules/ticket/back/methods/state/isEditable.js @@ -28,8 +28,7 @@ module.exports = Self => { let isAdministrative = await models.Account.hasRole(userId, 'administrative'); let state = await models.State.findById(stateId); - - let salesPersonAllowed = (isSalesPerson && state.code == 'PICKER_DESIGNED'); + let salesPersonAllowed = (isSalesPerson && (state.code == 'PICKER_DESIGNED' || state.code == 'PRINTED')); let isAllowed = isProduction || isAdministrative || salesPersonAllowed || state.alertLevel == 0; return isAllowed; diff --git a/modules/ticket/back/methods/state/specs/isEditable.spec.js b/modules/ticket/back/methods/state/specs/isEditable.spec.js index b90cc8eee..158a010dc 100644 --- a/modules/ticket/back/methods/state/specs/isEditable.spec.js +++ b/modules/ticket/back/methods/state/specs/isEditable.spec.js @@ -1,48 +1,61 @@ const app = require('vn-loopback/server/server'); describe('state isEditable()', () => { - it('should return false if the given state is not editable by a specific role', async() => { + it('should return false if the state is not editable by a specific role', async() => { const salesPersonRole = 18; const onDeliveryState = 13; let ctx = {req: {accessToken: {userId: salesPersonRole}}}; let result = await app.models.State.isEditable(ctx, onDeliveryState); - expect(result).toBeFalsy(); + expect(result).toBe(false); }); - it('should return true if the given state is editable by a specific role', async() => { + it('should return true if the state is editable by a specific role', async() => { const salesPersonRole = 18; const asignedState = 20; let ctx = {req: {accessToken: {userId: salesPersonRole}}}; let result = await app.models.State.isEditable(ctx, asignedState); - expect(result).toBeTruthy(); + expect(result).toBe(true); }); - it('should return true again if the given state is editable by a specific role', async() => { + it('should return true again if the state is editable by a specific role', async() => { const employeeRole = 1; const fixingState = 1; let ctx = {req: {accessToken: {userId: employeeRole}}}; let result = await app.models.State.isEditable(ctx, fixingState); - expect(result).toBeTruthy(); + expect(result).toBe(true); }); - it('should return false if the given state is not editable for the given role', async() => { + it('should return false if the state is not editable for the given role', async() => { const employeeRole = 1; const asignedState = 20; let ctx = {req: {accessToken: {userId: employeeRole}}}; let result = await app.models.State.isEditable(ctx, asignedState); - expect(result).toBeFalsy(); + expect(result).toBe(false); }); - it('should return true if the given state is editable for the given role', async() => { + it('should return true if the state is editable for the given role', async() => { const productionRole = 49; - const checkedState = 13; + const onDeliveryState = 13; let ctx = {req: {accessToken: {userId: productionRole}}}; - let result = await app.models.State.isEditable(ctx, checkedState); + let result = await app.models.State.isEditable(ctx, onDeliveryState); - expect(result).toBeTruthy(); + expect(result).toBe(true); + }); + + it('should return true if the ticket is editable, the role is salesPerson and the ticket state is printed', async() => { + const salesPersonRole = 18; + const printedState = 4; + const okState = 3; + const ctx = {req: {accessToken: {userId: salesPersonRole}}}; + + let canEditCurrent = await app.models.State.isEditable(ctx, printedState); + let canAsignNew = await app.models.State.isEditable(ctx, okState); + let result = canEditCurrent && canAsignNew; + + expect(result).toBe(true); }); }); From 20f9f7af24355555eeab86d1281839ae1f70df11 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 6 Feb 2020 12:46:44 +0100 Subject: [PATCH 25/95] 2084 - Keep categoryId selected on item confirmation --- loopback/locale/es.json | 3 ++- modules/order/front/catalog/index.html | 2 +- modules/order/front/catalog/index.js | 8 ++++++-- modules/order/front/catalog/index.spec.js | 19 +++++++++++++++++-- modules/order/front/prices-popover/index.js | 21 ++++++++++----------- 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d2f2882bc..90d4f8793 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -125,5 +125,6 @@ "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} (#{{clientId}})]({{{url}}}) a *{{credit}} €*", "MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} (#{{clientId}})]({{{url}}})", "MESSAGE_CLAIM_ITEM_REGULARIZE": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a {{nickname}} provenientes del ticket id [#{{ticketId}}]({{{ticketUrl}}})", - "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}" + "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" } \ No newline at end of file diff --git a/modules/order/front/catalog/index.html b/modules/order/front/catalog/index.html index 86b209e59..5cc72e3c8 100644 --- a/modules/order/front/catalog/index.html +++ b/modules/order/front/catalog/index.html @@ -29,7 +29,7 @@ ng-class="{'active': $ctrl.categoryId == category.id}" icon="{{::category.icon}}" vn-tooltip="{{::category.name}}" - ng-click="$ctrl.categoryId = category.id"> + ng-click="$ctrl.changeCategory(category.id)"> diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index a53d62089..ce684aabe 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -107,8 +107,7 @@ class Controller { } set categoryId(value) { - if (!value || (this.categoryId == value)) - value = null; + if (!value) value = null; this._categoryId = value; this.itemTypes = []; @@ -123,6 +122,11 @@ class Controller { this.updateItemTypes(); } + changeCategory(id) { + if (this._categoryId == id) id = null; + this.categoryId = id; + } + get typeId() { return this._typeId; } diff --git a/modules/order/front/catalog/index.spec.js b/modules/order/front/catalog/index.spec.js index 9f778ee41..dd9e13257 100644 --- a/modules/order/front/catalog/index.spec.js +++ b/modules/order/front/catalog/index.spec.js @@ -20,6 +20,7 @@ describe('Order', () => { $state.params.typeId = 2; $state.current.name = 'my.current.state'; controller = $componentController('vnOrderCatalog', {$scope, $state}); + controller._order = {id: 4}; })); describe('order() setter', () => { @@ -59,13 +60,28 @@ describe('Order', () => { it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => { spyOn(controller, 'updateStateParams'); - controller._order = {id: 4}; controller.categoryId = 2; expect(controller.updateStateParams).toHaveBeenCalledWith(); }); }); + describe('changeCategory()', () => { + it(`should set categoryId property to null if the new value equals to the old one`, () => { + controller.categoryId = 2; + controller.changeCategory(2); + + expect(controller.categoryId).toBeNull(); + }); + + it(`should set categoryId property`, () => { + controller.categoryId = 2; + controller.changeCategory(1); + + expect(controller.categoryId).toEqual(1); + }); + }); + describe('typeId() setter', () => { it(`should set type property to null, call updateStateParams() method and not call applyFilters()`, () => { spyOn(controller, 'updateStateParams'); @@ -132,7 +148,6 @@ describe('Order', () => { spyOn(model, 'applyFilter'); controller._categoryId = 2; controller._typeId = 4; - controller._order = {id: 4}; controller.applyFilters(); diff --git a/modules/order/front/prices-popover/index.js b/modules/order/front/prices-popover/index.js index 40590b8bb..2df8bea15 100644 --- a/modules/order/front/prices-popover/index.js +++ b/modules/order/front/prices-popover/index.js @@ -127,19 +127,18 @@ class Controller extends Component { return; } - setTimeout(() => { - let params = { - orderFk: this.order.id, - items: filledLines - }; - this.$http.post(`OrderRows/addToOrder`, params).then(res => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); - this.$.popover.hide(); + let params = { + orderFk: this.order.id, + items: filledLines + }; - if (this.card) - this.card.reload(); - }); + this.$http.post(`OrderRows/addToOrder`, params).then(res => { + this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.$.popover.hide(); + + if (this.card) + this.card.reload(); }); } } From de12911f305137803cfe065a19b4c8a78f88c70f Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 6 Feb 2020 13:00:41 +0100 Subject: [PATCH 26/95] #2030 e2e client.basicData --- e2e/helpers/extensions.js | 37 +++++++++++-------- e2e/helpers/selectors.js | 2 + .../02_edit_basic_data.spec.js | 18 +++++++++ e2e/paths/02-client-module/14_balance.spec.js | 1 - 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index fb0dd2d0c..452dd3a4d 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -191,7 +191,7 @@ let actions = { waitToClick: async function(selector) { await this.waitForSelector(selector, {}); - await this.click(selector, {waitUntil: 'domcontentloaded'}); + await this.click(selector); }, focusElement: async function(selector) { @@ -393,15 +393,17 @@ let actions = { autocompleteSearch: async function(selector, searchValue) { let builtSelector = await this.selectorFormater(selector); - try { - await this.waitToClick(builtSelector); - await this.waitForSelector(selector => { - document - .querySelector(`${selector} vn-drop-down`).$ctrl.content - .querySelectorAll('li'); - }, selector); - await this.type(`.vn-drop-down.shown`, searchValue); + await this.waitToClick(selector); + await this.waitForSelector(selector => { + document + .querySelector(`${selector} vn-drop-down`).$ctrl.content + .querySelectorAll('li'); + }, selector); + + await this.write('.vn-drop-down.vn-popover.vn-popup.shown vn-textfield', searchValue); + + try { await this.waitForFunction((selector, searchValue) => { let element = document .querySelector(`${selector} vn-drop-down`).$ctrl.content @@ -409,15 +411,18 @@ let actions = { if (element) return element.innerText.toLowerCase().includes(searchValue.toLowerCase()); }, {}, selector, searchValue); - - await this.keyboard.press('Enter'); - await this.waitForFunction((selector, searchValue) => { - return document.querySelector(selector).value.toLowerCase() - .includes(searchValue.toLowerCase()); - }, {}, builtSelector, searchValue); } catch (error) { - throw new Error(`${builtSelector} failed to autocomplete ${searchValue}! ${error}`); + let inputValue = await this.evaluate(() => { + return document.querySelector('.vn-drop-down.vn-popover.vn-popup.shown vn-textfield input').value; + }); + throw new Error(`${builtSelector} value is ${inputValue}! ${error}`); } + await this.keyboard.press('Enter'); + await this.waitForFunction((selector, searchValue) => { + return document.querySelector(selector).value.toLowerCase() + .includes(searchValue.toLowerCase()); + }, {}, builtSelector, searchValue); + await this.waitForMutation(`.vn-drop-down`, 'childList'); }, diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0399f7b17..8bda47afe 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -51,6 +51,8 @@ export default { name: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.name"]', contact: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.contact"]', email: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.email"]', + phone: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.phone"]', + mobile: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.mobile"]', salesPerson: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]', channel: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]', saveButton: 'vn-client-basic-data button[type=submit]' diff --git a/e2e/paths/02-client-module/02_edit_basic_data.spec.js b/e2e/paths/02-client-module/02_edit_basic_data.spec.js index 6be3f4baa..8b665bd96 100644 --- a/e2e/paths/02-client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client-module/02_edit_basic_data.spec.js @@ -92,6 +92,10 @@ describe('Client Edit basicData path', () => { await page.write(selectors.clientBasicData.contact, 'Black Panther'); await page.clearInput(selectors.clientBasicData.email); await page.write(selectors.clientBasicData.email, 'Storm@verdnatura.es'); + await page.clearInput(selectors.clientBasicData.phone); + await page.write(selectors.clientBasicData.phone, '333333333'); + await page.clearInput(selectors.clientBasicData.mobile); + await page.write(selectors.clientBasicData.mobile, '444444444'); await page.autocompleteSearch(selectors.clientBasicData.salesPerson, 'replenisherNick'); await page.autocompleteSearch(selectors.clientBasicData.channel, 'Metropolis newspaper'); await page.waitToClick(selectors.clientBasicData.saveButton); @@ -121,6 +125,20 @@ describe('Client Edit basicData path', () => { expect(result).toEqual('Storm@verdnatura.es'); }); + it('should now confirm the phone have been edited', async() => { + const result = await page + .waitToGetProperty(selectors.clientBasicData.phone, 'value'); + + expect(result).toEqual('333333333'); + }); + + it('should now confirm the mobile have been edited', async() => { + const result = await page + .waitToGetProperty(selectors.clientBasicData.mobile, 'value'); + + expect(result).toEqual('444444444'); + }); + it('should confirm the sales person have been selected', async() => { const result = await page .waitToGetProperty(selectors.clientBasicData.salesPerson, 'value'); diff --git a/e2e/paths/02-client-module/14_balance.spec.js b/e2e/paths/02-client-module/14_balance.spec.js index d70d11508..2e29dc04e 100644 --- a/e2e/paths/02-client-module/14_balance.spec.js +++ b/e2e/paths/02-client-module/14_balance.spec.js @@ -49,7 +49,6 @@ describe('Client balance path', () => { it('should create a new payment that clears the debt', async() => { await page.waitToClick(selectors.clientBalance.newPaymentButton); - await page.waitForContentLoaded(); await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt'); await page.waitToClick(selectors.clientBalance.saveButton); let result = await page.waitForLastSnackbar(); From 73c4e310f0063e081afeda3324f42ce407d6974a Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Thu, 6 Feb 2020 13:07:01 +0100 Subject: [PATCH 27/95] 2059 zone.index buscador avanzado --- modules/agency/back/models/agency-mode.json | 144 ++++++++++--------- modules/agency/front/search-panel/index.html | 1 + 2 files changed, 75 insertions(+), 70 deletions(-) diff --git a/modules/agency/back/models/agency-mode.json b/modules/agency/back/models/agency-mode.json index 5d6814dc8..ded58e819 100644 --- a/modules/agency/back/models/agency-mode.json +++ b/modules/agency/back/models/agency-mode.json @@ -1,73 +1,77 @@ { - "name": "AgencyMode", - "description": "Agency modes", - "base": "VnModel", - "options": { - "mysql": { - "table": "agencyMode" + "name": "AgencyMode", + "description": "Agency modes", + "base": "VnModel", + "options": { + "mysql": { + "table": "agencyMode" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": true + }, + "description": { + "type": "string" + }, + "deliveryMethodFk": { + "type": "number" + }, + "m3": { + "type": "Number" + }, + "inflation": { + "type": "Number" + }, + "reportMail": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "code": { + "type": "String", + "required": false + } + }, + "relations": { + "agency": { + "type": "belongsTo", + "model": "Agency", + "foreignKey": "agencyFk" + }, + "agencyType": { + "type": "belongsTo", + "model": "AgencyType", + "foreignKey": "agencyTypeFk" + }, + "deliveryMethod": { + "type": "belongsTo", + "model": "DeliveryMethod", + "foreignKey": "deliveryMethodFk" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ], + "scopes": { + "isActive": { + "where": { + "isActive": { + "neq": false + } + } + } } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "name": { - "type": "string", - "required": true - }, - "description": { - "type": "string" - }, - "deliveryMethodFk":{ - "type": "number" - }, - "m3": { - "type": "Number" - }, - "inflation": { - "type": "Number" - }, - "reportMail": { - "type": "string" - }, - "isActive":{ - "type": "boolean" - }, - "code": { - "type": "String", - "required": false - } - }, - "relations": { - "agency": { - "type": "belongsTo", - "model": "Agency", - "foreignKey": "agencyFk" - }, - "agencyType": { - "type": "belongsTo", - "model": "AgencyType", - "foreignKey": "agencyTypeFk" - }, - "deliveryMethod": { - "type": "belongsTo", - "model": "DeliveryMethod", - "foreignKey": "deliveryMethodFk" - } - }, - "acls": [ - { - "accessType": "READ", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - } - ], - "scopes" : { - "isActive" : { - "where": {"isActive": {"neq": false}} - } - } } \ No newline at end of file diff --git a/modules/agency/front/search-panel/index.html b/modules/agency/front/search-panel/index.html index a97428192..bda8a946e 100644 --- a/modules/agency/front/search-panel/index.html +++ b/modules/agency/front/search-panel/index.html @@ -22,6 +22,7 @@ label="Agency" ng-model="filter.agencyModeFk" url="AgencyModes/isActive" + where="{deliveryMethodFk: {neq: null}}" value-field="id" show-field="name"> From c7c79831d51d97fc5977dca558244802b969ec8b Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 6 Feb 2020 13:38:46 +0100 Subject: [PATCH 28/95] added crud-model save() unit test --- .../core/components/crud-model/index.spec.js | 50 +++++++++++++++++++ loopback/common/models/vn-model.js | 2 + 2 files changed, 52 insertions(+) create mode 100644 front/core/components/crud-model/index.spec.js diff --git a/front/core/components/crud-model/index.spec.js b/front/core/components/crud-model/index.spec.js new file mode 100644 index 000000000..e0daa2558 --- /dev/null +++ b/front/core/components/crud-model/index.spec.js @@ -0,0 +1,50 @@ +describe('Component vnCrudModel', () => { + let $httpBackend; + let controller; + let $element; + + beforeEach(ngModule('vnCore')); + + beforeEach(inject(($compile, $rootScope, _$httpBackend_) => { + $element = $compile(``)($rootScope); + $httpBackend = _$httpBackend_; + controller = $element.controller('vnCrudModel'); + controller.orgData = [ + {id: 1, value: 'My item 1'}, + {id: 2, value: 'My item 2'} + ]; + controller.data = [ + {id: 1, value: 'My item 1'}, + {id: 2, value: 'My item 2'} + ]; + controller._url = 'Model'; + })); + + afterEach(() => { + $element.remove(); + }); + + describe('save()', () => { + it(`should make an HTTP post query and then update the original rows with the returned values`, () => { + spyOn(controller, 'applyChanges'); + + controller.insert({value: 'My new item 1'}); + controller.insert({value: 'My new item 2'}); + + $httpBackend.when('POST', 'Model/crud').respond([ + {id: 3, value: 'My new item 1'}, + {id: 4, value: 'My modified item 2'} + ]); + controller.save(); + $httpBackend.flush(); + + const thirdRow = controller.data[2]; + const fourthRow = controller.data[3]; + + expect(thirdRow.id).toEqual(3); + expect(fourthRow.id).toEqual(4); + expect(fourthRow.value).toEqual('My modified item 2'); + expect(controller.applyChanges).toHaveBeenCalledWith(); + }); + }); +}); diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js index 592392666..d65ca71df 100644 --- a/loopback/common/models/vn-model.js +++ b/loopback/common/models/vn-model.js @@ -68,12 +68,14 @@ module.exports = function(Self) { let promises = []; for (let id of deletes) promises.push(this.destroyById(id, options)); + await Promise.all(promises); } if (updates) { let promises = []; for (let update of updates) promises.push(this.upsertWithWhere(update.where, update.data, options)); + await Promise.all(promises); } let created; From b6473794434e49d744f6468cc215745ba405e464 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 6 Feb 2020 13:42:28 +0100 Subject: [PATCH 29/95] removed line --- modules/order/front/catalog/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index ce684aabe..a7d2c18b2 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -106,9 +106,7 @@ class Controller { return this._categoryId; } - set categoryId(value) { - if (!value) value = null; - + set categoryId(value = null) { this._categoryId = value; this.itemTypes = []; this.typeId = null; From 3e0fd10b41160f7ae3eb23a89aa8eb1874459c89 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 6 Feb 2020 14:33:28 +0100 Subject: [PATCH 30/95] 2029 - Item request fixes & searchbar filters working --- modules/item/front/request/index.html | 30 ++++++++++----------------- modules/item/front/request/index.js | 2 +- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/modules/item/front/request/index.html b/modules/item/front/request/index.html index 6d6e786dc..e0cf05107 100644 --- a/modules/item/front/request/index.html +++ b/modules/item/front/request/index.html @@ -6,14 +6,15 @@ order="shipped DESC, isOk ASC"> - + suggested-filter="$ctrl.filter.where" + info="Search request by id or alias"> + + @@ -21,8 +22,6 @@ Ticket ID Shipped - Warehouse - SalesPerson Description Requested Price @@ -47,15 +46,7 @@ {{::request.shipped | date: 'dd/MM/yyyy'}} - {{::request.warehouse}} - - - {{::request.salesPersonNickname}} - - - {{::request.description}} + {{::request.description}} {{::request.quantity}} {{::request.price | currency: 'EUR':2}} @@ -82,7 +73,7 @@ - + + translate-attr="{title: 'Discard'}" + tabindex="-1"> @@ -124,7 +116,7 @@
Specify the reasons to deny this request
- diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js index b56df41a8..b91e5d6d1 100644 --- a/modules/item/front/request/index.js +++ b/modules/item/front/request/index.js @@ -86,6 +86,7 @@ export default class Controller extends Component { } onSearch(params) { + console.log(params); if (params) this.$.model.applyFilter(null, params); else @@ -96,7 +97,6 @@ export default class Controller extends Component { this.selectedRequest = requestId; this.$.denyReason.parent = event.target; this.$.denyReason.show(); - document.querySelector('vn-item-request vn-textarea textArea').focus(); } clear() { From 5cd3bde306c5dc7766a4a2fffe9f667b98dc4028 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Thu, 6 Feb 2020 14:59:00 +0100 Subject: [PATCH 31/95] ticketRequest front test --- modules/ticket/front/request/index/index.js | 2 + .../ticket/front/request/index/index.spec.js | 62 +++++++++++++++++++ .../ticket/front/request/index/locale/es.yml | 3 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 modules/ticket/front/request/index/index.spec.js diff --git a/modules/ticket/front/request/index/index.js b/modules/ticket/front/request/index/index.js index 38d800aeb..e8cb54f22 100644 --- a/modules/ticket/front/request/index/index.js +++ b/modules/ticket/front/request/index/index.js @@ -89,6 +89,8 @@ class Controller { isEditable(isOk) { if (isOk != null) return true; + + return false; } } diff --git a/modules/ticket/front/request/index/index.spec.js b/modules/ticket/front/request/index/index.spec.js new file mode 100644 index 000000000..90d71f062 --- /dev/null +++ b/modules/ticket/front/request/index/index.spec.js @@ -0,0 +1,62 @@ +import './index'; + +describe('Ticket', () => { + describe('Component vnTicketRequestIndex', () => { + let controller; + let $scope; + + beforeEach(ngModule('ticket')); + + beforeEach(angular.mock.inject(($componentController, $rootScope) => { + $scope = $rootScope.$new(); + + controller = $componentController('vnTicketRequestIndex', {$scope}); + })); + + describe('getRequestState()', () => { + it('should return New when the state is null', () => { + let state = null; + let result = controller.getRequestState(state); + + expect(result).toEqual('New'); + }); + + it('should return Denied when the state is false', () => { + let state = false; + let result = controller.getRequestState(state); + + expect(result).toEqual('Denied'); + }); + + it('should return Acepted when the state is true', () => { + let state = true; + let result = controller.getRequestState(state); + + expect(result).toEqual('Acepted'); + }); + }); + + describe('isEditable()', () => { + it('should return true when isOk is true', () => { + let isOk = true; + let result = controller.isEditable(isOk); + + expect(result).toEqual(true); + }); + + it('should return true when isOk is false', () => { + let isOk = false; + let result = controller.isEditable(isOk); + + expect(result).toEqual(true); + }); + + it('should return true when isOk is null', () => { + let isOk = null; + let result = controller.isEditable(isOk); + + expect(result).toEqual(false); + }); + }); + }); +}); diff --git a/modules/ticket/front/request/index/locale/es.yml b/modules/ticket/front/request/index/locale/es.yml index 65442cde1..1adcbad49 100644 --- a/modules/ticket/front/request/index/locale/es.yml +++ b/modules/ticket/front/request/index/locale/es.yml @@ -3,4 +3,5 @@ Atender: Comprador Remove request: Eliminar petición New request: Crear petición Sale id: Id linea -Requester: Solicitante \ No newline at end of file +Requester: Solicitante +New purchase request: Nueva petición de compra \ No newline at end of file From 5d0f72af4e85e7725471bedd8197704ed89eb933 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 6 Feb 2020 16:04:23 +0100 Subject: [PATCH 32/95] zoneDoCalc --- db/changes/10141-zoneDoCalc/00-ticket.sql | 19 +++++++ .../10141-zoneDoCalc/01-ticket_doCalc.sql | 56 +++++++++++++++++++ .../01-zoneClosure_recalc.sql | 1 + .../10141-zoneDoCalc/02-procNoOverlap.sql | 30 ++++++++++ modules/agency/back/model-config.json | 2 +- .../agency/back/models/zone-calc-ticket.js | 24 ++++++++ ...one-closure.json => zone-calc-ticket.json} | 12 +--- modules/agency/back/models/zone-closure.js | 13 ----- modules/agency/back/models/zone-event.js | 8 --- modules/agency/back/models/zone-exclusion.js | 11 ---- modules/agency/back/models/zone.js | 10 ---- 11 files changed, 133 insertions(+), 53 deletions(-) create mode 100644 db/changes/10141-zoneDoCalc/00-ticket.sql create mode 100644 db/changes/10141-zoneDoCalc/01-ticket_doCalc.sql create mode 100644 db/changes/10141-zoneDoCalc/01-zoneClosure_recalc.sql create mode 100644 db/changes/10141-zoneDoCalc/02-procNoOverlap.sql create mode 100644 modules/agency/back/models/zone-calc-ticket.js rename modules/agency/back/models/{zone-closure.json => zone-calc-ticket.json} (62%) delete mode 100644 modules/agency/back/models/zone-closure.js delete mode 100644 modules/agency/back/models/zone-exclusion.js diff --git a/db/changes/10141-zoneDoCalc/00-ticket.sql b/db/changes/10141-zoneDoCalc/00-ticket.sql new file mode 100644 index 000000000..c116e5139 --- /dev/null +++ b/db/changes/10141-zoneDoCalc/00-ticket.sql @@ -0,0 +1,19 @@ +ALTER TABLE `vn`.`ticket` +ADD COLUMN `zonePrice` DECIMAL(10,2) NULL DEFAULT NULL AFTER `collectionFk`, +ADD COLUMN `zoneBonus` DECIMAL(10,2) NULL DEFAULT NULL AFTER `zonePrice`, +ADD COLUMN `zoneClosure` TIME NULL AFTER `zoneBonus`; + +CREATE TABLE vn.`zoneCalcTicket` ( + `zoneFk` int(11) NOT NULL PRIMARY KEY, + CONSTRAINT `zoneCalcTicketfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +DROP EVENT IF EXISTS vn.`zone_doCalc`; +CREATE DEFINER=`root`@`%` EVENT vn.`zone_doCalc` + ON SCHEDULE EVERY 15 SECOND STARTS '2020-01-31 11:32:30' + ON COMPLETION PRESERVE ENABLE + DO CALL util.procNoOverlap('vn.zone_doCalc'); + +DROP TABLE `vn`.`zoneConfig`; + +DROP procedure IF EXISTS vn.`zoneClosure_recalc`; \ No newline at end of file diff --git a/db/changes/10141-zoneDoCalc/01-ticket_doCalc.sql b/db/changes/10141-zoneDoCalc/01-ticket_doCalc.sql new file mode 100644 index 000000000..d7538ff84 --- /dev/null +++ b/db/changes/10141-zoneDoCalc/01-ticket_doCalc.sql @@ -0,0 +1,56 @@ +USE `vn`; +DROP procedure IF EXISTS `zone_doCalc`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `zone_doCalc`() +proc: BEGIN +/** + * Updates ticket fields related with zone + */ + DECLARE vDone BOOL; + DECLARE vTicketFk INT; + DECLARE vShipped DATE; + DECLARE vZoneFk INT; + + DECLARE cCur CURSOR FOR + SELECT t.id, t.shipped, t.zoneFk + FROM zoneCalcTicket zct + JOIN ticket t ON t.zoneFk = zct.zoneFk + WHERE shipped >= CURDATE(); + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + OPEN cCur; + + myLoop: LOOP + SET vDone = FALSE; + FETCH cCur INTO vTicketFk, vShipped, vZoneFk; + + IF vDone THEN + LEAVE myLoop; + END IF; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE tmp.zone + (INDEX (id)) + ENGINE = MEMORY + SELECT vZoneFk id; + + CALL zone_getOptionsForShipment(vShipped, TRUE); + + UPDATE ticket t + LEFT JOIN tmp.zoneOption zo ON TRUE + SET zonePrice = zo.price, zoneBonus = zo.bonus, zoneClosure = zo.`hour` + WHERE t.id = vTicketFk; + + END LOOP; + + CLOSE cCur; + + DELETE FROM zoneCalcTicket; +END$$ + +DELIMITER ; + diff --git a/db/changes/10141-zoneDoCalc/01-zoneClosure_recalc.sql b/db/changes/10141-zoneDoCalc/01-zoneClosure_recalc.sql new file mode 100644 index 000000000..f015eb894 --- /dev/null +++ b/db/changes/10141-zoneDoCalc/01-zoneClosure_recalc.sql @@ -0,0 +1 @@ +USE `vn`; diff --git a/db/changes/10141-zoneDoCalc/02-procNoOverlap.sql b/db/changes/10141-zoneDoCalc/02-procNoOverlap.sql new file mode 100644 index 000000000..253264ce9 --- /dev/null +++ b/db/changes/10141-zoneDoCalc/02-procNoOverlap.sql @@ -0,0 +1,30 @@ +USE `util`; +DROP procedure IF EXISTS `procNoOverlap`; + +DELIMITER $$ +USE `util`$$ +CREATE PROCEDURE `procNoOverlap` (procName VARCHAR(255)) +SQL SECURITY INVOKER +proc: BEGIN +/** + * call procedure without overlap + */ + DECLARE vIsChanged BOOL; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK(procName); + RESIGNAL; + END; + + IF !GET_LOCK(procName, 0) THEN + LEAVE proc; + END IF; + + CALL exec(CONCAT('CALL ', procName)); + + DO RELEASE_LOCK(procName); +END$$ + +DELIMITER ; + diff --git a/modules/agency/back/model-config.json b/modules/agency/back/model-config.json index 7638e3f6c..c9a49ffe9 100644 --- a/modules/agency/back/model-config.json +++ b/modules/agency/back/model-config.json @@ -11,7 +11,7 @@ "Zone": { "dataSource": "vn" }, - "ZoneClosure": { + "ZoneCalcTicket": { "dataSource": "vn" }, "ZoneEvent": { diff --git a/modules/agency/back/models/zone-calc-ticket.js b/modules/agency/back/models/zone-calc-ticket.js new file mode 100644 index 000000000..c3633e8f4 --- /dev/null +++ b/modules/agency/back/models/zone-calc-ticket.js @@ -0,0 +1,24 @@ +const app = require('vn-loopback/server/server'); + + +module.exports = Self => { + app.on('started', function() { + let models = ['Zone', 'ZoneEvent', 'ZoneExclusion']; + + for (let modelName of models) { + let Model = app.models[modelName]; + + Model.observe('after save', doCalc); + Model.observe('after delete', doCalc); + } + + async function doCalc(ctx) { + try { + await Self.create({zoneFk: ctx.instance.zoneFk || ctx.instance.id}); + } catch (err) { + if (err.code != 'ER_DUP_ENTRY') + throw err; + } + } + }); +}; diff --git a/modules/agency/back/models/zone-closure.json b/modules/agency/back/models/zone-calc-ticket.json similarity index 62% rename from modules/agency/back/models/zone-closure.json rename to modules/agency/back/models/zone-calc-ticket.json index 895374838..5083d08ed 100644 --- a/modules/agency/back/models/zone-closure.json +++ b/modules/agency/back/models/zone-calc-ticket.json @@ -1,23 +1,15 @@ { - "name": "ZoneClosure", + "name": "ZoneCalcTicket", "base": "VnModel", "options": { "mysql": { - "table": "zoneClosure" + "table": "zoneCalcTicket" } }, "properties": { "zoneFk": { "id": true, "type": "Number" - }, - "dated": { - "type": "Date", - "required": true - }, - "hour": { - "type": "date", - "required": true } }, "relations": { diff --git a/modules/agency/back/models/zone-closure.js b/modules/agency/back/models/zone-closure.js deleted file mode 100644 index 8b66e31ae..000000000 --- a/modules/agency/back/models/zone-closure.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = Self => { - Self.doRecalc = async function() { - try { - await Self.rawSql(` - CREATE EVENT zoneClosure_doRecalc - ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 15 SECOND - DO CALL zoneClosure_recalc; - `); - } catch (err) { - if (err.code != 'ER_EVENT_ALREADY_EXISTS') throw err; - } - }; -}; diff --git a/modules/agency/back/models/zone-event.js b/modules/agency/back/models/zone-event.js index 46b2df202..d4fad8e96 100644 --- a/modules/agency/back/models/zone-event.js +++ b/modules/agency/back/models/zone-event.js @@ -34,12 +34,4 @@ module.exports = Self => { }, { message: `You should mark at least one week day` }); - - Self.observe('after save', async function() { - await app.models.ZoneClosure.doRecalc(); - }); - - Self.observe('after delete', async function() { - await app.models.ZoneClosure.doRecalc(); - }); }; diff --git a/modules/agency/back/models/zone-exclusion.js b/modules/agency/back/models/zone-exclusion.js deleted file mode 100644 index 51998aab8..000000000 --- a/modules/agency/back/models/zone-exclusion.js +++ /dev/null @@ -1,11 +0,0 @@ -const app = require('vn-loopback/server/server'); - -module.exports = Self => { - Self.observe('after save', async function() { - await app.models.ZoneClosure.doRecalc(); - }); - - Self.observe('after delete', async function() { - await app.models.ZoneClosure.doRecalc(); - }); -}; diff --git a/modules/agency/back/models/zone.js b/modules/agency/back/models/zone.js index 9d715a8d8..0c3ac24f6 100644 --- a/modules/agency/back/models/zone.js +++ b/modules/agency/back/models/zone.js @@ -1,5 +1,3 @@ -const app = require('vn-loopback/server/server'); - module.exports = Self => { require('../methods/zone/clone')(Self); require('../methods/zone/getLeaves')(Self); @@ -9,12 +7,4 @@ module.exports = Self => { Self.validatesPresenceOf('agencyModeFk', { message: `Agency cannot be blank` }); - - Self.observe('after save', async function() { - await app.models.ZoneClosure.doRecalc(); - }); - - Self.observe('after delete', async function() { - await app.models.ZoneClosure.doRecalc(); - }); }; From b623646f257e902d49179e6696864165aad7f02d Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 7 Feb 2020 07:02:27 +0100 Subject: [PATCH 33/95] removed console --- modules/item/front/request/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js index b91e5d6d1..3684a1911 100644 --- a/modules/item/front/request/index.js +++ b/modules/item/front/request/index.js @@ -86,7 +86,6 @@ export default class Controller extends Component { } onSearch(params) { - console.log(params); if (params) this.$.model.applyFilter(null, params); else From 2f81727594dae619bbc5e0a1cac455edc4e42e86 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Fri, 7 Feb 2020 07:43:22 +0100 Subject: [PATCH 34/95] reload_card_volume --- modules/route/front/card/index.html | 2 +- modules/route/front/descriptor/index.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/route/front/card/index.html b/modules/route/front/card/index.html index 051d8714f..9e0ae4e8c 100644 --- a/modules/route/front/card/index.html +++ b/modules/route/front/card/index.html @@ -1,5 +1,5 @@ - + diff --git a/modules/route/front/descriptor/index.js b/modules/route/front/descriptor/index.js index cfa718855..1beb7e095 100644 --- a/modules/route/front/descriptor/index.js +++ b/modules/route/front/descriptor/index.js @@ -70,7 +70,7 @@ class Controller { let url = `Routes/${this.route.id}/updateVolume`; this.$http.post(url).then(() => { this.vnApp.showSuccess(this.$translate.instant('Volume updated')); - if (this.card) this.card.reload(); + this.cardReload(); }); } } @@ -82,10 +82,8 @@ ngModule.component('vnRouteDescriptor', { template: require('./index.html'), bindings: { route: '<', + cardReload: '&?', quicklinks: '<' }, - require: { - card: '^?vnRouteCard' - }, controller: Controller }); From b192cb15c09055006af9230b1b3db3e5d042988c Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 7 Feb 2020 07:47:11 +0100 Subject: [PATCH 35/95] Show data save snackbar on auto-save --- e2e/paths/06-claim-module/04_claim_action.spec.js | 5 ++--- modules/claim/front/action/index.html | 7 +++++-- modules/claim/front/action/index.js | 4 ++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/e2e/paths/06-claim-module/04_claim_action.spec.js b/e2e/paths/06-claim-module/04_claim_action.spec.js index 460cd49ae..c0bc91365 100644 --- a/e2e/paths/06-claim-module/04_claim_action.spec.js +++ b/e2e/paths/06-claim-module/04_claim_action.spec.js @@ -32,12 +32,11 @@ describe('Claim action path', () => { expect(result).toEqual('Data saved!'); }); - // #2036 claim.action destinatario it('should edit the second line destination field', async() => { await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno'); - // const result = await page.waitForLastSnackbar(); + const result = await page.waitForLastSnackbar(); - // expect(result).toEqual('Data saved!'); + expect(result).toEqual('Data saved!'); }); it('should delete the first line', async() => { diff --git a/modules/claim/front/action/index.html b/modules/claim/front/action/index.html index 7c663eacd..31db6dabd 100644 --- a/modules/claim/front/action/index.html +++ b/modules/claim/front/action/index.html @@ -1,7 +1,10 @@ - + data="$ctrl.salesClaimed" + auto-load="true" + auto-save="true" + on-save="$ctrl.onSave()"> Date: Fri, 7 Feb 2020 10:34:24 +0100 Subject: [PATCH 36/95] #1824 e2e worker.basicData --- e2e/helpers/selectors.js | 6 +++ .../04_edit_billing_data.spec.js | 2 +- .../03-worker-module/01_basicData.spec.js | 50 +++++++++++++++++++ .../03-worker-module/02_time_control.spec.js | 3 +- .../{01_pbx.spec.js => 03_pbx.spec.js} | 0 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 e2e/paths/03-worker-module/01_basicData.spec.js rename e2e/paths/03-worker-module/{01_pbx.spec.js => 03_pbx.spec.js} (100%) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 4cde8771d..d7e20018b 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -659,6 +659,12 @@ export default { firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]', confirmButton: '.vn-confirm.shown button[response="accept"]' }, + workerBasicData: { + name: 'vn-worker-basic-data vn-textfield[ng-model="$ctrl.worker.firstName"]', + surname: 'vn-worker-basic-data vn-textfield[ng-model="$ctrl.worker.lastName"]', + phone: 'vn-worker-basic-data vn-textfield[ng-model="$ctrl.worker.phone"]', + saveButton: 'vn-worker-basic-data button[type=submit]' + }, workerPbx: { extension: 'vn-worker-pbx vn-textfield[ng-model="$ctrl.worker.sip.extension"]', saveButton: 'vn-worker-pbx button[type=submit]' diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js index 5ee308f7e..7e8df8aa8 100644 --- a/e2e/paths/02-client-module/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client-module/04_edit_billing_data.spec.js @@ -60,7 +60,7 @@ describe('Client Edit billing data path', () => { }); it(`should save the form with all its new data`, async() => { - // await page.waitFor(3000); + await page.waitFor(2000); await page.waitForWatcherData(selectors.clientBillingData.watcher); await page.waitToClick(selectors.clientBillingData.saveButton); let snackbarMessage = await page.waitForLastSnackbar(); diff --git a/e2e/paths/03-worker-module/01_basicData.spec.js b/e2e/paths/03-worker-module/01_basicData.spec.js new file mode 100644 index 000000000..21443c517 --- /dev/null +++ b/e2e/paths/03-worker-module/01_basicData.spec.js @@ -0,0 +1,50 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Worker basic data path', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('hr', 'worker'); + await page.accessToSearchResult('David Charles Haller'); + await page.accessToSection('worker.card.basicData'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should edit the form', async() => { + await page.clearInput(selectors.workerBasicData.name); + await page.write(selectors.workerBasicData.name, 'David C.'); + await page.clearInput(selectors.workerBasicData.surname); + await page.write(selectors.workerBasicData.surname, 'H.'); + await page.clearInput(selectors.workerBasicData.phone); + await page.write(selectors.workerBasicData.phone, '444332211'); + await page.waitToClick(selectors.workerBasicData.saveButton); + const result = await page.waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should reload the section then check the name was edited', async() => { + await page.reloadSection('worker.card.basicData'); + const result = await page.waitToGetProperty(selectors.workerBasicData.name, 'value'); + + expect(result).toEqual('David C.'); + }); + + it('should the surname was edited', async() => { + const result = await page.waitToGetProperty(selectors.workerBasicData.surname, 'value'); + + expect(result).toEqual('H.'); + }); + + it('should the phone was edited', async() => { + const result = await page.waitToGetProperty(selectors.workerBasicData.phone, 'value'); + + expect(result).toEqual('444332211'); + }); +}); diff --git a/e2e/paths/03-worker-module/02_time_control.spec.js b/e2e/paths/03-worker-module/02_time_control.spec.js index 6624f25eb..d49ffca03 100644 --- a/e2e/paths/03-worker-module/02_time_control.spec.js +++ b/e2e/paths/03-worker-module/02_time_control.spec.js @@ -1,8 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -// #2047 WorkerTimeControl no suma horas -xdescribe('Worker time control path', () => { +describe('Worker time control path', () => { let browser; let page; beforeAll(async() => { diff --git a/e2e/paths/03-worker-module/01_pbx.spec.js b/e2e/paths/03-worker-module/03_pbx.spec.js similarity index 100% rename from e2e/paths/03-worker-module/01_pbx.spec.js rename to e2e/paths/03-worker-module/03_pbx.spec.js From dac6563d6d6fd429efe6258872c791912188f077 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 7 Feb 2020 11:10:15 +0100 Subject: [PATCH 37/95] #2019 Deprecated method chat.sendMessage() --- back/methods/chat/sendMessage.js | 30 ------------------------------ back/models/chat.js | 1 - 2 files changed, 31 deletions(-) delete mode 100644 back/methods/chat/sendMessage.js diff --git a/back/methods/chat/sendMessage.js b/back/methods/chat/sendMessage.js deleted file mode 100644 index b6eaf79a8..000000000 --- a/back/methods/chat/sendMessage.js +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('sendMessage', { - description: 'Send a RocketChat message', - accessType: 'WRITE', - accepts: [{ - arg: 'to', - type: 'String', - required: true, - description: 'user (@) or channel (#) to send the message' - }, { - arg: 'message', - type: 'String', - required: true, - description: 'The message' - }], - returns: { - type: 'Object', - root: true - }, - http: { - path: `/sendMessage`, - verb: 'POST' - } - }); - - // FIXME: Deprecate this method #2019 - Self.sendMessage = async(ctx, to, message) => { - return Self.send(ctx, to, message); - }; -}; diff --git a/back/models/chat.js b/back/models/chat.js index ecd47029c..ab23ef713 100644 --- a/back/models/chat.js +++ b/back/models/chat.js @@ -1,5 +1,4 @@ module.exports = Self => { require('../methods/chat/send')(Self); - require('../methods/chat/sendMessage')(Self); require('../methods/chat/sendCheckingPresence')(Self); }; From f28a80b855384450407b910a3156e2494e0c8859 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 7 Feb 2020 11:25:56 +0100 Subject: [PATCH 38/95] #2078 ticket. step-one --- .../front/basic-data/step-one/index.html | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/modules/ticket/front/basic-data/step-one/index.html b/modules/ticket/front/basic-data/step-one/index.html index 0d2a7ecc6..aabfe7ae1 100644 --- a/modules/ticket/front/basic-data/step-one/index.html +++ b/modules/ticket/front/basic-data/step-one/index.html @@ -48,23 +48,6 @@ ng-model="$ctrl.warehouseId"> - - - - - - - - + + + + + + + +
From 5be55ca92dfad9ba90221f865e140f2f79b415c5 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 7 Feb 2020 11:50:09 +0100 Subject: [PATCH 39/95] #2083 Login on auth error --- back/methods/chat/send.js | 1 + 1 file changed, 1 insertion(+) diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js index c36178b0f..2b00df727 100644 --- a/back/methods/chat/send.js +++ b/back/methods/chat/send.js @@ -46,6 +46,7 @@ module.exports = Self => { }).catch(async error => { if (error.statusCode === 401 && !this.resendAttempted) { this.resendAttempted = true; + this.auth = null; return sendMessage(sender, channel, message); } From dd368a8c3f167e716b2d7e6d6c37ca1c39ceee1c Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Fri, 7 Feb 2020 13:38:32 +0100 Subject: [PATCH 40/95] refactor ticket.basicData steps --- .../10150-entry/00-ticketUpdateAction.sql | 5 ++ e2e/helpers/selectors.js | 2 +- .../06_basic_data_steps.spec.js | 12 +-- .../back/models/ticket-update-action.json | 57 ++++++++------- modules/ticket/front/basic-data/index.html | 5 +- modules/ticket/front/basic-data/index.js | 4 +- .../front/basic-data/step-three/index.html | 14 ---- .../front/basic-data/step-three/index.js | 73 ------------------- .../front/basic-data/step-three/index.spec.js | 67 ----------------- .../front/basic-data/step-three/locale/es.yml | 4 - .../front/basic-data/step-two/index.html | 20 +++++ .../ticket/front/basic-data/step-two/index.js | 49 ++++++++++++- modules/ticket/front/index.js | 1 - modules/ticket/front/routes.json | 8 -- 14 files changed, 112 insertions(+), 209 deletions(-) create mode 100644 db/changes/10150-entry/00-ticketUpdateAction.sql delete mode 100644 modules/ticket/front/basic-data/step-three/index.html delete mode 100644 modules/ticket/front/basic-data/step-three/index.js delete mode 100644 modules/ticket/front/basic-data/step-three/index.spec.js delete mode 100644 modules/ticket/front/basic-data/step-three/locale/es.yml diff --git a/db/changes/10150-entry/00-ticketUpdateAction.sql b/db/changes/10150-entry/00-ticketUpdateAction.sql new file mode 100644 index 000000000..a05c65d7a --- /dev/null +++ b/db/changes/10150-entry/00-ticketUpdateAction.sql @@ -0,0 +1,5 @@ +ALTER TABLE `vn`.`ticketUpdateAction` +ADD COLUMN `code` VARCHAR(45) NOT NULL AFTER `description`; + +UPDATE `vn`.`ticketUpdateAction` SET `code`='changePrice' WHERE `id`='1'; +UPDATE `vn`.`ticketUpdateAction` SET `code`='turnInMana' WHERE `id`='3'; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d7e20018b..89a0fdbd8 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -471,7 +471,7 @@ export default { nextStepButton: 'vn-step-control .buttons > section:last-child vn-button', finalizeButton: 'vn-step-control .buttons > section:last-child button[type=submit]', stepTwoTotalPriceDif: 'vn-ticket-basic-data-step-two vn-tfoot > vn-tr > :nth-child(6)', - chargesReason: 'vn-autocomplete[ng-model="$ctrl.ticket.option"]', + chargesReason: 'div:nth-child(3) > vn-radio > div', }, ticketComponents: { base: 'vn-ticket-components [name="base-sum"]' diff --git a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js index f677625cd..0be758205 100644 --- a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js @@ -80,15 +80,15 @@ describe('Ticket Edit basic data path', () => { expect(result).toContain('-€248.00'); }); - it(`should then click next to move on to step three`, async() => { - await page.waitToClick(selectors.ticketBasicData.nextStepButton); - let url = await page.expectURL('data/step-three'); + // it(`should then click next to move on to step three`, async() => { + // await page.waitToClick(selectors.ticketBasicData.nextStepButton); + // let url = await page.expectURL('data/step-three'); - expect(url).toBe(true); - }); + // expect(url).toBe(true); + // }); it(`should select a new reason for the changes made then click on finalize`, async() => { - await page.autocompleteSearch(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket'); + await page.waitToClick(selectors.ticketBasicData.chargesReason); await page.waitToClick(selectors.ticketBasicData.finalizeButton); let url = await page.expectURL('summary'); diff --git a/modules/ticket/back/models/ticket-update-action.json b/modules/ticket/back/models/ticket-update-action.json index c4a4ce8df..3072c2172 100644 --- a/modules/ticket/back/models/ticket-update-action.json +++ b/modules/ticket/back/models/ticket-update-action.json @@ -1,28 +1,31 @@ { - "name": "TicketUpdateAction", - "base": "VnModel", - "options": { - "mysql": { - "table": "ticketUpdateAction" - } - }, - "properties": { - "id": { - "id": true, - "type": "Number", - "description": "Identifier" - }, - "description": { - "type": "String", - "required": true - } -}, -"acls": [ - { - "accessType": "READ", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - } -] -} + "name": "TicketUpdateAction", + "base": "VnModel", + "options": { + "mysql": { + "table": "ticketUpdateAction" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "description": { + "type": "String", + "required": true + }, + "code": { + "type": "String" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/ticket/front/basic-data/index.html b/modules/ticket/front/basic-data/index.html index f313110b3..34db1e246 100644 --- a/modules/ticket/front/basic-data/index.html +++ b/modules/ticket/front/basic-data/index.html @@ -3,9 +3,8 @@ step-count="10" steps="[ {name: 'Basic data', state: 'ticket.card.basicData.stepOne'}, - {name: 'Price difference', state: 'ticket.card.basicData.stepTwo'}, - {name: 'Charge', state: 'ticket.card.basicData.stepThree'}]" - on-step-change="$ctrl.onStepChange(state)" + {name: 'Price difference', state: 'ticket.card.basicData.stepTwo'}]" + on-step-change="$ctrl.onStepChange()" on-step-end="$ctrl.onSubmit()"> diff --git a/modules/ticket/front/basic-data/index.js b/modules/ticket/front/basic-data/index.js index 1afe6f9aa..4965ee61e 100644 --- a/modules/ticket/front/basic-data/index.js +++ b/modules/ticket/front/basic-data/index.js @@ -16,8 +16,8 @@ class Controller { this.child = child; } - onStepChange(state) { - return this.child.onStepChange(state); + onStepChange() { + return this.child.onStepChange(); } onSubmit() { diff --git a/modules/ticket/front/basic-data/step-three/index.html b/modules/ticket/front/basic-data/step-three/index.html deleted file mode 100644 index 300b8f6d3..000000000 --- a/modules/ticket/front/basic-data/step-three/index.html +++ /dev/null @@ -1,14 +0,0 @@ -
- - - - - - -
diff --git a/modules/ticket/front/basic-data/step-three/index.js b/modules/ticket/front/basic-data/step-three/index.js deleted file mode 100644 index 1cd643dd2..000000000 --- a/modules/ticket/front/basic-data/step-three/index.js +++ /dev/null @@ -1,73 +0,0 @@ -import ngModule from '../../module'; - -class Controller { - constructor($http, $scope, $state, $translate, vnApp) { - this.$http = $http; - this.$scope = $scope; - this.$state = $state; - this.$translate = $translate; - this.vnApp = vnApp; - } - - $onInit() { - this.data.registerChild(this); - } - - get ticket() { - return this._ticket; - } - - set ticket(value) { - this._ticket = value; - - if (value) this.ticket.option = 1; - } - - onStepChange(state) { - return true; - } - - onSubmit() { - if (!this.ticket.option) { - return this.vnApp.showError( - this.$translate.instant('Choose an option') - ); - } - - let query = `tickets/${this.ticket.id}/componentUpdate`; - let params = { - clientId: this.ticket.clientFk, - agencyModeId: this.ticket.agencyModeFk, - addressId: this.ticket.addressFk, - zoneId: this.ticket.zoneFk, - warehouseId: this.ticket.warehouseFk, - companyId: this.ticket.companyFk, - shipped: this.ticket.shipped, - landed: this.ticket.landed, - isDeleted: this.ticket.isDeleted, - option: this.ticket.option - }; - - this.$http.post(query, params).then(res => { - this.vnApp.showMessage( - this.$translate.instant(`The ticket has been unrouted`) - ); - this.card.reload(); - this.$state.go('ticket.card.summary', {id: this.$state.params.id}); - }); - } -} - -Controller.$inject = ['$http', '$scope', '$state', '$translate', 'vnApp']; - -ngModule.component('vnTicketBasicDataStepThree', { - template: require('./index.html'), - controller: Controller, - bindings: { - ticket: '<' - }, - require: { - card: '^vnTicketCard', - data: '^vnTicketBasicData' - } -}); diff --git a/modules/ticket/front/basic-data/step-three/index.spec.js b/modules/ticket/front/basic-data/step-three/index.spec.js deleted file mode 100644 index 6843caec1..000000000 --- a/modules/ticket/front/basic-data/step-three/index.spec.js +++ /dev/null @@ -1,67 +0,0 @@ -import './index.js'; - -describe('ticket', () => { - describe('Component vnTicketBasicDataStepThree', () => { - let now = Date.now(); - let $state; - let controller; - let $httpBackend; - let vnApp; - - beforeEach(ngModule('ticket')); - - beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, _vnApp_) => { - $state = _$state_; - spyOn($state, 'go'); - vnApp = _vnApp_; - spyOn(vnApp, 'showError'); - $httpBackend = _$httpBackend_; - controller = $componentController('vnTicketBasicDataStepThree', {$state}); - })); - - describe('onSubmit()', () => { - it(`should return an error if the item doesn't have option property in the controller`, () => { - controller._ticket = {id: 1}; - controller.onSubmit(); - - expect(vnApp.showError).toHaveBeenCalledWith('Choose an option'); - }); - - it('should perform a post query correctly then call two functions()', () => { - spyOn(controller.vnApp, 'showMessage'); - controller.card = {reload: () => {}}; - spyOn(controller.card, 'reload'); - - controller.ticket = { - id: 1, - agencyModeFk: 1, - addressFk: 121, - zoneFk: 3, - warehouseFk: 1, - shipped: now, - landed: now, - option: 1 - }; - - let data = { - agencyModeId: 1, - addressId: 121, - zoneId: 3, - warehouseId: 1, - shipped: now, - landed: now, - option: 1 - }; - - $httpBackend.whenPOST(`tickets/1/componentUpdate`, data).respond('ok'); - $httpBackend.expectPOST(`tickets/1/componentUpdate`, data); - controller.onSubmit(); - $httpBackend.flush(); - - expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The ticket has been unrouted'); - expect(controller.card.reload).toHaveBeenCalledWith(); - expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.summary', jasmine.any(Object)); - }); - }); - }); -}); diff --git a/modules/ticket/front/basic-data/step-three/locale/es.yml b/modules/ticket/front/basic-data/step-three/locale/es.yml deleted file mode 100644 index 185534c34..000000000 --- a/modules/ticket/front/basic-data/step-three/locale/es.yml +++ /dev/null @@ -1,4 +0,0 @@ -Charge: Cargo -Choose an option: Selecciona una opción -Charge difference to: Diferencia a cargo de -The ticket has been unrouted: El ticket ha sido desenrutado \ No newline at end of file diff --git a/modules/ticket/front/basic-data/step-two/index.html b/modules/ticket/front/basic-data/step-two/index.html index 04cb7f212..345cb3f86 100644 --- a/modules/ticket/front/basic-data/step-two/index.html +++ b/modules/ticket/front/basic-data/step-two/index.html @@ -1,3 +1,23 @@ + + + +
+ Charge difference to +
+
+ + +
+
diff --git a/modules/ticket/front/basic-data/step-two/index.js b/modules/ticket/front/basic-data/step-two/index.js index a481afefc..ec8d94f9a 100644 --- a/modules/ticket/front/basic-data/step-two/index.js +++ b/modules/ticket/front/basic-data/step-two/index.js @@ -1,8 +1,11 @@ import ngModule from '../../module'; class Controller { - constructor($http) { + constructor($http, $state, $translate, vnApp) { this.$http = $http; + this.$state = $state; + this.$translate = $translate; + this.vnApp = vnApp; } $onInit() { @@ -21,9 +24,18 @@ class Controller { this.getTotalPrice(); this.getTotalNewPrice(); this.getTotalDifferenceOfPrice(); + this.loadDefaultTicketAction(); } - onStepChange(state) { + loadDefaultTicketAction() { + let filter = {where: {code: 'changePrice'}}; + + this.$http.get(`TicketUpdateActions`, {filter}).then(response => { + return this.ticket.option = response.data[0].id; + }); + } + + onStepChange() { return true; } @@ -53,9 +65,39 @@ class Controller { }); this.totalPriceDifference = totalPriceDifference; } + + onSubmit() { + if (!this.ticket.option) { + return this.vnApp.showError( + this.$translate.instant('Choose an option') + ); + } + + let query = `tickets/${this.ticket.id}/componentUpdate`; + let params = { + clientId: this.ticket.clientFk, + agencyModeId: this.ticket.agencyModeFk, + addressId: this.ticket.addressFk, + zoneId: this.ticket.zoneFk, + warehouseId: this.ticket.warehouseFk, + companyId: this.ticket.companyFk, + shipped: this.ticket.shipped, + landed: this.ticket.landed, + isDeleted: this.ticket.isDeleted, + option: parseInt(this.ticket.option) + }; + + this.$http.post(query, params).then(res => { + this.vnApp.showMessage( + this.$translate.instant(`The ticket has been unrouted`) + ); + this.card.reload(); + this.$state.go('ticket.card.summary', {id: this.$state.params.id}); + }); + } } -Controller.$inject = ['$http']; +Controller.$inject = ['$http', '$state', '$translate', 'vnApp']; ngModule.component('vnTicketBasicDataStepTwo', { template: require('./index.html'), @@ -64,6 +106,7 @@ ngModule.component('vnTicketBasicDataStepTwo', { ticket: '<' }, require: { + card: '^vnTicketCard', data: '^vnTicketBasicData' } }); diff --git a/modules/ticket/front/index.js b/modules/ticket/front/index.js index 2625d35f3..c3f15b214 100644 --- a/modules/ticket/front/index.js +++ b/modules/ticket/front/index.js @@ -13,7 +13,6 @@ import './summary'; import './basic-data'; import './basic-data/step-one'; import './basic-data/step-two'; -import './basic-data/step-three'; import './note'; import './expedition'; import './volume'; diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index af0683ee1..d95788036 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -79,14 +79,6 @@ "params": { "ticket": "$ctrl.data" } - }, { - "url" : "/step-three", - "state": "ticket.card.basicData.stepThree", - "component": "vn-ticket-basic-data-step-three", - "description": "Charge", - "params": { - "ticket": "$ctrl.data" - } }, { "url" : "/sale", "state": "ticket.card.sale", From fe780ff7c668c2c140f26af0c7f529b8112abc22 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 7 Feb 2020 14:04:18 +0100 Subject: [PATCH 41/95] 2089 - Removed mention from message --- back/methods/chat/send.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js index 2b00df727..b0a9431c7 100644 --- a/back/methods/chat/send.js +++ b/back/methods/chat/send.js @@ -31,7 +31,7 @@ module.exports = Self => { const recipient = to.replace('@', ''); if (sender.name != recipient) - return sendMessage(sender, to, `@${sender.name}: ${message} `); + return sendMessage(sender, to, message); }; async function sendMessage(sender, channel, message) { @@ -42,6 +42,7 @@ module.exports = Self => { return sendAuth(uri, { 'channel': channel, 'avatar': avatar, + 'alias': sender.nickname, 'text': message }).catch(async error => { if (error.statusCode === 401 && !this.resendAttempted) { From afaa46a6d6cd2dfaed88fd34d07482f37e4d85d2 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Fri, 7 Feb 2020 14:12:37 +0100 Subject: [PATCH 42/95] fix e2e --- e2e/helpers/selectors.js | 2 +- e2e/paths/05-ticket-module/06_basic_data_steps.spec.js | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 89a0fdbd8..63e5ddf2f 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -471,7 +471,7 @@ export default { nextStepButton: 'vn-step-control .buttons > section:last-child vn-button', finalizeButton: 'vn-step-control .buttons > section:last-child button[type=submit]', stepTwoTotalPriceDif: 'vn-ticket-basic-data-step-two vn-tfoot > vn-tr > :nth-child(6)', - chargesReason: 'div:nth-child(3) > vn-radio > div', + chargesReason: 'vn-ticket-basic-data-step-two div:nth-child(3) > vn-radio', }, ticketComponents: { base: 'vn-ticket-components [name="base-sum"]' diff --git a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js index 0be758205..de78b9fa7 100644 --- a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js @@ -80,13 +80,6 @@ describe('Ticket Edit basic data path', () => { expect(result).toContain('-€248.00'); }); - // it(`should then click next to move on to step three`, async() => { - // await page.waitToClick(selectors.ticketBasicData.nextStepButton); - // let url = await page.expectURL('data/step-three'); - - // expect(url).toBe(true); - // }); - it(`should select a new reason for the changes made then click on finalize`, async() => { await page.waitToClick(selectors.ticketBasicData.chargesReason); await page.waitToClick(selectors.ticketBasicData.finalizeButton); From 0a554afdb29a76256f8f50f53efeee807e1231f8 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 7 Feb 2020 15:42:11 +0100 Subject: [PATCH 43/95] 2007 e2e invoiceOut summary --- e2e/helpers/selectors.js | 7 ++- .../04_edit_billing_data.spec.js | 2 +- .../09-invoice-out-module/01_summary.spec.js | 49 +++++++++++++++++++ ...scriptor.spec.js => 02_descriptor.spec.js} | 0 modules/invoiceOut/front/summary/index.html | 2 +- .../invoiceOut/front/summary/locale/es.yml | 3 +- 6 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 e2e/paths/09-invoice-out-module/01_summary.spec.js rename e2e/paths/09-invoice-out-module/{01_descriptor.spec.js => 02_descriptor.spec.js} (100%) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d7e20018b..9f46384fd 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -735,6 +735,11 @@ export default { acceptBookingButton: '.vn-confirm.shown button[response="accept"]' }, invoiceOutSummary: { - bookedLabel: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-one > vn-label-value:nth-child(4) > section > span' + bookedLabel: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-one > vn-label-value:nth-child(4) > section > span', + company: 'vn-invoice-out-summary vn-label-value[label="Company"]', + taxOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-two > vn-table > div > vn-tbody > vn-tr:nth-child(1)', + taxTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-two > vn-table > div > vn-tbody > vn-tr:nth-child(2)', + ticketOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(1)', + ticketTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(2)' } }; diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js index 7e8df8aa8..b757940be 100644 --- a/e2e/paths/02-client-module/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client-module/04_edit_billing_data.spec.js @@ -60,7 +60,7 @@ describe('Client Edit billing data path', () => { }); it(`should save the form with all its new data`, async() => { - await page.waitFor(2000); + await page.waitFor(3000); await page.waitForWatcherData(selectors.clientBillingData.watcher); await page.waitToClick(selectors.clientBillingData.saveButton); let snackbarMessage = await page.waitForLastSnackbar(); diff --git a/e2e/paths/09-invoice-out-module/01_summary.spec.js b/e2e/paths/09-invoice-out-module/01_summary.spec.js new file mode 100644 index 000000000..c67fc547e --- /dev/null +++ b/e2e/paths/09-invoice-out-module/01_summary.spec.js @@ -0,0 +1,49 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('InvoiceOut summary path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'invoiceOut'); + await page.accessToSearchResult('T1111111'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should reach the summary section', async() => { + const result = await page.expectURL('/summary'); + + expect(result).toBe(true); + }); + + it('should contain the company from which the invoice is emited', async() => { + await page.waitForContentLoaded(); + const result = await page.waitToGetProperty(selectors.invoiceOutSummary.company, 'innerText'); + + expect(result).toEqual('Company VNL'); + }); + + it('should contain the tax breakdown', async() => { + const firstTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxOne, 'innerText'); + + const secondTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxTwo, 'innerText'); + + expect(firstTax).toContain('10%'); + expect(secondTax).toContain('21%'); + }); + + it('should contain the tickets info', async() => { + const firstTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketOne, 'innerText'); + + const secondTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketTwo, 'innerText'); + + expect(firstTicket).toContain('Bat cave'); + expect(secondTicket).toContain('Stark tower'); + }); +}); diff --git a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js b/e2e/paths/09-invoice-out-module/02_descriptor.spec.js similarity index 100% rename from e2e/paths/09-invoice-out-module/01_descriptor.spec.js rename to e2e/paths/09-invoice-out-module/02_descriptor.spec.js diff --git a/modules/invoiceOut/front/summary/index.html b/modules/invoiceOut/front/summary/index.html index 990957079..19ceeb3ab 100644 --- a/modules/invoiceOut/front/summary/index.html +++ b/modules/invoiceOut/front/summary/index.html @@ -19,7 +19,7 @@
-

Desglose impositivo

+

Tax breakdown

diff --git a/modules/invoiceOut/front/summary/locale/es.yml b/modules/invoiceOut/front/summary/locale/es.yml index d1b4a2406..f79a23093 100644 --- a/modules/invoiceOut/front/summary/locale/es.yml +++ b/modules/invoiceOut/front/summary/locale/es.yml @@ -8,4 +8,5 @@ Shipped: F. envío Type: Tipo Rate: Tasa Fee: Cuota -Taxable base: Base imp. \ No newline at end of file +Taxable base: Base imp. +Tax breakdown: Desglose impositivo \ No newline at end of file From 7a643eff3424ef061159c80566d7497f9b3d2ff5 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Mon, 10 Feb 2020 07:03:09 +0100 Subject: [PATCH 44/95] fix index step-two --- modules/ticket/front/basic-data/step-two/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ticket/front/basic-data/step-two/index.html b/modules/ticket/front/basic-data/step-two/index.html index 345cb3f86..0154b3caa 100644 --- a/modules/ticket/front/basic-data/step-two/index.html +++ b/modules/ticket/front/basic-data/step-two/index.html @@ -12,9 +12,9 @@
+ ng-model="$ctrl.ticket.option" + label="{{::action.description}}" + val={{::action.id}}>
From bafec3ce90a8d77940351795f172bf440882c796 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Mon, 10 Feb 2020 09:36:40 +0100 Subject: [PATCH 45/95] fix ticket.sale sms --- modules/ticket/front/sale/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 998f481ea..42699d8d1 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -370,10 +370,10 @@ - - + Date: Mon, 10 Feb 2020 12:12:49 +0100 Subject: [PATCH 46/95] #1940 e2e client.phone --- e2e/helpers/selectors.js | 7 ++++ .../04_edit_billing_data.spec.js | 2 +- .../02-client-module/18_contacts.spec.js | 37 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 e2e/paths/02-client-module/18_contacts.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 63e5ddf2f..6b8ae2aeb 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -185,6 +185,13 @@ export default { firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor', acceptDeleteButton: '.vn-confirm.shown button[response="accept"]' }, + clientContacts: { + addContactButton: 'vn-client-contact vn-icon[icon="add_circle"]', + name: 'vn-client-contact vn-textfield[ng-model="contact.name"]', + phone: 'vn-client-contact vn-textfield[ng-model="contact.phone"]', + deleteFirstPhone: 'vn-client-contact vn-icon[icon="delete"]', + saveButton: 'button[type=submit]' + }, itemsIndex: { searchIcon: 'vn-searchbar vn-icon[icon="search"]', createItemButton: `vn-float-button`, diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js index 7e8df8aa8..b757940be 100644 --- a/e2e/paths/02-client-module/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client-module/04_edit_billing_data.spec.js @@ -60,7 +60,7 @@ describe('Client Edit billing data path', () => { }); it(`should save the form with all its new data`, async() => { - await page.waitFor(2000); + await page.waitFor(3000); await page.waitForWatcherData(selectors.clientBillingData.watcher); await page.waitToClick(selectors.clientBillingData.saveButton); let snackbarMessage = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client-module/18_contacts.spec.js b/e2e/paths/02-client-module/18_contacts.spec.js new file mode 100644 index 000000000..252c5d667 --- /dev/null +++ b/e2e/paths/02-client-module/18_contacts.spec.js @@ -0,0 +1,37 @@ +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Client contacts', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Clark Kent'); + await page.accessToSection('client.card.contact'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should add a contact', async() => { + await page.waitToClick(selectors.clientContacts.addContactButton); + await page.clearInput(selectors.clientContacts.name); + await page.write(selectors.clientContacts.name, 'Ansible'); + await page.write(selectors.clientContacts.phone, 'FTL comms'); + await page.waitToClick(selectors.clientContacts.saveButton); + let result = await page.waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should delete de contact', async() => { + await page.waitToClick(selectors.clientContacts.deleteFirstPhone); + await page.waitToClick(selectors.clientContacts.saveButton); + let result = await page.waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); +}); From 80839c771ebe47442e799e9f2904b247dcd5324a Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 10 Feb 2020 12:57:00 +0100 Subject: [PATCH 47/95] updated a selector --- e2e/helpers/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 07aef93c1..99c78eea2 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -93,7 +93,7 @@ export default { newBankEntityBIC: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newBankEntity.bic"]', newBankEntityCode: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newBankEntity.id"]', acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]', - saveButton: `button[type=submit]`, + saveButton: 'vn-client-billing-data button[type=submit]', watcher: 'vn-client-billing-data vn-watcher' }, clientAddresses: { From f6674448f83d775cc211588cf6e13ddc73c1484d Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Mon, 10 Feb 2020 13:22:43 +0100 Subject: [PATCH 48/95] ticket/client.sms validations --- modules/client/front/sms/index.html | 5 ++++- modules/client/front/sms/index.js | 19 +++++++++++++++---- modules/client/front/sms/index.spec.js | 20 ++++++++++++++++++++ modules/client/front/sms/locale/es.yml | 4 +++- modules/ticket/front/sms/index.html | 5 ++++- modules/ticket/front/sms/index.js | 19 +++++++++++++++---- modules/ticket/front/sms/index.spec.js | 20 ++++++++++++++++++++ modules/ticket/front/sms/locale/es.yml | 4 +++- 8 files changed, 84 insertions(+), 12 deletions(-) diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index ac7a20651..facbb7694 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -8,7 +8,9 @@ + ng-model="$ctrl.sms.destination" + required="true" + rule> @@ -18,6 +20,7 @@ ng-model="$ctrl.sms.message" rows="5" maxlength="160" + required="true" rule> diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js index 1bf2fb99c..851ce1a66 100644 --- a/modules/client/front/sms/index.js +++ b/modules/client/front/sms/index.js @@ -28,12 +28,23 @@ class Controller extends Component { onResponse(response) { if (response === 'accept') { - this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => { - this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + try { + if (!this.sms.destination) + throw new Error(`The destination can't be empty`); + if (!this.sms.message) + throw new Error(`The message can't be empty`); - if (res.data) this.emit('send', {response: res.data}); - }); + this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => { + this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + + if (res.data) this.emit('send', {response: res.data}); + }); + } catch (e) { + this.vnApp.showError(this.$translate.instant(e.message)); + return false; + } } + return true; } } diff --git a/modules/client/front/sms/index.spec.js b/modules/client/front/sms/index.spec.js index c2a7eb935..26a597c17 100644 --- a/modules/client/front/sms/index.spec.js +++ b/modules/client/front/sms/index.spec.js @@ -30,6 +30,26 @@ describe('Client', () => { expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); }); + + it('should call onResponse without the destination and show an error snackbar', () => { + controller.sms = {destinationFk: 101, message: 'My SMS'}; + + spyOn(controller.vnApp, 'showError'); + + controller.onResponse('accept'); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The destination can't be empty`); + }); + + it('should call onResponse without the message and show an error snackbar', () => { + controller.sms = {destinationFk: 101, destination: 222222222}; + + spyOn(controller.vnApp, 'showError'); + + controller.onResponse('accept'); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The message can't be empty`); + }); }); describe('charactersRemaining()', () => { diff --git a/modules/client/front/sms/locale/es.yml b/modules/client/front/sms/locale/es.yml index f26c8ba24..4438e4fce 100644 --- a/modules/client/front/sms/locale/es.yml +++ b/modules/client/front/sms/locale/es.yml @@ -2,4 +2,6 @@ Send SMS: Enviar SMS Destination: Destinatario Message: Mensaje SMS sent!: ¡SMS enviado! -Characters remaining: Carácteres restantes \ No newline at end of file +Characters remaining: Carácteres restantes +The destination can't be empty: El destinatario no puede estar vacio +The message can't be empty: El mensaje no puede estar vacio \ No newline at end of file diff --git a/modules/ticket/front/sms/index.html b/modules/ticket/front/sms/index.html index ac7a20651..f74bc29e5 100644 --- a/modules/ticket/front/sms/index.html +++ b/modules/ticket/front/sms/index.html @@ -8,7 +8,9 @@ + ng-model="$ctrl.sms.destination" + required="true" + rule> @@ -18,6 +20,7 @@ ng-model="$ctrl.sms.message" rows="5" maxlength="160" + required="true" rule> diff --git a/modules/ticket/front/sms/index.js b/modules/ticket/front/sms/index.js index 1f2c7f9c0..0d639d46e 100644 --- a/modules/ticket/front/sms/index.js +++ b/modules/ticket/front/sms/index.js @@ -28,12 +28,23 @@ class Controller extends Component { onResponse(response) { if (response === 'accept') { - this.$http.post(`Tickets/${this.$params.id}/sendSms`, this.sms).then(res => { - this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + try { + if (!this.sms.destination) + throw new Error(`The destination can't be empty`); + if (!this.sms.message) + throw new Error(`The message can't be empty`); - if (res.data) this.emit('send', {response: res.data}); - }); + this.$http.post(`Tickets/${this.$params.id}/sendSms`, this.sms).then(res => { + this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + + if (res.data) this.emit('send', {response: res.data}); + }); + } catch (e) { + this.vnApp.showError(this.$translate.instant(e.message)); + return false; + } } + return true; } } diff --git a/modules/ticket/front/sms/index.spec.js b/modules/ticket/front/sms/index.spec.js index 5565c3623..d02b3f3eb 100644 --- a/modules/ticket/front/sms/index.spec.js +++ b/modules/ticket/front/sms/index.spec.js @@ -29,6 +29,26 @@ describe('Ticket', () => { expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); }); + + it('should call onResponse without the destination and show an error snackbar', () => { + controller.sms = {destinationFk: 101, message: 'My SMS'}; + + spyOn(controller.vnApp, 'showError'); + + controller.onResponse('accept'); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The destination can't be empty`); + }); + + it('should call onResponse without the message and show an error snackbar', () => { + controller.sms = {destinationFk: 101, destination: 222222222}; + + spyOn(controller.vnApp, 'showError'); + + controller.onResponse('accept'); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The message can't be empty`); + }); }); describe('charactersRemaining()', () => { diff --git a/modules/ticket/front/sms/locale/es.yml b/modules/ticket/front/sms/locale/es.yml index f26c8ba24..4438e4fce 100644 --- a/modules/ticket/front/sms/locale/es.yml +++ b/modules/ticket/front/sms/locale/es.yml @@ -2,4 +2,6 @@ Send SMS: Enviar SMS Destination: Destinatario Message: Mensaje SMS sent!: ¡SMS enviado! -Characters remaining: Carácteres restantes \ No newline at end of file +Characters remaining: Carácteres restantes +The destination can't be empty: El destinatario no puede estar vacio +The message can't be empty: El mensaje no puede estar vacio \ No newline at end of file From e1942875af67121a9ad7bef85bed992501fca7b2 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 10 Feb 2020 14:32:52 +0100 Subject: [PATCH 49/95] 1684 - Log transfer old values --- .../back/methods/ticket/transferSales.js | 57 +++++++++++-------- modules/ticket/front/sale/index.html | 8 +-- modules/worker/front/log/index.html | 8 +-- modules/worker/front/log/style.scss | 8 --- 4 files changed, 41 insertions(+), 40 deletions(-) diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 9d39453be..7aeb4bf56 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -62,11 +62,14 @@ module.exports = Self => { for (const sale of originalSales) map.set(sale.id, sale); - for (const sale of sales) { const originalSale = map.get(sale.id); - - let originalSaleQuantity = originalSale.quantity; + const originalSaleData = { // <-- Loopback modifies original instance on save + itemFk: originalSale.itemFk, + quantity: originalSale.quantity, + concept: originalSale.concept, + ticketFk: originalSale.ticketFk + }; if (sale.quantity == originalSale.quantity) { await models.Sale.updateAll({ @@ -77,39 +80,47 @@ module.exports = Self => { ticketId, originalSale, sale, options); } - let logTicketOrigin = { + // Log to original ticket + await models.TicketLog.create({ originFk: id, userFk: userId, action: 'update', changedModel: 'Ticket', - changedModelId: ticketId, - oldInstance: {item: sale.itemFk, - quantity: 0, - concept: sale.concept, - ticket: ticketId}, - newInstance: {item: sale.itemFk, + changedModelId: id, + oldInstance: { + item: originalSaleData.itemFk, + quantity: originalSaleData.quantity, + concept: originalSaleData.concept, + ticket: originalSaleData.ticketFk + }, + newInstance: { + item: sale.itemFk, quantity: sale.quantity, concept: sale.concept, - ticket: ticketId} - }; - await models.TicketLog.create(logTicketOrigin, options); + ticket: ticketId + } + }, options); - let logTicketDestination = { + // Log to destination ticket + await models.TicketLog.create({ originFk: ticketId, userFk: userId, action: 'update', changedModel: 'Ticket', changedModelId: ticketId, - oldInstance: {item: sale.itemFk, - quantity: originalSaleQuantity, + oldInstance: { + item: originalSaleData.itemFk, + quantity: originalSaleData.quantity, + concept: originalSaleData.concept, + ticket: originalSaleData.ticketFk + }, + newInstance: { + item: sale.itemFk, + quantity: sale.quantity, concept: sale.concept, - ticket: id}, - newInstance: {item: sale.itemFk, - quantity: originalSaleQuantity - sale.quantity, - concept: sale.concept, - ticket: id} - }; - await models.TicketLog.create(logTicketDestination, options); + ticket: ticketId + } + }, options); } const isTicketEmpty = await models.Ticket.isEmpty(id, options); diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 42699d8d1..89f3218b1 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -324,14 +324,12 @@ - - - + diff --git a/modules/worker/front/log/index.html b/modules/worker/front/log/index.html index 9624d4aed..8aa693924 100644 --- a/modules/worker/front/log/index.html +++ b/modules/worker/front/log/index.html @@ -14,18 +14,18 @@ - Date + Date Author Model Action - Name + Name Before After - + {{::log.creationDate | date:'dd/MM/yyyy HH:mm'}}
@@ -63,7 +63,7 @@ {{::$ctrl.actionsText[log.action]}} - + {{::log.changedModelValue}} diff --git a/modules/worker/front/log/style.scss b/modules/worker/front/log/style.scss index 0943cbc77..0d2d93914 100644 --- a/modules/worker/front/log/style.scss +++ b/modules/worker/front/log/style.scss @@ -14,14 +14,6 @@ vn-log { color: $color-font; } - .after, .before { - max-width: 250px; - } - - vn-table .firstColumn { - min-width: 150px - } - @media screen and (max-width: 1570px) { vn-table .expendable { display: none; From d1c8c8ad5884496fcd2a31952312bfe2541ecd0e Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Mon, 10 Feb 2020 13:22:43 +0100 Subject: [PATCH 50/95] ticket/client.sms validations --- modules/client/front/sms/index.html | 5 ++++- modules/client/front/sms/index.js | 19 +++++++++++++++---- modules/client/front/sms/index.spec.js | 20 ++++++++++++++++++++ modules/client/front/sms/locale/es.yml | 4 +++- modules/ticket/front/sms/index.html | 5 ++++- modules/ticket/front/sms/index.js | 19 +++++++++++++++---- modules/ticket/front/sms/index.spec.js | 20 ++++++++++++++++++++ modules/ticket/front/sms/locale/es.yml | 4 +++- 8 files changed, 84 insertions(+), 12 deletions(-) diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index ac7a20651..facbb7694 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -8,7 +8,9 @@ + ng-model="$ctrl.sms.destination" + required="true" + rule> @@ -18,6 +20,7 @@ ng-model="$ctrl.sms.message" rows="5" maxlength="160" + required="true" rule> diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js index 1bf2fb99c..851ce1a66 100644 --- a/modules/client/front/sms/index.js +++ b/modules/client/front/sms/index.js @@ -28,12 +28,23 @@ class Controller extends Component { onResponse(response) { if (response === 'accept') { - this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => { - this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + try { + if (!this.sms.destination) + throw new Error(`The destination can't be empty`); + if (!this.sms.message) + throw new Error(`The message can't be empty`); - if (res.data) this.emit('send', {response: res.data}); - }); + this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => { + this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + + if (res.data) this.emit('send', {response: res.data}); + }); + } catch (e) { + this.vnApp.showError(this.$translate.instant(e.message)); + return false; + } } + return true; } } diff --git a/modules/client/front/sms/index.spec.js b/modules/client/front/sms/index.spec.js index c2a7eb935..26a597c17 100644 --- a/modules/client/front/sms/index.spec.js +++ b/modules/client/front/sms/index.spec.js @@ -30,6 +30,26 @@ describe('Client', () => { expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); }); + + it('should call onResponse without the destination and show an error snackbar', () => { + controller.sms = {destinationFk: 101, message: 'My SMS'}; + + spyOn(controller.vnApp, 'showError'); + + controller.onResponse('accept'); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The destination can't be empty`); + }); + + it('should call onResponse without the message and show an error snackbar', () => { + controller.sms = {destinationFk: 101, destination: 222222222}; + + spyOn(controller.vnApp, 'showError'); + + controller.onResponse('accept'); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The message can't be empty`); + }); }); describe('charactersRemaining()', () => { diff --git a/modules/client/front/sms/locale/es.yml b/modules/client/front/sms/locale/es.yml index f26c8ba24..4438e4fce 100644 --- a/modules/client/front/sms/locale/es.yml +++ b/modules/client/front/sms/locale/es.yml @@ -2,4 +2,6 @@ Send SMS: Enviar SMS Destination: Destinatario Message: Mensaje SMS sent!: ¡SMS enviado! -Characters remaining: Carácteres restantes \ No newline at end of file +Characters remaining: Carácteres restantes +The destination can't be empty: El destinatario no puede estar vacio +The message can't be empty: El mensaje no puede estar vacio \ No newline at end of file diff --git a/modules/ticket/front/sms/index.html b/modules/ticket/front/sms/index.html index ac7a20651..f74bc29e5 100644 --- a/modules/ticket/front/sms/index.html +++ b/modules/ticket/front/sms/index.html @@ -8,7 +8,9 @@ + ng-model="$ctrl.sms.destination" + required="true" + rule> @@ -18,6 +20,7 @@ ng-model="$ctrl.sms.message" rows="5" maxlength="160" + required="true" rule> diff --git a/modules/ticket/front/sms/index.js b/modules/ticket/front/sms/index.js index 1f2c7f9c0..0d639d46e 100644 --- a/modules/ticket/front/sms/index.js +++ b/modules/ticket/front/sms/index.js @@ -28,12 +28,23 @@ class Controller extends Component { onResponse(response) { if (response === 'accept') { - this.$http.post(`Tickets/${this.$params.id}/sendSms`, this.sms).then(res => { - this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + try { + if (!this.sms.destination) + throw new Error(`The destination can't be empty`); + if (!this.sms.message) + throw new Error(`The message can't be empty`); - if (res.data) this.emit('send', {response: res.data}); - }); + this.$http.post(`Tickets/${this.$params.id}/sendSms`, this.sms).then(res => { + this.vnApp.showMessage(this.$translate.instant('SMS sent!')); + + if (res.data) this.emit('send', {response: res.data}); + }); + } catch (e) { + this.vnApp.showError(this.$translate.instant(e.message)); + return false; + } } + return true; } } diff --git a/modules/ticket/front/sms/index.spec.js b/modules/ticket/front/sms/index.spec.js index 5565c3623..d02b3f3eb 100644 --- a/modules/ticket/front/sms/index.spec.js +++ b/modules/ticket/front/sms/index.spec.js @@ -29,6 +29,26 @@ describe('Ticket', () => { expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); }); + + it('should call onResponse without the destination and show an error snackbar', () => { + controller.sms = {destinationFk: 101, message: 'My SMS'}; + + spyOn(controller.vnApp, 'showError'); + + controller.onResponse('accept'); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The destination can't be empty`); + }); + + it('should call onResponse without the message and show an error snackbar', () => { + controller.sms = {destinationFk: 101, destination: 222222222}; + + spyOn(controller.vnApp, 'showError'); + + controller.onResponse('accept'); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The message can't be empty`); + }); }); describe('charactersRemaining()', () => { diff --git a/modules/ticket/front/sms/locale/es.yml b/modules/ticket/front/sms/locale/es.yml index f26c8ba24..4438e4fce 100644 --- a/modules/ticket/front/sms/locale/es.yml +++ b/modules/ticket/front/sms/locale/es.yml @@ -2,4 +2,6 @@ Send SMS: Enviar SMS Destination: Destinatario Message: Mensaje SMS sent!: ¡SMS enviado! -Characters remaining: Carácteres restantes \ No newline at end of file +Characters remaining: Carácteres restantes +The destination can't be empty: El destinatario no puede estar vacio +The message can't be empty: El mensaje no puede estar vacio \ No newline at end of file From d26597c395837415f2023a54b8000fc0925bbe00 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Mon, 10 Feb 2020 09:36:40 +0100 Subject: [PATCH 51/95] fix ticket.sale sms --- modules/ticket/front/sale/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 998f481ea..42699d8d1 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -370,10 +370,10 @@ - - + Date: Tue, 11 Feb 2020 08:19:03 +0100 Subject: [PATCH 52/95] 1684 - Log old quantity value --- .../back/methods/ticket/transferSales.js | 8 +++---- modules/ticket/front/sale/index.html | 24 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 7aeb4bf56..c2257bf09 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -157,9 +157,9 @@ module.exports = Self => { // Update original sale const rest = originalSale.quantity - sale.quantity; - const updatedSale = await models.Sale.updateAll({ - id: sale.id - }, {quantity: rest}, options); + const originalInstance = await models.Sale.findById(sale.id, options); + await originalInstance.updateAttribute('quantity', rest, options); + // Clone sale with new quantity const newSale = originalSale; newSale.id = undefined; @@ -180,6 +180,6 @@ module.exports = Self => { await models.SaleComponent.create(newComponents, options); - return updatedSale; + return originalInstance; } }; diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 89f3218b1..224392deb 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -323,17 +323,19 @@ - - - - - - +
+ + + + + + +
Date: Tue, 11 Feb 2020 09:00:06 +0100 Subject: [PATCH 53/95] 2093 - Mention destinatary sending to department room --- back/methods/chat/sendCheckingPresence.js | 6 +++--- back/methods/chat/spec/sendCheckingPresence.spec.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index ac5836af3..3af0212c3 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -41,11 +41,11 @@ module.exports = Self => { }); const department = workerDepartment.department(); const channelName = department.chatName; - room = `#${channelName}`; - if (channelName) + if (channelName) { + message = `@${account.name} => ${message}`; room = `#${channelName}`; - else room = `@${account.name}`; + } else room = `@${account.name}`; } return Self.send(ctx, room, message); diff --git a/back/methods/chat/spec/sendCheckingPresence.spec.js b/back/methods/chat/spec/sendCheckingPresence.spec.js index 12a163962..1523cb1d0 100644 --- a/back/methods/chat/spec/sendCheckingPresence.spec.js +++ b/back/methods/chat/spec/sendCheckingPresence.spec.js @@ -38,7 +38,7 @@ describe('chat sendCheckingPresence()', () => { expect(response.statusCode).toEqual(200); expect(response.message).toEqual('Fake notification sent'); - expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', 'I changed something'); + expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', '@HankPym => I changed something'); }); it(`should call to send() method with the worker username when the worker is working`, async() => { From 7b958ba929c3a44a6b0114be3442f917351c38d1 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 11 Feb 2020 09:14:40 +0100 Subject: [PATCH 54/95] Changes --- back/methods/chat/sendCheckingPresence.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 3af0212c3..70b4da58f 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -30,10 +30,7 @@ module.exports = Self => { const query = `SELECT worker_isWorking(?) isWorking`; const [result] = await Self.rawSql(query, [workerId]); - let room; - if (result.isWorking) - room = `@${account.name}`; - else { + if (!result.isWorking) { const workerDepartment = await models.WorkerDepartment.findById(workerId, { include: { relation: 'department' @@ -42,12 +39,10 @@ module.exports = Self => { const department = workerDepartment.department(); const channelName = department.chatName; - if (channelName) { - message = `@${account.name} => ${message}`; - room = `#${channelName}`; - } else room = `@${account.name}`; + if (channelName) + return Self.send(ctx, `#${channelName}`, `@${account.name} => ${message}`); } - return Self.send(ctx, room, message); + return Self.send(ctx, `@${account.name}`, message); }; }; From a82f7d758451e76f53a2102c08a74773a7f4cba1 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 7 Feb 2020 11:50:09 +0100 Subject: [PATCH 55/95] #2083 Login on auth error --- back/methods/chat/send.js | 1 + 1 file changed, 1 insertion(+) diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js index c36178b0f..2b00df727 100644 --- a/back/methods/chat/send.js +++ b/back/methods/chat/send.js @@ -46,6 +46,7 @@ module.exports = Self => { }).catch(async error => { if (error.statusCode === 401 && !this.resendAttempted) { this.resendAttempted = true; + this.auth = null; return sendMessage(sender, channel, message); } From 375807dec4fdf9fa7def3dc12edd7244dbd0a89b Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 7 Feb 2020 14:04:18 +0100 Subject: [PATCH 56/95] 2089 - Removed mention from message --- back/methods/chat/send.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js index 2b00df727..b0a9431c7 100644 --- a/back/methods/chat/send.js +++ b/back/methods/chat/send.js @@ -31,7 +31,7 @@ module.exports = Self => { const recipient = to.replace('@', ''); if (sender.name != recipient) - return sendMessage(sender, to, `@${sender.name}: ${message} `); + return sendMessage(sender, to, message); }; async function sendMessage(sender, channel, message) { @@ -42,6 +42,7 @@ module.exports = Self => { return sendAuth(uri, { 'channel': channel, 'avatar': avatar, + 'alias': sender.nickname, 'text': message }).catch(async error => { if (error.statusCode === 401 && !this.resendAttempted) { From d481b0c71fd3e16320fa2c8c71ba93ac9848f267 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 11 Feb 2020 09:00:06 +0100 Subject: [PATCH 57/95] 2093 - Mention destinatary sending to department room --- back/methods/chat/sendCheckingPresence.js | 6 +++--- back/methods/chat/spec/sendCheckingPresence.spec.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index ac5836af3..3af0212c3 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -41,11 +41,11 @@ module.exports = Self => { }); const department = workerDepartment.department(); const channelName = department.chatName; - room = `#${channelName}`; - if (channelName) + if (channelName) { + message = `@${account.name} => ${message}`; room = `#${channelName}`; - else room = `@${account.name}`; + } else room = `@${account.name}`; } return Self.send(ctx, room, message); diff --git a/back/methods/chat/spec/sendCheckingPresence.spec.js b/back/methods/chat/spec/sendCheckingPresence.spec.js index 12a163962..1523cb1d0 100644 --- a/back/methods/chat/spec/sendCheckingPresence.spec.js +++ b/back/methods/chat/spec/sendCheckingPresence.spec.js @@ -38,7 +38,7 @@ describe('chat sendCheckingPresence()', () => { expect(response.statusCode).toEqual(200); expect(response.message).toEqual('Fake notification sent'); - expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', 'I changed something'); + expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', '@HankPym => I changed something'); }); it(`should call to send() method with the worker username when the worker is working`, async() => { From df21309e0a5734bec3a814a946ea106d8eb8b294 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 11 Feb 2020 09:14:40 +0100 Subject: [PATCH 58/95] Changes --- back/methods/chat/sendCheckingPresence.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 3af0212c3..70b4da58f 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -30,10 +30,7 @@ module.exports = Self => { const query = `SELECT worker_isWorking(?) isWorking`; const [result] = await Self.rawSql(query, [workerId]); - let room; - if (result.isWorking) - room = `@${account.name}`; - else { + if (!result.isWorking) { const workerDepartment = await models.WorkerDepartment.findById(workerId, { include: { relation: 'department' @@ -42,12 +39,10 @@ module.exports = Self => { const department = workerDepartment.department(); const channelName = department.chatName; - if (channelName) { - message = `@${account.name} => ${message}`; - room = `#${channelName}`; - } else room = `@${account.name}`; + if (channelName) + return Self.send(ctx, `#${channelName}`, `@${account.name} => ${message}`); } - return Self.send(ctx, room, message); + return Self.send(ctx, `@${account.name}`, message); }; }; From dbcc6410167ac8ca3f96c848fc2d50e16fc8eb38 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 11 Feb 2020 11:34:54 +0100 Subject: [PATCH 59/95] 1996 - Datalist component --- front/core/components/datalist/index.html | 36 +++ front/core/components/datalist/index.js | 295 ++++++++++++++++++++++ front/core/components/index.js | 1 + 3 files changed, 332 insertions(+) create mode 100644 front/core/components/datalist/index.html create mode 100644 front/core/components/datalist/index.js diff --git a/front/core/components/datalist/index.html b/front/core/components/datalist/index.html new file mode 100644 index 000000000..15c0f0e8a --- /dev/null +++ b/front/core/components/datalist/index.html @@ -0,0 +1,36 @@ +
+
+
+
+
+
+
+ +
+
+ + + + +
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/front/core/components/datalist/index.js b/front/core/components/datalist/index.js new file mode 100644 index 000000000..06fe9492e --- /dev/null +++ b/front/core/components/datalist/index.js @@ -0,0 +1,295 @@ +import ngModule from '../../module'; +import ArrayModel from '../array-model/array-model'; +import CrudModel from '../crud-model/crud-model'; +import {mergeWhere} from 'vn-loopback/util/filter'; +import Textfield from '../textfield/textfield'; + +export default class Datalist extends Textfield { + constructor($element, $scope, $compile, $transclude) { + super($element, $scope, $compile); + this.$transclude = $transclude; + this.searchDelay = 300; + this._selection = null; + + this.buildInput('text'); + + this.input.setAttribute('autocomplete', 'off'); + } + + get field() { + return super.field; + } + + set field(value) { + let oldValue = super.field; + super.field = value; + + value = value == '' || value == null ? null : value; + oldValue = oldValue == '' || oldValue == null ? null : oldValue; + + this.refreshSelection(); + + if (!value || value === oldValue && this.modelData != null) return; + + if (this.validSelection(value)) return; + + if (!oldValue) + return this.fetchSelection(); + + this.$timeout.cancel(this.searchTimeout); + + if (this.model) { + this.model.clear(); + if (!this.data) { + this.searchTimeout = this.$timeout(() => { + this.refreshModel(); + this.searchTimeout = null; + }, this.field != null ? this.searchDelay : 0); + } else + this.refreshModel(); + } + } + + validSelection(selection) { + return this.modelData && this.modelData.find(item => { + return item[this.valueField] == selection; + }); + } + + refreshSelection() { + const selectedItem = this.validSelection(this.field); + + if (this.field == null) { + this.selection = null; + return; + } + + if (selectedItem) + this.selection = selectedItem; + } + + get name() { + return super.name; + } + + set name(value) { + super.name = value; + + this.input.setAttribute('list', `datalist-${value}`); + } + + get modelData() { + return this.model ? this.model.data : null; + } + + get url() { + return this._url; + } + + set url(value) { + this._url = value; + if (value) { + this.model = new CrudModel(this.$q, this.$http); + this.model.autoLoad = false; + this.model.url = value; + this.model.$onInit(); + } + } + + get data() { + return this._data; + } + + set data(value) { + this._data = value; + if (value) { + this.model = new ArrayModel(this.$q, this.$filter); + this.model.autoLoad = false; + this.model.orgData = value; + this.model.$onInit(); + } + } + + /** + * @type {Object} The selected data object, you can use this property + * to prevent requests to display the initial value. + */ + get selection() { + return this._selection; + } + + set selection(value) { + this._selection = value; + } + + refreshModel() { + let model = this.model; + + let order; + if (this.order) + order = this.order; + else if (this.showField) + order = `${this.showField} ASC`; + + let filter = { + order, + limit: this.limit || 30 + }; + + if (model instanceof CrudModel) { + let searchExpr = this._field == null + ? null + : this.searchFunction({$search: this._field}); + + Object.assign(filter, { + fields: this.getFields(), + include: this.include, + where: mergeWhere(this.where, searchExpr) + }); + } else if (model instanceof ArrayModel) { + if (this._field != null) + filter.where = this.searchFunction({$search: this._field}); + } + + return this.model.applyFilter(filter).then(() => { + if (this.validSelection(this.field)) { + this.refreshSelection(); + this.destroyList(); + } else + this.buildList(); + + // this.emit('select', {selection}); + }); + } + + searchFunction(scope) { + if (this.model instanceof CrudModel) + return {[this.showField]: {like: `%${scope.$search}%`}}; + if (this.model instanceof ArrayModel) + return {[this.showField]: scope.$search}; + } + + fetchSelection() { + const data = this.modelData; + + if (data) { + let selection = data.find(i => this.validSelection(i[this.valueField])); + if (selection) return selection; + } + + if (this.url) { + let where = {}; + + if (this.multiple) + where[this.valueField] = {inq: this.field}; + else + where[this.valueField] = this.field; + + where = mergeWhere(where, this.fetchFunction); + + let filter = { + fields: this.getFields(), + where: where + }; + + let json = encodeURIComponent(JSON.stringify(filter)); + this.$http.get(`${this.url}?filter=${json}`).then( + json => this.onSelectionRequest(json.data), + () => this.onSelectionRequest() + ); + } + + return null; + } + + onSelectionRequest(data) { + if (data && data.length > 0) { + if (this.multiple) + this.selection = data; + else + this.selection = data[0]; + } else + this.selection = null; + } + + getFields() { + const fields = []; + fields.push(this.valueField); + fields.push(this.showField); + + if (this.fields) { + for (let field of this.fields) + fields.push(field); + } + + return fields; + } + + buildList() { + const list = this.$.datalist; + const data = this.modelData; + + this.destroyList(); + + const hasTemplate = this.$transclude && this.$transclude.isSlotFilled('tplItem'); + const fragment = this.document.createDocumentFragment(); + + if (data) { + for (let item of data) { + const option = document.createElement('option'); + option.setAttribute('value', item[this.valueField]); + + if (hasTemplate) { + this.$transclude((clone, scope) => { + Object.assign(scope, item); + option.appendChild(clone[0]); + this.scopes.push(scope); + }, null, 'tplItem'); + } else { + const text = document.createTextNode(item[this.showField]); + option.appendChild(text); + } + + fragment.appendChild(option); + } + + list.appendChild(fragment); + } + } + + destroyList() { + const list = this.$.datalist; + if (list) + list.innerHTML = ''; + + if (this.scopes) { + for (let scope of this.scopes) + scope.$destroy(); + } + + this.scopes = []; + } +} + +Datalist.$inject = ['$element', '$scope', '$compile', '$transclude']; + +ngModule.vnComponent('vnDatalist', { + controller: Datalist, + template: require('./index.html'), + bindings: { + showField: '@?', + valueField: '@?', + selection: '=?', + multiple: ' Date: Tue, 11 Feb 2020 11:53:26 +0100 Subject: [PATCH 60/95] changes --- front/core/components/datalist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/core/components/datalist/index.js b/front/core/components/datalist/index.js index 06fe9492e..d5feb1893 100644 --- a/front/core/components/datalist/index.js +++ b/front/core/components/datalist/index.js @@ -158,7 +158,7 @@ export default class Datalist extends Textfield { } else this.buildList(); - // this.emit('select', {selection}); + this.emit('select', {selection}); }); } From 1d73d9f89da5dd74a38cbd12c2e71b4bb7beb0f2 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Tue, 11 Feb 2020 13:25:41 +0100 Subject: [PATCH 61/95] refactor campaing report --- modules/client/front/descriptor/index.html | 33 ++++++++++++- modules/client/front/descriptor/index.js | 20 ++++++-- modules/client/front/descriptor/locale/es.yml | 3 +- .../campaign-metrics/campaign-metrics.html | 46 ++++++++++++------- 4 files changed, 80 insertions(+), 22 deletions(-) diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html index 722802c66..30777bcda 100644 --- a/modules/client/front/descriptor/index.html +++ b/modules/client/front/descriptor/index.html @@ -70,4 +70,35 @@
- \ No newline at end of file + + + +
+
+ From date +
+ + +
+ To date +
+ + +
+
+ + + + +
\ No newline at end of file diff --git a/modules/client/front/descriptor/index.js b/modules/client/front/descriptor/index.js index 332d87deb..3ef1e7616 100644 --- a/modules/client/front/descriptor/index.js +++ b/modules/client/front/descriptor/index.js @@ -2,12 +2,13 @@ import ngModule from '../module'; import Component from 'core/lib/component'; class Controller extends Component { - constructor($element, $) { + constructor($element, $, $httpParamSerializer) { super($element, $); - + this.$httpParamSerializer = $httpParamSerializer; this.moreOptions = [ {name: 'Simple ticket', callback: this.newTicket}, {name: 'Send SMS', callback: this.showSMSDialog}, + {name: 'Send consumer report', callback: this.showConsumerReportDialog} ]; } @@ -63,9 +64,22 @@ class Controller extends Component { }; this.$.sms.open(); } + + showConsumerReportDialog() { + this.$.consumerReportDialog.show(); + } + + sendConsumerReport(response) { + if (response === 'accept') { + const data = {from: this.from, to: this.to, clientId: this.client.id}; + const serializedParams = this.$httpParamSerializer(data); + const url = `api/report/campaign-metrics?${serializedParams}`; + window.open(url); + } + } } -Controller.$inject = ['$element', '$scope']; +Controller.$inject = ['$element', '$scope', '$httpParamSerializer']; ngModule.component('vnClientDescriptor', { template: require('./index.html'), diff --git a/modules/client/front/descriptor/locale/es.yml b/modules/client/front/descriptor/locale/es.yml index 5ae6935d0..23cd397e5 100644 --- a/modules/client/front/descriptor/locale/es.yml +++ b/modules/client/front/descriptor/locale/es.yml @@ -1 +1,2 @@ -Simple ticket: Ticket simple \ No newline at end of file +Simple ticket: Ticket simple +Sendconsumer report: Enviar informe de consumo \ No newline at end of file diff --git a/print/templates/reports/campaign-metrics/campaign-metrics.html b/print/templates/reports/campaign-metrics/campaign-metrics.html index 5e4bc7d08..7a0f30948 100644 --- a/print/templates/reports/campaign-metrics/campaign-metrics.html +++ b/print/templates/reports/campaign-metrics/campaign-metrics.html @@ -57,27 +57,39 @@ - + - - - - - - + +
{{$t('Code')}}{{$t('Code')}} {{$t('Quantity')}} {{$t('Concept')}}
{{sale.itemFk}}{{Math.trunc(sale.subtotal)}} - {{sale.concept}} {{sale.subName | uppercase}} -
- {{sale.tag5}} - {{sale.value5}} - {{sale.tag6}} - {{sale.value6}} - {{sale.tag7}} - {{sale.value7}} -
-
From 5375952778d19681089c9b8ba5648548a705c143 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Tue, 11 Feb 2020 13:52:05 +0100 Subject: [PATCH 62/95] translate --- modules/client/front/descriptor/locale/es.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/client/front/descriptor/locale/es.yml b/modules/client/front/descriptor/locale/es.yml index 23cd397e5..293191ec5 100644 --- a/modules/client/front/descriptor/locale/es.yml +++ b/modules/client/front/descriptor/locale/es.yml @@ -1,2 +1,2 @@ Simple ticket: Ticket simple -Sendconsumer report: Enviar informe de consumo \ No newline at end of file +Send consumer report: Enviar informe de consumo \ No newline at end of file From c78c154ab0161d4e35e10b2dd4aa528cd99f661f Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 11 Feb 2020 14:41:59 +0100 Subject: [PATCH 63/95] Added datalist --- front/core/components/datalist/index.js | 2 - .../order/back/methods/order/catalogFilter.js | 1 + modules/order/front/catalog/index.html | 13 ++-- modules/order/front/catalog/index.js | 74 +++++++++++-------- modules/order/front/catalog/index.spec.js | 55 ++++++++++++-- modules/order/front/locale/es.yml | 1 + 6 files changed, 102 insertions(+), 44 deletions(-) diff --git a/front/core/components/datalist/index.js b/front/core/components/datalist/index.js index d5feb1893..0964a1480 100644 --- a/front/core/components/datalist/index.js +++ b/front/core/components/datalist/index.js @@ -157,8 +157,6 @@ export default class Datalist extends Textfield { this.destroyList(); } else this.buildList(); - - this.emit('select', {selection}); }); } diff --git a/modules/order/back/methods/order/catalogFilter.js b/modules/order/back/methods/order/catalogFilter.js index 3814aa12d..114cd2786 100644 --- a/modules/order/back/methods/order/catalogFilter.js +++ b/modules/order/back/methods/order/catalogFilter.js @@ -162,6 +162,7 @@ module.exports = Self => { `SELECT it.tagFk, it.itemFk, + it.value, t.name FROM tmp.ticketCalculateItem tci JOIN vn.itemTag it ON it.itemFk = tci.itemFk diff --git a/modules/order/front/catalog/index.html b/modules/order/front/catalog/index.html index 5cc72e3c8..37767e81b 100644 --- a/modules/order/front/catalog/index.html +++ b/modules/order/front/catalog/index.html @@ -85,12 +85,15 @@ - + show-field="value" + value-field="value" + label="Search tag"> @@ -101,7 +104,7 @@ style="cursor: pointer;"> - + { - // Add new tag filters - item.tags.forEach(itemTag => { - const alreadyAdded = newFilterList.findIndex(filter => { - return filter.field == itemTag.tagFk; - }); - - if (alreadyAdded == -1) { - newFilterList.push({ - name: itemTag.name, - field: itemTag.tagFk, - isTag: true - }); - } - }); - }); - - // Add default filters - Replaces tags with same name - this.defaultOrderFields.forEach(orderField => { - const index = newFilterList.findIndex(newfield => { - return newfield.name == orderField.name; - }); - - if (index > -1) - newFilterList[index] = orderField; - else - newFilterList.push(orderField); - }); - - this.orderFields = newFilterList; + this.buildTagsFilter(value); + this.buildOrderFilter(value); } get categoryId() { @@ -273,6 +244,45 @@ class Controller { this.$state.go(this.$state.current.name, params); } + + // Builds the tags filter + buildTagsFilter(items) { + const tagValues = []; + items.forEach(item => { + item.tags.forEach(itemTag => { + const alreadyAdded = tagValues.findIndex(tag => { + return tag.value == itemTag.value; + }); + + if (alreadyAdded == -1) + tagValues.push(itemTag); + }); + }); + this.tagValues = tagValues; + } + + // Builds the order filter + buildOrderFilter(items) { + const tags = []; + items.forEach(item => { + item.tags.forEach(itemTag => { + const alreadyAdded = tags.findIndex(tag => { + return tag.field == itemTag.tagFk; + }); + + if (alreadyAdded == -1) { + tags.push({ + name: itemTag.name, + field: itemTag.tagFk, + isTag: true + }); + } + }); + }); + let newFilterList = [].concat(this.defaultOrderFields); + newFilterList = newFilterList.concat(tags); + this.orderFields = newFilterList; + } } Controller.$inject = ['$http', '$scope', '$state', '$compile', '$transitions']; diff --git a/modules/order/front/catalog/index.spec.js b/modules/order/front/catalog/index.spec.js index dd9e13257..01da61800 100644 --- a/modules/order/front/catalog/index.spec.js +++ b/modules/order/front/catalog/index.spec.js @@ -37,16 +37,19 @@ describe('Order', () => { describe('items() setter', () => { it(`should return an object with order params`, () => { - let expectedResult = [{field: 'showOrder, price', name: 'Color'}]; - let unexpectedResult = [{tagFk: 5, name: 'Color'}]; - controller.items = [{id: 1, name: 'My Item', tags: [ + spyOn(controller, 'buildTagsFilter'); + spyOn(controller, 'buildOrderFilter').and.callThrough(); + const expectedResult = [{field: 'showOrder, price', name: 'Color and price'}]; + const items = [{id: 1, name: 'My Item', tags: [ {tagFk: 4, name: 'Length'}, {tagFk: 5, name: 'Color'} ]}]; + controller.items = items; - expect(controller.orderFields.length).toEqual(5); + expect(controller.orderFields.length).toEqual(6); expect(controller.orderFields).toEqual(jasmine.arrayContaining(expectedResult)); - expect(controller.orderFields).not.toEqual(jasmine.arrayContaining(unexpectedResult)); + expect(controller.buildTagsFilter).toHaveBeenCalledWith(items); + expect(controller.buildOrderFilter).toHaveBeenCalledWith(items); }); }); @@ -222,6 +225,48 @@ describe('Order', () => { expect(controller.$.model.addFilter).toHaveBeenCalledWith(null, expectedOrder); }); }); + + describe('buildTagsFilter()', () => { + it(`should create an array of non repeated tag values and then set the tagValues property`, () => { + const items = [ + { + id: 1, name: 'My Item 1', tags: [ + {tagFk: 4, name: 'Length', value: 1}, + {tagFk: 5, name: 'Color', value: 'red'} + ] + }, + { + id: 2, name: 'My Item 2', tags: [ + {tagFk: 4, name: 'Length', value: 1}, + {tagFk: 5, name: 'Color', value: 'blue'} + ] + }]; + controller.buildTagsFilter(items); + + expect(controller.tagValues.length).toEqual(3); + }); + }); + + describe('buildOrderFilter()', () => { + it(`should create an array of non repeated tags plus default filters and then set the orderFields property`, () => { + const items = [ + { + id: 1, name: 'My Item 1', tags: [ + {tagFk: 4, name: 'Length'}, + {tagFk: 5, name: 'Color'} + ] + }, + { + id: 2, name: 'My Item 2', tags: [ + {tagFk: 5, name: 'Color'}, + {tagFk: 6, name: 'Relevancy'} + ] + }]; + controller.buildOrderFilter(items); + + expect(controller.orderFields.length).toEqual(7); + }); + }); }); }); diff --git a/modules/order/front/locale/es.yml b/modules/order/front/locale/es.yml index 0ada37bfd..565d4f251 100644 --- a/modules/order/front/locale/es.yml +++ b/modules/order/front/locale/es.yml @@ -16,6 +16,7 @@ Item id: Id de artículo Order by: Ordenar por Order: Orden Price: Precio +Color and price: Color y precio Ascendant: Ascendente Descendant: Descendente Created from: Creado desde From 14cee74ae24bda98f7bdc93c23e3950e4e4eb207 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 12 Feb 2020 07:21:53 +0100 Subject: [PATCH 64/95] #2024 e2e travel.thermograph + refactors --- e2e/dms/ecc/3.jpeg | Bin 0 -> 13518 bytes e2e/helpers/extensions.js | 16 ++++-- e2e/helpers/selectors.js | 7 +++ .../01_create_client.spec.js | 2 - .../02_edit_basic_data.spec.js | 6 +- .../03_edit_fiscal_data.spec.js | 2 +- .../04_edit_billing_data.spec.js | 0 .../05_add_address.spec.js | 0 .../06_add_address_notes.spec.js | 0 .../07_edit_web_access.spec.js | 0 .../08_add_notes.spec.js | 0 .../09_add_credit.spec.js | 2 - .../10_add_greuge.spec.js | 0 .../11_mandate.spec.js | 0 .../12_lock_of_verified_data.spec.js | 0 .../13_log.spec.js | 0 .../14_balance.spec.js | 2 - .../15_user_config.spec.js | 2 +- .../16_web_payment.spec.js | 0 .../17_dms.spec.js | 0 .../18_contacts.spec.js | 0 .../01_basicData.spec.js | 0 .../02_time_control.spec.js | 0 .../03_pbx.spec.js | 0 .../01_summary.spec.js | 0 .../02_basic_data.spec.js | 1 - .../03_tax.spec.js | 0 .../04_tags.spec.js | 0 .../05_niche.spec.js | 0 .../06_botanical.spec.js | 0 .../07_barcode.spec.js | 0 .../08_create_and_clone.spec.js | 1 - .../09_regularize.spec.js | 1 - .../10_item_index.spec.js | 0 .../11_item_log.spec.js | 0 .../12_descriptor.spec.js | 0 .../01-sale/01_list_sales.spec.js | 0 .../01-sale/02_edit_sale.spec.js | 0 .../01_observations.spec.js | 2 +- .../02_expeditions_and_log.spec.js | 0 .../04_packages.spec.js | 0 .../05_tracking_state.spec.js | 0 .../06_basic_data_steps.spec.js | 0 .../08_components.spec.js | 0 .../09_weekly.spec.js | 3 - .../10_request.spec.js | 0 .../11_diary.spec.js | 0 .../12_descriptor.spec.js | 2 - .../13_services.spec.js | 3 +- .../14_create_ticket.spec.js | 0 .../15_create_ticket_from_client.spec.js | 1 - .../16_summary.spec.js | 0 .../01_basic_data.spec.js | 0 .../02_development.spec.js | 2 +- .../03_detail.spec.js | 0 .../04_claim_action.spec.js | 0 .../05_summary.spec.js | 0 .../06_descriptor.spec.js | 1 - .../01_edit_basic_data.spec.js | 4 +- .../02_catalog.spec.js | 2 - .../03_lines.spec.js | 0 .../01_create.spec.js | 0 .../02_basic_data.spec.js | 2 +- .../03_tickets.spec.js | 0 .../01_summary.spec.js | 1 - .../02_descriptor.spec.js | 2 - e2e/paths/10-travel/01_thermograph.spec.js | 52 ++++++++++++++++++ gulpfile.js | 3 +- 68 files changed, 83 insertions(+), 39 deletions(-) create mode 100644 e2e/dms/ecc/3.jpeg rename e2e/paths/{02-client-module => 02-client}/01_create_client.spec.js (98%) rename e2e/paths/{02-client-module => 02-client}/02_edit_basic_data.spec.js (97%) rename e2e/paths/{02-client-module => 02-client}/03_edit_fiscal_data.spec.js (99%) rename e2e/paths/{02-client-module => 02-client}/04_edit_billing_data.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/05_add_address.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/06_add_address_notes.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/07_edit_web_access.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/08_add_notes.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/09_add_credit.spec.js (94%) rename e2e/paths/{02-client-module => 02-client}/10_add_greuge.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/11_mandate.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/12_lock_of_verified_data.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/13_log.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/14_balance.spec.js (98%) rename e2e/paths/{02-client-module => 02-client}/15_user_config.spec.js (99%) rename e2e/paths/{02-client-module => 02-client}/16_web_payment.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/17_dms.spec.js (100%) rename e2e/paths/{02-client-module => 02-client}/18_contacts.spec.js (100%) rename e2e/paths/{03-worker-module => 03-worker}/01_basicData.spec.js (100%) rename e2e/paths/{03-worker-module => 03-worker}/02_time_control.spec.js (100%) rename e2e/paths/{03-worker-module => 03-worker}/03_pbx.spec.js (100%) rename e2e/paths/{04-item-module => 04-item}/01_summary.spec.js (100%) rename e2e/paths/{04-item-module => 04-item}/02_basic_data.spec.js (98%) rename e2e/paths/{04-item-module => 04-item}/03_tax.spec.js (100%) rename e2e/paths/{04-item-module => 04-item}/04_tags.spec.js (100%) rename e2e/paths/{04-item-module => 04-item}/05_niche.spec.js (100%) rename e2e/paths/{04-item-module => 04-item}/06_botanical.spec.js (100%) rename e2e/paths/{04-item-module => 04-item}/07_barcode.spec.js (100%) rename e2e/paths/{04-item-module => 04-item}/08_create_and_clone.spec.js (99%) rename e2e/paths/{04-item-module => 04-item}/09_regularize.spec.js (99%) rename e2e/paths/{04-item-module => 04-item}/10_item_index.spec.js (100%) rename e2e/paths/{04-item-module => 04-item}/11_item_log.spec.js (100%) rename e2e/paths/{04-item-module => 04-item}/12_descriptor.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/01-sale/01_list_sales.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/01-sale/02_edit_sale.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/01_observations.spec.js (99%) rename e2e/paths/{05-ticket-module => 05-ticket}/02_expeditions_and_log.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/04_packages.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/05_tracking_state.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/06_basic_data_steps.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/08_components.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/09_weekly.spec.js (97%) rename e2e/paths/{05-ticket-module => 05-ticket}/10_request.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/11_diary.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/12_descriptor.spec.js (98%) rename e2e/paths/{05-ticket-module => 05-ticket}/13_services.spec.js (98%) rename e2e/paths/{05-ticket-module => 05-ticket}/14_create_ticket.spec.js (100%) rename e2e/paths/{05-ticket-module => 05-ticket}/15_create_ticket_from_client.spec.js (96%) rename e2e/paths/{05-ticket-module => 05-ticket}/16_summary.spec.js (100%) rename e2e/paths/{06-claim-module => 06-claim}/01_basic_data.spec.js (100%) rename e2e/paths/{06-claim-module => 06-claim}/02_development.spec.js (99%) rename e2e/paths/{06-claim-module => 06-claim}/03_detail.spec.js (100%) rename e2e/paths/{06-claim-module => 06-claim}/04_claim_action.spec.js (100%) rename e2e/paths/{06-claim-module => 06-claim}/05_summary.spec.js (100%) rename e2e/paths/{06-claim-module => 06-claim}/06_descriptor.spec.js (98%) rename e2e/paths/{07-order-module => 07-order}/01_edit_basic_data.spec.js (97%) rename e2e/paths/{07-order-module => 07-order}/02_catalog.spec.js (97%) rename e2e/paths/{07-order-module => 07-order}/03_lines.spec.js (100%) rename e2e/paths/{08-route-module => 08-route}/01_create.spec.js (100%) rename e2e/paths/{08-route-module => 08-route}/02_basic_data.spec.js (99%) rename e2e/paths/{08-route-module => 08-route}/03_tickets.spec.js (100%) rename e2e/paths/{09-invoice-out-module => 09-invoice-out}/01_summary.spec.js (97%) rename e2e/paths/{09-invoice-out-module => 09-invoice-out}/02_descriptor.spec.js (98%) create mode 100644 e2e/paths/10-travel/01_thermograph.spec.js diff --git a/e2e/dms/ecc/3.jpeg b/e2e/dms/ecc/3.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..fb2483f69669a8f3ac8238a0ec0e135b074609c1 GIT binary patch literal 13518 zcmYjX1909!)Bne|%{ET@#B5{RYU8xA(b&!t8;xz-R%6??`Stz2d1t=8nVY@cncLsZ z+}`f&-pAs{CV(z2E+q~?KmY*5zX5!#00963EF2aVCJq)B7A_7B9zHoC0X{wfJ~A~JFc5alO224-evatbzXHbyR5CT0c*L_|bX6jUN~bbKZf z5)uZc|ImNt|Kt95`QPcEi0eN**MF5<|G1AX00SPVhrok^padW>AfPZHKKcM+0Dy#q z`VZ9q5)3R9Gyn+)0sl{{hz>wPKte-7!@|HKAi_fZI}jukGzI{JNdb!mq7+gxfWv0B z^Npd(uI|3XVG~xaoucM2w0Cfq&MH2VS!^WufO(@@@kJtm#Mt{V3V}2>r!jJkgmOBempe6XZFEm%#aij7VF^q9o zIS%VsNkK_@@lh&mk1(|ZxhbA0eF6EQr&9TstO7x*o}ck)bWXfsl-t;=QDTPS}gBU;Y1{59^V3x zF>bZAXyZ6z&9u$%VrA+p9Q$@10ml^spAOJ1-0&mYmm&_N@qBsFeJt1AGc#3Bk@_l% z0bqKZhXGzS);Xhi7AcUiY_upd+cGcRrQ|!tXujKch0z6Z{tNsd)|S`@z^CHg^=Ly?Qt6{cJvpsXYZjSLm?}P( zTaZd z2!D;-weYTB1Sv_$h9K!Ih5kj!z*coNE%MngUtQ`){9QfDC*J3@8rH+ui#)m}-f}~H z3=hZS>MEKj`h9lBBnZ&P4cst|C4EM2JGE1 zD$8U}l)8VnZH*fgu$U1+qLkvrGu%v2EJ0Ybne`3ckh+{~&`>y;<^{5Pv#?6!m8MbR z&#wEwLJS4)Bz$SL&}~fJ@`2FS5CZ_tB^@9gFIyw5=|_q0=D{#_DafSFd`E`<7;jeY zoF(i@17&VbWlpu{%B+x)$3(aFP;eI#rNYJ_*jp-;YA^m~q^y!elbW*+E>;xpdRk&G z{A)0^YC$QpWk;R(2QZ>J>-iJ4H>?_?NxsZ2ct+&|K)vTfTWs?ff6+N>SZw@r$zj4m zqb9~iPzVMf1-cXJf&?o3(N@)@tJQX6$ZPT@O86mr1fQ#Fk3Q40jItw>yt&UGiF^Ws z)oa^tm!HcwE_KE4YJUL8dP!4GuAJH>!uL(e zHIRb!f0eE5Vb0b;7Bh~jy2s8jtLpyvp#ZP6gLsa7+K+{c-f@?!cA7issAU!Xs_k}S z?F`dc*W#~Wf>cvK;Rk(iRy1QCR*|pK{+C~u8TP3i#P9-0XVgxnVkdKmRd0*OUz2M4WYdSyYc=fqUv6t)sXu^T9S>VgTj6tw?zuU1F}_(9 z6#^fS=tzI&vG!mcqod!vq9m}9-LIPz#DGy%MDDVaKZ|m0 zbM)<%4(4#L{`V(cc8~^t6}$BiJB;mG!^~`b!%28LTTi{y zRNa(<9APL4ByY2IuUT`g%jN;LcWL|wFfH<;i+ZaeUz*;L0HsD$-T0eLqWPwaUSmo< z*Z*X`f?g~(RXm1ZG|;vhnjXQxUW%)V$Y_FMt0k4T-K5a3Btu8E9G!lOvmDM!6uokZ z&yR0V2mAI1+}`WL+r=`n-o&@L*THAEKNmJW9*Sv2M(Wioq;U8TKL{pVqizO_)UWWz z0LPz^&#_F~rFJ)cXyQ?|Jl_CNIpYOE6V#f6O(FubR|r9Vp*UZLjKNLQ^TlP~p_EP* zlZR4Yc5|dbeP{=cIorN$MK05w8NvQT@%rD8!Q0b4qnFBT%$+qZUw& z$1(bg2UUM-ys3A%IKijf2{yIaow)N7a$>_-MPSLt*5S*eTJ{jfi6n2%{(TqxUyO&qq-5pj`%KGY2Y@Fu}Ttr%_fl_ zB3$9lDE~lHKoe`do#*}mcronV&Lyaf<4_9S(g%)J^t_I%Hza&3vCEz)q{$2WmS|#` zd##@rmtxD4nmhHh=F(8E-k8W_tkoB<@B@WC4l!Sji9irGc?sq2i-0^E=Lj2Zz8?YI z<{aN4SS&t%&eVeIrzWQ!5?K&+aIk}VswU+0NhrqhwUpr}R+#E3_ctQFEuYSdDR-8g z=2&el>YViJVnV!Hv1R8kB*JH>Z$!V(zm!Y=3==B_^GPSL@D2=?vTh`J{XIl2FxLL6^H!$W73pd-8`2J{MW$rc#6Ntv4Yv zTC13Y1!6P7Eiq=hKQl%p=;NmwRUsd^7Nd|kezt+qXGcta9mYq)1k|ipd;mvV`o<}t ze)N&p%b#MXl*VG8^P)u?PaS7nu6w6gGHx*^T#pVi{fxxEuvh#gpTo0IHaop?M;kE zFq+1{U<(#YIsA-Sf+MUgkT4RvU=N86c!;w$-%8S)^E9NNNZ)})w=C*;A?KbC?`85MlDl|ubYAF4B-#4#3_ta#Ld2t#U=sUs z(XHXvcUmTmiEUJHoWvZXEu?*LwuCtb&^-y1ovlKfR=k~YTvdGk#m}N34loa0Sg5io z)s1i1Vv)XB;sacpeuk-@ikLE;d9&M?uo$QoBd?Ygc9UpLo^&WN(ceR=Z@VUwkk?J4 zupn|Sd1SOGfJ;pg$t!U;E-aldJ(chS(EidkG`r70p(w=4pnFVZfvil^OIrG5IL6aj zrUtI+RP5_4EwOkEhJg*0|uvr$jO(F2UP z@(A1mr(cMaE(dfU^|Rk19@JSMXWVzzE(y}~NR38~#z1JMeu|tHF9YPM>5HYu)hiW? zhY1A8OieHfF`Q5OYI>+mYml8uB6n$qw2iP04*bml9?QScetObu%pm4lF|Z_VAUl$> zjI2V?h726-&3Yy)mFF5B_R&Z489Nzzc)U~xB(QZ7KQUZukCxcT(UZ-sU|y!hlpM6; zm>v1`jh7bHSF@m!F6f}XN}G(EMFiJB7oK#ph)J2B_IXqODQvNXwIcn-Xwl;#L8_;r zej~wGHjEksX8i!t_RZT{+(k$v(xPth;<$6s;wQUR6EMZpk+9dh4bzDpiJEY)xh=Ba z*(%@5<=#r#>^!n$5LG5(NR2sQtx!yu^D|Gp_UTvj(B?>E%pg+D-P{UGQrV*trxKu& z#%7A6Oaz%1$kSm*q!QZ6OsnP<^PvYMKZVKke@=s?``omIAIT_$OY63{y#X_$E|D?E zWEsv7rZz=cq&RiMx#&n93;!=4g4)WY4I-p1s>LsWMNpUA4b+;K!$iPZ!h`1Qm)sci zELU+8i7-`G8Ef4;BhoUN(t!Yl!A+EE~&8v>wvZEK>0r4>@l@bo;i= zkyTofS;FHT5UC!D6lg@%%Dhe(1S>@0oGFMH`ZG}snbGpR-c@nn_@-O)xD{eR1kU;8QSFI!w8&r5Yu~-tGug))g~xYVpk%xF?pH_zM!E{RbacW z=dzR+gQf9JwL_^*lZS{cpfzET=i8qlEHbK6BwZ4nqk`=pM43l!$1vQQG5rnp<(X|e z9GKL9kEMd8#dX_f88b8;cDRTfS0jL}4p1IAh>-p^#q;}IZY&35js1o;QN{KOBq~E^ zUY3Kw4@$~(k>h0~+W2BmQ^h|MP_^!h`gPa?W1D)P$1DGNiP{|xH zFIgt=8@RU8iRM&~IH)BI{sw^u$4cFg+^M=F(bS@_$@TYEFXc{MVfk1oeep3RxG-Ar z*Id4#MpT39lIAMW@2#(8Q|(%D%wWxnauHo|s}iTeQq%_9=<4{owtyzx%kektx{ z`CYL`tcM7Sn>JJd98yiF_@IalzSta2aXUj!0HV_+lV|tt^UFrp%K)ld&nB}2N}A^3 zn&$@)d6m8p=Yi!(Sg&Wy;*5N`OCD5TA>oBP3HzYGfg}xe)E;H`5^{MnfH_@T!;)8v#dO3&Ia$>W6AZ9F&JNQn6XR^ z`-{$z@}NW2BC+_m?^0<^b|McU4+Zk!kfqSH(8icm_-6)p{1SWqY4+cwAxC12gBhgV zLNuMd=q6e}4Ae0H!eHSif0r2w8RJ)zT6M*;*t{q}UU$7V|19-g`#TbavXJd0NMFH~ zrh?djV zQfp@CPFW}OK(eIm>(SlD4}jIcJ1nmpn;a+;D*aFO4I^IA)0)#BO(dTFP&XWkW1tsmxPDo$0&O2eVVf$wj8O zsWEpF`sw|y{^YU{N(GgfMJ5*y08 zvAywW=MTNh&+My$juw;WW2&zOO)%x|NV+Qy7oYo{Hh{mV*-T~9e4L1aRW?KqQH&tv zefoCbX$9A!RD^<8u&Vt|?-c56fH?K1wBIkCAy#2(HIsRSMbLUzwEO*fm)_rA4AsfM z6LsI&xcQIgyh4 z!9QUI%m>w-79+zD=Z2GY5{-4s%`QGhV2u|OSJXf23o+y_b6)<)dtAO3u!YEtY1kV< z^Ob-*9Tafoqxwc=^3~%wS2d{1iO8uxj9{nOS`nzVY#`d$@*zM~5A-deQE-%Ymw4(U z9a(8DzP>oR`Dv%DIIbioow_a9!$A~di!ubgh!pDqOE~Zf-688{-iLfZ7n=;loWWG( z#HI6yWni>x+nhE#U=RmJm|3HVOe%ytMSYBHoQMxt=S2O5eqkwHFc0#s8E)%&{+}fmv42ismc)%V=6t5 z`OjZ8`K$felJ&u{;>db?K(XpnBD=HpjL;_ozOtob_fqd;oC7z0*wid4G9wL>@bV`p<1Ke5CaN)-knrTU zZs8Zm1cE#@wYvm#%&Bj*3^-2Bs^q6#BvFZsI_Q(AUHwftjDm_% z0F7S`M(1`Mj1t+MQ7pUm`&BY^oy(nir?MDrRi6)N;ew;U%Z?MSREFc7a_{)y zVAg`z0`Ah!iS%}*$wmt$_ov{VSh3ggaL0?^_#~kp0I`LJ5LDH^U-@d+;!FF&AiuW4 z&zzaqoI7MKvZ=)KGIi$Xp}WX<+`X7zEir|Kb0IZjOQJ$fLkBvG&4&HR0TjHA_f}h> zW;L!|Fy`95MYDy2g{BWj8-6LK;?t~R@-1m{=Y!syrcXB8;`H{)bC_9Mt#HzNEt#(v z5tbkrD=g77qHtCsjK}K@-0kndtt4L}>G{iM_89n)B4$E`ch!DejfTf;Au(O&^?p)Z0w0G>37cylV6#F zacTbcp7vRKK01E&-YlZ0=PTCP9swODmfaQ#UD&-`ju$+RL!tU7w-Qv+kKn?n9}|vo z9tv{RqVAuBRrcOZxD+>DiwxT&$#T*JeE>h0D9>gP{ZD@>_y-;fegHBI=L;`aB7E6J zer&JI%0z})(fA}G0_EMEvW}eKN0seVE?dYbG-6)jpOzw;@BYodA6 z9`!mQ7HE^tM!DU#mSMr@gbN=4L_o}M8W~Zf?%Q@vNrg~{aNEm#@)MG`(}RodFCE-5 zR$K4iIio^Y#g{|rH!S;Jr@mtslsjlJF;Ta)MNTxi>@Rj z$zJ4$q8_Oh3F!{8^}%NP(Q&8g0uiv3P3+hxS+i+a^TI!fXE3As$w@HxQm#y_6lJoCob2^@?}Wgf15k@O&tn|&Q1rj!1Q z?F7$AtvG*4Q}T*3*o%U{r&ec=`e_t}Efkwn?fzXN=K7L*nQkj}`OL#n_J*AG6sCKz zQqiuzgmqVYM-E3&@(%c3F%*zSGN?vYKIwAG5|YTr-k-L30RzK(-^QEK&^w`kTsO%i zY8Uhy^;rD13IX?~^Vh>-WJ5ogVAIXbN%{Cwv`zT~*EQ+TlZUMZZ*&oOg+${~GpZ9B zG{0DwcIu%t!lvEJ|Cg@Oa>F_Uz5W6JH%sCTTw_{-lwr{PVmu(_H39DrW zATG!=sKe8vOrLzVU{6>eSmV`0eK8Y*%mo}`Qx(l0km0i zoo|pH(R3E@H}14zn@SWc#v{8n^}KnLnF1ieR~;T?@PAvcHllN&c12_p3vL?!h9RiRoZ;;%- z-q1Uv6nq9HhIXc-C3$(1m)AH=C%s5O;KJT}b5WA*gWXfR^cLPLuO5oB zUDv2u!jbpIE2O({uT$eS5yJ{ITYPX^jYKr*Gt=+UdHdM!_Q;V?E5UcJx~5hus1IH2rMpp=vaL|<;tZpStG!IB zQ?A8o2HqmKv}Y%&QS<)mmBm{VU$?^%oAQH~7t4P0vl!WUocE(YByBDs=b_Ej$--ZZ zy&K;677AAqPU#Ky&-;&!MOrI{oP6_<`~Em729BG10+L`lVnlLHdEP%~%8!5Add zrZ`=-Fv72Atf?SlbJpdb4lYQehVEm=`F~RYVw()L#P}sAdS|x}V9d+i;|r4SF$@R) zFqt`*0Ta)4v{w96E*;G}92lXW)~rG=g4M@zx&`J4~rq3+Z#>=VfD^STyIu zuh82`xn+xk3_aG$V#s-mD1szG`@2Qo$oao?4~W(?`p%Y;&w_I{(cNGA`}@zVo+BKz zdFR7i_fRY}6KJwks-W()tl@8-s7#%C!|)IAXhb{9pV#rO9_~n8^@{U4oNqY1lv)Y@)*4$M#t44{15i%goexQ#qJ?GK}M?HIUQB{%-d}t$ztS+>cSh?$xQ^ zOq`utsFs;lx`}~xJEGL*SAH%*I0Pu!2nphGgU}Mx(l^FOui!kQFlcGRC|fX=ub{&k ztXYWM)Q4njxBY@r4LQrx4p zNFUM<;LpWCfbRRLWM|Z1CqVk!Xq>D4s@SXDuKDVE<-kY0O#a0xWJw}QZ!n13WTo}s z!1DK+k7>**n#)DcVBRM}{W(w0*!vUf0YXd8lR!O504KO!U)1lQ)p!FTDe4wt2yF_@ zdlfYO=q4O3yw=Bczd}4n^-WaZ1F#*G-D*UW3}0{QtQ)-O8_lgGJLEqrcJ5Q7D^>6} z*Gq1o%62c0O61RvQ~lXbcFH|=h*SGyBZ4mQ*ZRb=0-o!<{++W&Ou$!-%NZj4=9uvc9M0-h zj4h*=t31z?CHG`q_W`P{;|yW>ow8Vd1il@Q$)jJpmlkAT0Ju7x2eUV+|Fp1nsUZWr zwI79w3Jnug^5UB2^i@~9NkX1%f>|U(WN#A%qNzJ}It58Q+zix((TQRj{?mx$B!MzN zs%~mPqNks!ewYf<*XA)x3I9bgnfWIE_p&3S<=l3S)hqf0tkTsCPHh^A#)+Bk(@bL; zSaY6ff303n@{g<<=1;-Rp^5Cjqf_zTgZ%nx2iXU^A;Q24Se@n1s0};|UI9?xDWW4A zFCGP4m4MO=rfO#=D2o$_i8sC>ffpzrqjjYe+#uEy!=ZLGIUlNhrtsN>@rlXt#d~QN zbP4ZFNZZ&@+8h-9lVayihkqBt4nItKPrEC^${ld8Y~1ic_XY)x*H;BA8B{ILOO2UttFKNDfh*DV=xV)kJEe=16sVJF|!Lzg`xaUPq|J*a@haGvIt4 z#4v};?x5`oRUzG01SK2%)Q$WL#^4@NHV41qNX#m11naNkAG|8DTo%K80IJ^8O=4ff znDsc+j8&^=-8!1q?yl!$4ri8XF;;E-2v{KJXQh;bK?uh)_9AX|#>0yevqIJr6P$fK zDB|f8zLoP55q}N_`aDJ=oZO5xKiP{#%89RE!N24*e5%bQR*8}zh@vd#G2chirDE>> z{k0+hMfrN6PW$EMJAai*nCsV^uuQ2x+`^+oE#kA6#qn7k39TDlmS{@;nXz!CCXQ7) z%cWu8;_Cj~8!5#5C@bf1yjX)Z5JE&N3s-60bUX`(DIMWG#sd*=OH zIcK!WRs++}k&(9kh}BE*{kxUwtY4k5{z8cmBo~)#D$If+QdP&I{;dpBfdOmV^q3g2 zGi$Sbu8yI+f!+f7ZA@OAFf>66g{KBXwnnNO!-FH4#CZr zU>hlV*~@-+B00yo+fz-on7|Chc7B$HDOg_~$UnXyZq3Z$Hm6koaO_?^TRWnEX(C;l z>by_GG$-QR{zDK3yb^wH%PC7)ekheUT)JEC(Wq)hZBc$Kye4a9g41MyH7JEmqiOEU+g%ed)uL9!KFs_4ot^6F?aW#o$SgVC+S*z8< zrlX6-HPv(!MR(rWW+_kRFR-Ejq+m7E!YITW<)xD-mXZ+D zPXTjdQ1EVv{qV2ZGzRAesy4^o%A6(+jX5bB!%W)lcL%8ZYbVBTB)86d%?CP$myotigX5}(<5@+71V}|!!6$xEd$WWRF ziVY&3;8G1vH&@R5+&)Ce9z3(*zW!n~K|NAhbDU~!r~Mgc8vdyu124XR${HJlQtS8? zA9QG*8MnZ&pQVo7O{t1fsy1Y}KGmrd?qMXwpt7qxmTxLOViKdE#$u)M0sI#1;?sXU znc}~L?t7|{B8TX+k`J?L3F0+wA`v^a8=Cth6~PE3m?BJ)urdU$4D{*!B~w7#F?y5r znycY8X$Ebhjdg_}_M{%cn)c$Z{>BK*sD%I|VCon`v{15d4~phbld8kjwahf{r)dPc6YXag%OjU zVX|{p&=EsOsCC_sHlvfDouo)oDOp5+xHyL8th_bi5UP8MmM&Io0&@#0mS$_ZYbQgh znl~MD4!mb9$4;4}THIEa;>_iFQm(%ob#{&-D}Dg!xsoNZxy%(94T+H>0fyOAN0)HOX@+_*ww|ihbrz|4n1hUAlZ+Tc8X`wb%eKqf3#%@h61XPUN@@~ryJeo3 zwGf0fbUA=eH~t+>cB3rr?KjEG103720jb=`c_{?yq2J-A)E7;S%C_a{!l(wR^?~zJ z4;LE<3Am?bf9-j1gZ%PqnZ(UvBU!s*(Ts^;&e%Cx6pBZWv?zFkw zwS+k>cJs!gpeBJwf&Op(PZD<}-&)bSjeggA*M;ERK*}*)^Gb{&2Y39<$YwT8FxEdK zYBQ+|To`rMS+r!aPHq+TR~w-FbDR3-1nYgN+ASt13oet1xb`dn+X&PWVM-AF0myN* zFG_5~!j?EJG}=T%A+rJnA!=zOgi(_a{#*99g2^ z5rgTYJjt(!pTcHJl!noR3_uIip6z^^ns=*r-K31$edU3%y4h>DynWZ~aEZDQb{#7| z&X@SvC2t;ARYwa2co=Vgr}P3Gr0k!b*2`{!^1)QulV--$X~&d1YkrRW>Q(dgvOFpS zq?8pnn=q?Qp0Xm=Ry!T^n6Ugb5AXb!kA7p*^gpdgOcY~iJr&vQ%f?+V7^F2EveGgO z4hCUqn?@v$HiL3m+(M5ecZVvn2@<5?xX6pA<@&)7{el}V3z7Exji8c1bF-tZU&&R9 zGiFBFDJTQsD6{GGA`yEuc{1;6bI9Yh(0K*~fd;OGqVruK-uUqH?yD>Ajj!7xYO=Gc zvo>JyL?ofqs4wKF7@uE;}CE znJtk#bB=!8yzDU}HNTpxX0u@H|0)IMqz!+^x-3K=7W$-Cw40WGJTh|S1DU1BIPhi@ zmQqMIQipvxKO;Mx7qb7|ZfT6QG{d*E2IwEF{XAA;h}A7e*teFqKccp)(xjg)sRK?0 z2R8a)RK6E_bvvW5;2`#=c56t-$|Jr95+SAc>Y4+4O znO;oucdgOPEs5T{9wm{zmSv*mL|lu7XIe7~V7&1^xjy7cz}`u6w~$Z=GJN#8@c4er z_s*e8rOYs52W4hN_}*r^1A?s_?@`_50Xj9ZX_4Cncm8q-ZNf5IN?D5ecydE<6{S1U z;4j5)_?T{Vd9er-iBe8|PS?~LhOnipB{4Idz_07)gR;y(y1Bwge@Uk|LO6(S7K?{l z$Vavm<$ZSky39l#=!t5oK{{Ge@oDJPIOWLaMer%*EkV+>58|9fqO<}db1mbK@pIU| zG;@Jo;;3Nmbdi*ZfnQ4#&7X{gVXt9{^qTZY;B8^8j;~d&i|d-mNgbRaxX7|Q(#hv9 zNz9c5EZ_qux9U1Ae$u-0dTY9FF5Wtx)=tNtsW4_1vvnQ%(cbktGL))VdrR-^g;5EV zNJ~pnW+lk6pM1`x<}_BfS6OZ!;Y?TDT1Oez#?GMIfs&+;l_`+GUD3~DdFj&+Qd7~< zn9z1pgH1n5FpU#|s~_>f2A}+R*~ASwd7};-+bJ{WQB%&yrmNsvOXoO8DL05@)00t> zf)Qn(6{n*YvG`45A-^XqaQ*Mz! zqpA8!vb#4n;TUZ-x#Hn)4DYB}Ozq!Z!H6;_f35znrR<1Y@t%uCIyw7twtBYJsE5YS zkdtmxbwFgtI^Q#5-=HVd+jRF*)ymJmK>l7#hC~dqWw9;96W}yb(qlxSQiVm1sfmPBj^C zen@Aa6JrXlm8U4m%nXCcisxXTld69R)!tclMCSN*xMKg1pJ$J~;~lzepP3e;jxNFTvzpN&e|-HB6)I% zh7OVkx*g|gNzQqFt=k_py$2KN!JqSqzkSyI-fnpVgeS15C{DnZ6AJuG)MO(sfAhlX zqzNhg`9`T4FCmnlg8v2OZ%0~W1x)2dKbfS}$Z)BsNr}kFbBgpbiSlYt>yHuV<(CJD zz#kan#rCIt!=T-s*;MQ@YauV|945kyv-Y9BrA9&}sYHz#>arO*#&W{zf-|_-lV%yD zC`{1jqvhJH{WOJm->UhZ^KR1!tp&W8MdF)${@jsdRO(dn9=m$H5`Se1;`K z(TYE2+DA9rx~jR6f5{dsK&~v7Vv3_CdwVqt|C?|pI#DxWHjT334-pwL6v7o1?p8~N zXv4*VSHkBFM(+L2qgm3U&Z?$;U88|!2NUJV$&ouWish@JhB+EgIIbA(F-%)kuf!1z zL(<$qYIas4w3QOOJ(i1NVNUcK=d?m5fOP5l0q`EceE`aT?x~0yesIji^h+GiN$-f2 zNH2d;7wq<5-|-3_MD}1Aj1fszpPkL^l~Y&BjV|TPR6hJ}AjD8)Gh>}x+}9=~YClv{ zf{)fuW;x&Hf+}J0@%Yv%9#!mBdRX{dokcs2Al)k2#8K5!D zJLg&+w9dq3Q{q-~_u;>s6N@gB(N`9wvb|rkl!v~*%6NvUDNZ>R}kZ<1E-r8&!77&Eyeq6N=#8;T*I06hiYK!=ik1< zopv3|7EzfqYHqJfeG(Z^|8;7#p?1%(u`xZbuVB|-4TX-6*T;9h zD}D)rh<^AadFrWq&&4rQbd2JSoyf}j_fu0g0AGI4W?*p<<=N?_I(ZC)&$}~V`A(1ZPyzqWn=L2Lw}ycj=&s5`&7VA<^juVbetIG#i9 z5JYrIV?XAHmN2+mB-wKcM2CI-SA%0zN_cCmf)N}1`*$N^z<^EjiS*H9nH?$%8ZD*w z$9D>7j9JG4qc4B?XbxNDL`;w>^|Re{^aH zW%bOn<)5*cVT?l(*@&stnBO=~OP)EoNe-RIOg=YU9gJ;%i_lfI?`t9}rW)V;PX?RD mv=4ViK7bqs&|=IP?9q&LO}LF$gxf}?GylIcj_LgTSo$B0FZNXc literal 0 HcmV?d00001 diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 452dd3a4d..ea8f50626 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -21,6 +21,7 @@ let actions = { } catch (error) { throw new Error(`failed to reach URL containing: ${expectedHash}`); } + await this.waitForContentLoaded(); return true; }, @@ -167,7 +168,7 @@ let actions = { waitToGetProperty: async function(selector, property) { let builtSelector = selector; - if (property != 'innerText') + if (selector.includes('vn-input-file') || property != 'innerText') builtSelector = await this.selectorFormater(selector); try { @@ -311,6 +312,9 @@ let actions = { if (selector.includes('vn-textfield')) return builtSelector = `${selector} input`; + if (selector.includes('vn-input-file')) + return builtSelector = `${selector} section`; + return builtSelector; }, @@ -365,14 +369,15 @@ let actions = { await this.write('vn-searchbar', searchValue); await this.waitToClick('vn-searchbar vn-icon[icon="search"]'); await this.waitForNumberOfElements('.search-result', 1); - await this.waitFor(1000); + await this.waitForContentLoaded(); await this.evaluate(() => { return document.querySelector('.search-result').click(); }); + await this.waitForContentLoaded(); }, accessToSection: async function(sectionRoute) { - await this.waitForSelector(`vn-left-menu`, {visible: true}); + await this.waitForSelector('vn-left-menu'); let nested = await this.evaluate(sectionRoute => { return document.querySelector(`vn-left-menu li li > a[ui-sref="${sectionRoute}"]`) != null; }, sectionRoute); @@ -394,6 +399,7 @@ let actions = { autocompleteSearch: async function(selector, searchValue) { let builtSelector = await this.selectorFormater(selector); + await this.waitForContentLoaded(); await this.waitToClick(selector); await this.waitForSelector(selector => { document @@ -424,10 +430,11 @@ let actions = { }, {}, builtSelector, searchValue); await this.waitForMutation(`.vn-drop-down`, 'childList'); + await this.waitForContentLoaded(); }, reloadSection: async function(sectionRoute) { - await this.waitFor(1000); + await this.waitForContentLoaded(); await Promise.all([ this.waitForNavigation({waitUntil: 'networkidle0'}), this.click('vn-icon[icon="desktop_windows"]', {}), @@ -437,6 +444,7 @@ let actions = { this.waitForNavigation({waitUntil: 'networkidle0'}), this.click(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`, {}), ]); + await this.waitForContentLoaded(); }, forceReloadSection: async function(sectionRoute) { diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 99c78eea2..ed232ef3b 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -748,5 +748,12 @@ export default { taxTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-two > vn-table > div > vn-tbody > vn-tr:nth-child(2)', ticketOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(1)', ticketTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(2)' + }, + travelThermograph: { + add: 'vn-travel-thermograph-index vn-float-button[icon="add"]', + thermographID: 'vn-travel-thermograph-create vn-autocomplete[ng-model="$ctrl.dms.thermographId"]', + uploadIcon: 'vn-travel-thermograph-create vn-icon[icon="cloud_upload"]', + createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr', + upload: 'vn-travel-thermograph-create button[type=submit]' } }; diff --git a/e2e/paths/02-client-module/01_create_client.spec.js b/e2e/paths/02-client/01_create_client.spec.js similarity index 98% rename from e2e/paths/02-client-module/01_create_client.spec.js rename to e2e/paths/02-client/01_create_client.spec.js index 29525df49..8f1a116ee 100644 --- a/e2e/paths/02-client-module/01_create_client.spec.js +++ b/e2e/paths/02-client/01_create_client.spec.js @@ -53,7 +53,6 @@ describe('Client create path', async() => { await page.write(selectors.createClientView.name, 'Carol Danvers'); await page.write(selectors.createClientView.socialName, 'AVG tax'); await page.write(selectors.createClientView.street, 'Many places'); - await page.waitForContentLoaded(); await page.autocompleteSearch(selectors.createClientView.country, 'España'); await page.autocompleteSearch(selectors.createClientView.province, 'Province one'); await page.write(selectors.createClientView.city, 'Valencia'); @@ -113,7 +112,6 @@ describe('Client create path', async() => { }); it(`should search for the user Carol Danvers to confirm it exists`, async() => { - await page.waitForContentLoaded(); await page.accessToSearchResult('Carol Danvers'); let url = await page.expectURL('#!/client/114/summary'); diff --git a/e2e/paths/02-client-module/02_edit_basic_data.spec.js b/e2e/paths/02-client/02_edit_basic_data.spec.js similarity index 97% rename from e2e/paths/02-client-module/02_edit_basic_data.spec.js rename to e2e/paths/02-client/02_edit_basic_data.spec.js index 8b665bd96..9373dfe86 100644 --- a/e2e/paths/02-client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client/02_edit_basic_data.spec.js @@ -70,14 +70,14 @@ describe('Client Edit basicData path', () => { }); describe('as salesAssistant', () => { - beforeAll(async() => { + it('should navigate to a client basic data', async() => { await page.loginAndModule('salesASsistant', 'client'); await page.accessToSearchResult('Ptonomy Wallace'); await page.accessToSection('client.card.basicData'); - }); + }, 30000); it('should be able to change the salesPerson', async() => { - await page.wait(selectors.clientBasicData.name); + await page.waitForSelector(selectors.clientBasicData.name); const result = await page.evaluate(selector => { return document.querySelector(selector).disabled; }, `${selectors.clientBasicData.salesPerson} input`); diff --git a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js b/e2e/paths/02-client/03_edit_fiscal_data.spec.js similarity index 99% rename from e2e/paths/02-client-module/03_edit_fiscal_data.spec.js rename to e2e/paths/02-client/03_edit_fiscal_data.spec.js index d39f196cb..ac08b100d 100644 --- a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client/03_edit_fiscal_data.spec.js @@ -83,7 +83,7 @@ describe('Client Edit fiscalData path', () => { const result = await page.waitForLastSnackbar(); expect(result).toEqual('Invalid Tax number'); - }, 15000); + }); it(`should edit the fiscal this time with a valid fiscal id`, async() => { await page.clearInput(selectors.clientFiscalData.fiscalId); diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client/04_edit_billing_data.spec.js similarity index 100% rename from e2e/paths/02-client-module/04_edit_billing_data.spec.js rename to e2e/paths/02-client/04_edit_billing_data.spec.js diff --git a/e2e/paths/02-client-module/05_add_address.spec.js b/e2e/paths/02-client/05_add_address.spec.js similarity index 100% rename from e2e/paths/02-client-module/05_add_address.spec.js rename to e2e/paths/02-client/05_add_address.spec.js diff --git a/e2e/paths/02-client-module/06_add_address_notes.spec.js b/e2e/paths/02-client/06_add_address_notes.spec.js similarity index 100% rename from e2e/paths/02-client-module/06_add_address_notes.spec.js rename to e2e/paths/02-client/06_add_address_notes.spec.js diff --git a/e2e/paths/02-client-module/07_edit_web_access.spec.js b/e2e/paths/02-client/07_edit_web_access.spec.js similarity index 100% rename from e2e/paths/02-client-module/07_edit_web_access.spec.js rename to e2e/paths/02-client/07_edit_web_access.spec.js diff --git a/e2e/paths/02-client-module/08_add_notes.spec.js b/e2e/paths/02-client/08_add_notes.spec.js similarity index 100% rename from e2e/paths/02-client-module/08_add_notes.spec.js rename to e2e/paths/02-client/08_add_notes.spec.js diff --git a/e2e/paths/02-client-module/09_add_credit.spec.js b/e2e/paths/02-client/09_add_credit.spec.js similarity index 94% rename from e2e/paths/02-client-module/09_add_credit.spec.js rename to e2e/paths/02-client/09_add_credit.spec.js index 1cb06fb36..05c50e809 100644 --- a/e2e/paths/02-client-module/09_add_credit.spec.js +++ b/e2e/paths/02-client/09_add_credit.spec.js @@ -24,7 +24,6 @@ describe('Client Add credit path', () => { }); it(`should edit the credit`, async() => { - await page.waitForContentLoaded(); await page.clearInput(selectors.clientCredit.credit); await page.write(selectors.clientCredit.credit, '999'); await page.waitToClick(selectors.clientCredit.saveButton); @@ -34,7 +33,6 @@ describe('Client Add credit path', () => { }); it('should confirm the credit was updated', async() => { - await page.waitForContentLoaded(); const result = await page.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText'); expect(result).toContain(999); diff --git a/e2e/paths/02-client-module/10_add_greuge.spec.js b/e2e/paths/02-client/10_add_greuge.spec.js similarity index 100% rename from e2e/paths/02-client-module/10_add_greuge.spec.js rename to e2e/paths/02-client/10_add_greuge.spec.js diff --git a/e2e/paths/02-client-module/11_mandate.spec.js b/e2e/paths/02-client/11_mandate.spec.js similarity index 100% rename from e2e/paths/02-client-module/11_mandate.spec.js rename to e2e/paths/02-client/11_mandate.spec.js diff --git a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js similarity index 100% rename from e2e/paths/02-client-module/12_lock_of_verified_data.spec.js rename to e2e/paths/02-client/12_lock_of_verified_data.spec.js diff --git a/e2e/paths/02-client-module/13_log.spec.js b/e2e/paths/02-client/13_log.spec.js similarity index 100% rename from e2e/paths/02-client-module/13_log.spec.js rename to e2e/paths/02-client/13_log.spec.js diff --git a/e2e/paths/02-client-module/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js similarity index 98% rename from e2e/paths/02-client-module/14_balance.spec.js rename to e2e/paths/02-client/14_balance.spec.js index 2e29dc04e..52d179383 100644 --- a/e2e/paths/02-client-module/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -17,7 +17,6 @@ describe('Client balance path', () => { it('should now edit the local user config data', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); - await page.waitForContentLoaded(); await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs'); let result = await page.waitForLastSnackbar(); @@ -118,7 +117,6 @@ describe('Client balance path', () => { }); it('should now search for the user Petter Parker', async() => { - await page.waitForContentLoaded(); await page.write(selectors.clientsIndex.topbarSearch, 'Petter Parker'); await page.waitToClick(selectors.clientsIndex.searchButton); await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1); diff --git a/e2e/paths/02-client-module/15_user_config.spec.js b/e2e/paths/02-client/15_user_config.spec.js similarity index 99% rename from e2e/paths/02-client-module/15_user_config.spec.js rename to e2e/paths/02-client/15_user_config.spec.js index 6f76c73ca..193305177 100644 --- a/e2e/paths/02-client-module/15_user_config.spec.js +++ b/e2e/paths/02-client/15_user_config.spec.js @@ -21,7 +21,7 @@ describe('User config', () => { it('should now open the user config form to check the settings', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); - await page.waitFor(1000); + await page.waitForContentLoaded(); let expectedLocalWarehouse = await page .expectPropertyValue(selectors.globalItems.userLocalWarehouse, 'value', ''); diff --git a/e2e/paths/02-client-module/16_web_payment.spec.js b/e2e/paths/02-client/16_web_payment.spec.js similarity index 100% rename from e2e/paths/02-client-module/16_web_payment.spec.js rename to e2e/paths/02-client/16_web_payment.spec.js diff --git a/e2e/paths/02-client-module/17_dms.spec.js b/e2e/paths/02-client/17_dms.spec.js similarity index 100% rename from e2e/paths/02-client-module/17_dms.spec.js rename to e2e/paths/02-client/17_dms.spec.js diff --git a/e2e/paths/02-client-module/18_contacts.spec.js b/e2e/paths/02-client/18_contacts.spec.js similarity index 100% rename from e2e/paths/02-client-module/18_contacts.spec.js rename to e2e/paths/02-client/18_contacts.spec.js diff --git a/e2e/paths/03-worker-module/01_basicData.spec.js b/e2e/paths/03-worker/01_basicData.spec.js similarity index 100% rename from e2e/paths/03-worker-module/01_basicData.spec.js rename to e2e/paths/03-worker/01_basicData.spec.js diff --git a/e2e/paths/03-worker-module/02_time_control.spec.js b/e2e/paths/03-worker/02_time_control.spec.js similarity index 100% rename from e2e/paths/03-worker-module/02_time_control.spec.js rename to e2e/paths/03-worker/02_time_control.spec.js diff --git a/e2e/paths/03-worker-module/03_pbx.spec.js b/e2e/paths/03-worker/03_pbx.spec.js similarity index 100% rename from e2e/paths/03-worker-module/03_pbx.spec.js rename to e2e/paths/03-worker/03_pbx.spec.js diff --git a/e2e/paths/04-item-module/01_summary.spec.js b/e2e/paths/04-item/01_summary.spec.js similarity index 100% rename from e2e/paths/04-item-module/01_summary.spec.js rename to e2e/paths/04-item/01_summary.spec.js diff --git a/e2e/paths/04-item-module/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js similarity index 98% rename from e2e/paths/04-item-module/02_basic_data.spec.js rename to e2e/paths/04-item/02_basic_data.spec.js index 2b3ff9d51..2c8a8a7a1 100644 --- a/e2e/paths/04-item-module/02_basic_data.spec.js +++ b/e2e/paths/04-item/02_basic_data.spec.js @@ -41,7 +41,6 @@ describe('Item Edit basic data path', () => { it(`should confirm the item name was edited`, async() => { await page.reloadSection('item.card.basicData'); - await page.waitForContentLoaded(); const result = await page.waitToGetProperty(selectors.itemBasicData.name, 'value'); expect(result).toEqual('Rose of Purity'); diff --git a/e2e/paths/04-item-module/03_tax.spec.js b/e2e/paths/04-item/03_tax.spec.js similarity index 100% rename from e2e/paths/04-item-module/03_tax.spec.js rename to e2e/paths/04-item/03_tax.spec.js diff --git a/e2e/paths/04-item-module/04_tags.spec.js b/e2e/paths/04-item/04_tags.spec.js similarity index 100% rename from e2e/paths/04-item-module/04_tags.spec.js rename to e2e/paths/04-item/04_tags.spec.js diff --git a/e2e/paths/04-item-module/05_niche.spec.js b/e2e/paths/04-item/05_niche.spec.js similarity index 100% rename from e2e/paths/04-item-module/05_niche.spec.js rename to e2e/paths/04-item/05_niche.spec.js diff --git a/e2e/paths/04-item-module/06_botanical.spec.js b/e2e/paths/04-item/06_botanical.spec.js similarity index 100% rename from e2e/paths/04-item-module/06_botanical.spec.js rename to e2e/paths/04-item/06_botanical.spec.js diff --git a/e2e/paths/04-item-module/07_barcode.spec.js b/e2e/paths/04-item/07_barcode.spec.js similarity index 100% rename from e2e/paths/04-item-module/07_barcode.spec.js rename to e2e/paths/04-item/07_barcode.spec.js diff --git a/e2e/paths/04-item-module/08_create_and_clone.spec.js b/e2e/paths/04-item/08_create_and_clone.spec.js similarity index 99% rename from e2e/paths/04-item-module/08_create_and_clone.spec.js rename to e2e/paths/04-item/08_create_and_clone.spec.js index 7d6a8e54d..32d0ff23b 100644 --- a/e2e/paths/04-item-module/08_create_and_clone.spec.js +++ b/e2e/paths/04-item/08_create_and_clone.spec.js @@ -40,7 +40,6 @@ describe('Item Create/Clone path', () => { }); it('should now access to the create item view by clicking the create floating button', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.itemsIndex.createItemButton); let url = await page.expectURL('#!/item/create'); diff --git a/e2e/paths/04-item-module/09_regularize.spec.js b/e2e/paths/04-item/09_regularize.spec.js similarity index 99% rename from e2e/paths/04-item-module/09_regularize.spec.js rename to e2e/paths/04-item/09_regularize.spec.js index 76e92f8a6..e43429aa0 100644 --- a/e2e/paths/04-item-module/09_regularize.spec.js +++ b/e2e/paths/04-item/09_regularize.spec.js @@ -81,7 +81,6 @@ describe('Item regularize path', () => { }); it('should clear the user local settings now', async() => { - await page.waitForTransitionEnd('vn-searchbar'); await page.waitToClick(selectors.globalItems.userMenuButton); await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/04-item-module/10_item_index.spec.js b/e2e/paths/04-item/10_item_index.spec.js similarity index 100% rename from e2e/paths/04-item-module/10_item_index.spec.js rename to e2e/paths/04-item/10_item_index.spec.js diff --git a/e2e/paths/04-item-module/11_item_log.spec.js b/e2e/paths/04-item/11_item_log.spec.js similarity index 100% rename from e2e/paths/04-item-module/11_item_log.spec.js rename to e2e/paths/04-item/11_item_log.spec.js diff --git a/e2e/paths/04-item-module/12_descriptor.spec.js b/e2e/paths/04-item/12_descriptor.spec.js similarity index 100% rename from e2e/paths/04-item-module/12_descriptor.spec.js rename to e2e/paths/04-item/12_descriptor.spec.js diff --git a/e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js b/e2e/paths/05-ticket/01-sale/01_list_sales.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/01-sale/01_list_sales.spec.js rename to e2e/paths/05-ticket/01-sale/01_list_sales.spec.js diff --git a/e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/01-sale/02_edit_sale.spec.js rename to e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js diff --git a/e2e/paths/05-ticket-module/01_observations.spec.js b/e2e/paths/05-ticket/01_observations.spec.js similarity index 99% rename from e2e/paths/05-ticket-module/01_observations.spec.js rename to e2e/paths/05-ticket/01_observations.spec.js index b343bcfeb..cccfa8b67 100644 --- a/e2e/paths/05-ticket-module/01_observations.spec.js +++ b/e2e/paths/05-ticket/01_observations.spec.js @@ -25,7 +25,7 @@ describe('Ticket Create notes path', () => { const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); - }, 15000); + }); it('should confirm the note is the expected one', async() => { await page.reloadSection('ticket.card.observation'); diff --git a/e2e/paths/05-ticket-module/02_expeditions_and_log.spec.js b/e2e/paths/05-ticket/02_expeditions_and_log.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/02_expeditions_and_log.spec.js rename to e2e/paths/05-ticket/02_expeditions_and_log.spec.js diff --git a/e2e/paths/05-ticket-module/04_packages.spec.js b/e2e/paths/05-ticket/04_packages.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/04_packages.spec.js rename to e2e/paths/05-ticket/04_packages.spec.js diff --git a/e2e/paths/05-ticket-module/05_tracking_state.spec.js b/e2e/paths/05-ticket/05_tracking_state.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/05_tracking_state.spec.js rename to e2e/paths/05-ticket/05_tracking_state.spec.js diff --git a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js b/e2e/paths/05-ticket/06_basic_data_steps.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/06_basic_data_steps.spec.js rename to e2e/paths/05-ticket/06_basic_data_steps.spec.js diff --git a/e2e/paths/05-ticket-module/08_components.spec.js b/e2e/paths/05-ticket/08_components.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/08_components.spec.js rename to e2e/paths/05-ticket/08_components.spec.js diff --git a/e2e/paths/05-ticket-module/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js similarity index 97% rename from e2e/paths/05-ticket-module/09_weekly.spec.js rename to e2e/paths/05-ticket/09_weekly.spec.js index e88018ad5..c732a4b87 100644 --- a/e2e/paths/05-ticket-module/09_weekly.spec.js +++ b/e2e/paths/05-ticket/09_weekly.spec.js @@ -26,7 +26,6 @@ describe('Ticket descriptor path', () => { it('should go back to the ticket index then search and access a ticket summary', async() => { await page.accessToSection('ticket.index'); await page.accessToSearchResult('11'); - await page.waitForContentLoaded(); }); it('should add the ticket to thursday turn using the descriptor more menu', async() => { @@ -64,7 +63,6 @@ describe('Ticket descriptor path', () => { }); it('should now search for the ticket 11', async() => { - await page.waitForContentLoaded(); await page.write(selectors.ticketsIndex.topbarSearch, '11'); await page.waitToClick(selectors.ticketsIndex.searchButton); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); @@ -81,7 +79,6 @@ describe('Ticket descriptor path', () => { }); it('should add the ticket to saturday turn using the descriptor more menu', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn); await page.waitToClick(selectors.ticketDescriptor.saturdayButton); diff --git a/e2e/paths/05-ticket-module/10_request.spec.js b/e2e/paths/05-ticket/10_request.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/10_request.spec.js rename to e2e/paths/05-ticket/10_request.spec.js diff --git a/e2e/paths/05-ticket-module/11_diary.spec.js b/e2e/paths/05-ticket/11_diary.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/11_diary.spec.js rename to e2e/paths/05-ticket/11_diary.spec.js diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js similarity index 98% rename from e2e/paths/05-ticket-module/12_descriptor.spec.js rename to e2e/paths/05-ticket/12_descriptor.spec.js index 6e3864b48..1aa0516de 100644 --- a/e2e/paths/05-ticket-module/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -34,7 +34,6 @@ describe('Ticket descriptor path', () => { }); it(`should update the shipped hour using the descriptor menu`, async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour); await page.pickTime(selectors.ticketDescriptor.changeShippedHour, '08:15'); @@ -130,7 +129,6 @@ describe('Ticket descriptor path', () => { }); it('should delete the stowaway', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton); await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton); diff --git a/e2e/paths/05-ticket-module/13_services.spec.js b/e2e/paths/05-ticket/13_services.spec.js similarity index 98% rename from e2e/paths/05-ticket-module/13_services.spec.js rename to e2e/paths/05-ticket/13_services.spec.js index cafc5f27c..0a09c7aa3 100644 --- a/e2e/paths/05-ticket-module/13_services.spec.js +++ b/e2e/paths/05-ticket/13_services.spec.js @@ -26,7 +26,7 @@ describe('Ticket services path', () => { const result = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton); expect(result).toBeTruthy(); - }, 15000); + }); it('should receive an error if you attempt to save a service without access rights', async() => { await page.clearInput(selectors.ticketService.firstPrice); @@ -50,7 +50,6 @@ describe('Ticket services path', () => { }); it('should click on the add button to prepare the form to create a new service', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketService.addServiceButton); const result = await page .isVisible(selectors.ticketService.firstServiceType); diff --git a/e2e/paths/05-ticket-module/14_create_ticket.spec.js b/e2e/paths/05-ticket/14_create_ticket.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/14_create_ticket.spec.js rename to e2e/paths/05-ticket/14_create_ticket.spec.js diff --git a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js b/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js similarity index 96% rename from e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js rename to e2e/paths/05-ticket/15_create_ticket_from_client.spec.js index 80bb217fb..28c11de3a 100644 --- a/e2e/paths/05-ticket-module/15_create_ticket_from_client.spec.js +++ b/e2e/paths/05-ticket/15_create_ticket_from_client.spec.js @@ -17,7 +17,6 @@ describe('Ticket create from client path', () => { }); it('should click the create simple ticket on the descriptor menu', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.clientDescriptor.moreMenu); await page.waitToClick(selectors.clientDescriptor.simpleTicketButton); let url = await page.expectURL('clientFk=102'); diff --git a/e2e/paths/05-ticket-module/16_summary.spec.js b/e2e/paths/05-ticket/16_summary.spec.js similarity index 100% rename from e2e/paths/05-ticket-module/16_summary.spec.js rename to e2e/paths/05-ticket/16_summary.spec.js diff --git a/e2e/paths/06-claim-module/01_basic_data.spec.js b/e2e/paths/06-claim/01_basic_data.spec.js similarity index 100% rename from e2e/paths/06-claim-module/01_basic_data.spec.js rename to e2e/paths/06-claim/01_basic_data.spec.js diff --git a/e2e/paths/06-claim-module/02_development.spec.js b/e2e/paths/06-claim/02_development.spec.js similarity index 99% rename from e2e/paths/06-claim-module/02_development.spec.js rename to e2e/paths/06-claim/02_development.spec.js index 351dee50f..346f88581 100644 --- a/e2e/paths/06-claim-module/02_development.spec.js +++ b/e2e/paths/06-claim/02_development.spec.js @@ -29,7 +29,7 @@ describe('Claim development', () => { const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); - }, 15000); + }); it(`should redirect to the next section of claims as the role is salesAssistant`, async() => { let url = await page.expectURL('/action'); diff --git a/e2e/paths/06-claim-module/03_detail.spec.js b/e2e/paths/06-claim/03_detail.spec.js similarity index 100% rename from e2e/paths/06-claim-module/03_detail.spec.js rename to e2e/paths/06-claim/03_detail.spec.js diff --git a/e2e/paths/06-claim-module/04_claim_action.spec.js b/e2e/paths/06-claim/04_claim_action.spec.js similarity index 100% rename from e2e/paths/06-claim-module/04_claim_action.spec.js rename to e2e/paths/06-claim/04_claim_action.spec.js diff --git a/e2e/paths/06-claim-module/05_summary.spec.js b/e2e/paths/06-claim/05_summary.spec.js similarity index 100% rename from e2e/paths/06-claim-module/05_summary.spec.js rename to e2e/paths/06-claim/05_summary.spec.js diff --git a/e2e/paths/06-claim-module/06_descriptor.spec.js b/e2e/paths/06-claim/06_descriptor.spec.js similarity index 98% rename from e2e/paths/06-claim-module/06_descriptor.spec.js rename to e2e/paths/06-claim/06_descriptor.spec.js index 8e6b3fd05..104f63945 100644 --- a/e2e/paths/06-claim-module/06_descriptor.spec.js +++ b/e2e/paths/06-claim/06_descriptor.spec.js @@ -24,7 +24,6 @@ describe('claim Descriptor path', () => { }); it(`should not be able to see the delete claim button of the descriptor more menu`, async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.claimDescriptor.moreMenu); await page.waitForSelector(selectors.claimDescriptor.moreMenuDeleteClaim, {hidden: true}); }); diff --git a/e2e/paths/07-order-module/01_edit_basic_data.spec.js b/e2e/paths/07-order/01_edit_basic_data.spec.js similarity index 97% rename from e2e/paths/07-order-module/01_edit_basic_data.spec.js rename to e2e/paths/07-order/01_edit_basic_data.spec.js index 2cbee95f7..768985628 100644 --- a/e2e/paths/07-order-module/01_edit_basic_data.spec.js +++ b/e2e/paths/07-order/01_edit_basic_data.spec.js @@ -27,7 +27,7 @@ describe('Order edit basic data path', () => { const result = await page.waitForLastSnackbar(); expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`); - }, 15000); + }); }); describe('when order with rows', () => { @@ -39,7 +39,6 @@ describe('Order edit basic data path', () => { await page.waitForContentLoaded(); await page.accessToSearchResult(orderId); await page.accessToSection('order.card.basicData'); - await page.waitForContentLoaded(); await page.waitForSelector(selectors.orderBasicData.observation, {visible: true}); let url = await page.expectURL(`#!/order/${orderId}/basic-data`); @@ -47,7 +46,6 @@ describe('Order edit basic data path', () => { }); it('should not be able to change anything', async() => { - await page.waitForContentLoaded(); await page.write(selectors.orderBasicData.observation, 'observation'); await page.waitToClick(selectors.orderBasicData.saveButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/07-order-module/02_catalog.spec.js b/e2e/paths/07-order/02_catalog.spec.js similarity index 97% rename from e2e/paths/07-order-module/02_catalog.spec.js rename to e2e/paths/07-order/02_catalog.spec.js index d67dd3c92..ca6489779 100644 --- a/e2e/paths/07-order-module/02_catalog.spec.js +++ b/e2e/paths/07-order/02_catalog.spec.js @@ -35,9 +35,7 @@ describe('Order catalog', () => { }); it('should add the realm and type filters and obtain results', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.orderCatalog.plantRealmButton); - await page.waitForContentLoaded(); await page.autocompleteSearch(selectors.orderCatalog.type, 'Anthurium'); await page.waitForNumberOfElements('section.product', 4); const result = await page.countElement('section.product'); diff --git a/e2e/paths/07-order-module/03_lines.spec.js b/e2e/paths/07-order/03_lines.spec.js similarity index 100% rename from e2e/paths/07-order-module/03_lines.spec.js rename to e2e/paths/07-order/03_lines.spec.js diff --git a/e2e/paths/08-route-module/01_create.spec.js b/e2e/paths/08-route/01_create.spec.js similarity index 100% rename from e2e/paths/08-route-module/01_create.spec.js rename to e2e/paths/08-route/01_create.spec.js diff --git a/e2e/paths/08-route-module/02_basic_data.spec.js b/e2e/paths/08-route/02_basic_data.spec.js similarity index 99% rename from e2e/paths/08-route-module/02_basic_data.spec.js rename to e2e/paths/08-route/02_basic_data.spec.js index 7828b3827..91688b3ff 100644 --- a/e2e/paths/08-route-module/02_basic_data.spec.js +++ b/e2e/paths/08-route/02_basic_data.spec.js @@ -31,7 +31,7 @@ describe('Route basic Data path', () => { const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); - }, 15000); + }); it('should confirm the worker was edited', async() => { await page.reloadSection('route.card.basicData'); diff --git a/e2e/paths/08-route-module/03_tickets.spec.js b/e2e/paths/08-route/03_tickets.spec.js similarity index 100% rename from e2e/paths/08-route-module/03_tickets.spec.js rename to e2e/paths/08-route/03_tickets.spec.js diff --git a/e2e/paths/09-invoice-out-module/01_summary.spec.js b/e2e/paths/09-invoice-out/01_summary.spec.js similarity index 97% rename from e2e/paths/09-invoice-out-module/01_summary.spec.js rename to e2e/paths/09-invoice-out/01_summary.spec.js index c67fc547e..126c745d3 100644 --- a/e2e/paths/09-invoice-out-module/01_summary.spec.js +++ b/e2e/paths/09-invoice-out/01_summary.spec.js @@ -23,7 +23,6 @@ describe('InvoiceOut summary path', () => { }); it('should contain the company from which the invoice is emited', async() => { - await page.waitForContentLoaded(); const result = await page.waitToGetProperty(selectors.invoiceOutSummary.company, 'innerText'); expect(result).toEqual('Company VNL'); diff --git a/e2e/paths/09-invoice-out-module/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js similarity index 98% rename from e2e/paths/09-invoice-out-module/02_descriptor.spec.js rename to e2e/paths/09-invoice-out/02_descriptor.spec.js index a51ae9d8f..e70c39ded 100644 --- a/e2e/paths/09-invoice-out-module/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -37,7 +37,6 @@ describe('InvoiceOut descriptor path', () => { }); it('should search for the target invoiceOut', async() => { - await page.waitForContentLoaded(); await page.write(selectors.invoiceOutIndex.topbarSearch, 'T2222222'); await page.waitToClick(selectors.invoiceOutIndex.searchButton); await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1); @@ -108,7 +107,6 @@ describe('InvoiceOut descriptor path', () => { }); it(`should search and access to the invoiceOut summary`, async() => { - await page.waitForContentLoaded(); await page.accessToSearchResult('T1111111'); let url = await page.expectURL('/summary'); diff --git a/e2e/paths/10-travel/01_thermograph.spec.js b/e2e/paths/10-travel/01_thermograph.spec.js new file mode 100644 index 000000000..efa2295a6 --- /dev/null +++ b/e2e/paths/10-travel/01_thermograph.spec.js @@ -0,0 +1,52 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Travel thermograph path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'travel'); + await page.accessToSearchResult('3'); + await page.accessToSection('travel.card.thermograph.index'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should reach the thermograph section', async() => { + const result = await page.expectURL('/thermograph/index'); + + expect(result).toBe(true); + }); + + it('should click the add thermograph floating button', async() => { + await page.waitToClick(selectors.travelThermograph.add); + const result = await page.expectURL('/thermograph/create'); + + expect(result).toBe(true); + }); + + it('should select the thermograph and then the file to upload', async() => { + let currentDir = process.cwd(); + let filePath = `${currentDir}/e2e/dms/ecc/3.jpeg`; + await page.autocompleteSearch(selectors.travelThermograph.thermographID, '138350-0'); + + const [fileChooser] = await Promise.all([ + page.waitForFileChooser(), + page.waitToClick(selectors.travelThermograph.uploadIcon) + ]); + await fileChooser.accept([filePath]); + + await page.waitToClick(selectors.travelThermograph.upload); + }); + + it('should reload the section and check everything was saved', async() => { + let createdThermograph = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText'); + + expect(createdThermograph).toContain('138350-0'); + }); +}); diff --git a/gulpfile.js b/gulpfile.js index 853fcf2d4..eb421ba9b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -174,12 +174,13 @@ function e2eSingleRun() { `${__dirname}/e2e/paths/07*/*[sS]pec.js`, `${__dirname}/e2e/paths/08*/*[sS]pec.js`, `${__dirname}/e2e/paths/09*/*[sS]pec.js`, + `${__dirname}/e2e/paths/10*/*[sS]pec.js`, `${__dirname}/e2e/paths/**/*[sS]pec.js` ]; return gulp.src(specFiles).pipe(jasmine({ errorOnFail: false, - timeout: 10000, + timeout: 30000, reporter: [ new SpecReporter({ spec: { From 752621fbf698718475ae9e76f0ee1194ac73249b Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 12 Feb 2020 07:31:46 +0100 Subject: [PATCH 65/95] removed unused timout arg --- e2e/paths/02-client/02_edit_basic_data.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/02-client/02_edit_basic_data.spec.js b/e2e/paths/02-client/02_edit_basic_data.spec.js index 9373dfe86..6ae512542 100644 --- a/e2e/paths/02-client/02_edit_basic_data.spec.js +++ b/e2e/paths/02-client/02_edit_basic_data.spec.js @@ -74,7 +74,7 @@ describe('Client Edit basicData path', () => { await page.loginAndModule('salesASsistant', 'client'); await page.accessToSearchResult('Ptonomy Wallace'); await page.accessToSection('client.card.basicData'); - }, 30000); + }); it('should be able to change the salesPerson', async() => { await page.waitForSelector(selectors.clientBasicData.name); From e0f7b917d75d59eded4b2879cab7bf326d053f74 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Wed, 12 Feb 2020 10:39:46 +0100 Subject: [PATCH 66/95] db test ticket_recalcComponent --- db/dump/fixtures.sql | 22 +++---- db/tests/vn/ticket_recalcComponents.spec.js | 62 +++++++++++++++++++ .../ticket/specs/priceDifference.spec.js | 4 +- 3 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 db/tests/vn/ticket_recalcComponents.spec.js diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 7b7651a9d..0b9c21780 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -753,7 +753,7 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric (7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.44, 0, 0, 0, CURDATE()), (8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 1.79, 0, 0, 0, CURDATE()), (9, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, CURDATE()), - (10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, CURDATE()), + (10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, CURDATE()), (11, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, CURDATE()), (12, 4, 16, 'Melee weapon heavy shield 1x0.5m', 20, 1.71, 0, 0, 0, CURDATE()), (13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, CURDATE()), @@ -814,25 +814,25 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (8, 28, 1.25), (8, 29, 0.42), (8, 39, 0.017), + (9, 15, 3.0949), (9, 21, 0.001), - (9, 28, 50), - (9, 29, 49.4), + (9, 28, 53), + (9, 29, 46.4), (9, 39, 0.994), - (10, 15, 0.0111), - (10, 21, -0.001), - (10, 28, 5), - (10, 29, 2), + (10, 15, 0.0199), + (10, 28, 7), + (10, 29, 0), (10, 39, 0.07), (11, 15, 3.0949), (11, 21, 0.001), - (11, 28, 50), - (11, 29, 49.4), + (11, 28, 53), + (11, 29, 46.4), (11, 39, 0.994), (12, 15, 0.0199), (12, 21, 0.003), - (12, 28, 1.25), - (12, 29, 0.42), + (12, 28, 2.25), + (12, 29, -0.58), (12, 39, 0.017), (13, 15, 0.114), (13, 28, 5), diff --git a/db/tests/vn/ticket_recalcComponents.spec.js b/db/tests/vn/ticket_recalcComponents.spec.js new file mode 100644 index 000000000..e140db34c --- /dev/null +++ b/db/tests/vn/ticket_recalcComponents.spec.js @@ -0,0 +1,62 @@ +const app = require('vn-loopback/server/server'); +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; + +describe('ticket_recalcComponents()', () => { + it('should recalculate the components in a ticket and check it', async() => { + let stmts = []; + let stmt; + const ticketId = 11; + + stmts.push('START TRANSACTION'); + + let sales = await app.models.Sale.find({where: {ticketFk: ticketId}}); + + stmt = new ParameterizedSQL('UPDATE vn.sale SET price=100 WHERE id IN(?,?)', [ + sales[0].id, + sales[1].id + ]); + stmts.push(stmt); + + stmt = new ParameterizedSQL('SELECT * FROM vn.sale WHERE ticketFk = ?', [ + ticketId + ]); + stmts.push(stmt); + + let modifiedSales = stmts.push(stmt) - 1; + + stmt = new ParameterizedSQL('CALL vn.ticket_recalcComponents(?)', [ + ticketId, + ]); + stmts.push(stmt); + + stmt = new ParameterizedSQL('SELECT * FROM vn.sale WHERE ticketFk = ?', [ + ticketId + ]); + stmts.push(stmt); + + let expectedSales = stmts.push(stmt) - 1; + + stmts.push('ROLLBACK'); + + let sql = ParameterizedSQL.join(stmts, ';'); + let result = await app.models.Ticket.rawStmt(sql); + + // original data + const firstPrice = sales[0].price; + const secondPrice = sales[1].price; + + // alteratons for test purposes + const modifiedFirstPrice = result[modifiedSales][0].price; + const modifiedSecondPrice = result[modifiedSales][1].price; + + // expected data after recalc + const expectedSalesFirstPrice = result[expectedSales][0].price; + const expectedSalesSecondPrice = result[expectedSales][1].price; + + expect(firstPrice).not.toEqual(modifiedFirstPrice); + expect(secondPrice).not.toEqual(modifiedSecondPrice); + + expect(firstPrice).toEqual(expectedSalesFirstPrice); + expect(secondPrice).toEqual(expectedSalesSecondPrice); + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js index 61060c9a2..bf61524c7 100644 --- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js @@ -17,8 +17,8 @@ describe('sale priceDifference()', () => { let result = await app.models.Ticket.priceDifference(httpCtx, ticketId, landed, addressId, agencyModeId, zoneId, warehouseId); - expect(result.totalUnitPrice).toEqual(215.77); - expect(result.totalNewPrice).toEqual(215.77); + expect(result.totalUnitPrice).toEqual(215.78); + expect(result.totalNewPrice).toEqual(215.78); expect(result.totalDifference).toEqual(0); }); From 2be5e04a39e7660a7e31bc12d3605a9a10d4fe36 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Wed, 12 Feb 2020 13:20:08 +0100 Subject: [PATCH 67/95] changed title in report driver-route --- print/templates/reports/driver-route/driver-route.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index bfeba3b8a..6d3b840df 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -14,7 +14,7 @@
-

{{$t('title')}}

+

{{route.id}}

{{$t('information')}}
From e8a178d5f407d53448f1e29c14d32a9e804c822d Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 12 Feb 2020 14:36:05 +0100 Subject: [PATCH 68/95] #2006 e2e route.summary plus refactors --- db/dump/fixtures.sql | 26 ++++---- e2e/helpers/extensions.js | 23 +++---- e2e/helpers/puppeteer.js | 12 ++++ e2e/helpers/selectors.js | 8 ++- e2e/paths/02-client/14_balance.spec.js | 2 +- e2e/paths/02-client/17_dms.spec.js | 2 +- e2e/paths/04-item/01_summary.spec.js | 7 +-- e2e/paths/04-item/09_regularize.spec.js | 3 +- e2e/paths/06-claim/05_summary.spec.js | 6 +- e2e/paths/08-route/01_summary.spec.js | 61 +++++++++++++++++++ .../{01_create.spec.js => 03_create.spec.js} | 1 - ...{03_tickets.spec.js => 04_tickets.spec.js} | 0 front/core/module.js | 2 +- modules/route/front/summary/index.html | 4 +- 14 files changed, 111 insertions(+), 46 deletions(-) create mode 100644 e2e/paths/08-route/01_summary.spec.js rename e2e/paths/08-route/{01_create.spec.js => 03_create.spec.js} (98%) rename e2e/paths/08-route/{03_tickets.spec.js => 04_tickets.spec.js} (100%) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 7b7651a9d..ef913eb21 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -35,7 +35,7 @@ INSERT INTO `vn`.`packagingConfig`(`upperGap`) UPDATE `account`.`role` SET id = 100 WHERE id = 0; INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`) - SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'es' + SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'EN' FROM `account`.`role` WHERE id <> 20 ORDER BY id; @@ -55,18 +55,18 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType` INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`) VALUES - (101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'), - (102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'), - (103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'), - (104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'), - (105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'), - (106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'), - (107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'), - (108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'), - (109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'), - (110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'), - (111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'), - (112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'); + (101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'ES'), + (102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'EN'), + (103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'FR'), + (104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'ES'), + (105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'PT'), + (106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'EN'), + (107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'EN'), + (108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'EN'), + (109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'EN'), + (110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'EN'), + (111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'EN'), + (112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'EN'); INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`) VALUES diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index ea8f50626..816eea064 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -1,4 +1,3 @@ -/* eslint no-invalid-this: "off" */ import {url as defaultURL} from './config'; let actions = { @@ -31,20 +30,6 @@ let actions = { }, selector); }, - changeLanguageToEnglish: async function() { - let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]'; - - await this.waitToClick('#user'); - await this.waitForSelector(`${langSelector} input`, {}); - - let lang = await this.waitToGetProperty(langSelector, 'value'); - if (lang !== 'English') - await this.autocompleteSearch(langSelector, 'English'); - - await this.keyboard.press('Escape'); - await this.waitForSelector(langSelector, {hidden: true}); - }, - doLogin: async function(userName, password = 'nightmare') { await this.waitForSelector(`vn-login vn-textfield[ng-model="$ctrl.user"]`, {visible: true}); await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.user"]`); @@ -70,7 +55,6 @@ let actions = { await this.waitForFunction(() => { return document.location.hash === '#!/'; }, {}); - await this.changeLanguageToEnglish(); }, selectModule: async function(moduleName) { @@ -534,6 +518,13 @@ let actions = { }, selector); }, + closePopup: async function(selector) { + await Promise.all([ + this.keyboard.press('Escape'), + this.waitForSelector('.vn-popup', {hidden: true}), + ]); + }, + waitForContentLoaded: async function() { await this.waitFor(1000); // to be implemented in base of a directive loaded once al modules are done loading, further investigation required. diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index 351a26669..ed05909d0 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -15,6 +15,18 @@ export async function getBrowser() { slowMo: 0, // slow down by ms }); let page = (await browser.pages())[0]; + await page.evaluateOnNewDocument(() => { + Object.defineProperty(navigator, 'language', { + get: function() { + return 'en'; + } + }); + Object.defineProperty(navigator, 'languages', { + get: function() { + return ['en']; + } + }); + }); page = extendPage(page); page.setDefaultTimeout(5000); await page.goto(defaultURL, {waitUntil: 'networkidle0'}); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ed232ef3b..564745752 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -643,7 +643,13 @@ export default { volume: 'vn-route-descriptor vn-label-value[label="Volume"] > section > span' }, routeSummary: { - routeId: 'vn-route-summary > vn-card > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(1) > section > span' + header: 'vn-route-summary > vn-card > h5', + routeId: 'vn-route-summary > vn-card > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(1) > section > span', + cost: 'vn-route-summary vn-label-value[label="Cost"]', + firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(2) > span', + firstTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor', + firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(3) > span', + firstClientDescriptor: '.vn-popover.shown vn-client-descriptor', }, routeBasicData: { worker: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]', diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index 52d179383..f45937deb 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -39,7 +39,7 @@ describe('Client balance path', () => { }); it('should click the new payment button', async() => { - await page.keyboard.press('Escape'); + await page.closePopup(); await page.reloadSection('client.card.balance.index'); let url = await page.expectURL('/balance'); diff --git a/e2e/paths/02-client/17_dms.spec.js b/e2e/paths/02-client/17_dms.spec.js index 01a197c84..9891fd3f4 100644 --- a/e2e/paths/02-client/17_dms.spec.js +++ b/e2e/paths/02-client/17_dms.spec.js @@ -27,7 +27,7 @@ describe('Client DMS', () => { it(`should click on the first document line worker name making the descriptor visible`, async() => { await page.waitToClick(selectors.dms.firstDocWorker); - await page.wait(selectors.dms.firstDocWorkerDescriptor); + await page.waitForSelector(selectors.dms.firstDocWorkerDescriptor); const visible = await page.isVisible(selectors.dms.firstDocWorkerDescriptor); expect(visible).toBeTruthy(); diff --git a/e2e/paths/04-item/01_summary.spec.js b/e2e/paths/04-item/01_summary.spec.js index 0196e0930..97fef9ca9 100644 --- a/e2e/paths/04-item/01_summary.spec.js +++ b/e2e/paths/04-item/01_summary.spec.js @@ -68,9 +68,8 @@ describe('Item summary path', () => { }); it(`should close the summary popup`, async() => { - await page.keyboard.press('Escape'); - await page.waitUntilNotPresent(selectors.itemSummary.basicData); - await page.waitFor(selectors.itemSummary.basicData, {hidden: true}); + await page.closePopup(); + await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true}); }); it('should search for other item', async() => { @@ -125,7 +124,7 @@ describe('Item summary path', () => { }); it(`should now close the summary popup`, async() => { - await page.keyboard.press('Escape'); + await page.closePopup(); await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true}); }); diff --git a/e2e/paths/04-item/09_regularize.spec.js b/e2e/paths/04-item/09_regularize.spec.js index e43429aa0..7f63694b9 100644 --- a/e2e/paths/04-item/09_regularize.spec.js +++ b/e2e/paths/04-item/09_regularize.spec.js @@ -27,8 +27,7 @@ describe('Item regularize path', () => { const userLocalWarehouse = await page .waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value'); - await page.keyboard.press('Escape'); - await page.waitForSelector('.user-popover.vn-popover', {hidden: true}); + await page.closePopup(); expect(userLocalWarehouse).toContain('Warehouse Four'); }); diff --git a/e2e/paths/06-claim/05_summary.spec.js b/e2e/paths/06-claim/05_summary.spec.js index a9d97533c..9dab65954 100644 --- a/e2e/paths/06-claim/05_summary.spec.js +++ b/e2e/paths/06-claim/05_summary.spec.js @@ -60,8 +60,7 @@ describe('claim Summary path', () => { it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => { await page.waitForSelector(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton, {visible: true}); - await page.keyboard.press('Escape'); - await page.waitFor(1000); + await page.closePopup(); }); it('should display the claim development details', async() => { @@ -81,8 +80,7 @@ describe('claim Summary path', () => { it(`should check the url for the go to clientlink of the descriptor is for the right client id`, async() => { await page.waitForSelector(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton, {visible: true}); - await page.keyboard.press('Escape'); - await page.waitFor(1000); + await page.closePopup(); }); it(`should click on the first action ticket ID making the ticket descriptor visible`, async() => { diff --git a/e2e/paths/08-route/01_summary.spec.js b/e2e/paths/08-route/01_summary.spec.js new file mode 100644 index 000000000..c062b9b08 --- /dev/null +++ b/e2e/paths/08-route/01_summary.spec.js @@ -0,0 +1,61 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Route summary path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'route'); + await page.waitToClick('vn-route-index vn-tbody > a:nth-child(1)'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should reach the first route summary section', async() => { + let url = await page.expectURL('#!/route/1/summary'); + + expect(url).toBe(true); + }); + + it(`should display details from the route on the header`, async() => { + await page.waitForTextInElement(selectors.routeSummary.header, 'first route'); + const result = await page.waitToGetProperty(selectors.routeSummary.header, 'innerText'); + + expect(result).toContain('first route'); + }); + + it('should display some route details like the cost', async() => { + const result = await page.waitToGetProperty(selectors.routeSummary.cost, 'innerText'); + + expect(result).toContain('€10.00'); + }); + + it('should click on the first ticket ID making the descriptor popover visible', async() => { + await page.waitToClick(selectors.routeSummary.firstTicketID); + await page.waitForSelector(selectors.routeSummary.firstTicketDescriptor); + const visible = await page.isVisible(selectors.routeSummary.firstTicketDescriptor); + + expect(visible).toBe(true); + }); + + it('should close the ticket descriptor', async() => { + await page.closePopup(); + }); + + it('should click on the first alias making the client descriptor popover visible', async() => { + await page.waitToClick(selectors.routeSummary.firstAlias); + await page.waitForSelector(selectors.routeSummary.firstClientDescriptor); + const visible = await page.isVisible(selectors.routeSummary.firstClientDescriptor); + + expect(visible).toBe(true); + }); + + it('should close the client descriptor', async() => { + await page.closePopup(); + }); +}); diff --git a/e2e/paths/08-route/01_create.spec.js b/e2e/paths/08-route/03_create.spec.js similarity index 98% rename from e2e/paths/08-route/01_create.spec.js rename to e2e/paths/08-route/03_create.spec.js index 14d5273b3..11ffd500b 100644 --- a/e2e/paths/08-route/01_create.spec.js +++ b/e2e/paths/08-route/03_create.spec.js @@ -37,7 +37,6 @@ describe('Route create path', () => { beforeAll(async() => { await page.login('delivery'); await page.selectModule('route'); - await page.changeLanguageToEnglish(); }); it('should again click on the add new route button and open the creation form', async() => { diff --git a/e2e/paths/08-route/03_tickets.spec.js b/e2e/paths/08-route/04_tickets.spec.js similarity index 100% rename from e2e/paths/08-route/03_tickets.spec.js rename to e2e/paths/08-route/04_tickets.spec.js diff --git a/front/core/module.js b/front/core/module.js index 0c52fd565..82a954892 100644 --- a/front/core/module.js +++ b/front/core/module.js @@ -80,7 +80,7 @@ export function config($translateProvider, $translatePartialLoaderProvider, $ani let langs = ['en', 'es']; let langAliases = { en_US: 'en', - en_UK: 'en', + en_GB: 'en', es_ES: 'es', es_AR: 'es' }; diff --git a/modules/route/front/summary/index.html b/modules/route/front/summary/index.html index 0ec6c47fe..527f7fe96 100644 --- a/modules/route/front/summary/index.html +++ b/modules/route/front/summary/index.html @@ -84,8 +84,8 @@ {{ticket.packages}} {{ticket.volume}} {{ticket.warehouse.name}} - {{ticket.client.postcode}} - {{ticket.client.street}} + {{ticket.address.postalCode}} + {{ticket.address.street}} Date: Wed, 12 Feb 2020 14:38:51 +0100 Subject: [PATCH 69/95] db production exported --- .../10121-zoneClosure/00-zoneClosure.sql | 5 - .../00-zoneClosure_recalc.sql | 50 - .../10121-zoneClosure/00-zoneConfig.sql | 11 - .../00-catalog_componentCalculate.sql | 254 -- db/changes/10130-christmas/00-chatConfig.sql | 5 - .../10130-christmas/00-greugeConfig.sql | 6 - .../00-manaSpellersRequery.sql | 70 - .../00-timeControl_calculate.sql | 44 - db/changes/10140-kings/00-ACL.sql | 3 - db/changes/10140-kings/00-buy_afterUpsert.sql | 81 - .../10140-kings/00-clientRisk_update.sql | 18 - db/changes/10140-kings/00-componentType.sql | 3 - .../10140-kings/00-customer_risk_update.sql | 12 - db/changes/10140-kings/00-department.sql | 2 - .../00-ticketComponentUpdateSale.sql | 155 -- .../10140-kings/00-travelThermograph.sql | 7 - .../10140-kings/00-triggerInvoiceOut.sql | 27 - db/changes/10140-kings/00-triggerReceipt.sql | 20 - .../10140-kings/00-weekWaste_getDetail.sql | 29 - .../10140-kings/00-worker_isWorking.sql | 32 - .../10140-kings/01-order_confirmWithUser.sql | 240 -- .../10140-kings/01-tarifaComponentSerie.sql | 12 - db/dump/dumpedFixtures.sql | 32 +- db/dump/structure.sql | 2347 +++++++++++------ .../specs/activeWorkersWithRole.spec.js | 2 +- .../methods/client/specs/listWorkers.spec.js | 2 +- 26 files changed, 1535 insertions(+), 1934 deletions(-) delete mode 100644 db/changes/10121-zoneClosure/00-zoneClosure.sql delete mode 100644 db/changes/10121-zoneClosure/00-zoneClosure_recalc.sql delete mode 100644 db/changes/10121-zoneClosure/00-zoneConfig.sql delete mode 100644 db/changes/10130-christmas/00-catalog_componentCalculate.sql delete mode 100644 db/changes/10130-christmas/00-chatConfig.sql delete mode 100644 db/changes/10130-christmas/00-greugeConfig.sql delete mode 100644 db/changes/10130-christmas/00-manaSpellersRequery.sql delete mode 100644 db/changes/10130-christmas/00-timeControl_calculate.sql delete mode 100644 db/changes/10140-kings/00-ACL.sql delete mode 100644 db/changes/10140-kings/00-buy_afterUpsert.sql delete mode 100644 db/changes/10140-kings/00-clientRisk_update.sql delete mode 100644 db/changes/10140-kings/00-componentType.sql delete mode 100644 db/changes/10140-kings/00-customer_risk_update.sql delete mode 100644 db/changes/10140-kings/00-department.sql delete mode 100644 db/changes/10140-kings/00-ticketComponentUpdateSale.sql delete mode 100644 db/changes/10140-kings/00-travelThermograph.sql delete mode 100644 db/changes/10140-kings/00-triggerInvoiceOut.sql delete mode 100644 db/changes/10140-kings/00-triggerReceipt.sql delete mode 100644 db/changes/10140-kings/00-weekWaste_getDetail.sql delete mode 100644 db/changes/10140-kings/00-worker_isWorking.sql delete mode 100644 db/changes/10140-kings/01-order_confirmWithUser.sql delete mode 100644 db/changes/10140-kings/01-tarifaComponentSerie.sql diff --git a/db/changes/10121-zoneClosure/00-zoneClosure.sql b/db/changes/10121-zoneClosure/00-zoneClosure.sql deleted file mode 100644 index 07db5b167..000000000 --- a/db/changes/10121-zoneClosure/00-zoneClosure.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE `vn`.`zoneClosure` ( - `zoneFk` INT NOT NULL, - `dated` DATE NOT NULL, - `hour` TIME NOT NULL, - PRIMARY KEY (`zoneFk`, `dated`)); diff --git a/db/changes/10121-zoneClosure/00-zoneClosure_recalc.sql b/db/changes/10121-zoneClosure/00-zoneClosure_recalc.sql deleted file mode 100644 index cb313cdec..000000000 --- a/db/changes/10121-zoneClosure/00-zoneClosure_recalc.sql +++ /dev/null @@ -1,50 +0,0 @@ - -DROP procedure IF EXISTS vn.`zoneClosure_recalc`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` PROCEDURE vn.`zoneClosure_recalc`() -proc: BEGIN -/** - * Recalculates the delivery time (hour) for every zone in days + scope in future - */ - DECLARE vScope INT; - DECLARE vCounter INT DEFAULT 0; - DECLARE vShipped DATE DEFAULT CURDATE(); - - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - BEGIN - DO RELEASE_LOCK('vn.zoneClosure_recalc'); - RESIGNAL; - END; - - IF NOT GET_LOCK('vn.zoneClosure_recalc', 0) THEN - LEAVE proc; - END IF; - - SELECT scope INTO vScope - FROM zoneConfig; - - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - CREATE TEMPORARY TABLE tmp.zone - (INDEX (id)) - ENGINE = MEMORY - SELECT id FROM zone; - - TRUNCATE TABLE zoneClosure; - - REPEAT - CALL zone_getOptionsForShipment(vShipped); - INSERT INTO zoneClosure(zoneFk, dated, `hour`) - SELECT zoneFk, vShipped, `hour` FROM tmp.zoneOption; - - SET vCounter = vCounter + 1; - SET vShipped = TIMESTAMPADD(DAY, 1, vShipped); - UNTIL vCounter > vScope - END REPEAT; - - DROP TEMPORARY TABLE tmp.zone; - DO RELEASE_LOCK('vn.zoneClosure_recalc'); -END$$ - -DELIMITER ; - diff --git a/db/changes/10121-zoneClosure/00-zoneConfig.sql b/db/changes/10121-zoneClosure/00-zoneConfig.sql deleted file mode 100644 index 915fb8894..000000000 --- a/db/changes/10121-zoneClosure/00-zoneConfig.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE `vn`.`zoneConfig` ( - `id` INT UNSIGNED NOT NULL, - `scope` INT UNSIGNED NOT NULL, - PRIMARY KEY (`id`)); - -ALTER TABLE `vn`.`zoneConfig` -CHANGE COLUMN `id` `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ; - -INSERT INTO `vn`.`zoneConfig` (`scope`) VALUES ('1'); - -INSERT INTO `bs`.`nightTask` (`order`, `schema`, `procedure`) VALUES ('100', 'vn', 'zoneClosure_recalc'); diff --git a/db/changes/10130-christmas/00-catalog_componentCalculate.sql b/db/changes/10130-christmas/00-catalog_componentCalculate.sql deleted file mode 100644 index c778c7b3a..000000000 --- a/db/changes/10130-christmas/00-catalog_componentCalculate.sql +++ /dev/null @@ -1,254 +0,0 @@ -DROP procedure IF EXISTS `vn`.`catalog_componentCalculate`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`catalog_componentCalculate`( - vZoneFk INT, - vAddressFk INT, - vShipped DATE) -proc: BEGIN -/** - * Calcula los componentes de los articulos de tmp.ticketLot - * - * @param vZoneFk para calcular el transporte - * @param vAgencyModeFk Id del modo de agencia - * @param tmp.ticketLot (warehouseFk,available,itemFk,buyFk) - * - * @return tmp.ticketComponent(itemFk, warehouseFk, available, rate2, rate3, minPrice, - * packing, grouping, groupingMode, buyFk, typeFk) - * @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, grouping, price) - */ - DECLARE vClientFk INT; - DECLARE vGeneralInflationCoefficient INT DEFAULT 1; - DECLARE vMinimumDensityWeight INT DEFAULT 167; - DECLARE vBoxFreightItem INT DEFAULT 71; - DECLARE vBoxVolume BIGINT; -- DEFAULT 138000; - DECLARE vSpecialPriceComponent INT DEFAULT 10; - DECLARE vDeliveryComponent INT DEFAULT 15; - DECLARE vRecoveryComponent INT DEFAULT 17; - DECLARE vSellByPacketComponent INT DEFAULT 22; - DECLARE vBuyValueComponent INT DEFAULT 28; - DECLARE vMarginComponent INT DEFAULT 29; - DECLARE vDiscountLastItemComponent INT DEFAULT 32; - DECLARE vExtraBaggedComponent INT DEFAULT 38; - DECLARE vManaAutoComponent INT DEFAULT 39; - - SELECT volume INTO vBoxVolume - FROM vn.packaging - WHERE id = '94'; - - SELECT clientFk INTO vClientFK - FROM address - WHERE id = vAddressFk; - - SET @rate2 := 0; - SET @rate3 := 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate; - CREATE TEMPORARY TABLE tmp.ticketComponentCalculate - (PRIMARY KEY (itemFk, warehouseFk)) - ENGINE = MEMORY - SELECT - tl.itemFk, tl.warehouseFk, tl.available, - IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) * 1.0 rate2, - IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) * 1.0 rate3, - IFNULL(pf.rate3, 0) AS minPrice, - IFNULL(pf.packing, b.packing) packing, - IFNULL(pf.`grouping`, b.`grouping`) `grouping`, - ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, - tl.buyFk, - i.typeFk, - IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping - FROM tmp.ticketLot tl - JOIN buy b ON b.id = tl.buyFk - JOIN item i ON i.id = tl.itemFk - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN specialPrice sp ON sp.itemFk = i.id AND sp.clientFk = vClientFk - LEFT JOIN ( - SELECT * FROM ( - SELECT pf.itemFk, pf.`grouping`, pf.packing, pf.box, pf.rate2, pf.rate3, zw.warehouseFk - FROM priceFixed pf - JOIN zoneWarehouse zw ON zw.zoneFk = vZoneFk AND (zw.warehouseFk = pf.warehouseFk OR pf.warehouseFk = 0) - WHERE vShipped BETWEEN pf.started AND pf.ended ORDER BY pf.itemFk, pf.warehouseFk DESC - ) tpf - GROUP BY tpf.itemFk, tpf.warehouseFk - ) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk - WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.display <> 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent; - CREATE TEMPORARY TABLE tmp.ticketComponent ( - `warehouseFk` INT UNSIGNED NOT NULL, - `itemFk` INT NOT NULL, - `componentFk` INT UNSIGNED NOT NULL, - `cost` DECIMAL(10,4) NOT NULL, - INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC), - UNIQUE INDEX `itemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC)); - - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - vBuyValueComponent, - b.buyingValue + b.freightValue + b.packageValue + b.comissionValue - FROM tmp.ticketComponentCalculate tcc - JOIN buy b ON b.id = tcc.buyFk; - - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - vMarginComponent, - tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue - FROM tmp.ticketComponentCalculate tcc - JOIN buy b ON b.id = tcc.buyFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase; - CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY - SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk - FROM tmp.ticketComponent tc - GROUP BY tc.itemFk, warehouseFk; - - INSERT INTO tmp.ticketComponent - SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.priceIncreasing, 0.25), 3) - FROM tmp.ticketComponentBase tcb - JOIN claimRatio cr ON cr.clientFk = vClientFk - WHERE cr.priceIncreasing > 0.009; - - INSERT INTO tmp.ticketComponent - SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto - FROM tmp.ticketComponentBase tcb - JOIN `client` c on c.id = vClientFk - JOIN workerMana wm ON c.salesPersonFk = wm.workerFk - WHERE wm.isPricesModifierActivated - HAVING manaAuto <> 0; - - INSERT INTO tmp.ticketComponent - SELECT tcb.warehouseFk, - tcb.itemFk, - c.id, - GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3) - FROM tmp.ticketComponentBase tcb - JOIN component c - JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; - - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3 - FROM tmp.ticketComponentCalculate tcc - JOIN buy b ON b.id = tcc.buyFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE sp.value IS NULL; - - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFK, - tcc.itemFk, - vDeliveryComponent, - vGeneralInflationCoefficient - * ROUND(( - i.compression - * ic.cm3 - * IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1) - * IFNULL((z.price - z.bonus) - * 1/*amz.inflation*/ , 50)) / vBoxVolume, 4 - ) cost - FROM tmp.ticketComponentCalculate tcc - JOIN item i ON i.id = tcc.itemFk - JOIN zone z ON z.id = vZoneFk - JOIN agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk - AND ic.itemFk = tcc.itemFk - HAVING cost <> 0; - - IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, b.itemFk, vExtraBaggedComponent, ap.packagingValue cost - FROM tmp.ticketComponentCalculate tcc - JOIN vn.addressForPackaging ap - WHERE ap.addressFk = vAddressFk; - END IF; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy; - CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY - SELECT * FROM tmp.ticketComponent; - - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, - tcc.itemFk, - vSpecialPriceComponent, - sp.value - SUM(tcc.cost) sumCost - FROM tmp.ticketComponentCopy tcc - JOIN component c ON c.id = tcc.componentFk - JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk - WHERE c.classRate IS NULL - GROUP BY tcc.itemFk, tcc.warehouseFk - HAVING ABS(sumCost) > 0.001; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum; - CREATE TEMPORARY TABLE tmp.ticketComponentSum - (INDEX (itemFk, warehouseFk)) - ENGINE = MEMORY - SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate - FROM tmp.ticketComponent tc - JOIN component c ON c.id = tc.componentFk - GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; - CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY - SELECT tcc.warehouseFk, - tcc.itemFk, - 1 rate, - IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`, - CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, - CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 1) = 1 - AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT - tcc.warehouseFk, - tcc.itemFk, - 2 rate, - tcc.packing `grouping`, - SUM(tcs.sumCost) price, - SUM(tcs.sumCost) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2 - AND tcc.packing > 0 AND tcc.available >= tcc.packing) - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT - tcc.warehouseFk, - tcc.itemFk, - 3 rate, - tcc.available `grouping`, - SUM(tcs.sumCost) price, - SUM(tcs.sumCost) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 3) = 3 - GROUP BY tcs.warehouseFk, tcs.itemFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice; - CREATE TEMPORARY TABLE tmp.ticketComponentPrice ENGINE = MEMORY - SELECT * FROM ( - SELECT * FROM tmp.ticketComponentRate ORDER BY price - ) t - GROUP BY itemFk, warehouseFk, `grouping`; - - DROP TEMPORARY TABLE - tmp.ticketComponentCalculate, - tmp.ticketComponentSum, - tmp.ticketComponentBase, - tmp.ticketComponentRate, - tmp.ticketComponentCopy; -END$$ -DELIMITER ; \ No newline at end of file diff --git a/db/changes/10130-christmas/00-chatConfig.sql b/db/changes/10130-christmas/00-chatConfig.sql deleted file mode 100644 index beff3bde4..000000000 --- a/db/changes/10130-christmas/00-chatConfig.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE `vn`.`chatConfig` -ADD COLUMN `host` VARCHAR(255) NOT NULL AFTER `id`, -CHANGE COLUMN `uri` `api` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL ; - -UPDATE `vn`.`chatConfig` SET `host` = 'https://chat.verdnatura.es' WHERE (`id` = '1'); diff --git a/db/changes/10130-christmas/00-greugeConfig.sql b/db/changes/10130-christmas/00-greugeConfig.sql deleted file mode 100644 index c21751f08..000000000 --- a/db/changes/10130-christmas/00-greugeConfig.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE `vn`.`greugeConfig` ( - `id` INT NOT NULL AUTO_INCREMENT, - `freightPickUpPrice` DECIMAL(10,2) NOT NULL, - PRIMARY KEY (`id`)); - -INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); diff --git a/db/changes/10130-christmas/00-manaSpellersRequery.sql b/db/changes/10130-christmas/00-manaSpellersRequery.sql deleted file mode 100644 index cc185fdba..000000000 --- a/db/changes/10130-christmas/00-manaSpellersRequery.sql +++ /dev/null @@ -1,70 +0,0 @@ - -DROP procedure IF EXISTS `vn`.`manaSpellersRequery`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`manaSpellersRequery`(vWorkerFk INTEGER) -BEGIN - - DECLARE vWorkerIsExcluded BOOLEAN; - DECLARE vFromDated DATE; - DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,CURDATE()); - DECLARE vMana INT; - DECLARE vAutoMana INT; - DECLARE vManaBank INT; - DECLARE vManaGreugeType INT; - - SELECT id INTO vMana - FROM `component` WHERE code = 'mana'; - - SELECT id INTO vAutoMana - FROM `component` WHERE code = 'autoMana'; - - SELECT id INTO vManaBank - FROM `bank` WHERE code = 'mana'; - - SELECT id INTO vManaGreugeType - FROM `greugeType` WHERE code = 'mana'; - - SELECT COUNT(*) INTO vWorkerIsExcluded - FROM workerManaExcluded - WHERE workerFk = vWorkerFk; - - IF NOT vWorkerIsExcluded THEN - - SELECT max(dated) INTO vFromDated - FROM clientManaCache; - - REPLACE workerMana (workerFk, amount) - SELECT vWorkerFk, sum(mana) FROM - ( - SELECT s.quantity * sc.value as mana - FROM ticket t - JOIN address a ON a.id = t.addressFk - JOIN client c ON c.id = a.clientFk - JOIN sale s ON s.ticketFk = t.id - JOIN saleComponent sc ON sc.saleFk = s.id - WHERE c.salesPersonFk = vWorkerFk AND sc.componentFk IN (vMana, vAutoMana) - AND t.shipped > vFromDated AND t.shipped < vToDated - UNION ALL - SELECT - r.amountPaid - FROM receipt r - JOIN client c ON c.id = r.clientFk - WHERE c.salesPersonFk = vWorkerFk AND bankFk = vManaBank - AND payed > vFromDated - UNION ALL - SELECT g.amount - FROM greuge g - JOIN client c ON c.id = g.clientFk - WHERE c.salesPersonFk = vWorkerFk AND g.greugeTypeFk = vManaGreugeType - AND g.shipped > vFromDated and g.shipped < CURDATE() - UNION ALL - SELECT cc.mana - FROM clientManaCache cc - JOIN client c ON c.id = cc.clientFk - WHERE c.salesPersonFk = vWorkerFk AND cc.dated = vFromDated - ) sub; - END IF; -END$$ - -DELIMITER ; - diff --git a/db/changes/10130-christmas/00-timeControl_calculate.sql b/db/changes/10130-christmas/00-timeControl_calculate.sql deleted file mode 100644 index 0a6470216..000000000 --- a/db/changes/10130-christmas/00-timeControl_calculate.sql +++ /dev/null @@ -1,44 +0,0 @@ -USE `vn`; -DROP procedure IF EXISTS `timeControl_calculate`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `timeControl_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - SET @vIsOdd := TRUE; - SET @vUser := NULL; - SET @vDated := NULL; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; - - CREATE TEMPORARY TABLE tmp.timeControlCalculate - SELECT userFk, - dated, - IF( timeWork >= 18000, @timeWork:=timeWork + 1200, @timeWork:=timeWork) timeWorkSeconds, - SEC_TO_TIME(@timeWork ) timeWorkSexagesimal, - @timeWork / 3600 timeWorkDecimal - FROM (SELECT SUM(timeWork) timeWork, - userFk, - dated - FROM (SELECT IF(@vUser = wtc.userFk, @vUser :=@vUser, @vUser := wtc.userFk ), - IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE ), - IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd ), - IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed), - IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed)-@vLastTimed) timeWork, - IF(direction='in', @vDated := DATE(wtc.timed), @vDated :=@vDated) dated, - wtc.userFk, - wtc.timed timed, - direction - FROM (SELECT * FROM workerTimeControl ORDER BY userFk, timed ASC) wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk - WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo - ORDER BY userFk, timed ASC - ) sub - GROUP BY userFk, dated - ORDER BY userFk, dated - )sub2; - -END$$ - -DELIMITER ; - diff --git a/db/changes/10140-kings/00-ACL.sql b/db/changes/10140-kings/00-ACL.sql deleted file mode 100644 index fe1cbeb24..000000000 --- a/db/changes/10140-kings/00-ACL.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Thermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer'); -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('TravelThermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer'); -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Entry', '*', '*', 'ALLOW', 'ROLE', 'buyer'); \ No newline at end of file diff --git a/db/changes/10140-kings/00-buy_afterUpsert.sql b/db/changes/10140-kings/00-buy_afterUpsert.sql deleted file mode 100644 index ab038628c..000000000 --- a/db/changes/10140-kings/00-buy_afterUpsert.sql +++ /dev/null @@ -1,81 +0,0 @@ - -DROP procedure IF EXISTS `vn`.`buy_afterUpsert`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`buy_afterUpsert`(vSelf INT) -BEGIN -/** - * Triggered actions when a buy is updated or inserted. - * - * @param vSelf The buy reference - */ - DECLARE vEntryFk INT; - DECLARE vItemFk INT; - DECLARE vStickers INT; - DECLARE vPacking INT; - DECLARE vWarehouse INT; - DECLARE vWarehouseOut INT; - DECLARE vIsMerchandise BOOL; - DECLARE vIsFeedStock BOOL; - DECLARE vLanded DATE; - DECLARE vBuyerFk INT; - DECLARE vItemName VARCHAR(50); - - SELECT entryFk, itemFk, stickers, packing - INTO vEntryFk, vItemFk, vStickers, vPacking - FROM buy - WHERE id = vSelf; - - SELECT t.warehouseInFk, t.warehouseOutFk, t.landed - INTO vWarehouse, vWarehouseOut, vLanded - FROM entry e - JOIN travel t ON t.id = e.travelFk - WHERE e.id = vEntryFk; - - SELECT k.merchandise, it.workerFk, i.longName - INTO vIsMerchandise, vBuyerFk, vItemName - FROM itemCategory k - JOIN itemType it ON it.categoryFk = k.id - JOIN item i ON i.typeFk = it.id - WHERE i.id = vItemFk; - - IF vIsMerchandise THEN - REPLACE itemCost SET - itemFk = vItemFk, - warehouseFk = vWarehouse, - cm3 = buy_getUnitVolume(vSelf); - END IF; - - SELECT isFeedStock INTO vIsFeedStock - FROM warehouse WHERE id = vWarehouseOut AND id <> 13; - - IF vIsFeedStock THEN - INSERT IGNORE INTO producer(`name`) - SELECT es.company_name - FROM buy b - JOIN edi.ekt be ON be.id = b.ektFk - JOIN edi.supplier es ON es.supplier_id = be.pro - WHERE b.id = vSelf; - - IF buy_hasNotifyPassport(vSelf, vItemFk) THEN - CALL vn.buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking); - END IF; - END IF; - - -- Aviso al comprador de modificacion de entrada en Barajas - IF (SELECT isBuyerToBeEmailed FROM warehouse WHERE id = vWarehouse) - AND vLanded = CURDATE() - AND vBuyerFk != account.myUserGetId() - THEN - - CALL vn.mail_insert(CONCAT(account.userGetNameFromId(vBuyerFk),'@verdnatura.es'), - CONCAT(account.myUserGetName(),'@verdnatura.es'), - CONCAT('E ',vEntryFk,' Se ha modificado item ', vItemFk, ' ',vItemName), - 'Este email se ha generado automáticamente'); - - END IF; - -END$$ - -DELIMITER ; - diff --git a/db/changes/10140-kings/00-clientRisk_update.sql b/db/changes/10140-kings/00-clientRisk_update.sql deleted file mode 100644 index 389236e1d..000000000 --- a/db/changes/10140-kings/00-clientRisk_update.sql +++ /dev/null @@ -1,18 +0,0 @@ - -DELIMITER $$ -CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2)) -BEGIN - IF vAmount IS NOT NULL - THEN - INSERT INTO clientRisk - SET - clientFk = vClientId, - companyFk = vCompanyId, - amount = vAmount - ON DUPLICATE KEY UPDATE - amount = amount + VALUES(amount); - END IF; -END$$ - -DELIMITER ; - diff --git a/db/changes/10140-kings/00-componentType.sql b/db/changes/10140-kings/00-componentType.sql deleted file mode 100644 index e17d35400..000000000 --- a/db/changes/10140-kings/00-componentType.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE `vn`.`componentType` -CHANGE COLUMN `base` `isBase` TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos' ; - diff --git a/db/changes/10140-kings/00-customer_risk_update.sql b/db/changes/10140-kings/00-customer_risk_update.sql deleted file mode 100644 index c7ecead4f..000000000 --- a/db/changes/10140-kings/00-customer_risk_update.sql +++ /dev/null @@ -1,12 +0,0 @@ - -DROP procedure IF EXISTS `bi`.`customer_risk_update`; - -DELIMITER $$ -USE `bi`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `bi`.`customer_risk_update`(v_customer INT, v_company INT, v_amount DECIMAL(10,2)) -BEGIN - CALL vn.clientRisk_update(v_customer, v_company, v_amount); -END$$ - -DELIMITER ; - diff --git a/db/changes/10140-kings/00-department.sql b/db/changes/10140-kings/00-department.sql deleted file mode 100644 index 29008d753..000000000 --- a/db/changes/10140-kings/00-department.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `vn`.`department` -ADD COLUMN `chatName` VARCHAR(45) NULL AFTER `path`; diff --git a/db/changes/10140-kings/00-ticketComponentUpdateSale.sql b/db/changes/10140-kings/00-ticketComponentUpdateSale.sql deleted file mode 100644 index b40debce6..000000000 --- a/db/changes/10140-kings/00-ticketComponentUpdateSale.sql +++ /dev/null @@ -1,155 +0,0 @@ - - -DROP procedure IF EXISTS `vn`.`ticketComponentUpdateSale`; - -DELIMITER $$ - -CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketComponentUpdateSale`(vOption INT) -BEGIN -/** - * A partir de la tabla tmp.sale, crea los Movimientos_componentes - * y modifica el campo Preu de la tabla Movimientos - * - * @param i_option integer tipo de actualizacion - * @param table tmp.sale tabla memory con el campo saleFk, warehouseFk - **/ - DECLARE vComponentFk INT; - DECLARE vRenewComponents BOOLEAN; - DECLARE vKeepPrices BOOLEAN; - - CASE vOption - WHEN 1 THEN - SET vRenewComponents = TRUE; - SET vKeepPrices = FALSE; - WHEN 2 THEN - SET vComponentFk = 17; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 3 THEN - SET vComponentFk = 37; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 4 THEN - SET vComponentFk = 34; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 5 THEN - SET vComponentFk = 35; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 6 THEN - SET vComponentFk = 36; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 7 THEN - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk NOT IN (28, 29) - GROUP BY s.id; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk NOT IN (28, 29) - GROUP BY s.id; - - SET vRenewComponents = FALSE; - SET vKeepPrices = FALSE; - WHEN 8 THEN - DELETE sc.* - FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id; - - SET vRenewComponents = FALSE; - SET vKeepPrices = FALSE; - WHEN 9 THEN - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - END CASE; - - IF vRenewComponents THEN - DELETE sc.* - FROM tmp.sale tmps - JOIN saleComponent sc ON sc.saleFk = tmps.saleFk - JOIN `component` c ON c.id = sc.componentFk - WHERE c.isRenewable; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, tc.componentFk, tc.cost - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk = tc.componentFk - LEFT JOIN `component` c ON c.id = tc.componentFk - WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE); - END IF; - - IF vKeepPrices THEN - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - WHERE sc.saleFk <> vComponentFk - GROUP BY s.id - HAVING dif <> 0; - ELSE - UPDATE sale s - JOIN item i on i.id = s.itemFk - JOIN itemType it on it.id = i.typeFk - JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk - FROM saleComponent sc - JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - GROUP BY sc.saleFk) sc ON sc.saleFk = s.id - SET s.price = sumValue - WHERE it.code != 'PRT' ; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - WHERE sc.componentFk != 21 - GROUP BY s.id - HAVING ROUND(saleValue, 4) <> 0; - END IF; - - UPDATE sale s - JOIN ( - SELECT SUM(sc.value) sumValue, sc.saleFk - FROM saleComponent sc - JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - JOIN `component` c ON c.id = sc.componentFk - JOIN componentType ct on ct.id = c.typeFk AND ct.isBase - GROUP BY sc.saleFk) sc ON sc.saleFk = s.id - SET s.priceFixed = sumValue, s.isPriceFixed = 1; - - DELETE sc.* - FROM saleComponent sc - JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - JOIN sale s on s.id = sc.saleFk - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - WHERE it.code = 'PRT'; - - INSERT INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 15, s.price - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - JOIN item i ON i.id = s.itemFK - JOIN itemType it ON it.id = i.typeFk - WHERE it.code = 'PRT' AND s.price > 0; -END$$ - -DELIMITER ; - diff --git a/db/changes/10140-kings/00-travelThermograph.sql b/db/changes/10140-kings/00-travelThermograph.sql deleted file mode 100644 index c19151a45..000000000 --- a/db/changes/10140-kings/00-travelThermograph.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE `vn`.`travelThermograph` -ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST, -DROP PRIMARY KEY, -ADD PRIMARY KEY (`id`); - -ALTER TABLE `vn`.`travelThermograph` -ADD UNIQUE INDEX `thermograph_created` (`thermographFk` ASC, `created` ASC) VISIBLE; \ No newline at end of file diff --git a/db/changes/10140-kings/00-triggerInvoiceOut.sql b/db/changes/10140-kings/00-triggerInvoiceOut.sql deleted file mode 100644 index 7f6ed30b1..000000000 --- a/db/changes/10140-kings/00-triggerInvoiceOut.sql +++ /dev/null @@ -1,27 +0,0 @@ -DROP TRIGGER IF EXISTS `vn`.`invoiceOut_afterInsert`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_afterInsert` AFTER INSERT ON `vn`.`invoiceOut` FOR EACH ROW BEGIN - CALL clientRisk_update(NEW.clientFk, NEW.companyFk, NEW.amount); -END$$ -DELIMITER ; - -DROP TRIGGER IF EXISTS `vn`.`invoiceOut_beforeUpdate`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_beforeUpdate` BEFORE UPDATE ON `vn`.`invoiceOut` FOR EACH ROW -BEGIN - CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount); - CALL clientRisk_update (NEW.clientFk, NEW.companyFk, NEW.amount); -END$$ - -DELIMITER ; - - -DROP TRIGGER IF EXISTS `vn`.`invoiceOut_beforeDelete`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_beforeDelete` BEFORE DELETE ON `invoiceOut` FOR EACH ROW BEGIN - CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount); -END$$ -DELIMITER ; diff --git a/db/changes/10140-kings/00-triggerReceipt.sql b/db/changes/10140-kings/00-triggerReceipt.sql deleted file mode 100644 index c9c368a40..000000000 --- a/db/changes/10140-kings/00-triggerReceipt.sql +++ /dev/null @@ -1,20 +0,0 @@ -DROP TRIGGER IF EXISTS `vn`.`receipt_afterInsert`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_afterInsert` AFTER INSERT ON `receipt` FOR EACH ROW - CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid)$$ -DELIMITER ; -DROP TRIGGER IF EXISTS `vn`.`receipt_beforeUpdate`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_beforeUpdate` BEFORE UPDATE ON `receipt` FOR EACH ROW BEGIN - CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid); - CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid); -END$$ -DELIMITER ; -DROP TRIGGER IF EXISTS `vn`.`receipt_beforeDelete`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_beforeDelete` BEFORE DELETE ON `receipt` FOR EACH ROW - CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid)$$ -DELIMITER ; diff --git a/db/changes/10140-kings/00-weekWaste_getDetail.sql b/db/changes/10140-kings/00-weekWaste_getDetail.sql deleted file mode 100644 index a7e099f58..000000000 --- a/db/changes/10140-kings/00-weekWaste_getDetail.sql +++ /dev/null @@ -1,29 +0,0 @@ -USE `bs`; -DROP procedure IF EXISTS `weekWaste_getDetail`; - -DELIMITER $$ -USE `bs`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `weekWaste_getDetail`() -BEGIN - DECLARE vLastWeek DATE; - DECLARE vWeek INT; - DECLARE vYear INT; - - SET vLastWeek = TIMESTAMPADD(WEEK,-1,CURDATE()); - SET vYear = YEAR(vLastWeek); - SET vWeek = WEEK(vLastWeek, 1); - - SELECT *, 100 * dwindle / total AS percentage - FROM ( - SELECT buyer, - ws.family, - sum(ws.saleTotal) AS total, - sum(ws.saleWaste) AS dwindle - FROM bs.waste ws - WHERE year = vYear AND week = vWeek - GROUP BY buyer, family - ) sub - ORDER BY percentage DESC; -END$$ - -DELIMITER ; diff --git a/db/changes/10140-kings/00-worker_isWorking.sql b/db/changes/10140-kings/00-worker_isWorking.sql deleted file mode 100644 index b80d287e0..000000000 --- a/db/changes/10140-kings/00-worker_isWorking.sql +++ /dev/null @@ -1,32 +0,0 @@ -USE `vn`; -DROP function IF EXISTS `worker_isWorking`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` FUNCTION `worker_isWorking`(vWorkerFk INT) RETURNS tinyint(1) - READS SQL DATA -BEGIN -/** - * Comprueba si el trabajador está trabajando en el momento de la consulta - * @return Devuelve TRUE en caso de que este trabajando. Si se encuentra en un descanso devolverá FALSE - */ - DECLARE vLastIn DATETIME ; - - SELECT MAX(timed) INTO vLastIn - FROM vn.workerTimeControl - WHERE userFk = vWorkerFk AND - direction = 'in'; - - IF (SELECT MOD(COUNT(*),2) - FROM vn.workerTimeControl - WHERE userFk = vWorkerFk AND - timed >= vLastIn - ) THEN - RETURN TRUE; - ELSE - RETURN FALSE; - END IF; -END$$ - -DELIMITER ; - diff --git a/db/changes/10140-kings/01-order_confirmWithUser.sql b/db/changes/10140-kings/01-order_confirmWithUser.sql deleted file mode 100644 index c398edc4c..000000000 --- a/db/changes/10140-kings/01-order_confirmWithUser.sql +++ /dev/null @@ -1,240 +0,0 @@ - -DROP procedure IF EXISTS `hedera`.`order_confirmWithUser`; - -DELIMITER $$ -CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`order_confirmWithUser`(IN `vOrder` INT, IN `vUserId` INT) -BEGIN -/** - * Confirms an order, creating each of its tickets on the corresponding - * date, store and user. - * - * @param vOrder The order identifier - * @param vUser The user identifier - */ - DECLARE vOk BOOL; - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vWarehouse INT; - DECLARE vShipment DATETIME; - DECLARE vTicket INT; - DECLARE vNotes VARCHAR(255); - DECLARE vItem INT; - DECLARE vConcept VARCHAR(30); - DECLARE vAmount INT; - DECLARE vPrice DECIMAL(10,2); - DECLARE vSale INT; - DECLARE vRate INT; - DECLARE vRowId INT; - DECLARE vDelivery DATE; - DECLARE vAddress INT; - DECLARE vIsConfirmed BOOL; - DECLARE vClientId INT; - DECLARE vCompanyId INT; - DECLARE vAgencyModeId INT; - - DECLARE TICKET_FREE INT DEFAULT 2; - - DECLARE cDates CURSOR FOR - SELECT zgs.shipped, r.warehouse_id - FROM `order` o - JOIN order_row r ON r.order_id = o.id - LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id - WHERE o.id = vOrder AND r.amount != 0 - GROUP BY r.warehouse_id; - - DECLARE cRows CURSOR FOR - SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate - FROM order_row r - JOIN vn.item i ON i.id = r.item_id - WHERE r.amount != 0 - AND r.warehouse_id = vWarehouse - AND r.order_id = vOrder - ORDER BY r.rate DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - -- Carga los datos del pedido - - SELECT o.date_send, o.address_id, o.note, - o.confirmed, a.clientFk, o.company_id, o.agency_id - INTO vDelivery, vAddress, vNotes, - vIsConfirmed, vClientId, vCompanyId, vAgencyModeId - FROM hedera.`order` o - JOIN vn.address a ON a.id = o.address_id - WHERE o.id = vOrder; - - -- Comprueba que el pedido no está confirmado - - IF vIsConfirmed THEN - CALL util.throw ('ORDER_ALREADY_CONFIRMED'); - END IF; - - -- Comprueba que el pedido no está vacío - - SELECT COUNT(*) > 0 INTO vOk - FROM order_row WHERE order_id = vOrder AND amount > 0; - - IF !vOk THEN - CALL util.throw ('ORDER_EMPTY'); - END IF; - - -- Carga las fechas de salida de cada almacén - - CALL vn.zone_getShippedWarehouse (vDelivery, vAddress, vAgencyModeId); - - -- Trabajador que realiza la acción - - IF vUserId IS NULL THEN - SELECT employeeFk INTO vUserId FROM orderConfig; - END IF; - - -- Crea los tickets del pedido - - START TRANSACTION; - - OPEN cDates; - - lDates: - LOOP - SET vTicket = NULL; - SET vDone = FALSE; - FETCH cDates INTO vShipment, vWarehouse; - - IF vDone THEN - LEAVE lDates; - END IF; - - -- Busca un ticket existente que coincida con los parametros - - SELECT t.id INTO vTicket - FROM vn.ticket t - LEFT JOIN vn.ticketState tls on tls.ticket = t.id - JOIN `order` o - ON o.address_id = t.addressFk - AND vWarehouse = t.warehouseFk - AND o.agency_id = t.agencyModeFk - AND o.date_send = t.landed - AND vShipment = DATE(t.shipped) - WHERE o.id = vOrder - AND t.invoiceOutFk IS NULL - AND IFNULL(tls.alertLevel,0) = 0 - AND t.clientFk <> 1118 - LIMIT 1; - - -- Crea el ticket en el caso de no existir uno adecuado - - IF vTicket IS NULL - THEN - CALL vn.ticketCreateWithUser( - vClientId, - IFNULL(vShipment, CURDATE()), - vWarehouse, - vCompanyId, - vAddress, - vAgencyModeId, - NULL, - vDelivery, - vUserId, - vTicket - ); - ELSE - INSERT INTO vncontrol.inter - SET Id_Ticket = vTicket, - Id_Trabajador = vUserId, - state_id = TICKET_FREE; - END IF; - - INSERT IGNORE INTO vn.orderTicket - SET orderFk = vOrder, - ticketFk = vTicket; - - -- Añade las notas - - IF vNotes IS NOT NULL AND vNotes != '' - THEN - INSERT INTO vn.ticketObservation SET - ticketFk = vTicket, - observationTypeFk = 4 /* salesperson */ , - `description` = vNotes - ON DUPLICATE KEY UPDATE - `description` = CONCAT(VALUES(`description`),'. ', `description`); - END IF; - - -- Añade los movimientos y sus componentes - - OPEN cRows; - - lRows: - LOOP - SET vDone = FALSE; - FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate; - - IF vDone THEN - LEAVE lRows; - END IF; - - INSERT INTO vn.sale - SET - itemFk = vItem, - ticketFk = vTicket, - concept = vConcept, - quantity = vAmount, - price = vPrice, - priceFixed = 0, - isPriceFixed = TRUE; - - SET vSale = LAST_INSERT_ID(); - - INSERT INTO vn.saleComponent - (saleFk, componentFk, `value`) - SELECT vSale, cm.component_id, cm.price - FROM order_component cm - JOIN vn.component c ON c.id = cm.component_id - WHERE cm.order_row_id = vRowId - GROUP BY vSale, cm.component_id; - - UPDATE order_row SET Id_Movimiento = vSale - WHERE id = vRowId; - - END LOOP; - - CLOSE cRows; - - -- Fija el coste - - DROP TEMPORARY TABLE IF EXISTS tComponents; - CREATE TEMPORARY TABLE tComponents - (INDEX (saleFk)) - ENGINE = MEMORY - SELECT SUM(sc.`value`) valueSum, sc.saleFk - FROM vn.saleComponent sc - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase - JOIN vn.sale s ON s.id = sc.saleFk - WHERE s.ticketFk = vTicket - GROUP BY sc.saleFk; - - UPDATE vn.sale s - JOIN tComponents mc ON mc.saleFk = s.id - SET s.priceFixed = valueSum; - - DROP TEMPORARY TABLE tComponents; - END LOOP; - - CLOSE cDates; - - DELETE FROM basketOrder WHERE orderFk = vOrder; - UPDATE `order` SET confirmed = TRUE, confirm_date = NOW() - WHERE id = vOrder; - - COMMIT; -END$$ - -DELIMITER ; - diff --git a/db/changes/10140-kings/01-tarifaComponentSerie.sql b/db/changes/10140-kings/01-tarifaComponentSerie.sql deleted file mode 100644 index acdae0b13..000000000 --- a/db/changes/10140-kings/01-tarifaComponentSerie.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `bi`.`tarifa_componentes_series` AS - SELECT - `ct`.`id` AS `tarifa_componentes_series_id`, - `ct`.`type` AS `Serie`, - `ct`.`isBase` AS `base`, - `ct`.`isMargin` AS `margen` - FROM - `vn`.`componentType` `ct`; diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 7e766195d..47bfd9b53 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -23,7 +23,7 @@ USE `util`; LOCK TABLES `config` WRITE; /*!40000 ALTER TABLE `config` DISABLE KEYS */; -INSERT INTO `config` VALUES (1,'10121',0,'production',NULL); +INSERT INTO `config` VALUES (1,'10140',0,'production',NULL); /*!40000 ALTER TABLE `config` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -36,7 +36,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-23 14:05:01 +-- Dump completed on 2020-02-12 13:30:39 USE `account`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -61,7 +61,7 @@ USE `account`; LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; -INSERT INTO `role` VALUES (0,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2018-04-23 14:33:59'),(1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de departamento',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'),(49,'production','Empleado de producción',0,'2018-02-26 15:28:23','2019-01-21 12:57:21'),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12'),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39'),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57'),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57'),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17'),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31'),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02'),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19'),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45'),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10'),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01'),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07'),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05'),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08'),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26'),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56'),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23'); +INSERT INTO `role` VALUES (0,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2018-04-23 14:33:59'),(1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de departamento',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'),(49,'production','Empleado de producción',0,'2018-02-26 15:28:23','2019-01-21 12:57:21'),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12'),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39'),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57'),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57'),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17'),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31'),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02'),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19'),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45'),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10'),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01'),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07'),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05'),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08'),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26'),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56'),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23'),(69,'coolerAssist','Empleado cámara con permiso compras',1,'2020-02-05 12:36:09','2020-02-05 12:36:09'); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -71,7 +71,7 @@ UNLOCK TABLES; LOCK TABLES `roleInherit` WRITE; /*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */; -INSERT INTO `roleInherit` VALUES (9,0),(66,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(51,1),(53,1),(54,1),(56,1),(58,1),(1,2),(1,3),(30,5),(39,5),(60,5),(67,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(50,13),(52,13),(55,13),(57,13),(59,13),(61,13),(16,15),(20,16),(21,18),(52,19),(65,19),(17,20),(30,20),(5,21),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(41,35),(52,35),(65,35),(49,36),(61,36),(17,37),(38,37),(60,37),(67,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47),(50,49),(60,50),(65,50),(52,51),(21,53),(30,53),(55,54),(57,56),(15,57),(39,57),(50,57),(60,57),(49,58),(59,58),(50,59),(17,64),(30,64),(38,64),(20,65); +INSERT INTO `roleInherit` VALUES (9,0),(66,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(51,1),(53,1),(54,1),(56,1),(58,1),(1,2),(1,3),(30,5),(39,5),(60,5),(67,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(50,13),(52,13),(55,13),(57,13),(59,13),(61,13),(16,15),(20,16),(21,18),(52,19),(65,19),(17,20),(30,20),(5,21),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(41,35),(52,35),(65,35),(69,35),(49,36),(61,36),(17,37),(38,37),(60,37),(67,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47),(69,47),(50,49),(60,50),(65,50),(52,51),(21,53),(30,53),(55,54),(57,56),(15,57),(39,57),(50,57),(60,57),(49,58),(59,58),(50,59),(17,64),(30,64),(38,64),(20,65); /*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */; UNLOCK TABLES; @@ -81,7 +81,7 @@ UNLOCK TABLES; LOCK TABLES `roleRole` WRITE; /*!40000 ALTER TABLE `roleRole` DISABLE KEYS */; -INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(0,49),(0,50),(0,51),(0,52),(0,53),(0,54),(0,55),(0,56),(0,57),(0,58),(0,59),(0,60),(0,61),(0,62),(0,64),(0,65),(0,66),(0,67),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,21),(5,33),(5,53),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(9,49),(9,50),(9,51),(9,52),(9,53),(9,54),(9,55),(9,56),(9,57),(9,58),(9,59),(9,60),(9,61),(9,62),(9,64),(9,65),(9,66),(9,67),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,13),(15,15),(15,35),(15,56),(15,57),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(16,56),(16,57),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,15),(17,16),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,35),(17,36),(17,37),(17,39),(17,44),(17,47),(17,49),(17,50),(17,53),(17,56),(17,57),(17,58),(17,59),(17,64),(17,65),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(19,53),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,15),(20,16),(20,18),(20,19),(20,20),(20,21),(20,35),(20,36),(20,44),(20,47),(20,49),(20,50),(20,53),(20,56),(20,57),(20,58),(20,59),(20,65),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(21,53),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(22,53),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,15),(30,16),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(30,35),(30,36),(30,44),(30,47),(30,49),(30,50),(30,53),(30,56),(30,57),(30,58),(30,59),(30,64),(30,65),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(38,64),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,21),(39,33),(39,39),(39,53),(39,56),(39,57),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,35),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48),(49,1),(49,2),(49,3),(49,6),(49,11),(49,36),(49,44),(49,47),(49,49),(49,58),(50,1),(50,2),(50,3),(50,6),(50,11),(50,13),(50,36),(50,44),(50,47),(50,49),(50,50),(50,56),(50,57),(50,58),(50,59),(51,1),(51,2),(51,3),(51,6),(51,11),(51,51),(52,1),(52,2),(52,3),(52,6),(52,11),(52,13),(52,18),(52,19),(52,21),(52,35),(52,51),(52,52),(52,53),(53,1),(53,2),(53,3),(53,6),(53,11),(53,53),(54,1),(54,2),(54,3),(54,6),(54,11),(54,54),(55,1),(55,2),(55,3),(55,6),(55,11),(55,13),(55,54),(55,55),(56,1),(56,2),(56,3),(56,6),(56,11),(56,56),(57,1),(57,2),(57,3),(57,6),(57,11),(57,13),(57,56),(57,57),(58,1),(58,2),(58,3),(58,6),(58,11),(58,58),(59,1),(59,2),(59,3),(59,6),(59,11),(59,13),(59,58),(59,59),(60,1),(60,2),(60,3),(60,5),(60,6),(60,11),(60,13),(60,18),(60,21),(60,33),(60,36),(60,37),(60,44),(60,47),(60,49),(60,50),(60,53),(60,56),(60,57),(60,58),(60,59),(60,60),(61,1),(61,2),(61,3),(61,6),(61,11),(61,13),(61,36),(61,44),(61,47),(61,61),(62,62),(64,64),(65,1),(65,2),(65,3),(65,6),(65,11),(65,13),(65,18),(65,19),(65,21),(65,35),(65,36),(65,44),(65,47),(65,49),(65,50),(65,53),(65,56),(65,57),(65,58),(65,59),(65,65),(66,0),(66,1),(66,2),(66,3),(66,5),(66,6),(66,9),(66,11),(66,13),(66,15),(66,16),(66,17),(66,18),(66,19),(66,20),(66,21),(66,22),(66,30),(66,31),(66,32),(66,33),(66,34),(66,35),(66,36),(66,37),(66,38),(66,39),(66,40),(66,41),(66,42),(66,43),(66,44),(66,45),(66,47),(66,48),(66,49),(66,50),(66,51),(66,52),(66,53),(66,54),(66,55),(66,56),(66,57),(66,58),(66,59),(66,60),(66,61),(66,62),(66,64),(66,65),(66,66),(66,67),(67,1),(67,2),(67,3),(67,5),(67,6),(67,11),(67,13),(67,18),(67,21),(67,33),(67,37),(67,53),(67,67); +INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(0,49),(0,50),(0,51),(0,52),(0,53),(0,54),(0,55),(0,56),(0,57),(0,58),(0,59),(0,60),(0,61),(0,62),(0,64),(0,65),(0,66),(0,67),(0,69),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,21),(5,33),(5,53),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(9,49),(9,50),(9,51),(9,52),(9,53),(9,54),(9,55),(9,56),(9,57),(9,58),(9,59),(9,60),(9,61),(9,62),(9,64),(9,65),(9,66),(9,67),(9,69),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,13),(15,15),(15,35),(15,56),(15,57),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(16,56),(16,57),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,15),(17,16),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,35),(17,36),(17,37),(17,39),(17,44),(17,47),(17,49),(17,50),(17,53),(17,56),(17,57),(17,58),(17,59),(17,64),(17,65),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(19,53),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,15),(20,16),(20,18),(20,19),(20,20),(20,21),(20,35),(20,36),(20,44),(20,47),(20,49),(20,50),(20,53),(20,56),(20,57),(20,58),(20,59),(20,65),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(21,53),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(22,53),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,15),(30,16),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(30,35),(30,36),(30,44),(30,47),(30,49),(30,50),(30,53),(30,56),(30,57),(30,58),(30,59),(30,64),(30,65),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(38,64),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,21),(39,33),(39,39),(39,53),(39,56),(39,57),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,35),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48),(49,1),(49,2),(49,3),(49,6),(49,11),(49,36),(49,44),(49,47),(49,49),(49,58),(50,1),(50,2),(50,3),(50,6),(50,11),(50,13),(50,36),(50,44),(50,47),(50,49),(50,50),(50,56),(50,57),(50,58),(50,59),(51,1),(51,2),(51,3),(51,6),(51,11),(51,51),(52,1),(52,2),(52,3),(52,6),(52,11),(52,13),(52,18),(52,19),(52,21),(52,35),(52,51),(52,52),(52,53),(53,1),(53,2),(53,3),(53,6),(53,11),(53,53),(54,1),(54,2),(54,3),(54,6),(54,11),(54,54),(55,1),(55,2),(55,3),(55,6),(55,11),(55,13),(55,54),(55,55),(56,1),(56,2),(56,3),(56,6),(56,11),(56,56),(57,1),(57,2),(57,3),(57,6),(57,11),(57,13),(57,56),(57,57),(58,1),(58,2),(58,3),(58,6),(58,11),(58,58),(59,1),(59,2),(59,3),(59,6),(59,11),(59,13),(59,58),(59,59),(60,1),(60,2),(60,3),(60,5),(60,6),(60,11),(60,13),(60,18),(60,21),(60,33),(60,36),(60,37),(60,44),(60,47),(60,49),(60,50),(60,53),(60,56),(60,57),(60,58),(60,59),(60,60),(61,1),(61,2),(61,3),(61,6),(61,11),(61,13),(61,36),(61,44),(61,47),(61,61),(62,62),(64,64),(65,1),(65,2),(65,3),(65,6),(65,11),(65,13),(65,18),(65,19),(65,21),(65,35),(65,36),(65,44),(65,47),(65,49),(65,50),(65,53),(65,56),(65,57),(65,58),(65,59),(65,65),(66,0),(66,1),(66,2),(66,3),(66,5),(66,6),(66,9),(66,11),(66,13),(66,15),(66,16),(66,17),(66,18),(66,19),(66,20),(66,21),(66,22),(66,30),(66,31),(66,32),(66,33),(66,34),(66,35),(66,36),(66,37),(66,38),(66,39),(66,40),(66,41),(66,42),(66,43),(66,44),(66,45),(66,47),(66,48),(66,49),(66,50),(66,51),(66,52),(66,53),(66,54),(66,55),(66,56),(66,57),(66,58),(66,59),(66,60),(66,61),(66,62),(66,64),(66,65),(66,66),(66,67),(66,69),(67,1),(67,2),(67,3),(67,5),(67,6),(67,11),(67,13),(67,18),(67,21),(67,33),(67,37),(67,53),(67,67),(69,1),(69,2),(69,3),(69,6),(69,11),(69,35),(69,47),(69,69); /*!40000 ALTER TABLE `roleRole` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -94,7 +94,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-23 14:05:01 +-- Dump completed on 2020-02-12 13:30:39 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -119,7 +119,7 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'WorkerCalendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'WorkerCalendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','employee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','employee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'WorkerCalendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'WorkerCalendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','employee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','employee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','*','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -142,7 +142,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-23 14:05:01 +-- Dump completed on 2020-02-12 13:30:39 USE `vn`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -217,7 +217,7 @@ UNLOCK TABLES; LOCK TABLES `pgc` WRITE; /*!40000 ALTER TABLE `pgc` DISABLE KEYS */; -INSERT INTO `pgc` VALUES ('4722000000',0.00,'Importación Exento ',1,0,0,1),('4722000010',10.00,'Importación Reducido ',1,0,0,1),('4722000021',21.00,'Importación General ',1,0,0,1),('4770000001',8.00,'Reducido',1,1,1,1),('4770000002',0.00,'Extra-Community supply',3,1,0,2),('4770000004',4.00,'Super reducido',1,1,1,1),('4770000010',10.00,'Reducido',1,1,1,1),('4770000020',0.00,'Exento',7,1,1,1),('4770000021',21.00,'General',1,1,1,1),('4770000101',10.00,'Reducido ',1,1,1,1),('4770000108',8.00,'Reducido',1,1,1,1),('4770000110',1.40,'Rec. Eq. Reducido',1,0,0,1),('4770000215',21.00,'General',1,1,1,1),('4770000405',0.50,'Rec. Eq. Super Reducido',1,0,0,1),('4770000504',4.00,'Super reducido',1,1,1,1),('4770000521',5.20,'Rec. Eq. General',1,0,0,1),('4770000701',1.00,'Rec. Eq. Reducido',1,0,0,1),('4771000000',0.00,'Intra-Community supply',6,1,1,1),('4771000001',0.00,'Intra-Community services',7,1,1,1),('HolandaGEN',21.00,'General',1,0,0,1),('HolandaRED',9.00,'Reducido',1,0,0,1),('IGIC cero',0.00,'Cero',1,0,0,1),('IGIC gener',6.50,'General',1,0,0,1),('IGIC reduc',3.00,'Reducido',1,0,0,1); +INSERT INTO `pgc` VALUES ('4722000000',0.00,'Importación Exento ',1,0,0,1,0),('4722000010',10.00,'Importación Reducido ',1,0,0,1,0),('4722000021',21.00,'Importación General ',1,0,0,1,0),('4770000001',8.00,'Reducido',1,1,1,1,0),('4770000002',0.00,'Extra-Community supply',3,1,0,2,0),('4770000004',4.00,'Super reducido',1,1,1,1,0),('4770000010',10.00,'Reducido',1,1,1,1,0),('4770000020',0.00,'Exento',7,1,1,1,0),('4770000021',21.00,'General',1,1,1,1,0),('4770000101',10.00,'Reducido ',1,1,1,1,0),('4770000108',8.00,'Reducido',1,1,1,1,0),('4770000110',1.40,'Rec. Eq. Reducido',1,0,0,1,1),('4770000215',21.00,'General',1,1,1,1,0),('4770000405',0.50,'Rec. Eq. Super Reducido',1,0,0,1,1),('4770000504',4.00,'Super reducido',1,1,1,1,0),('4770000521',5.20,'Rec. Eq. General',1,0,0,1,1),('4770000701',1.00,'Rec. Eq. Reducido',1,0,0,1,1),('4771000000',0.00,'Intra-Community supply',6,1,1,1,0),('4771000001',0.00,'Intra-Community services',7,1,1,1,0),('HolandaGEN',21.00,'General',1,0,0,1,0),('HolandaRED',9.00,'Reducido',1,0,0,1,0),('IGIC cero',0.00,'Cero',1,0,0,1,0),('IGIC gener',6.50,'General',1,0,0,1,0),('IGIC reduc',3.00,'Reducido',1,0,0,1,0); /*!40000 ALTER TABLE `pgc` ENABLE KEYS */; UNLOCK TABLES; @@ -307,7 +307,7 @@ UNLOCK TABLES; LOCK TABLES `department` WRITE; /*!40000 ALTER TABLE `department` DISABLE KEYS */; -INSERT INTO `department` VALUES (1,'VERDNATURA',1,2,763,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(22,'COMPRAS',3,4,NULL,72,596,2,5,0,0,0,0,NULL,'/'),(23,'CAMARA',5,6,NULL,72,604,2,6,1,0,0,0,NULL,'/'),(31,'INFORMATICA',7,8,NULL,72,127,3,9,0,0,0,0,NULL,'/'),(34,'CONTABILIDAD',9,10,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(35,'FINANZAS',11,12,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(36,'LABORAL',13,14,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(37,'PRODUCCION',15,24,NULL,72,230,3,11,0,0,0,4,NULL,'/'),(38,'SACADO',16,17,NULL,72,230,4,14,1,0,1,0,37,'/37/'),(39,'ENCAJADO',18,19,NULL,72,230,4,12,1,0,1,0,37,'/37/'),(41,'ADMINISTRACION',25,26,NULL,72,599,3,8,0,0,0,0,NULL,'/'),(43,'VENTAS',27,48,NULL,0,NULL,NULL,NULL,0,0,0,10,NULL,'/'),(44,'GERENCIA',49,50,NULL,72,300,2,7,0,0,0,0,NULL,'/'),(45,'LOGISTICA',51,52,NULL,72,596,3,19,0,0,0,0,NULL,'/'),(46,'REPARTO',20,21,NULL,72,659,3,10,0,0,1,0,37,'/37/'),(48,'ALMACENAJE',53,54,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(49,'PROPIEDAD',55,56,NULL,72,1008,1,1,0,0,0,0,NULL,'/'),(52,'CARGA AEREA',57,58,NULL,72,163,4,28,0,0,0,0,NULL,'/'),(53,'MARKETING Y COMUNICACIÓN',59,60,NULL,72,1238,0,0,0,0,0,0,NULL,'/'),(54,'ORNAMENTALES',61,62,NULL,72,433,3,21,0,0,0,0,NULL,'/'),(55,'TALLER NATURAL',63,64,NULL,72,695,2,23,0,0,0,0,NULL,'/'),(56,'TALLER ARTIFICIAL',65,66,NULL,72,1780,2,24,0,0,0,0,NULL,'/'),(58,'CAMPOS',67,68,NULL,72,225,2,2,0,0,0,0,NULL,'/'),(59,'MANTENIMIENTO',69,70,NULL,72,1907,4,16,0,0,0,0,NULL,'/'),(60,'RECLAMACIONES',71,72,NULL,72,563,3,20,0,0,0,0,NULL,'/'),(61,'VNH',73,74,NULL,73,1297,3,17,0,0,0,0,NULL,'/'),(63,'VENTAS FRANCIA',28,29,NULL,72,277,2,27,0,0,1,0,43,'/43/'),(66,'VERDNAMADRID',75,76,NULL,72,163,3,18,0,0,0,0,NULL,'/'),(68,'COMPLEMENTOS',77,78,NULL,72,617,3,26,1,0,0,0,NULL,'/'),(69,'VERDNABARNA',79,80,NULL,74,432,3,22,0,0,0,0,NULL,'/'),(77,'PALETIZADO',22,23,NULL,72,230,4,15,1,0,1,0,37,'/37/'),(80,'EQUIPO J VALLES',30,31,NULL,72,693,3,4,0,0,1,0,43,'/43/'),(86,'LIMPIEZA',81,82,NULL,72,599,0,0,0,0,0,0,NULL,'/'),(89,'COORDINACION',83,84,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,'/'),(90,'TRAILER',85,86,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(91,'ARTIFICIAL',87,88,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,'/'),(92,'EQUIPO SILVERIO',32,33,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(93,'CONFECCION',89,90,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/'),(94,'EQUIPO J BROCAL',34,35,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(95,'EQUIPO C ZAMBRANO',36,37,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(96,'EQUIPO C LOPEZ',38,39,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(97,'EQUIPO D SARRION',40,41,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(98,'EQUIPO RODRIGO',42,43,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(99,'EQUIPO MANOLI',44,45,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'),(101,'EQUIPO J IBAÑEZ',46,47,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/'); +INSERT INTO `department` VALUES (1,'VERDNATURA',1,2,763,0,NULL,NULL,NULL,0,0,0,0,NULL,'/',NULL),(22,'COMPRAS',3,4,NULL,72,596,2,5,0,0,0,0,NULL,'/',NULL),(23,'CAMARA',5,6,NULL,72,604,2,6,1,0,0,0,NULL,'/',NULL),(31,'INFORMATICA',7,8,NULL,72,127,3,9,0,0,0,0,NULL,'/','informatica'),(34,'CONTABILIDAD',9,10,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/',NULL),(35,'FINANZAS',11,12,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/',NULL),(36,'LABORAL',13,14,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/',NULL),(37,'PRODUCCION',15,24,NULL,72,230,3,11,0,0,0,4,NULL,'/',NULL),(38,'SACADO',16,17,NULL,72,230,4,14,1,0,1,0,37,'/37/',NULL),(39,'ENCAJADO',18,19,NULL,72,230,4,12,1,0,1,0,37,'/37/',NULL),(41,'ADMINISTRACION',25,26,NULL,72,599,3,8,0,0,0,0,NULL,'/',NULL),(43,'VENTAS',27,48,NULL,0,NULL,NULL,NULL,0,0,0,10,NULL,'/',NULL),(44,'GERENCIA',49,50,NULL,72,300,2,7,0,0,0,0,NULL,'/',NULL),(45,'LOGISTICA',51,52,NULL,72,596,3,19,0,0,0,0,NULL,'/',NULL),(46,'REPARTO',20,21,NULL,72,659,3,10,0,0,1,0,37,'/37/',NULL),(48,'ALMACENAJE',53,54,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/',NULL),(49,'PROPIEDAD',55,56,NULL,72,1008,1,1,0,0,0,0,NULL,'/',NULL),(52,'CARGA AEREA',57,58,NULL,72,163,4,28,0,0,0,0,NULL,'/',NULL),(53,'MARKETING Y COMUNICACIÓN',59,60,NULL,72,1238,0,0,0,0,0,0,NULL,'/',NULL),(54,'ORNAMENTALES',61,62,NULL,72,433,3,21,0,0,0,0,NULL,'/',NULL),(55,'TALLER NATURAL',63,64,NULL,72,695,2,23,0,0,0,0,NULL,'/',NULL),(56,'TALLER ARTIFICIAL',65,66,NULL,72,1780,2,24,0,0,0,0,NULL,'/',NULL),(58,'CAMPOS',67,68,NULL,72,225,2,2,0,0,0,0,NULL,'/',NULL),(59,'MANTENIMIENTO',69,70,NULL,72,1907,4,16,0,0,0,0,NULL,'/',NULL),(60,'RECLAMACIONES',71,72,NULL,72,563,3,20,0,0,0,0,NULL,'/',NULL),(61,'VNH',73,74,NULL,73,1297,3,17,0,0,0,0,NULL,'/',NULL),(63,'VENTAS FRANCIA',28,29,NULL,72,277,2,27,0,0,1,0,43,'/43/',NULL),(66,'VERDNAMADRID',75,76,NULL,72,163,3,18,0,0,0,0,NULL,'/',NULL),(68,'COMPLEMENTOS',77,78,NULL,72,617,3,26,1,0,0,0,NULL,'/',NULL),(69,'VERDNABARNA',79,80,NULL,74,432,3,22,0,0,0,0,NULL,'/',NULL),(77,'PALETIZADO',22,23,NULL,72,230,4,15,1,0,1,0,37,'/37/',NULL),(80,'EQUIPO J VALLES',30,31,NULL,72,693,3,4,0,0,1,0,43,'/43/','jvp_equipo'),(86,'LIMPIEZA',81,82,NULL,72,599,0,0,0,0,0,0,NULL,'/',NULL),(89,'COORDINACION',83,84,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,'/',NULL),(90,'TRAILER',85,86,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/',NULL),(91,'ARTIFICIAL',87,88,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,'/',NULL),(92,'EQUIPO SILVERIO',32,33,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/','sdc_equipo'),(93,'CONFECCION',89,90,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,'/',NULL),(94,'EQUIPO J BROCAL',34,35,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/','jes_equipo'),(95,'EQUIPO C ZAMBRANO',36,37,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/','czg_equipo'),(96,'EQUIPO C LOPEZ',38,39,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/','cla_equipo'),(97,'EQUIPO D SARRION',40,41,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/','dsr_equipo'),(98,'EQUIPO RODRIGO',42,43,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/','rhr_equipo'),(99,'EQUIPO MANOLI',44,45,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/','man_equipo'),(101,'EQUIPO J IBAÑEZ',46,47,NULL,0,NULL,NULL,NULL,0,0,1,0,43,'/43/','jmi_equipo'); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; @@ -340,7 +340,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-23 14:05:01 +-- Dump completed on 2020-02-12 13:30:40 USE `cache`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -378,7 +378,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-23 14:05:01 +-- Dump completed on 2020-02-12 13:30:40 USE `hedera`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -436,7 +436,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-23 14:05:01 +-- Dump completed on 2020-02-12 13:30:40 USE `postgresql`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -491,7 +491,7 @@ UNLOCK TABLES; LOCK TABLES `professional_category` WRITE; /*!40000 ALTER TABLE `professional_category` DISABLE KEYS */; -INSERT INTO `professional_category` VALUES (1,'Mozos',5,1,27.5),(2,'Encargados',3,1,27.5),(4,'Comprador',3,1,27.5),(5,'Aux Administracion',NULL,1,27.5),(6,'Of Administracion',3,1,27.5),(7,'Jefe Administracion',2,1,27.5),(8,'Informatico',3,1,27.5),(9,'Directivo',1,0,27.5),(10,'Aux Ventas',4,1,27.5),(11,'Vendedor',4,1,27.5),(12,'Jefe de Ventas',4,0,27.5),(13,'Repartidor',5,1,27.5),(14,'Aprendices',NULL,1,27.5),(15,'Técnicos',2,1,27.5),(16,'Aux Florista',5,1,27.5),(17,'Florista',4,1,27.5),(18,'Jefe Floristas',2,1,27.5),(19,'Técnico marketing',3,1,27.5),(20,'Auxiliar marketing',4,1,27.5),(21,'Aux Informática',4,1,27.5),(22,'Peón agrícola',5,1,27.5),(23,'Oficial mantenimiento',4,1,27.5),(24,'Aux mantenimiento',5,1,27.5),(25,'Mozo Aeropuerto',5,1,27.5),(26,'Coordinador',2,1,27.5),(28,'Aux Logistica',4,1,27.5),(29,'Oficial Logistica',3,1,27.5),(30,'Subencargado',4,1,27.5); +INSERT INTO `professional_category` VALUES (1,'Mozos',5,1,27.5),(2,'Encargados',3,1,27.5),(4,'Comprador',3,1,27.5),(5,'Aux Administracion',NULL,1,27.5),(6,'Of Administracion',3,1,27.5),(7,'Jefe Administracion',2,1,27.5),(8,'Informatico',3,1,27.5),(9,'Directivo',1,0,27.5),(10,'Aux Ventas',4,1,27.5),(11,'Vendedor',4,1,27.5),(12,'Jefe de Ventas',4,0,27.5),(13,'Repartidor',5,1,27.5),(14,'Aprendices',NULL,1,27.5),(15,'Técnicos',2,1,27.5),(16,'Aux Florista',5,1,27.5),(17,'Florista',4,1,27.5),(18,'Jefe Floristas',2,1,27.5),(19,'Técnico marketing',3,1,27.5),(20,'Auxiliar marketing',4,1,27.5),(21,'Aux Informática',4,1,27.5),(22,'Peón agrícola',5,1,27.5),(23,'Oficial mantenimiento',4,1,27.5),(24,'Aux mantenimiento',5,1,27.5),(25,'Mozo Aeropuerto',5,1,27.5),(26,'Coordinador',2,1,27.5),(28,'Aux Logistica',4,1,27.5),(29,'Oficial Logistica',3,1,27.5),(30,'Subencargado',4,1,27.5),(31,'Conductor +3500kg',NULL,1,NULL); /*!40000 ALTER TABLE `professional_category` ENABLE KEYS */; UNLOCK TABLES; @@ -511,7 +511,7 @@ UNLOCK TABLES; LOCK TABLES `workcenter` WRITE; /*!40000 ALTER TABLE `workcenter` DISABLE KEYS */; -INSERT INTO `workcenter` VALUES (1,'Silla',20,1027,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20008,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2852,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10); +INSERT INTO `workcenter` VALUES (1,'Silla',20,1030,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20008,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2852,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10); /*!40000 ALTER TABLE `workcenter` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -524,4 +524,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-23 14:05:01 +-- Dump completed on 2020-02-12 13:30:40 diff --git a/db/dump/structure.sql b/db/dump/structure.sql index c78730381..76756c9be 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -3217,7 +3217,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `comercialesCompleto__`(IN vWorker INT, vDate DATE) BEGIN -CALL vn.subordinateGetList(vWorker); +CALL vn.worker_GetHierarchy(vWorker); SELECT c.Id_Cliente id_cliente, @@ -3323,9 +3323,9 @@ FROM WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker) GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente - JOIN tmp.subordinate s ON s.workerFk = c.Id_Trabajador; + JOIN tmp.workerHierarchyList s ON s.workerFk = c.Id_Trabajador; -DROP TEMPORARY TABLE tmp.subordinate; +DROP TEMPORARY TABLE tmp.workerHierarchyList; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3583,6 +3583,36 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `fruitsEvolution` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`z-developer`@`%` PROCEDURE `fruitsEvolution`() +BEGIN +select Id_Cliente, + Cliente, count(semana) as semanas, (w.code IS NOT NULL) isWorker +from ( +select distinct v.Id_Cliente, c.name as Cliente, week(fecha, 3) as semana +from bs.ventas v +join vn.itemType it ON it.id = v.tipo_id +join vn.client c ON c.id = v.Id_Cliente +where it.categoryFk = 12 +and v.fecha > '2020-01-01') sub +left join vn.worker w ON w.id = sub.Id_Cliente +group by Id_Cliente; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `indicatorsUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4725,13 +4755,194 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add`(intYEAR INT, vQuarter INT) +BEGIN + + DECLARE vCommissionRate DOUBLE DEFAULT 0.029; + + -- vaciar tabla + DELETE v.* FROM vendedores v + JOIN vn.`time` t ON t.`year` = v.año AND t.`month` = v.mes + WHERE t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter; + + REPLACE vendedores(Id_Trabajador, año, mes, importe, comision) + SELECT c.Id_Trabajador + , intYEAR + , MONTH(v.fecha) intMONTH + , sum(v.importe) + , sum(v.importe) * vCommissionRate + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN vn.`time` t on t.dated = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter + GROUP BY c.Id_Trabajador, t.`month`; + + -- Ventas nuevas + UPDATE vendedores v + JOIN + ( + SELECT c.Id_Trabajador + , sum(importe) * vCommissionRate as comisionNueva + , t.`month` + , t.`year` + FROM ventas v + JOIN bs.clientNewBorn cnb on v.Id_Cliente = cnb.clientFk + JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY c.Id_Trabajador, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comisionNuevos = sub.comisionNueva, v.comision = v.comision - sub.comisionNueva; + + -- Ventas cedidas + UPDATE vendedores v + JOIN ( + SELECT cc.Id_Trabajador_old as Id_Trabajador + , sum(importe) * vCommissionRate * comision_old as cedido + , sum(importe) * vCommissionRate * comision_new as arrendada + , t.`month` + , t.`year` + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN vn2008.Clientes_cedidos cc on cc.Id_Cliente = c.Id_Cliente AND v.fecha between datSTART and datEND + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY cc.Id_Trabajador_old, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comisionCedida = sub.cedido, v.comision = v.comision - sub.cedido - sub.arrendada; + + -- Ventas arrendadas + UPDATE vendedores v + JOIN ( + SELECT cc.Id_Trabajador_new as Id_Trabajador + , sum(importe) * vCommissionRate * comision_new as arrendada + , t.`month` + , t.`year` + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN vn2008.Clientes_cedidos cc on cc.Id_Cliente = c.Id_Cliente AND v.fecha between datSTART and datEND + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE c.Id_Trabajador is not null + AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY cc.Id_Trabajador_new, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comisionArrendada = sub.arrendada; + + -- Sustitucion cedidas - lended + INSERT INTO vendedores (Id_Trabajador, mes, año, comision) + SELECT c.salesPersonFk + , t.`month` + , t.`year` + , sum(importe) * vCommissionRate as lended + FROM ventas v + JOIN vn.client c ON c.id = v.Id_Cliente + JOIN vn.sharingCartDaily scd on scd.ownerFk = c.salesPersonFk AND scd.dated = v.fecha + JOIN vn.`time` t ON t.dated = v.fecha + WHERE t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter + GROUP BY c.salesPersonFk, t.`month` + ON DUPLICATE KEY UPDATE comision = comision - VALUES(comision); + + -- Sustitucion arrendadas - borrowed + INSERT INTO vendedores (Id_Trabajador, mes, año, sustitucionArrendada) + SELECT scd.substituteFk + , t.`month` + , t.`year` + , sum(importe) * vCommissionRate as borrowed + FROM ventas v + JOIN vn.client c ON c.id = v.Id_Cliente + JOIN vn.sharingCartDaily scd on scd.ownerFk = c.salesPersonFk AND scd.dated = v.fecha + JOIN vn.`time` t ON t.dated = v.fecha + WHERE t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter + GROUP BY scd.substituteFk, t.`month` + ON DUPLICATE KEY UPDATE sustitucionArrendada = VALUES(sustitucionArrendada); + + DROP TEMPORARY TABLE IF EXISTS tmp.workerItemType; + CREATE TEMPORARY TABLE tmp.workerItemType + (INDEX(ownerWorkerFk, itemTypeFk)) + SELECT wd.workerFk ownerWorkerFk, itemTypeFk, dit.workerFk substituteFk + FROM vn.departmentItemType dit + JOIN vn.workerDepartment wd ON wd.departmentFk = dit.departmentFk; + + -- itemType Lended, prestado + UPDATE vendedores v + JOIN ( + SELECT c.Id_Trabajador + , sum(importe) * vCommissionRate as amount + , t.`month` + , t.`year` + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN tmp.workerItemType wit ON wit.ownerWorkerFk = c.Id_Trabajador AND wit.itemTypeFk = v.tipo_id + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + GROUP BY c.Id_Trabajador, t.`month` + ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año + SET v.comision = v.comision - sub.amount; + + -- itemType borrowed, tomado prestado + INSERT INTO vendedores (Id_Trabajador, año, mes, itemTypeBorrowed) + SELECT wit.substituteFk + , t.`year` + , t.`month` + , importe * vCommissionRate + FROM ventas v + JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente + JOIN tmp.workerItemType wit ON wit.ownerWorkerFk = c.Id_Trabajador AND wit.itemTypeFk = v.tipo_id + JOIN vn2008.`time` t on t.`date` = v.fecha + WHERE t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter + ON DUPLICATE KEY UPDATE itemTypeBorrowed = itemTypeBorrowed + values(itemTypeBorrowed); + + DROP TEMPORARY TABLE tmp.workerItemType; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add_launcher` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add`(intYEAR INT, vQuarter INT) +CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add_launcher`() +BEGIN + + call bs.vendedores_add(YEAR(CURDATE()),QUARTER(CURDATE())); + + call bs.vendedores_evolution_add; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add__`(intYEAR INT, vQuarter INT) BEGIN DECLARE vCommissionRate DOUBLE DEFAULT 0.029; @@ -4879,40 +5090,17 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add_launcher` */; +/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add___` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add_launcher`() -BEGIN - - call bs.vendedores_add(YEAR(CURDATE()),QUARTER(CURDATE())); - - call bs.vendedores_evolution_add; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add__`(intYEAR INT, vQuarter INT) +CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add___`(intYEAR INT, vQuarter INT) BEGIN DECLARE comisionRate DOUBLE DEFAULT 0.029; @@ -5573,9 +5761,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -11666,20 +11854,20 @@ BEGIN -- Comprueba que se ha seleccionado una dirección IF vDeliveryMethod IN ('AGENCY', 'DELIVERY') - && vAddress IS NULL + AND vAddress IS NULL THEN CALL util.throw ('ORDER_EMPTY_ADDRESS'); END IF; -- Comprueba que la agencia es correcta - CALL vn.zoneGetAgency(vAddress, vLanded); + CALL vn.zone_getAgency(vAddress, vLanded); SELECT COUNT(*) > 0 INTO vIsAvailable FROM tmp.zoneGetAgency WHERE agencyModeFk = vAgencyMode; - IF !vIsAvailable THEN + IF NOT vIsAvailable THEN CALL util.throw ('ORDER_INVALID_AGENCY'); END IF; @@ -11719,9 +11907,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -11918,8 +12106,7 @@ BEGIN (saleFk, componentFk, `value`) SELECT vSale, cm.component_id, cm.price FROM order_component cm - JOIN bi.tarifa_componentes tc - ON tc.Id_Componente = cm.component_id + JOIN vn.component c ON c.id = cm.component_id WHERE cm.order_row_id = vRowId GROUP BY vSale, cm.component_id; @@ -11938,12 +12125,9 @@ BEGIN ENGINE = MEMORY SELECT SUM(sc.`value`) valueSum, sc.saleFk FROM vn.saleComponent sc - JOIN bi.tarifa_componentes tc ON tc.Id_Componente = sc.componentFk - JOIN bi.tarifa_componentes_series tcs - ON tcs.tarifa_componentes_series_id = tc.tarifa_componentes_series_id - AND tcs.base - JOIN vn.sale s - ON s.id = sc.saleFk + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase + JOIN vn.sale s ON s.id = sc.saleFk WHERE s.ticketFk = vTicket GROUP BY sc.saleFk; @@ -16604,6 +16788,37 @@ CREATE TABLE `debug` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de depuración'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `version` +-- + +DROP TABLE IF EXISTS `version`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `version` ( + `code` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `number` char(11) COLLATE utf8_unicode_ci NOT NULL, + `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `versionUser` +-- + +DROP TABLE IF EXISTS `versionUser`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `versionUser` ( + `code` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `user` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `number` char(11) COLLATE utf8_unicode_ci NOT NULL, + `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`code`,`user`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Dumping events for database 'util' -- @@ -17270,7 +17485,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `findObject` */; -ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -17292,6 +17506,78 @@ BEGIN */ SET vChain = CONCAT('%', vChain, '%'); + SELECT * FROM + ( + SELECT + `db`, + `name`, + `type`, + `body`, + `created`, + `modified` + FROM `mysql`.`proc` + WHERE `body` LIKE vChain COLLATE utf8_general_ci + UNION ALL + SELECT + `db`, + `name`, + 'EVENT', + `body_utf8`, + `created`, + `modified` + FROM `mysql`.`event` + WHERE `body_utf8` LIKE vChain COLLATE utf8_general_ci + UNION ALL + SELECT + `EVENT_OBJECT_SCHEMA`, + `TRIGGER_NAME`, + 'TRIGGER', + `ACTION_STATEMENT`, + NULL, + NULL + FROM `information_schema`.`TRIGGERS` + WHERE `ACTION_STATEMENT` LIKE vChain COLLATE utf8_general_ci + UNION ALL + SELECT + `TABLE_SCHEMA`, + `TABLE_NAME`, + 'VIEW', + `VIEW_DEFINITION`, + NULL, + NULL + FROM `information_schema`.`VIEWS` + WHERE `VIEW_DEFINITION` LIKE vChain COLLATE utf8_general_ci + ) t + ORDER BY `db`, `name`; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `findObject__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `findObject__`(vChain VARCHAR(45)) + READS SQL DATA +BEGIN +/** + * Devuelve un listado de todos los procedimientos, funciones + * eventos, disparadores y vistas que inluyen una cadena dada. + * + * @param vChain Cadena a buscar + * @select Listado de objetos + */ + SET vChain = CONCAT('%', vChain, '%'); + SELECT * FROM ( SELECT @@ -17341,7 +17627,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `proc_changedPrivs` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -17895,7 +18180,7 @@ CREATE TABLE `agencyMode` ( `cod71` tinyint(3) unsigned DEFAULT '0', `web` smallint(1) unsigned zerofill NOT NULL DEFAULT '0', `agencyFk` smallint(5) unsigned NOT NULL, - `agencyServiceFk` tinyint(4) NOT NULL DEFAULT '1', + `agencyServiceFk__` tinyint(4) NOT NULL DEFAULT '1', `inflation` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT 'Este valor se utiliza para aumentar el valor del componente porte.', `isVolumetric` tinyint(1) NOT NULL DEFAULT '0', `reportMail` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -18042,7 +18327,7 @@ CREATE TABLE `bank` ( `bank` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `account` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `cash` smallint(6) NOT NULL DEFAULT '0', - `warehouseFk` smallint(5) unsigned NOT NULL DEFAULT '1', + `warehouseFk__` smallint(5) unsigned NOT NULL DEFAULT '1', `entityFk` int(10) unsigned NOT NULL, `isActive` tinyint(4) NOT NULL DEFAULT '1', `currencyFk` tinyint(3) unsigned DEFAULT '1', @@ -18516,7 +18801,8 @@ DROP TABLE IF EXISTS `chatConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `chatConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `uri` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `api` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `user` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(50) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) @@ -18851,7 +19137,7 @@ CREATE TABLE `client` ( `fi` varchar(14) COLLATE utf8_unicode_ci DEFAULT NULL, `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `fax` varchar(11) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', - `email` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, + `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `cc` varchar(23) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', `dueDay` smallint(6) NOT NULL DEFAULT '5', `receipt` int(11) DEFAULT '1' COMMENT 'obsoleta', @@ -19497,7 +19783,7 @@ CREATE TABLE `collectionVolumetry` ( `level` int(10) unsigned NOT NULL DEFAULT '0', `lines` int(10) unsigned NOT NULL DEFAULT '1', `liters` int(10) unsigned NOT NULL DEFAULT '0', - `height` int(10) NOT NULL DEFAULT '20', + `height` int(10) unsigned NOT NULL DEFAULT '20', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19607,7 +19893,7 @@ DROP TABLE IF EXISTS `componentType`; CREATE TABLE `componentType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `base` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos', + `isBase` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos', `isMargin` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `Serie_UNIQUE` (`type`) @@ -19763,6 +20049,101 @@ CREATE TABLE `contactChannel` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Canal por el que nos ha conocido un cliente y se ha dado de'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `conveyor` +-- + +DROP TABLE IF EXISTS `conveyor`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `conveyor` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `typeFk` int(11) NOT NULL, + `stratum` int(11) NOT NULL DEFAULT '0', + `length` int(11) DEFAULT NULL, + `width` int(11) DEFAULT NULL, + `height` int(11) DEFAULT NULL, + `x` int(11) DEFAULT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `conveyor_fk1_idx` (`typeFk`), + CONSTRAINT `conveyor_fk1` FOREIGN KEY (`typeFk`) REFERENCES `conveyorType` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `conveyorBuildingClass` +-- + +DROP TABLE IF EXISTS `conveyorBuildingClass`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `conveyorBuildingClass` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `priority` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tipo de caja para el montaje de pallets'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `conveyorConfig` +-- + +DROP TABLE IF EXISTS `conveyorConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `conveyorConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemName` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `length` int(11) DEFAULT NULL, + `width` int(11) DEFAULT NULL, + `height` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `itemName_UNIQUE` (`itemName`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `conveyorExpedition` +-- + +DROP TABLE IF EXISTS `conveyorExpedition`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `conveyorExpedition` ( + `expeditionFk` int(11) NOT NULL, + `conveyorFk` int(11) DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `conveyorBuildingClassFk` int(11) NOT NULL, + `length` int(11) NOT NULL DEFAULT '1', + `width` int(11) NOT NULL DEFAULT '1', + `height` int(11) NOT NULL DEFAULT '1', + `x` int(11) NOT NULL DEFAULT '1', + `y` int(11) NOT NULL DEFAULT '1', + `routeFk` int(11) NOT NULL, + PRIMARY KEY (`expeditionFk`), + KEY `conveyorExpedition_fk1_idx` (`conveyorFk`), + KEY `conveyorExpedition_fk2_idx` (`conveyorBuildingClassFk`), + CONSTRAINT `conveyorExpedition_fk1` FOREIGN KEY (`conveyorFk`) REFERENCES `conveyor` (`id`) ON UPDATE CASCADE, + CONSTRAINT `conveyorExpedition_fk2` FOREIGN KEY (`conveyorBuildingClassFk`) REFERENCES `conveyorBuildingClass` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `conveyorType` +-- + +DROP TABLE IF EXISTS `conveyorType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `conveyorType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `country` -- @@ -20208,6 +20589,7 @@ CREATE TABLE `department` ( `sons` decimal(10,0) NOT NULL DEFAULT '0', `parentFk` int(10) unsigned DEFAULT NULL, `path` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `chatName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`), KEY `fk_department_Trabajadores1_idx` (`workerFk`), @@ -21042,6 +21424,22 @@ CREATE TABLE `envialiaConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `errorLogApp` +-- + +DROP TABLE IF EXISTS `errorLogApp`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `errorLogApp` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `error` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL, + `date` datetime DEFAULT NULL, + `workerFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Guarda un registro de errores e la app de almacén'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `exchangeInsuranceEntry` -- @@ -21381,6 +21779,20 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `greugeConfig` +-- + +DROP TABLE IF EXISTS `greugeConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `greugeConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `freightPickUpPrice` decimal(10,2) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `greugeType` -- @@ -21772,16 +22184,14 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`invoiceOut_afterInsert` - AFTER INSERT ON `invoiceOut` FOR EACH ROW -BEGIN - CALL bi.customer_risk_update (NEW.clientFk, NEW.companyFk, NEW.amount); +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`invoiceOut_afterInsert` AFTER INSERT ON `vn`.`invoiceOut` FOR EACH ROW BEGIN + CALL clientRisk_update(NEW.clientFk, NEW.companyFk, NEW.amount); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -21791,17 +22201,16 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeUpdate` - BEFORE UPDATE ON `invoiceOut` FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeUpdate` BEFORE UPDATE ON `vn`.`invoiceOut` FOR EACH ROW BEGIN - CALL bi.customer_risk_update (OLD.clientFk, OLD.companyFk, -OLD.amount); - CALL bi.customer_risk_update (NEW.clientFk, NEW.companyFk, NEW.amount); + CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount); + CALL clientRisk_update (NEW.clientFk, NEW.companyFk, NEW.amount); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -21811,16 +22220,14 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeDelete` - BEFORE DELETE ON `invoiceOut` FOR EACH ROW -BEGIN - CALL bi.customer_risk_update (OLD.clientFk, OLD.companyFk, -OLD.amount); +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeDelete` BEFORE DELETE ON `invoiceOut` FOR EACH ROW BEGIN + CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -22366,6 +22773,23 @@ CREATE TABLE `itemFreeNumber` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `itemLabel` +-- + +DROP TABLE IF EXISTS `itemLabel`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemLabel` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemFk` int(11) DEFAULT NULL, + `itemName` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `price` decimal(10,2) DEFAULT NULL, + `labels` int(11) DEFAULT NULL COMMENT 'Tabla hecha para Ruben Espinosa, para sacar etiquetas en Holanda para un cliente.', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `itemLog` -- @@ -22457,7 +22881,7 @@ CREATE TABLE `itemPlacementSupply` ( `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `userFk` int(10) unsigned NOT NULL COMMENT 'Persona que crea la orden', `repoUserFk` int(10) unsigned DEFAULT NULL COMMENT 'Reponedor que la tiene asignada', - `sectorFk` int(11) NOT NULL DEFAULT '2', + `sectorFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `itemPlacementSupply_fk1_idx` (`itemFk`), KEY `itemPlacementSupply_fk2_idx` (`userFk`), @@ -22492,33 +22916,6 @@ SET character_set_client = utf8; 1 AS `size`, 1 AS `workerCode`, 1 AS `repoCode`, - 1 AS `parking`, - 1 AS `sectorFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `itemPlacementSupplyList__` --- - -DROP TABLE IF EXISTS `itemPlacementSupplyList__`; -/*!50001 DROP VIEW IF EXISTS `itemPlacementSupplyList__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `itemPlacementSupplyList__` AS SELECT - 1 AS `id`, - 1 AS `itemFk`, - 1 AS `quantity`, - 1 AS `priority`, - 1 AS `created`, - 1 AS `userFk`, - 1 AS `repoUserFk`, - 1 AS `saldo`, - 1 AS `longName`, - 1 AS `subName`, - 1 AS `size`, - 1 AS `workerCode`, - 1 AS `repoCode`, - 1 AS `parking`, 1 AS `sectorFk`*/; SET character_set_client = @saved_cs_client; @@ -22654,7 +23051,8 @@ SET character_set_client = utf8; 1 AS `packing`, 1 AS `hour`, 1 AS `isPreviousPreparable`, - 1 AS `physicalVolume`*/; + 1 AS `physicalVolume`, + 1 AS `warehouseFk`*/; SET character_set_client = @saved_cs_client; -- @@ -23211,6 +23609,18 @@ CREATE TABLE `itemVerdecora` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona nuestros articulos con los de Verdecora'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `kk` +-- + +DROP TABLE IF EXISTS `kk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `kk` ( + `pasillo` varchar(3) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `labourTree` -- @@ -23869,6 +24279,7 @@ CREATE TABLE `pgc` ( `mod340` tinyint(1) NOT NULL DEFAULT '0', `mod347` tinyint(1) NOT NULL DEFAULT '0', `cplusTrascendency477Fk` int(10) unsigned DEFAULT '1', + `isEqualizated` tinyint(1) DEFAULT '0', PRIMARY KEY (`code`), KEY `pgc_fk1_idx` (`cplusTaxBreakFk`), KEY `pgc_fk2_idx` (`cplusTrascendency477Fk`), @@ -24237,7 +24648,7 @@ CREATE TABLE `printServerQueue2` ( KEY `Id_Informe` (`reportFk`), KEY `Id_Prioridad` (`priorityFk`), KEY `Id_Trabajador` (`workerFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24512,14 +24923,14 @@ CREATE TABLE `receipt` ( /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`receipt_afterInsert` AFTER INSERT ON `receipt` FOR EACH ROW - CALL bi.customer_risk_update (NEW.clientFk, NEW.companyFk, -NEW.amountPaid) */;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`receipt_afterInsert` AFTER INSERT ON `receipt` FOR EACH ROW + CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid) */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -24528,16 +24939,15 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`receipt_beforeUpdate` BEFORE UPDATE ON `receipt` FOR EACH ROW -BEGIN - CALL bi.customer_risk_update (OLD.clientFk, OLD.companyFk, OLD.amountPaid); - CALL bi.customer_risk_update (NEW.clientFk, NEW.companyFk, -NEW.amountPaid); +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`receipt_beforeUpdate` BEFORE UPDATE ON `receipt` FOR EACH ROW BEGIN + CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid); + CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -24547,14 +24957,14 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`receipt_beforeDelete` BEFORE DELETE ON `receipt` FOR EACH ROW - CALL bi.customer_risk_update (OLD.clientFk, OLD.companyFk, OLD.amountPaid) */;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`receipt_beforeDelete` BEFORE DELETE ON `receipt` FOR EACH ROW + CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid) */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -24979,6 +25389,11 @@ BEGIN SET NEW.discount = 0; END IF; + IF old.discount > 0 AND NEW.discount = 0 THEN + INSERT INTO ticketLog + SET originFk = NEW.ticketFk, userFk = account.myUserGetId(), `action` = 'insert', + description = CONCAT('Cambio de descuento del item :', ' ', new.itemFk, ' de ', old.discount ,' a 0 '); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25422,9 +25837,12 @@ CREATE TABLE `shelving` ( `isPrinted` tinyint(4) NOT NULL DEFAULT '0', `priority` int(11) DEFAULT NULL, `parked` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `userFk` int(11) DEFAULT NULL, PRIMARY KEY (`code`), KEY `shelving_fk1_idx` (`parkingFk`), - CONSTRAINT `shelving_fk1` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + KEY `shelving_fk2_idx` (`userFk`), + CONSTRAINT `shelving_fk1` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `shelving_fk2` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla usada para localizar el carro en el parking del altillo'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -26212,8 +26630,8 @@ CREATE TABLE `ticketCollection` ( `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `level` int(11) DEFAULT NULL, PRIMARY KEY (`id`), + UNIQUE KEY `ticketCollection_fk2_idx` (`ticketFk`), KEY `ticketCollection_fk1_idx` (`collectionFk`), - KEY `ticketCollection_fk2_idx` (`ticketFk`), CONSTRAINT `ticketCollection_fk1` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketCollection_fk2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -26261,8 +26679,14 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`ticketDms_beforeDelete` BEFORE DELETE ON `ticketDms` FOR EACH ROW BEGIN UPDATE dms - SET dmsTypeFk = (SELECT id FROM dmsType WHERE `code` = 'trash') - WHERE id = OLD.dmsFk; + SET dmsTypeFk = (SELECT id + FROM dmsType + WHERE `code` = 'trash' + ) + WHERE id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE) + FROM ticketDms + WHERE dmsFk = OLD.dmsFk + ) ; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27204,6 +27628,7 @@ DROP TABLE IF EXISTS `travelThermograph`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `travelThermograph` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `thermographFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `created` date NOT NULL, `warehouseFk` smallint(6) unsigned NOT NULL, @@ -27211,7 +27636,7 @@ CREATE TABLE `travelThermograph` ( `temperature` enum('COOL','WARM') COLLATE utf8_unicode_ci NOT NULL, `result` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `dmsFk` int(11) DEFAULT NULL, - PRIMARY KEY (`thermographFk`,`created`), + PRIMARY KEY (`id`), KEY `thermograph_fk_idx` (`thermographFk`), KEY `gestdoc_fk_idx` (`dmsFk`), KEY `travel_id` (`travelFk`), @@ -27220,7 +27645,7 @@ CREATE TABLE `travelThermograph` ( CONSTRAINT `travelThermographThermographFgn` FOREIGN KEY (`thermographFk`) REFERENCES `thermograph` (`id`) ON UPDATE CASCADE, CONSTRAINT `travelThermographTravelFgn` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`), CONSTRAINT `travelThermographWarehouseFgn` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registra cada termografo que se ha introducido en cada travel'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registra cada termografo que se ha introducido en cada travel'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27505,7 +27930,7 @@ CREATE TABLE `worker` ( `birthed` date NOT NULL, `maritalStatus` enum('soltero/a','casado/a') COLLATE utf8_unicode_ci NOT NULL, `phone` varchar(9) COLLATE utf8_unicode_ci NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL, + `companyFk` smallint(5) unsigned DEFAULT NULL, `clientFk` int(11) DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `bossFk` int(11) NOT NULL DEFAULT '2', @@ -28016,14 +28441,14 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `workerTimeControl_Journey` +-- Temporary table structure for view `workerTimeControl_Journey__` -- -DROP TABLE IF EXISTS `workerTimeControl_Journey`; -/*!50001 DROP VIEW IF EXISTS `workerTimeControl_Journey`*/; +DROP TABLE IF EXISTS `workerTimeControl_Journey__`; +/*!50001 DROP VIEW IF EXISTS `workerTimeControl_Journey__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `workerTimeControl_Journey` AS SELECT +/*!50001 CREATE VIEW `workerTimeControl_Journey__` AS SELECT 1 AS `userFk`, 1 AS `dated`, 1 AS `Journey`, @@ -32100,9 +32525,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -32731,11 +33156,11 @@ BEGIN JOIN itemType it ON it.categoryFk = k.id JOIN item i ON i.typeFk = it.id WHERE i.id = vItemFk; - + IF vIsMerchandise THEN - REPLACE bi.rotacion SET - Id_Article = vItemFk, - warehouse_id = vWarehouse, + REPLACE itemCost SET + itemFk = vItemFk, + warehouseFk = vWarehouse, cm3 = buy_getUnitVolume(vSelf); END IF; @@ -32750,7 +33175,7 @@ BEGIN JOIN edi.supplier es ON es.supplier_id = be.pro WHERE b.id = vSelf; - IF vn2008.has_notify_passport(vItemFk, vSelf) THEN + IF buy_hasNotifyPassport(vSelf, vItemFk) THEN CALL vn.buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking); END IF; END IF; @@ -33356,9 +33781,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -33378,7 +33803,6 @@ proc: BEGIN * packing, grouping, groupingMode, buyFk, typeFk) * @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, grouping, price) */ - DECLARE vClientFk INT; DECLARE vGeneralInflationCoefficient INT DEFAULT 1; DECLARE vMinimumDensityWeight INT DEFAULT 167; @@ -33471,17 +33895,17 @@ proc: BEGIN GROUP BY tc.itemFk, warehouseFk; INSERT INTO tmp.ticketComponent - SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.recobro, 0.25), 3) + SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.priceIncreasing, 0.25), 3) FROM tmp.ticketComponentBase tcb - JOIN bi.claims_ratio cr ON cr.Id_Cliente = vClientFk - WHERE cr.recobro > 0.009; + JOIN claimRatio cr ON cr.clientFk = vClientFk + WHERE cr.priceIncreasing > 0.009; INSERT INTO tmp.ticketComponent - SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + prices_modifier_rate), 3) as manaAuto + SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto FROM tmp.ticketComponentBase tcb JOIN `client` c on c.id = vClientFk - JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador - WHERE ms.prices_modifier_activated + JOIN workerMana wm ON c.salesPersonFk = wm.workerFk + WHERE wm.isPricesModifierActivated HAVING manaAuto <> 0; INSERT INTO tmp.ticketComponent @@ -33490,7 +33914,7 @@ proc: BEGIN c.id, GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3) FROM tmp.ticketComponentBase tcb - JOIN `component` c + JOIN component c JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; @@ -33509,7 +33933,7 @@ proc: BEGIN vGeneralInflationCoefficient * ROUND(( i.compression - * r.cm3 + * ic.cm3 * IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1) * IFNULL((z.price - z.bonus) * 1/*amz.inflation*/ , 50)) / vBoxVolume, 4 @@ -33518,8 +33942,8 @@ proc: BEGIN JOIN item i ON i.id = tcc.itemFk JOIN zone z ON z.id = vZoneFk JOIN agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN bi.rotacion r ON r.warehouse_id = tcc.warehouseFk - AND r.Id_Article = tcc.itemFk + LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk + AND ic.itemFk = tcc.itemFk HAVING cost <> 0; IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN @@ -33540,7 +33964,7 @@ proc: BEGIN vSpecialPriceComponent, sp.value - SUM(tcc.cost) sumCost FROM tmp.ticketComponentCopy tcc - JOIN `component` c ON c.id = tcc.componentFk + JOIN component c ON c.id = tcc.componentFk JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk WHERE c.classRate IS NULL GROUP BY tcc.itemFk, tcc.warehouseFk @@ -33552,7 +33976,7 @@ proc: BEGIN ENGINE = MEMORY SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate FROM tmp.ticketComponent tc - JOIN `component` c ON c.id = tc.componentFk + JOIN component c ON c.id = tc.componentFk GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; @@ -34569,6 +34993,34 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `clientRisk_update` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2)) +BEGIN + IF vAmount IS NOT NULL + THEN + INSERT INTO clientRisk + SET + clientFk = vClientId, + companyFk = vCompanyId, + amount = vAmount + ON DUPLICATE KEY UPDATE + amount = amount + VALUES(amount); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `clonTravelComplete` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -34786,18 +35238,20 @@ BEGIN sh.code COLLATE utf8_general_ci as shelving, ish.created, ish.visible, - IFNULL(p.pickingOrder,0) as `order`, + IFNULL(cpd.id,0) as `order`, IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`) as `grouping` FROM vn.ticketCollection tc JOIN vn.sale s ON s.ticketFk = tc.ticketFk JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk JOIN vn.shelving sh ON sh.code = ish.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk + LEFT JOIN vn.coolerPathDetail cpd ON CAST(cpd.hallway AS DECIMAL(3,0)) = p.column JOIN vn.sector sc ON sc.id = p.sectorFk JOIN vn.warehouse w ON w.id = sc.warehouseFk JOIN tmp.`grouping` g ON g.itemFk = s.itemFk WHERE tc.collectionFk = vCollectionFk AND w.aliasFk = vWarehouseAliasFk + AND ish.visible > 0 UNION ALL SELECT s.id as saleFk, s.itemFk, ip.code COLLATE utf8_general_ci as placement, @@ -34814,8 +35268,241 @@ BEGIN JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vCalcFk LEFT JOIN tmp.grouping2 g ON g.itemFk = s.itemFk WHERE tc.collectionFk = vCollectionFk - -- HAVING visible > 0 - ; + AND v.visible - p.quantity > 0 + AND IFNULL(cpd.id,0); + + DROP TEMPORARY TABLE + tmp.parked, + tmp.`grouping`, + tmp.grouping2; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collectionPlacement_get_beta` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionPlacement_get_beta`(vCollectionFk INT) +BEGIN + + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + DECLARE vWarehouseAliasFk INT; + + SELECT t.warehouseFk, w.aliasFk + INTO vWarehouseFk, vWarehouseAliasFk + FROM vn.ticket t + JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE tc.collectionFk = vCollectionFk + LIMIT 1; + + CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.parked; + CREATE TEMPORARY TABLE tmp.parked + ENGINE MEMORY + SELECT s.itemFk, 0 as quantity + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk; + + UPDATE tmp.parked pk + JOIN ( SELECT itemFk, sum(visible) as visible + FROM vn.itemShelvingStock iss + JOIN vn.warehouse w ON w.id = iss.warehouseFk + WHERE w.aliasFk = vWarehouseAliasFk + GROUP BY iss.itemFk ) iss ON iss.itemFk = pk.itemFk + SET pk.quantity = iss.visible; + + DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; + CREATE TEMPORARY TABLE tmp.`grouping` + ENGINE MEMORY + SELECT itemFk, `grouping` + FROM ( + SELECT itemFk, + CASE groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN packing + ELSE `grouping` + END AS `grouping` + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + WHERE tr.warehouseInFk = vWarehouseFk + AND landed BETWEEN (SELECT FechaInventario FROM vn2008.tblContadores LIMIT 1) AND CURDATE() + AND b.isIgnored = FALSE + ORDER BY tr.landed DESC + ) sub + GROUP BY sub.itemFk ; + + DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; + CREATE TEMPORARY TABLE tmp.grouping2 + ENGINE MEMORY + SELECT * FROM tmp.`grouping`; + + SELECT s.id as saleFk, s.itemFk, + p.code COLLATE utf8_general_ci as placement , + sh.code COLLATE utf8_general_ci as shelving, + ish.created, + ish.visible, + IFNULL(cpd.id,0) as `order`, + IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`) as `grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + LEFT JOIN vn.coolerPathDetail cpd ON CAST(cpd.hallway AS DECIMAL(3,0)) = p.column + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN vn.warehouse w ON w.id = sc.warehouseFk + JOIN tmp.`grouping` g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + AND w.aliasFk = vWarehouseAliasFk + AND ish.visible > 0 + UNION ALL + SELECT s.id as saleFk, s.itemFk, + ip.code COLLATE utf8_general_ci as placement, + '' COLLATE utf8_general_ci as shelving, + modificationDate as created, + v.visible - p.quantity as visible, + IFNULL(cpd.id,0) as `order`, + g.`grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemPlacement ip ON ip.itemFk = s.itemFk AND ip.warehouseFk = vWarehouseFk + LEFT JOIN vn.coolerPathDetail cpd ON cpd.hallway = LEFT(ip.`code`,3) + JOIN tmp.parked p ON p.itemFk = s.itemFk + JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vCalcFk + LEFT JOIN tmp.grouping2 g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + AND v.visible - p.quantity > 0 + AND IFNULL(cpd.id,0); + + DROP TEMPORARY TABLE + tmp.parked, + tmp.`grouping`, + tmp.grouping2; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collectionPlacement_get__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionPlacement_get__`(vCollectionFk INT) +BEGIN + + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + DECLARE vWarehouseAliasFk INT; + + SELECT t.warehouseFk, w.aliasFk + INTO vWarehouseFk, vWarehouseAliasFk + FROM vn.ticket t + JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE tc.collectionFk = vCollectionFk + LIMIT 1; + + CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.parked; + CREATE TEMPORARY TABLE tmp.parked + ENGINE MEMORY + SELECT s.itemFk, 0 as quantity + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk; + + UPDATE tmp.parked pk + JOIN ( SELECT itemFk, sum(visible) as visible + FROM vn.itemShelvingStock iss + JOIN vn.warehouse w ON w.id = iss.warehouseFk + WHERE w.aliasFk = vWarehouseAliasFk + GROUP BY iss.itemFk ) iss ON iss.itemFk = pk.itemFk + SET pk.quantity = iss.visible; + + DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; + CREATE TEMPORARY TABLE tmp.`grouping` + ENGINE MEMORY + SELECT itemFk, `grouping` + FROM ( + SELECT itemFk, + CASE groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN packing + ELSE `grouping` + END AS `grouping` + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + WHERE tr.warehouseInFk = vWarehouseFk + AND landed BETWEEN (SELECT FechaInventario FROM vn2008.tblContadores LIMIT 1) AND CURDATE() + AND b.isIgnored = FALSE + ORDER BY tr.landed DESC + ) sub + GROUP BY sub.itemFk ; + + DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; + CREATE TEMPORARY TABLE tmp.grouping2 + ENGINE MEMORY + SELECT * FROM tmp.`grouping`; + + SELECT s.id as saleFk, s.itemFk, + p.code COLLATE utf8_general_ci as placement , + sh.code COLLATE utf8_general_ci as shelving, + ish.created, + ish.visible, + IFNULL(p.pickingOrder,0) as `order`, + IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`) as `grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN vn.warehouse w ON w.id = sc.warehouseFk + JOIN tmp.`grouping` g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + AND w.aliasFk = vWarehouseAliasFk + AND ish.visible > 0 + UNION ALL + SELECT s.id as saleFk, s.itemFk, + ip.code COLLATE utf8_general_ci as placement, + '' COLLATE utf8_general_ci as shelving, + modificationDate as created, + v.visible - p.quantity as visible, + IFNULL(cpd.hallway * 100,0) as `order`, + g.`grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemPlacement ip ON ip.itemFk = s.itemFk AND ip.warehouseFk = vWarehouseFk + LEFT JOIN vn.coolerPathDetail cpd ON cpd.hallway = LEFT(ip.`code`,3) + JOIN tmp.parked p ON p.itemFk = s.itemFk + JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vCalcFk + LEFT JOIN tmp.grouping2 g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + AND v.visible - p.quantity > 0 + AND IFNULL(cpd.id,0); DROP TEMPORARY TABLE tmp.parked, @@ -35035,6 +35722,238 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `collection_new`(vSectorFk INT) +proc:BEGIN + + DECLARE vIsPreviousPrepared BOOLEAN; + DECLARE vCollectionFk INT; + DECLARE vWarehouseFk INT; + DECLARE vMaxTickets INT DEFAULT 4; + DECLARE vStateFk INT; + DECLARE vFirstTicketFk INT; + DECLARE vWorkerCode VARCHAR(3); + DECLARE vShelve INT; + DECLARE vTicket INT; + + -- Establecemos el almacén y si es un sector de preparación previa, así como el estado para los tickets que se vayan preparando + SELECT isPreviousPrepared, warehouseFk + INTO vIsPreviousPrepared, vWarehouseFk + FROM vn.sector + WHERE id = vSectorFk; + + IF vIsPreviousPrepared THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'PREVIOUS_PREPARATION'; + ELSE + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'ON_PREPARATION'; + + END IF; + + -- Obtenemos el código del usuario + SELECT w.code + INTO vWorkerCode + FROM vn.worker w + WHERE w.id = account.myUserGetId(); + + -- Se obtiene nº de colección y el buffer con los pedidos preparables + INSERT INTO vn.collection + SET workerFk = account.myUserGetId(); + + SELECT LAST_INSERT_ID() INTO vCollectionFk; + + CALL vn2008.production_control_source(vWarehouseFk, 0); + + -- Se seleccionan los primeros tickets, asignando colección para dejarlos bloqueados a otros sacadores. + INSERT IGNORE INTO vn.ticketCollection(ticketFk, collectionFk) + SELECT pb.Id_Ticket, + vCollectionFk + FROM tmp.production_buffer pb + JOIN vn.state s ON s.id = pb.state + WHERE pb.collectionFk IS NULL + AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) + ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto + LIMIT vMaxTickets; + + -- Creamos una tabla temporal con los datos que necesitamos para depurar la colección + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.Id_Ticket ticketFk, + pb.lines, + pb.m3 * 1000 liters, + 0 as height, + 0 as shelve + FROM tmp.production_buffer pb + JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket + WHERE tc.collectionFk = vCollectionFk; + + /* El criterio para formar la colección es el siguiente: + * + * 1º.- Los tickets asignados son prioritarios, y por ello ya vienen ordenados en las primeras posiciones. + * 2º.- Las recogidas en Silla tienen que ir en carros independientes. + * + * Por tanto, si el primer pedido es recogida, nos olvidamos del resto. + * Si el primer pedido no es recogida, eliminamos las recogidas posteriores. + */ + + SELECT ticketFk + INTO vFirstTicketFk + FROM tmp.ticket + LIMIT 1; + + IF (SELECT pb.Agencia FROM tmp.production_buffer pb WHERE Id_Ticket = vFirstTicketFk) = 'REC_SILLA' THEN + + DELETE FROM tmp.ticket WHERE ticketFk != vFirstTicketFk; + + UPDATE tmp.ticket SET shelve = 1; + -- Como sólo hay un ticket, se le asigna el nivel 1 y acabamos + + ELSE + + -- Eliminamos los de recogida, puesto que el primero sabemos que no es de rec_silla + DELETE t.* + FROM tmp.ticket t + JOIN tmp.production_buffer pb ON pb.Id_Ticket = t.ticketFk + WHERE pb.Agencia = 'REC_SILLA'; + + -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. + UPDATE tmp.ticket t + JOIN + ( SELECT MAX(i.size) maxHeigth, + tc.ticketFk + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE ic.isReclining = FALSE + AND tc.collectionFk = vCollectionFk + GROUP BY tc.ticketFk) sub ON sub.ticketFk = t.ticketFk + SET t.height = sub.maxHeigth; + + -- Vamos a generar una tabla con todas las posibilidades de asignacion de pedido + DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelve; + CREATE TEMPORARY TABLE tmp.ticketShelve + SELECT ticketFk, shelve + FROM ( + SELECT t.ticketFk, + cv.`level` shelve, + CAST(cv.lines AS SIGNED) - t.lines as linesDif, + CAST(cv.liters AS SIGNED) - t.liters as litersDif, + CAST(cv.height AS SIGNED) - t.height as heightDif + FROM vn.collectionVolumetry cv + JOIN tmp.ticket t + ORDER BY (t.ticketFk = vFirstTicketFk) DESC, linesDif + ) sub + WHERE linesDif >= 0 + AND litersDif >= 0 + AND heightDif >= 0 + ORDER BY linesDif; + + -- Asignamos la primera balda util al primer pedido + SELECT IFNULL(shelve,0) INTO vShelve + FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + LIMIT 1; + + IF vShelve THEN + + UPDATE tmp.ticket + SET shelve = vShelve + WHERE ticketFk = vFirstTicketFk; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + OR shelve = vShelve; + + WHILE (SELECT COUNT(*) FROM tmp.ticketShelve) DO + + SELECT ticketFk, shelve + INTO vTicket, vShelve + FROM tmp.ticketShelve + LIMIT 1; + + UPDATE tmp.ticket + SET shelve = vShelve + WHERE ticketFk = vTicket; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vTicket + OR shelve = vShelve; + + END WHILE; + + ELSE + + UPDATE tmp.ticket + SET shelve = 1 + WHERE ticketFk = vFirstTicketFk; + + END IF; + + END IF; + + -- Eliminamos los que se han quedado sin balda + DELETE FROM tmp.ticket WHERE shelve = 0 ; + + -- Elimina los tickets bloqueados que no se van a preparar + DELETE tc.* + FROM vn.ticketCollection tc + LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND t.ticketFk IS NULL; + + -- Actualiza el estado de la colección + UPDATE vn.collection c + JOIN vn.state st ON st.code = 'ON_PREPARATION' + SET c.stateFk = st.id + WHERE c.id = vCollectionFk; + + -- Asigna las bandejas + UPDATE vn.ticketCollection tc + JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + SET tc.level = t.shelve; + + -- Actualiza el estado de los tickets + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT vStateFk, ticketFk, account.myUserGetId() + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; + + -- Avisa los preparados previos que hay que bajar del altillo imprimiendo etiqueta + INSERT IGNORE INTO vn.ticketDown(ticketFk) + SELECT DISTINCT tc.ticketFk + FROM vn.ticketCollection tc + JOIN vncontrol.inter vi ON vi.Id_Ticket = tc.ticketFk + JOIN vn.state st ON st.id = vi.state_id + JOIN vn.ticket t ON t.id = tc.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE tc.collectionFk = vCollectionFk + AND w.name = 'Silla FV' + AND st.code = 'PREVIOUS_PREPARATION'; + + SELECT vCollectionFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collection_new__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collection_new__`(vSectorFk INT) proc:BEGIN DECLARE vIsPreviousPrepared BOOLEAN; @@ -35078,6 +35997,14 @@ proc:BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + -- Reenvio a la version beta si el sector es el de pruebas + IF vSectorFk IN (17,18) THEN + + CALL vn.collection_new_beta(vSectorFk); + LEAVE proc; + + END IF; + SELECT isPreviousPrepared, warehouseFk INTO vIsPreviousPrepared, vWarehouseFk FROM vn.sector @@ -35130,6 +36057,7 @@ proc:BEGIN JOIN vn.state s ON s.id = pb.state LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket WHERE pb.problems = 0 + AND pb.Agencia = 'REC_SILLA' AND tc.ticketFk IS NULL AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC @@ -35316,510 +36244,39 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `collection_new_beta` */; +/*!50003 DROP PROCEDURE IF EXISTS `collection_update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `collection_new_beta`(vSectorFk INT) -proc:BEGIN +CREATE DEFINER=`root`@`%` PROCEDURE `collection_update`(vTicketFk INT) +BEGIN + + DECLARE vNumChecked INT; + DECLARE vCollectionFk INT; - DECLARE vIsPreviousPrepared BOOLEAN; - DECLARE vCollectionFk INT; - DECLARE vWarehouseFk INT; - - DECLARE vTicketLiters INT; - DECLARE vTicketLines INT; - DECLARE vTicketFk INT; - DECLARE vTicketHeight INT; - DECLARE vTicketHeightTop INT; - DECLARE vTicketHeightFloor INT; - DECLARE vIsTicketCollected BOOLEAN; - DECLARE vMaxTickets INT; - DECLARE vStateFk INT; - DECLARE vTopTicketFk INT; - DECLARE vFloorTicketFk INT; - - DECLARE vVolumetryLiters INT; - DECLARE vVolumetryLines INT; - DECLARE vVolumetryFk INT; - DECLARE vVolumetryLevel INT; - DECLARE vVolumetryHeight INT; - DECLARE vVolumetryLitersMax INT; - DECLARE vVolumetryLinesMax INT; - DECLARE vVolumetryHeightTop INT; - DECLARE vVolumetryHeightFloor INT; - - DECLARE vDone BOOLEAN DEFAULT FALSE; - DECLARE vWorkerCode VARCHAR(3); - - DECLARE cVolumetry CURSOR FOR - SELECT level, liters, `lines`, height - FROM vn.collectionVolumetry - ORDER BY `level`; - - DECLARE cTicket CURSOR FOR - SELECT * - FROM tmp.ticket - ORDER BY height DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SELECT isPreviousPrepared, warehouseFk - INTO vIsPreviousPrepared, vWarehouseFk - FROM vn.sector - WHERE id = vSectorFk; - - SELECT w.code - INTO vWorkerCode - FROM vn.worker w - WHERE w.id = account.myUserGetId(); - - IF vIsPreviousPrepared THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'PREVIOUS_PREPARATION'; - ELSE - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'ON_PREPARATION'; - - END IF; - - SELECT COUNT(*), sum(liters), sum(`lines`) - INTO vMaxTickets, vVolumetryLitersMax, vVolumetryLinesMax - FROM vn.collectionVolumetry; - - CALL vn2008.production_control_source(vWarehouseFk, 0); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - - -- Recogida Silla requiere carros individuales - - IF (SELECT pb.Agencia - FROM tmp.production_buffer pb - JOIN vn.state s ON s.id = pb.state - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket - WHERE pb.problems = 0 - AND tc.ticketFk IS NULL - AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) - ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC - LIMIT 1) = 'REC_SILLA' THEN - - CREATE TEMPORARY TABLE tmp.ticket - SELECT pb.Id_Ticket ticketFk, - pb.lines, - pb.m3 * 1000 liters, - 0 as height - FROM tmp.production_buffer pb - JOIN vn.state s ON s.id = pb.state - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket - WHERE pb.problems = 0 - AND tc.ticketFk IS NULL - AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) - ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC - LIMIT 1; - - ELSE - - CREATE TEMPORARY TABLE tmp.ticket - SELECT pb.Id_Ticket ticketFk, - pb.lines, - pb.m3 * 1000 liters, - 0 as height - FROM tmp.production_buffer pb - JOIN vn.state s ON s.id = pb.state - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket - WHERE pb.problems = 0 - AND pb.Agencia != 'REC_SILLA' - AND tc.ticketFk IS NULL - AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) - ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC - LIMIT vMaxTickets; - - -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; - CREATE TEMPORARY TABLE tmp.ticket2 - SELECT MAX(i.size) maxHeigth, t.ticketFk - FROM tmp.ticket t - JOIN vn.sale s ON s.ticketFk = t.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE ic.isReclining = FALSE - GROUP BY t.ticketFk; - - UPDATE tmp.ticket t - JOIN tmp.ticket2 t2 ON t2.ticketFk = t.ticketFk - SET t.height = t2.maxHeigth; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; - -- Si hay un ticket con una planta que supera la máxima altura para la bandeja superior, el pedido ha de ser único. Por tanto, eliminamos el resto. - -- Si hay dos tickets con plantas que superen la medida inferior, el carro llevará una bandeja. Hay que eliminar los otros dos. - - SELECT height, ticketFk - INTO vTicketHeightTop, vTopTicketFk - FROM tmp.ticket - ORDER BY height DESC - LIMIT 1; - - SELECT max(height) - INTO vVolumetryHeightTop - FROM vn.collectionVolumetry; - - SELECT height, ticketFk - INTO vTicketHeightFloor, vFloorTicketFk - FROM tmp.ticket - WHERE ticketFk != vTopTicketFk - ORDER BY height DESC - LIMIT 1; - - SELECT height - INTO vVolumetryHeightFloor - FROM vn.collectionVolumetry - WHERE level = 1; - - IF vTicketHeightTop > vVolumetryHeightTop - OR vTicketHeightFloor > vVolumetryHeightFloor THEN - - DELETE FROM tmp.ticket WHERE ticketFk != vTopTicketFk; - - ELSEIF vTicketHeightFloor <= vVolumetryHeightFloor THEN - - DELETE FROM tmp.ticket WHERE ticketFk NOT IN (vTopTicketFk, vFloorTicketFk); - - END IF; - - - + /*SI TODAS LOS TICKETS DE UNA COLECCIÓN ESTAN REVISADOS CAMBIADOS ESTADO COLECCIÓN*/ + SELECT collectionFk + INTO vCollectionFk + FROM vn.ticketCollection + WHERE ticketFk = vTicketFk; + + IF (SELECT COUNT(*) + FROM vn.ticketCollection tc + JOIN vn.ticketLastState tls ON tls.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND (name = 'Preparación' OR name = 'En Revisión' OR name = 'Impreso' OR name = 'Preparado') ) = 0 THEN + + UPDATE vn.collection + SET stateFk = (SELECT id FROM vn.state WHERE code = 'PREPARED') + WHERE id = vCollectionFk; END IF; - - - -- Empieza el bucle - OPEN cVolumetry; - OPEN cTicket; - - FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters, vTicketHeight; - FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines, vVolumetryHeight; - - IF NOT vDone THEN - - INSERT INTO vn.collection - SET workerFk = account.myUserGetId(); - - SELECT LAST_INSERT_ID() INTO vCollectionFk; - - END IF; - - bucle:WHILE NOT vDone DO - - IF (vVolumetryLitersMax < vTicketLiters OR vVolumetryLinesMax < vTicketLines) AND vVolumetryLevel > 1 THEN - - LEAVE bucle; - - END IF; - - SELECT COUNT(*) INTO vIsTicketCollected - FROM vn.ticketCollection - WHERE ticketFk = vTicketFk - AND collectionFk = vCollectionFk; - - IF vIsTicketCollected THEN - - UPDATE vn.ticketCollection - SET level = CONCAT(level, vVolumetryLevel) - WHERE ticketFk = vTicketFk - AND collectionFk = vCollectionFk; - - ELSE - - INSERT INTO vn.ticketCollection - SET collectionFk = vCollectionFk, - ticketFk = vTicketFk, - level = vVolumetryLevel; - - INSERT INTO vncontrol.inter - SET state_id = vStateFk, - Id_Ticket = vTicketFk, - Id_Trabajador = account.myUserGetId(); - - END IF; - - SET vVolumetryLitersMax = GREATEST(0,vVolumetryLitersMax - vVolumetryLiters); - SET vVolumetryLinesMax = GREATEST(0,vVolumetryLinesMax - vVolumetryLines); - SET vTicketLiters = GREATEST(0,vTicketLiters - vVolumetryLiters); - SET vTicketLines = GREATEST(0,vTicketLines - vVolumetryLines); - - IF vVolumetryLitersMax = 0 OR vVolumetryLinesMax = 0 THEN - - LEAVE bucle; - - END IF; - - IF vTicketLiters > 0 OR vTicketLines > 0 THEN - - FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines, vVolumetryHeight; - - ELSE - - FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters, vTicketHeight; - FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines, vVolumetryHeight; - - END IF; - - END WHILE; - - - UPDATE vn.collection c - JOIN vn.state st ON st.code = 'ON_PREPARATION' - SET c.stateFk = st.id - WHERE c.id = vCollectionFk; - - INSERT IGNORE INTO vn.ticketDown(ticketFk) - SELECT DISTINCT tc.ticketFk - FROM vn.ticketCollection tc - JOIN vncontrol.inter vi ON vi.Id_Ticket = tc.ticketFk - JOIN vn.state st ON st.id = vi.state_id - JOIN vn.ticket t ON t.id = tc.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - WHERE tc.collectionFk = vCollectionFk - AND w.name = 'Silla FV' - AND st.code = 'PREVIOUS_PREPARATION'; - - - SELECT vCollectionFk; - - CLOSE cVolumetry; - CLOSE cTicket; - -- DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - -- DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `collection_new__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `collection_new__`(vSectorFk INT) -proc:BEGIN - - DECLARE vIsPreviousPrepared BOOLEAN; - DECLARE vCollectionFk INT; - DECLARE vWarehouseFk INT; - DECLARE vTicketLiters INT; - DECLARE vTicketLines INT; - DECLARE vTicketFk INT; - DECLARE vIsTicketCollected BOOLEAN; - DECLARE vMaxTickets INT; - DECLARE vStateFk INT; - DECLARE vVolumetryLiters INT; - DECLARE vVolumetryLines INT; - DECLARE vVolumetryFk INT; - DECLARE vVolumetryLevel INT; - DECLARE vVolumetryLitersMax INT; - DECLARE vVolumetryLinesMax INT; - DECLARE vDone BOOLEAN DEFAULT FALSE; - DECLARE vWorkerCode VARCHAR(3); - - DECLARE cVolumetry CURSOR FOR - SELECT level, liters, `lines` - FROM vn.collectionVolumetry - ORDER BY `level`; - - DECLARE cTicket CURSOR FOR - SELECT * - FROM tmp.ticket; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SELECT isPreviousPrepared, warehouseFk - INTO vIsPreviousPrepared, vWarehouseFk - FROM vn.sector - WHERE id = vSectorFk; - - SELECT w.code - INTO vWorkerCode - FROM vn.worker w - WHERE w.id = account.myUserGetId(); - - IF vIsPreviousPrepared THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'PREVIOUS_PREPARATION'; - ELSE - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'ON_PREPARATION'; - - END IF; - - SELECT COUNT(*), sum(liters), sum(`lines`) - INTO vMaxTickets, vVolumetryLitersMax, vVolumetryLinesMax - FROM vn.collectionVolumetry; - - CALL vn2008.production_control_source(vWarehouseFk, 0); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - - IF (SELECT pb.Agencia - FROM tmp.production_buffer pb - JOIN vn.state s ON s.id = pb.state - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket - WHERE pb.problems = 0 - AND tc.ticketFk IS NULL - AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) - ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC - LIMIT 1) = 'REC_SILLA' THEN - - CREATE TEMPORARY TABLE tmp.ticket - SELECT pb.Id_Ticket ticketFk, - pb.lines, - pb.m3 * 1000 liters - FROM tmp.production_buffer pb - JOIN vn.state s ON s.id = pb.state - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket - WHERE pb.problems = 0 - AND tc.ticketFk IS NULL - AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) - ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC - LIMIT 1; - - ELSE - - CREATE TEMPORARY TABLE tmp.ticket - SELECT pb.Id_Ticket ticketFk, - pb.lines, - pb.m3 * 1000 liters - FROM tmp.production_buffer pb - JOIN vn.state s ON s.id = pb.state - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = pb.Id_Ticket - WHERE pb.problems = 0 - AND pb.Agencia != 'REC_SILLA' - AND tc.ticketFk IS NULL - AND (s.isPreparable OR (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode)) - ORDER BY (s.code = 'PICKER_DESIGNED' AND pb.CodigoTrabajador = vWorkerCode) DESC, pb.Hora, pb.Minuto, m3 DESC, pb.lines DESC - LIMIT vMaxTickets; - - END IF; - - -- Empieza el bucle - OPEN cVolumetry; - OPEN cTicket; - - FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters; - FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines; - - IF NOT vDone THEN - - INSERT INTO vn.collection - SET workerFk = account.myUserGetId(); - - SELECT LAST_INSERT_ID() INTO vCollectionFk; - - END IF; - - bucle:WHILE NOT vDone DO - - IF (vVolumetryLitersMax < vTicketLiters OR vVolumetryLinesMax < vTicketLines) AND vVolumetryLevel > 1 THEN - - LEAVE bucle; - - END IF; - - SELECT COUNT(*) INTO vIsTicketCollected - FROM vn.ticketCollection - WHERE ticketFk = vTicketFk - AND collectionFk = vCollectionFk; - - IF vIsTicketCollected THEN - - UPDATE vn.ticketCollection - SET level = CONCAT(level, vVolumetryLevel) - WHERE ticketFk = vTicketFk - AND collectionFk = vCollectionFk; - - ELSE - - INSERT INTO vn.ticketCollection - SET collectionFk = vCollectionFk, - ticketFk = vTicketFk, - level = vVolumetryLevel; - - INSERT INTO vncontrol.inter - SET state_id = vStateFk, - Id_Ticket = vTicketFk, - Id_Trabajador = account.myUserGetId(); - - END IF; - - SET vVolumetryLitersMax = GREATEST(0,vVolumetryLitersMax - vVolumetryLiters); - SET vVolumetryLinesMax = GREATEST(0,vVolumetryLinesMax - vVolumetryLines); - SET vTicketLiters = GREATEST(0,vTicketLiters - vVolumetryLiters); - SET vTicketLines = GREATEST(0,vTicketLines - vVolumetryLines); - - IF vVolumetryLitersMax = 0 OR vVolumetryLinesMax = 0 THEN - - LEAVE bucle; - - END IF; - - IF vTicketLiters > 0 OR vTicketLines > 0 THEN - - FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines; - - ELSE - - FETCH cTicket INTO vTicketFk, vTicketLines, vTicketLiters; - FETCH cVolumetry INTO vVolumetryLevel, vVolumetryLiters, vVolumetryLines; - - END IF; - - END WHILE; - - - UPDATE vn.collection c - JOIN vn.state st ON st.code = 'ON_PREPARATION' - SET c.stateFk = st.id - WHERE c.id = vCollectionFk; - - INSERT IGNORE INTO vn.ticketDown(ticketFk) - SELECT DISTINCT tc.ticketFk - FROM vn.ticketCollection tc - JOIN vncontrol.inter vi ON vi.Id_Ticket = tc.ticketFk - JOIN vn.state st ON st.id = vi.state_id - JOIN vn.ticket t ON t.id = tc.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - WHERE tc.collectionFk = vCollectionFk - AND w.name = 'Silla FV' - AND st.code = 'PREVIOUS_PREPARATION'; - - - SELECT vCollectionFk; - - CLOSE cVolumetry; - CLOSE cTicket; - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -37815,7 +38272,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `getItemUbication`(vItemFk INT) +CREATE DEFINER=`root`@`%` PROCEDURE `getItemUbication`(vItemFk VARCHAR(22)) BEGIN SELECT vn.barcodeToItem(vItemFk) INTO vItemFk; @@ -41882,28 +42339,22 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `itemShelvingMake`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vShelve` VARCHAR(2), IN `vDeep` INT, IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, IN `vLevel` INT) BEGIN - - DECLARE vItemFk INT; - - - + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - SELECT itemFk INTO vItemFk + /*SELECT itemFk INTO vItemFk FROM vn.buy b - WHERE b.id = vItemFk; - + WHERE b.id = vItemFk;*/ IF (SELECT COUNT(*) FROM vn.shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN @@ -41915,8 +42366,6 @@ BEGIN END IF; - - IF (SELECT COUNT(*) FROM vn.itemShelving WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk @@ -42474,9 +42923,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -42497,12 +42946,10 @@ BEGIN LIMIT 1; UPDATE vn.itemShelving - SET quantity = quantity - ( vPacking * vQuantity ), - visible = visible - ( vPacking * vQuantity ), - available = available - ( vPacking * vQuantity ) + SET shelvingFk = shelvingFkD WHERE shelvingFk = shelvingFkO COLLATE utf8_unicode_ci AND itemFk = vItemFk; - CALL vn.itemShelvingMakeFromDate(shelvingFkD,vItemFk,'A',0,( vPacking * vQuantity ),'',0,vPacking,1,1,vDate); + /*CALL vn.itemShelvingMakeFromDate(shelvingFkD,vItemFk,'A',0,( vPacking * vQuantity ),'',0,vPacking,1,1,vDate); */ SELECT true; @@ -43547,9 +43994,25 @@ BEGIN DECLARE vWorkerIsExcluded BOOLEAN; DECLARE vFromDated DATE; DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,CURDATE()); - - SELECT COUNT(*) INTO vWorkerIsExcluded - FROM bs.manaSpellersExcluded + DECLARE vMana INT; + DECLARE vAutoMana INT; + DECLARE vManaBank INT; + DECLARE vManaGreugeType INT; + + SELECT id INTO vMana + FROM `component` WHERE code = 'mana'; + + SELECT id INTO vAutoMana + FROM `component` WHERE code = 'autoMana'; + + SELECT id INTO vManaBank + FROM `bank` WHERE code = 'mana'; + + SELECT id INTO vManaGreugeType + FROM `greugeType` WHERE code = 'mana'; + + SELECT COUNT(*) INTO vWorkerIsExcluded + FROM workerManaExcluded WHERE workerFk = vWorkerFk; IF NOT vWorkerIsExcluded THEN @@ -43557,7 +44020,7 @@ BEGIN SELECT max(dated) INTO vFromDated FROM clientManaCache; - REPLACE bs.workerMana (workerFk, amount) + REPLACE workerMana (workerFk, amount) SELECT vWorkerFk, sum(mana) FROM ( SELECT s.quantity * sc.value as mana @@ -43566,28 +44029,22 @@ BEGIN JOIN client c ON c.id = a.clientFk JOIN sale s ON s.ticketFk = t.id JOIN saleComponent sc ON sc.saleFk = s.id - WHERE c.salesPersonFk = vWorkerFk AND componentFk IN (39, 37) -- maná auto y maná + WHERE c.salesPersonFk = vWorkerFk AND sc.componentFk IN (vMana, vAutoMana) AND t.shipped > vFromDated AND t.shipped < vToDated - UNION ALL - SELECT - r.amountPaid FROM receipt r JOIN client c ON c.id = r.clientFk - WHERE c.salesPersonFk = vWorkerFk AND bankFk = 66 + WHERE c.salesPersonFk = vWorkerFk AND bankFk = vManaBank AND payed > vFromDated - UNION ALL - SELECT g.amount FROM greuge g JOIN client c ON c.id = g.clientFk - WHERE c.salesPersonFk = vWorkerFk AND g.greugeTypeFk = 3 -- Maná - AND g.shipped > vFromDated and g.shipped < CURDATE() - - UNION ALL - - SELECT mana + WHERE c.salesPersonFk = vWorkerFk AND g.greugeTypeFk = vManaGreugeType + AND g.shipped > vFromDated and g.shipped < CURDATE() + UNION ALL + SELECT cc.mana FROM clientManaCache cc JOIN client c ON c.id = cc.clientFk WHERE c.salesPersonFk = vWorkerFk AND cc.dated = vFromDated @@ -44462,7 +44919,7 @@ BEGIN WHILE vRow <= vToRow DO INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`, pickingOrder) - VALUES (vColumn, vRow, vSectorFk, vCode, vColumn ) + VALUES (vColumn, vRow, vSectorFk, vCode, vColumn * 100 + vRow ) ON DUPLICATE KEY UPDATE `code` = vCode; SET vRow = vRow + 1; @@ -44623,7 +45080,6 @@ BEGIN SELECT 0,999999,0 INTO @sameTicket, @ticket, @litrosTicket; - SELECT @litrosTicket := IF(sub.ticketFk = @ticket, @litrosTicket + Litros, Litros) as LitrosTicket, @sameTicket := IF(sub.ticketFk = @ticket, @sameTicket, IF(@sameTicket, 0 , 1)) as sameTicket, sub.*, @@ -44641,7 +45097,7 @@ BEGIN CAST(isa.physicalVolume * 1000 AS DECIMAL(10,0)) as Litros FROM vn.itemShelvingAvailable isa JOIN vn.item i ON i.id = isa.itemFk - JOIN vn.sector s ON s.id = isa.sectorFk + JOIN vn.sector s ON s.id = isa.sectorFk AND s.warehouseFk = isa.warehouseFk WHERE IF(s.isPreviousPreparedByPacking, (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ), TRUE) AND isa.isPreviousPreparable = TRUE AND isa.sectorFk = vSectorFk @@ -46151,7 +46607,7 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `shelvingPark`(IN `vShelvingFk` VARCHAR(8), IN `vParkingCode` VARCHAR(8)) -BEGIN +proc: BEGIN DECLARE vParkingFk INT DEFAULT 0; DECLARE idParking INT; @@ -46162,22 +46618,23 @@ BEGIN /*ELIMINAR ESPACIOS*/ SET vParkingCode = replace(vParkingCode,' ','') ; - /*SINO EXISTE EL PARKING LO CREAMOS*/ + /*SINO EXISTE EL PARKING ABORTAMOS*/ SELECT id INTO idParking FROM vn.parking WHERE code = vParkingCode COLLATE utf8_unicode_ci; - + IF idParking IS NULL THEN - IF LOCATE('-',vParkingCode) = 4 THEN + + LEAVE proc; + /*IF LOCATE('-',vParkingCode) = 4 THEN SELECT SUBSTRING_INDEX(vParkingCode,'-',1) INTO vColumn; SELECT SUBSTRING_INDEX(vParkingCode,'-',-1) INTO vRow; INSERT INTO vn.parking(`column`,`row`,code,sectorFk) VALUES(vColumn,vRow,vParkingCode,1); END IF; + */ END IF; - /*FIN INSERTAR PARKING*/ - - + SELECT id INTO vParkingFk FROM vn.parking WHERE `code` = vParkingCode COLLATE utf8_unicode_ci; @@ -46321,77 +46778,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `sinComponentes` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `sinComponentes`() -BEGIN - DECLARE v_done BOOL DEFAULT FALSE; - DECLARE vSaleFk INTEGER; - DECLARE vCur CURSOR FOR -SELECT s.id - FROM vn.ticket t - JOIN vn.client clt ON clt.id = t.clientFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType tp ON tp.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = tp.categoryFk - LEFT JOIN tmp.coste c ON c.id = s.id - WHERE t.shipped >= '2019-10-01' AND t.shipped <= '2019-10-30' - AND c.id IS NULL - AND clt.isActive != 0 - AND ic.merchandise != 0 - GROUP BY s.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; - -DROP TEMPORARY TABLE IF EXISTS tmp.coste; - -DROP TEMPORARY TABLE IF EXISTS tmp.coste; -CREATE TEMPORARY TABLE tmp.coste - (primary key (id)) ENGINE = MEMORY - SELECT s.id - FROM vn.ticket t - JOIN vn.client clt ON clt.id = t.clientFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType tp ON tp.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = tp.categoryFk - JOIN vn.saleComponent sc ON sc.saleFk = s.id - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.id = 1 - WHERE t.shipped >= '2019-10-01' - AND ic.merchandise != 0; - - - OPEN vCur; - - l: LOOP - SET v_done = FALSE; - FETCH vCur INTO vSaleFk; - - IF v_done THEN - LEAVE l; - END IF; - - CALL vn.ticketCalculateSaleForcePrice2(vSaleFk); - END LOOP; - - CLOSE vCur; - END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `solunionRiskRequest` */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -47455,9 +47841,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -47478,6 +47864,7 @@ BEGIN DECLARE vNewInvoiceId INT; DECLARE vHasDailyInvoice BOOL; DECLARE vWithPackage BOOL; + DECLARE vHasToInvoice BOOL; DECLARE cur CURSOR FOR SELECT ticketFk FROM tmp.ticketClosure; @@ -47511,13 +47898,15 @@ BEGIN t.companyFk, t.shipped, co.hasDailyInvoice, - w.isManaged + w.isManaged, + c.hasToInvoice INTO vClientFk, vIsTaxDataChecked, vCompanyFk, vShipped, vHasDailyInvoice, - vWithPackage + vWithPackage, + vHasToInvoice FROM ticket t JOIN `client` c ON c.id = t.clientFk JOIN province p ON p.id = c.provinceFk @@ -47543,7 +47932,7 @@ BEGIN AND getSpecialPrice(e.itemFk, vClientFk) > 0 GROUP BY e.itemFk); - IF(vHasDailyInvoice) THEN + IF(vHasDailyInvoice) AND vHasToInvoice THEN -- Facturacion rapida CALL ticketTrackingAdd(vTicketFk, 'DELIVERED', NULL); @@ -47827,6 +48216,30 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ticketCollection_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticketCollection_get`(vTicketFk INT) +BEGIN + + SELECT collectionFk + FROM vn.collectionReportSource + WHERE ticketFk = vTicketFk + GROUP BY collectionFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketComponentCalculate__` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48526,7 +48939,7 @@ BEGIN FROM saleComponent sc JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk JOIN `component` c ON c.id = sc.componentFk - JOIN componentType ct on ct.id = c.typeFk AND ct.base + JOIN componentType ct on ct.id = c.typeFk AND ct.isBase GROUP BY sc.saleFk) sc ON sc.saleFk = s.id SET s.priceFixed = sumValue, s.isPriceFixed = 1; @@ -50433,7 +50846,7 @@ BEGIN DECLARE vWarehouseFk INT; DECLARE vCursor CURSOR FOR SELECT id, landed, addressFk, agencyModeFk, warehouseFk - FROM vn.ticket WHERE shipped >= '2019-07-01'; + FROM vn.ticket WHERE shipped BETWEEN '2019-01-01' and '2019-02-01' AND zoneFk is null; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET vDone = 1; OPEN vCursor; @@ -50442,7 +50855,7 @@ BEGIN CALL zoneGetShippedWarehouse(vLanded, vAddressFk, vAgencyModeFk); UPDATE vn.ticket t JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = vWarehouseFk - SET zoneFk = zgs.id + SET t.zoneFk = zgs.zoneFk WHERE t.id = vFechedTicket; UNTIL vDone END REPEAT; @@ -50683,6 +51096,76 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ticket_withoutComponents` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_withoutComponents`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + DECLARE v_done BOOL DEFAULT FALSE; + DECLARE vSaleFk INTEGER; + DECLARE vCur CURSOR FOR + SELECT s.id + FROM vn.ticket t + JOIN vn.client clt ON clt.id = t.clientFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType tp ON tp.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = tp.categoryFk + LEFT JOIN tmp.coste c ON c.id = s.id + WHERE t.shipped >= vDatedFrom AND t.shipped <= vDatedTo + AND c.id IS NULL + AND clt.isActive != 0 + AND ic.merchandise != 0 + GROUP BY s.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET v_done = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.coste; + + DROP TEMPORARY TABLE IF EXISTS tmp.coste; + CREATE TEMPORARY TABLE tmp.coste + (primary key (id)) ENGINE = MEMORY + SELECT s.id + FROM vn.ticket t + JOIN vn.client clt ON clt.id = t.clientFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType tp ON tp.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = tp.categoryFk + JOIN vn.saleComponent sc ON sc.saleFk = s.id + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.id = 1 + WHERE t.shipped >= vDatedFrom + AND ic.merchandise != 0; + + OPEN vCur; + + l: LOOP + SET v_done = FALSE; + FETCH vCur INTO vSaleFk; + + IF v_done THEN + LEAVE l; + END IF; + + CALL vn.ticketCalculateSaleForcePrice2(vSaleFk); + END LOOP; + + CLOSE vCur; + END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `timeBusiness_calculate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50944,9 +51427,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -50976,10 +51459,14 @@ BEGIN wtc.userFk, wtc.timed timed, direction - FROM workerTimeControl wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk + FROM (SELECT wtc.* + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo + ORDER BY userFk, timed ASC + ) wtc WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo - ORDER BY userFk, timed + ORDER BY userFk, timed ASC ) sub GROUP BY userFk, dated ORDER BY userFk, dated @@ -51138,6 +51625,57 @@ BEGIN DROP TEMPORARY TABLE tmp.`user`; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `timeControl_calculate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `timeControl_calculate__`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + SET @vIsOdd := TRUE; + SET @vUser := NULL; + SET @vDated := NULL; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + + CREATE TEMPORARY TABLE tmp.timeControlCalculate + SELECT userFk, + dated, + IF( timeWork >= 18000, @timeWork:=timeWork + 1200, @timeWork:=timeWork) timeWorkSeconds, + SEC_TO_TIME(@timeWork ) timeWorkSexagesimal, + @timeWork / 3600 timeWorkDecimal + FROM (SELECT SUM(timeWork) timeWork, + userFk, + dated + FROM (SELECT IF(@vUser = wtc.userFk, @vUser :=@vUser, @vUser := wtc.userFk ), + IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE ), + IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd ), + IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed), + IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed)-@vLastTimed) timeWork, + IF(direction='in', @vDated := DATE(wtc.timed), @vDated :=@vDated) dated, + wtc.userFk, + wtc.timed timed, + direction + FROM (SELECT * FROM workerTimeControl ORDER BY userFk, timed ASC) wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo + ORDER BY userFk, timed ASC + ) sub + GROUP BY userFk, dated + ORDER BY userFk, dated + )sub2; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54073,6 +54611,9 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `zone_getAvailable`(vAddress INT, vLanded DATE) BEGIN + +/* JGF esta trabajando en este archivo, si se modifica avisadme 2020-02-12*/ + CALL zone_getFromGeo(address_getGeo(vAddress)); CALL zone_getOptionsForLanding(vLanded); @@ -54364,14 +54905,86 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `zone_getOptionsForLanding`(vLanded DATE) BEGIN +/** + * Gets computed options for the passed zones and delivery date. + * + * @table tmp.zones(id) The zones ids + * @param vLanded The delivery date + * @return tmp.zoneOption The computed options + */ + DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; + CREATE TEMPORARY TABLE tmp.zoneOption + ENGINE = MEMORY + SELECT + zoneFk, + `hour`, + travelingDays, + price, + bonus, + TIMESTAMPADD(DAY, -travelingDays, vLanded) shipped + FROM ( + SELECT t.id zoneFk, + TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, + IFNULL(e.travelingDays, z.travelingDays) travelingDays, + IFNULL(e.price, z.price) price, + IFNULL(e.bonus, z.bonus) bonus + FROM tmp.zone t + JOIN zone z ON z.id = t.id + JOIN zoneEvent e ON e.zoneFk = t.id + WHERE ( + e.`type` = 'day' + AND e.dated = vLanded + ) OR ( + e.`type` != 'day' + AND e.weekDays & (1 << WEEKDAY(vLanded)) + AND (e.`started` IS NULL OR vLanded >= e.`started`) + AND (e.`ended` IS NULL OR vLanded <= e.`ended`) + ) + ORDER BY + zoneFk, + CASE + WHEN e.`type` = 'day' + THEN 1 + WHEN e.`type` = 'range' + THEN 2 + ELSE 3 + END + ) t + GROUP BY zoneFk; + + DELETE t FROM tmp.zoneOption t + JOIN zoneExclusion e + ON e.zoneFk = t.zoneFk AND e.`dated` = vLanded; + + DELETE FROM tmp.zoneOption + WHERE shipped < CURDATE() + OR (shipped = CURDATE() AND CURTIME() > `hour`); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `zone_getOptionsForLanding__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `zone_getOptionsForLanding__`(vLanded DATE) +BEGIN /** * Gets computed options for the passed zones and delivery date. * @@ -54438,14 +55051,99 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `zone_getOptionsForShipment`(vShipped DATE, vShowExpiredZones BOOLEAN) BEGIN +/** + * Gets computed options for the passed zones and shipping date. + * + * @table tmp.zones(id) The zones ids + * @param vShipped The shipping date + * @return tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, specificity) The computed options + */ + DECLARE vHour TIME DEFAULT TIME(NOW()); + + DROP TEMPORARY TABLE IF EXISTS tLandings; + CREATE TEMPORARY TABLE tLandings + (INDEX (eventFk)) + ENGINE = MEMORY + SELECT e.id eventFk, + @travelingDays := IFNULL(e.travelingDays, z.travelingDays) travelingDays, + TIMESTAMPADD(DAY, @travelingDays, vShipped) landed + FROM tmp.zone t + JOIN zone z ON z.id = t.id + JOIN zoneEvent e ON e.zoneFk = t.id; + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; + CREATE TEMPORARY TABLE tmp.zoneOption + ENGINE = MEMORY + SELECT * + FROM ( + SELECT t.id zoneFk, + TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, + l.travelingDays, + IFNULL(e.price, z.price) price, + IFNULL(e.bonus, z.bonus) bonus, + l.landed + FROM tmp.zone t + JOIN zone z ON z.id = t.id + JOIN zoneEvent e ON e.zoneFk = t.id + JOIN tLandings l ON l.eventFk = e.id + WHERE ( + e.`type` = 'day' + AND e.`dated` = l.landed + ) OR ( + e.`type` != 'day' + AND e.weekDays & (1 << WEEKDAY(l.landed)) + AND (e.`started` IS NULL OR l.landed >= e.`started`) + AND (e.`ended` IS NULL OR l.landed <= e.`ended`) + ) + ORDER BY + zoneFk, + CASE + WHEN e.`type` = 'day' + THEN 1 + WHEN e.`type` = 'range' + THEN 2 + ELSE 3 + END + ) t + GROUP BY zoneFk; + + DROP TEMPORARY TABLE tLandings; + + DELETE t FROM tmp.zoneOption t + JOIN zoneExclusion e + ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed; + + IF NOT vShowExpiredZones THEN + DELETE FROM tmp.zoneOption + WHERE vShipped < CURDATE() + OR (vShipped = CURDATE() AND CURTIME() > `hour`); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `zone_getOptionsForShipment__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `zone_getOptionsForShipment__`(vShipped DATE, vShowExpiredZones BOOLEAN) +BEGIN /** * Gets computed options for the passed zones and shipping date. * @@ -54585,6 +55283,9 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT) BEGIN + +/* JGF esta trabajando en este archivo, si se modifica avisadme 2020-02-12*/ + /** * Devuelve el listado de agencias disponibles para la fecha, * dirección y almacén pasados. @@ -54735,10 +55436,14 @@ DELIMITER ;; AFTER INSERT ON `inter` FOR EACH ROW BEGIN + + REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) SELECT NEW.Id_Ticket, NEW.inter_id, `name` FROM vn.state WHERE id = NEW.state_id; + + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56284,25 +56989,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,ifnull(`isps`.`created`,`ips`.`created`) AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,(`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0))) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,max(`p`.`code`) AS `parking`,`ips`.`sectorFk` AS `sectorFk` from (((((((`itemPlacementSupply` `ips` join `item` `i` on((`i`.`id` = `ips`.`itemFk`))) left join `worker` `w` on((`w`.`userFk` = `ips`.`userFk`))) left join `worker` `rw` on((`rw`.`userFk` = `ips`.`repoUserFk`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemPlacementSupplyFk` = `ips`.`id`))) left join `itemShelving` `ish` on((`ish`.`id` = `isps`.`itemShelvingFk`))) left join `shelving` `s` on((`ish`.`shelvingFk` = `s`.`code`))) left join `parking` `p` on((`s`.`parkingFk` = `p`.`id`))) where (`ips`.`created` >= curdate()) group by `ips`.`priority`,`ips`.`id`,`p`.`sectorFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemPlacementSupplyList__` --- - -/*!50001 DROP VIEW IF EXISTS `itemPlacementSupplyList__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemPlacementSupplyList__` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,`ips`.`created` AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,(`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0))) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,max(`p`.`code`) AS `parking`,max(`p`.`sectorFk`) AS `sectorFk` from (((((((`itemPlacementSupply` `ips` join `itemShelving` `ish` on((`ish`.`itemFk` = `ips`.`itemFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) left join `worker` `w` on((`w`.`userFk` = `ips`.`userFk`))) left join `worker` `rw` on((`rw`.`userFk` = `ips`.`repoUserFk`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemPlacementSupplyFk` = `ips`.`id`))) left join `shelving` `s` on((`ish`.`shelvingFk` = `s`.`code`))) left join `parking` `p` on((`s`.`parkingFk` = `p`.`id`))) where (`ips`.`created` >= curdate()) group by `ips`.`priority`,`ips`.`id`,`p`.`sectorFk` */; +/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,ifnull(`isps`.`created`,`ips`.`created`) AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,(`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0))) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,`ips`.`sectorFk` AS `sectorFk` from ((((`itemPlacementSupply` `ips` join `item` `i` on((`i`.`id` = `ips`.`itemFk`))) left join `worker` `w` on((`w`.`userFk` = `ips`.`userFk`))) left join `worker` `rw` on((`rw`.`userFk` = `ips`.`repoUserFk`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemPlacementSupplyFk` = `ips`.`id`))) where (`ips`.`created` >= curdate()) group by `ips`.`priority`,`ips`.`id`,`ips`.`sectorFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -56338,7 +57025,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume` from (((((((((`vn`.`sale` `s` join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `st` on((`st`.`id` = `tst`.`state`))) join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemShelvingStock` `stock` on((`stock`.`itemFk` = `i`.`id`))) left join `vn`.`saleTracking` `stk` on((`stk`.`saleFk` = `s`.`id`))) left join `vn`.`zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(curdate())) and isnull(`stk`.`id`) and (`stock`.`visible` > 0) and isnull(`stk`.`saleFk`) and `st`.`sectorProdPriority`) */; +/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`vn`.`sale` `s` join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `st` on((`st`.`id` = `tst`.`state`))) join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemShelvingStock` `stock` on((`stock`.`itemFk` = `i`.`id`))) left join `vn`.`saleTracking` `stk` on((`stk`.`saleFk` = `s`.`id`))) left join `vn`.`zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(curdate())) and isnull(`stk`.`id`) and (`stock`.`visible` > 0) and isnull(`stk`.`saleFk`) and `st`.`sectorProdPriority`) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -56531,12 +57218,12 @@ USE `vn`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastTopClaims` AS select `s`.`itemFk` AS `itemFk`,`i`.`longName` AS `itemName`,`it`.`name` AS `itemTypeName`,count(0) AS `claimsNumber`,round(sum(((((`cb`.`quantity` * `s`.`price`) * (1 - ((`c`.`responsibility` - 1) / 4))) * (100 - `s`.`discount`)) / 100)),2) AS `claimedAmount`,round(sum((((`cb`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100)),2) AS `totalAmount` from ((((`claim` `c` join `claimBeginning` `cb` on((`cb`.`claimFk` = `c`.`id`))) join `sale` `s` on((`s`.`id` = `cb`.`saleFk`))) join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `itemType` `it` on((`it`.`id` = `i`.`typeFk`))) where (`c`.`created` >= (curdate() + interval -(1) week)) group by `s`.`itemFk` having (((`claimedAmount` > 100) and (`claimsNumber` > 2)) or (`claimsNumber` > 4)) order by `claimedAmount` desc */; +/*!50001 VIEW `lastTopClaims` AS select `s`.`itemFk` AS `itemFk`,`i`.`longName` AS `itemName`,`it`.`name` AS `itemTypeName`,count(0) AS `claimsNumber`,round(sum(((((`cb`.`quantity` * `s`.`price`) * (1 - ((`c`.`responsibility` - 1) / 4))) * (100 - `s`.`discount`)) / 100)),2) AS `claimedAmount`,round(sum((((`cb`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100)),2) AS `totalAmount` from ((((`claim` `c` join `claimBeginning` `cb` on((`cb`.`claimFk` = `c`.`id`))) join `sale` `s` on((`s`.`id` = `cb`.`saleFk`))) join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `itemType` `it` on((`it`.`id` = `i`.`typeFk`))) where (`c`.`created` >= (curdate() + interval -(1) week)) group by `s`.`itemFk` having (((`claimedAmount` > 100) and (`claimsNumber` > 2)) or (`claimsNumber` > 4)) order by `claimsNumber` desc */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -56974,19 +57661,19 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `workerTimeControl_Journey` +-- Final view structure for view `workerTimeControl_Journey__` -- -/*!50001 DROP VIEW IF EXISTS `workerTimeControl_Journey`*/; +/*!50001 DROP VIEW IF EXISTS `workerTimeControl_Journey__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeControl_Journey` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,cast(sum((if((`wtc`.`order` % 2),-(1),1) * (hour(`wtc`.`timed`) + (minute(`wtc`.`timed`) / 60)))) as decimal(10,2)) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) group by cast(`wtc`.`timed` as date),`wtc`.`userFk` */; +/*!50001 VIEW `workerTimeControl_Journey__` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,cast(sum((if((`wtc`.`order` % 2),-(1),1) * (hour(`wtc`.`timed`) + (minute(`wtc`.`timed`) / 60)))) as decimal(10,2)) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) group by cast(`wtc`.`timed` as date),`wtc`.`userFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -57024,4 +57711,4 @@ USE `vncontrol`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-24 12:08:27 +-- Dump completed on 2020-02-12 13:30:31 diff --git a/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js b/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js index b9b28fe09..0004b2156 100644 --- a/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js +++ b/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js @@ -17,7 +17,7 @@ describe('Client activeWorkersWithRole', () => { let isBuyer = await app.models.Account.hasRole(result[0].id, 'buyer'); - expect(result.length).toEqual(10); + expect(result.length).toEqual(11); expect(isBuyer).toBeTruthy(); }); }); diff --git a/modules/client/back/methods/client/specs/listWorkers.spec.js b/modules/client/back/methods/client/specs/listWorkers.spec.js index 728268457..97f4b591d 100644 --- a/modules/client/back/methods/client/specs/listWorkers.spec.js +++ b/modules/client/back/methods/client/specs/listWorkers.spec.js @@ -6,7 +6,7 @@ describe('Client listWorkers', () => { .then(result => { let amountOfEmployees = Object.keys(result).length; - expect(amountOfEmployees).toEqual(49); + expect(amountOfEmployees).toEqual(50); done(); }) .catch(done.fail); From 4b48a89eaa4d8b0b07812e96b4b825591f86b4fc Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Thu, 13 Feb 2020 08:31:29 +0100 Subject: [PATCH 70/95] ticket descriptor update acl --- db/changes/10150-entry/00-acl.sql | 3 +++ e2e/paths/05-ticket/09_weekly.spec.js | 2 +- modules/ticket/front/descriptor/index.js | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 db/changes/10150-entry/00-acl.sql diff --git a/db/changes/10150-entry/00-acl.sql b/db/changes/10150-entry/00-acl.sql new file mode 100644 index 000000000..59934a266 --- /dev/null +++ b/db/changes/10150-entry/00-acl.sql @@ -0,0 +1,3 @@ +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES ('TicketWeekly', '*', 'WRITE', 'ALLOW', 'ROLE', 'buyer'); +UPDATE salix.ACL SET accessType = 'READ' WHERE (id = '91'); \ No newline at end of file diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js index c732a4b87..3e791dc18 100644 --- a/e2e/paths/05-ticket/09_weekly.spec.js +++ b/e2e/paths/05-ticket/09_weekly.spec.js @@ -8,7 +8,7 @@ describe('Ticket descriptor path', () => { beforeAll(async() => { browser = await getBrowser(); page = browser.page; - await page.loginAndModule('employee', 'ticket'); + await page.loginAndModule('buyer', 'ticket'); await page.accessToSection('ticket.weekly.index'); }); diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js index ef64bf84e..10da4cca9 100644 --- a/modules/ticket/front/descriptor/index.js +++ b/modules/ticket/front/descriptor/index.js @@ -7,7 +7,11 @@ class Controller extends Component { this.aclService = aclService; this.$httpParamSerializer = $httpParamSerializer; this.moreOptions = [ - {name: 'Add turn', callback: this.showAddTurnDialog}, + { + name: 'Add turn', + acl: 'buyer', + callback: this.showAddTurnDialog + }, {name: 'Show Delivery Note', callback: this.showDeliveryNote}, {name: 'Send Delivery Note', callback: this.confirmDeliveryNote}, {name: 'Delete ticket', callback: this.showDeleteTicketDialog}, From b78858eb7c59f61b22b4a9c6cf8439141fbdd721 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Thu, 13 Feb 2020 09:30:18 +0100 Subject: [PATCH 71/95] export structure db --- db/changes/10150-entry/00-acl.sql | 3 -- db/dump/dumpedFixtures.sql | 14 +++++----- db/dump/structure.sql | 46 +++++++++++++++++-------------- 3 files changed, 32 insertions(+), 31 deletions(-) delete mode 100644 db/changes/10150-entry/00-acl.sql diff --git a/db/changes/10150-entry/00-acl.sql b/db/changes/10150-entry/00-acl.sql deleted file mode 100644 index 59934a266..000000000 --- a/db/changes/10150-entry/00-acl.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) - VALUES ('TicketWeekly', '*', 'WRITE', 'ALLOW', 'ROLE', 'buyer'); -UPDATE salix.ACL SET accessType = 'READ' WHERE (id = '91'); \ No newline at end of file diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 47bfd9b53..74290b451 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -36,7 +36,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-02-12 13:30:39 +-- Dump completed on 2020-02-13 9:07:05 USE `account`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -94,7 +94,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-02-12 13:30:39 +-- Dump completed on 2020-02-13 9:07:05 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -142,7 +142,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-02-12 13:30:39 +-- Dump completed on 2020-02-13 9:07:05 USE `vn`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -340,7 +340,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-02-12 13:30:40 +-- Dump completed on 2020-02-13 9:07:05 USE `cache`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -378,7 +378,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-02-12 13:30:40 +-- Dump completed on 2020-02-13 9:07:05 USE `hedera`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -436,7 +436,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-02-12 13:30:40 +-- Dump completed on 2020-02-13 9:07:06 USE `postgresql`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -524,4 +524,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-02-12 13:30:40 +-- Dump completed on 2020-02-13 9:07:06 diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 76756c9be..35cb82fd4 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -17509,24 +17509,24 @@ BEGIN SELECT * FROM ( SELECT - `db`, - `name`, - `type`, - `body`, + `routine_schema` `schema`, + `routine_name` `name`, + `routine_type` `type`, + `routine_definition` `definition`, `created`, - `modified` - FROM `mysql`.`proc` - WHERE `body` LIKE vChain COLLATE utf8_general_ci + `last_altered` + FROM `information_schema`.`routines` + WHERE `routine_definition` LIKE vChain COLLATE utf8_general_ci UNION ALL SELECT - `db`, - `name`, + `event_schema`, + `event_name`, 'EVENT', - `body_utf8`, + `event_definition`, `created`, - `modified` - FROM `mysql`.`event` - WHERE `body_utf8` LIKE vChain COLLATE utf8_general_ci + `last_altered` + FROM `information_schema`.`events` + WHERE `event_definition` LIKE vChain COLLATE utf8_general_ci UNION ALL SELECT `EVENT_OBJECT_SCHEMA`, @@ -17548,8 +17548,7 @@ BEGIN FROM `information_schema`.`VIEWS` WHERE `VIEW_DEFINITION` LIKE vChain COLLATE utf8_general_ci ) t - ORDER BY `db`, `name`; - + ORDER BY `schema`, `name`; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -26562,6 +26561,10 @@ BEGIN SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); SET NEW.routeFk = NULL; END IF; + + IF NEW.routeFk AND NEW.isDeleted THEN + CALL util.throw ('This ticket is deleted'); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27930,7 +27933,6 @@ CREATE TABLE `worker` ( `birthed` date NOT NULL, `maritalStatus` enum('soltero/a','casado/a') COLLATE utf8_unicode_ci NOT NULL, `phone` varchar(9) COLLATE utf8_unicode_ci NOT NULL, - `companyFk` smallint(5) unsigned DEFAULT NULL, `clientFk` int(11) DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `bossFk` int(11) NOT NULL DEFAULT '2', @@ -27943,7 +27945,6 @@ CREATE TABLE `worker` ( UNIQUE KEY `Id_Cliente_Interno` (`clientFk`), KEY `sub` (`sub`), KEY `boss_idx` (`bossFk`), - KEY `empresa_id` (`companyFk`), CONSTRAINT `Clientes` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `worker_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -29651,14 +29652,15 @@ BEGIN LIMIT 1; -- Margen - INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) + -- No se aplica margen, cau 12589 +/* INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) SELECT vWarehouse, vItem, vComponentMargin, (vCost / ((100 - rate2) / 100)) - vCost FROM vn.rate WHERE dated <= CURDATE() AND warehouseFk = vWarehouse ORDER BY dated DESC LIMIT 1; - + */ -- Recobro INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) SELECT vWarehouse, vItem, vComponentRecovery, ROUND(LEAST(recobro,0.25), 3) @@ -42947,7 +42949,9 @@ BEGIN UPDATE vn.itemShelving SET shelvingFk = shelvingFkD - WHERE shelvingFk = shelvingFkO COLLATE utf8_unicode_ci AND itemFk = vItemFk; + WHERE shelvingFk = shelvingFkO COLLATE utf8_unicode_ci + AND itemFk = vItemFk + AND visible = ( vPacking * vQuantity ); /*CALL vn.itemShelvingMakeFromDate(shelvingFkD,vItemFk,'A',0,( vPacking * vQuantity ),'',0,vPacking,1,1,vDate); */ @@ -57711,4 +57715,4 @@ USE `vncontrol`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-02-12 13:30:31 +-- Dump completed on 2020-02-13 9:07:01 From f7dc279489e0dffe5dd25ac33edfd383c3a78847 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 13 Feb 2020 09:47:05 +0100 Subject: [PATCH 72/95] #2002 e2e client.summary --- e2e/helpers/selectors.js | 11 ++++ e2e/paths/02-client/19_summary.spec.js | 80 ++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 e2e/paths/02-client/19_summary.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 564745752..63d40f9d5 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -27,6 +27,17 @@ export default { createClientButton: `vn-float-button`, othersButton: 'vn-left-menu li[name="Others"] > a' }, + clientSummary: { + header: 'vn-client-summary > vn-card > h5', + email: 'vn-client-summary vn-label-value[label="Email"]', + street: 'vn-client-summary vn-label-value[label="Street"]', + verifiedData: 'vn-client-summary > vn-card > vn-horizontal vn-check[ng-model="$ctrl.summary.isTaxDataChecked"]', + payMethod: 'vn-client-summary vn-label-value[label="Pay method"]', + defaultAdressName: 'vn-client-summary vn-label-value[label="Name"]', + userName: 'vn-client-summary vn-label-value[label="User"]', + rate: 'vn-client-summary vn-label-value[label="Rate"]', + credit: 'vn-client-summary vn-label-value[label="Credit"]', + }, createClientView: { name: 'vn-client-create vn-textfield[ng-model="$ctrl.client.name"]', taxNumber: 'vn-client-create vn-textfield[ng-model="$ctrl.client.fi"]', diff --git a/e2e/paths/02-client/19_summary.spec.js b/e2e/paths/02-client/19_summary.spec.js new file mode 100644 index 000000000..11b5a298e --- /dev/null +++ b/e2e/paths/02-client/19_summary.spec.js @@ -0,0 +1,80 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Client summary path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Petter Parker'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should reach the first route summary section', async() => { + let url = await page.expectURL('#!/client/102/summary'); + + expect(url).toBe(true); + }); + + it('should display details from the client on the header', async() => { + await page.waitForTextInElement(selectors.clientSummary.header, 'Petter Parker'); + const result = await page.waitToGetProperty(selectors.clientSummary.header, 'innerText'); + + expect(result).toContain('Petter Parker'); + }); + + it('should display some basic data', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.email, 'innerText'); + + expect(result).toContain('PetterParker@mydomain.com'); + }); + + it('should display fiscal address details', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.street, 'innerText'); + + expect(result).toContain('20 Ingram Street'); + }); + + it('should display some fiscal data', async() => { + await page.waitForClassPresent(selectors.clientSummary.verifiedData, 'checked'); + const result = await page.waitToGetProperty(selectors.clientSummary.verifiedData, 'innerText'); + + expect(result).toContain('Verified data'); + }); + + it('should display pay method details', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.payMethod, 'innerText'); + + expect(result).toContain('PayMethod five'); + }); + + it('should display default address details', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.defaultAdressName, 'innerText'); + + expect(result).toContain('Petter Parker'); + }); + + it('should display web access details', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.userName, 'innerText'); + + expect(result).toContain('PetterParker'); + }); + + it('should display business data', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.rate, 'innerText'); + + expect(result).toContain('%'); + }); + + it('should display financial information', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.credit, 'innerText'); + + expect(result).toContain('€300.00'); + }); +}); From df873b4ac06a98d8299ae8c9d046788a819900f1 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 13 Feb 2020 11:05:00 +0100 Subject: [PATCH 73/95] added datalist to catalog filter --- e2e/helpers/selectors.js | 4 ++-- front/core/components/datalist/index.js | 2 +- front/core/components/datalist/style.scss | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100755 front/core/components/datalist/style.scss diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 99c78eea2..d92bb5b14 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -606,8 +606,8 @@ export default { plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]', type: 'vn-autocomplete[data="$ctrl.itemTypes"]', itemId: 'vn-order-catalog > vn-side-menu vn-textfield[ng-model="$ctrl.itemId"]', - itemTagValue: 'vn-order-catalog > vn-side-menu vn-textfield[ng-model="$ctrl.value"]', - openTagSearch: 'vn-order-catalog > vn-side-menu > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i', + itemTagValue: 'vn-order-catalog > vn-side-menu vn-datalist[ng-model="$ctrl.value"]', + openTagSearch: 'vn-order-catalog > vn-side-menu > div > vn-vertical > vn-datalist[ng-model="$ctrl.value"] .append i', tag: 'vn-order-catalog-search-panel vn-autocomplete[ng-model="filter.tagFk"]', tagValue: 'vn-order-catalog-search-panel vn-textfield[ng-model="filter.value"]', searchTagButton: 'vn-order-catalog-search-panel button[type=submit]', diff --git a/front/core/components/datalist/index.js b/front/core/components/datalist/index.js index 0964a1480..bf3cab9a1 100644 --- a/front/core/components/datalist/index.js +++ b/front/core/components/datalist/index.js @@ -3,6 +3,7 @@ import ArrayModel from '../array-model/array-model'; import CrudModel from '../crud-model/crud-model'; import {mergeWhere} from 'vn-loopback/util/filter'; import Textfield from '../textfield/textfield'; +import './style.scss'; export default class Datalist extends Textfield { constructor($element, $scope, $compile, $transclude) { @@ -12,7 +13,6 @@ export default class Datalist extends Textfield { this._selection = null; this.buildInput('text'); - this.input.setAttribute('autocomplete', 'off'); } diff --git a/front/core/components/datalist/style.scss b/front/core/components/datalist/style.scss new file mode 100755 index 000000000..db4ed2bb0 --- /dev/null +++ b/front/core/components/datalist/style.scss @@ -0,0 +1,7 @@ +@import "effects"; + +vn-datalist { + input::-webkit-calendar-picker-indicator { + display: none + } +} \ No newline at end of file From 39470e837b7e8f24790064cf65242dc7d615849a Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 13 Feb 2020 13:20:31 +0100 Subject: [PATCH 74/95] 2094 Regularize claim send chat even if doesn't have destination --- back/methods/chat/sendCheckingPresence.js | 2 +- loopback/locale/en.json | 2 +- loopback/locale/es.json | 2 +- .../back/methods/claim/regularizeClaim.js | 49 ++++++++++--------- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 70b4da58f..b2a3ca725 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -36,7 +36,7 @@ module.exports = Self => { relation: 'department' } }); - const department = workerDepartment.department(); + const department = workerDepartment && workerDepartment.department(); const channelName = department.chatName; if (channelName) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 23717ba8f..49cd0f171 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -61,7 +61,7 @@ "MESSAGE_BOUGHT_UNITS": "Bought {{quantity}} units of {{concept}} (#{{itemId}}) for the ticket id [#{{ticketId}}]({{{url}}})", "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} (#{{clientId}})]({{{url}}}) to *{{credit}} €*", "MESSAGE_CHANGED_PAYMETHOD": "I have changed the pay method for client [{{clientName}} (#{{clientId}})]({{{url}}})", - "MESSAGE_CLAIM_ITEM_REGULARIZE": "I sent *{{quantity}}* units of [{{concept}} (#{{itemId}})]({{{itemUrl}}}) to {{nickname}} coming from ticket id [#{{ticketId}}]({{{ticketUrl}}})", + "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} (#{{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [#{{ticketId}}]({{{ticketUrl}}})", "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}}" diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 90d4f8793..64fabd522 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -124,7 +124,7 @@ "MESSAGE_BOUGHT_UNITS": "Se ha comprado {{quantity}} unidades de {{concept}} (#{{itemId}}) para el ticket id [#{{ticketId}}]({{{url}}})", "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} (#{{clientId}})]({{{url}}}) a *{{credit}} €*", "MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} (#{{clientId}})]({{{url}}})", - "MESSAGE_CLAIM_ITEM_REGULARIZE": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a {{nickname}} provenientes del ticket id [#{{ticketId}}]({{{ticketUrl}}})", + "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [#{{ticketId}}]({{{ticketUrl}}})", "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" } \ No newline at end of file diff --git a/modules/claim/back/methods/claim/regularizeClaim.js b/modules/claim/back/methods/claim/regularizeClaim.js index 8a4f6dc95..adf1623c6 100644 --- a/modules/claim/back/methods/claim/regularizeClaim.js +++ b/modules/claim/back/methods/claim/regularizeClaim.js @@ -37,27 +37,43 @@ module.exports = Self => { for (let i = 0; i < claimEnds.length; i++) { const claimEnd = claimEnds[i]; const destination = claimEnd.claimDestination(); - const addressFk = destination && destination.addressFk; + const sale = await getSale(claimEnd.saleFk, options); + const addressId = destination && destination.addressFk; - if (!addressFk) continue; + let address; + if (addressId) + address = await models.Address.findById(addressId, null, options); + + const salesPerson = sale.ticket().client().salesPerson(); + if (salesPerson) { + const nickname = address && address.nickname || destination.description; + const origin = ctx.req.headers.origin; + const message = $t('Sent units from ticket', { + quantity: sale.quantity, + concept: sale.concept, + itemId: sale.itemFk, + ticketId: sale.ticketFk, + nickname: nickname, + ticketUrl: `${origin}/#!/ticket/${sale.ticketFk}/summary`, + itemUrl: `${origin}/#!/item/${sale.itemFk}/summary` + }); + await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message); + } + + if (!address) continue; - let sale = await getSale(claimEnd.saleFk, options); let ticketFk = await getTicketId({ - addressFk: addressFk, + addressFk: addressId, companyFk: sale.ticket().companyFk, warehouseFk: sale.ticket().warehouseFk }, options); - let address = await models.Address.findOne({ - where: {id: addressFk} - }, options); - if (!ticketFk) { ticketFk = await createTicket(ctx, { clientId: address.clientFk, warehouseId: sale.ticket().warehouseFk, companyId: sale.ticket().companyFk, - addressId: addressFk + addressId: addressId }, options); } @@ -69,21 +85,6 @@ module.exports = Self => { price: sale.price, discount: 100 }, options); - - const salesPerson = sale.ticket().client().salesPerson(); - if (salesPerson) { - const origin = ctx.req.headers.origin; - const message = $t('MESSAGE_CLAIM_ITEM_REGULARIZE', { - quantity: sale.quantity, - concept: sale.concept, - itemId: sale.itemFk, - ticketId: sale.ticketFk, - nickname: address.nickname, - ticketUrl: `${origin}/#!/ticket/${sale.ticketFk}/summary`, - itemUrl: `${origin}/#!/item/${sale.itemFk}/summary` - }); - await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message); - } } let claim = await Self.findById(params.claimFk, null, options); From be07e33e5f65af733eec711c3578845066f45b93 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 13 Feb 2020 14:39:33 +0100 Subject: [PATCH 75/95] updated unit test --- .../claim/specs/regularizeClaim.spec.js | 44 ++++++++++++++++--- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index fd3fb3c3d..96f2c8172 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -describe('regularizeClaim()', () => { +fdescribe('regularizeClaim()', () => { const claimFk = 1; const pendentState = 1; const resolvedState = 3; @@ -21,15 +21,20 @@ describe('regularizeClaim()', () => { done(); }); - it('should change claim state to resolved', async() => { - const ctx = {req: { - accessToken: {userId: 18}, - headers: {origin: 'http://localhost'}} + it('should send a chat message with value "Trash" and then change claim state to resolved', async() => { + const ctx = { + req: { + accessToken: {userId: 18}, + headers: {origin: 'http://localhost'} + } }; - ctx.req.__ = value => { - return value; + ctx.req.__ = (value, params) => { + return params.nickname; }; + let params = {claimFk: claimFk}; + const chatModel = app.models.Chat; + spyOn(chatModel, 'sendCheckingPresence').and.callThrough(); claimEnds = await app.models.ClaimEnd.importTicketSales(ctx, { claimFk: claimFk, @@ -49,5 +54,30 @@ describe('regularizeClaim()', () => { expect(trashTicket.addressFk).toEqual(trashAddress); expect(claimBefore.claimStateFk).toEqual(pendentState); expect(claimAfter.claimStateFk).toEqual(resolvedState); + expect(chatModel.sendCheckingPresence).toHaveBeenCalledWith(ctx, 18, 'Trash'); + }); + + it('should send a chat message with value "Bueno" and then change claim state to resolved', async() => { + const ctx = { + req: { + accessToken: {userId: 18}, + headers: {origin: 'http://localhost'} + } + }; + ctx.req.__ = (value, params) => { + return params.nickname; + }; + + let params = {claimFk: claimFk}; + const chatModel = app.models.Chat; + spyOn(chatModel, 'sendCheckingPresence').and.callThrough(); + + claimEnds.forEach(async claimEnd => { + claimEnd.updateAttributes({claimDestinationFk: 1}); + }); + + await app.models.Claim.regularizeClaim(ctx, params); + + expect(chatModel.sendCheckingPresence).toHaveBeenCalledWith(ctx, 18, 'Bueno'); }); }); From 5360c407d58ec008a6309560424172c05b231e20 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 13 Feb 2020 14:46:18 +0100 Subject: [PATCH 76/95] updated unit test --- .../claim/back/methods/claim/specs/regularizeClaim.spec.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index 96f2c8172..c2be4379d 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -5,6 +5,7 @@ fdescribe('regularizeClaim()', () => { const pendentState = 1; const resolvedState = 3; const trashDestination = 2; + const okDestination = 1; const trashAddress = 12; let claimEnds = []; let trashTicket; @@ -55,6 +56,7 @@ fdescribe('regularizeClaim()', () => { expect(claimBefore.claimStateFk).toEqual(pendentState); expect(claimAfter.claimStateFk).toEqual(resolvedState); expect(chatModel.sendCheckingPresence).toHaveBeenCalledWith(ctx, 18, 'Trash'); + expect(chatModel.sendCheckingPresence).toHaveBeenCalledTimes(4); }); it('should send a chat message with value "Bueno" and then change claim state to resolved', async() => { @@ -73,11 +75,12 @@ fdescribe('regularizeClaim()', () => { spyOn(chatModel, 'sendCheckingPresence').and.callThrough(); claimEnds.forEach(async claimEnd => { - claimEnd.updateAttributes({claimDestinationFk: 1}); + claimEnd.updateAttributes({claimDestinationFk: okDestination}); }); await app.models.Claim.regularizeClaim(ctx, params); expect(chatModel.sendCheckingPresence).toHaveBeenCalledWith(ctx, 18, 'Bueno'); + expect(chatModel.sendCheckingPresence).toHaveBeenCalledTimes(4); }); }); From fd45c41210a4049ed50b9fcc35a399e26336044b Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 13 Feb 2020 15:01:24 +0100 Subject: [PATCH 77/95] removed focus --- modules/claim/back/methods/claim/specs/regularizeClaim.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index c2be4379d..c7aa1cf0a 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -fdescribe('regularizeClaim()', () => { +describe('regularizeClaim()', () => { const claimFk = 1; const pendentState = 1; const resolvedState = 3; From bba6c9be15a23b1e091d9e8ee89a474e670fa011 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 14 Feb 2020 07:53:13 +0100 Subject: [PATCH 78/95] Return response when the sender equals recipient --- back/methods/chat/send.js | 2 ++ back/methods/chat/spec/send.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js index b0a9431c7..53e5da7cc 100644 --- a/back/methods/chat/send.js +++ b/back/methods/chat/send.js @@ -32,6 +32,8 @@ module.exports = Self => { if (sender.name != recipient) return sendMessage(sender, to, message); + + return false; }; async function sendMessage(sender, channel, message) { diff --git a/back/methods/chat/spec/send.spec.js b/back/methods/chat/spec/send.spec.js index b2585a9a1..56f2a9c27 100644 --- a/back/methods/chat/spec/send.spec.js +++ b/back/methods/chat/spec/send.spec.js @@ -9,10 +9,10 @@ describe('chat send()', () => { expect(response.message).toEqual('Fake notification sent'); }); - it('should not return a response', async() => { + it('should retrun false as response', async() => { let ctx = {req: {accessToken: {userId: 18}}}; let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something'); - expect(response).toBeUndefined(); + expect(response).toBeFalsy(); }); }); From 84bf95db1325b811dd489b59568ccd397a05bc9b Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 14 Feb 2020 12:01:17 +0100 Subject: [PATCH 79/95] 2106 - Sms max length fix --- modules/client/front/sms/index.html | 13 ++++++++++--- modules/client/front/sms/index.js | 11 ++++++----- modules/client/front/sms/index.spec.js | 12 ++++++++---- modules/client/front/sms/locale/es.yml | 4 +++- modules/ticket/front/sms/index.html | 11 +++++++++-- modules/ticket/front/sms/index.js | 11 ++++++----- modules/ticket/front/sms/index.spec.js | 12 ++++++++---- modules/ticket/front/sms/locale/es.yml | 4 +++- 8 files changed, 53 insertions(+), 25 deletions(-) diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index facbb7694..fb2f1dfff 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -13,20 +13,27 @@ rule> - + - {{'Characters remaining' | translate}}: {{$ctrl.charactersRemaining()}} + {{'Characters remaining' | translate}}: + + {{$ctrl.charactersRemaining()}} + diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js index 851ce1a66..c7d89e717 100644 --- a/modules/client/front/sms/index.js +++ b/modules/client/front/sms/index.js @@ -17,13 +17,12 @@ class Controller extends Component { } charactersRemaining() { - let elementMaxLength; - let textAreaLength; const element = this.$scope.message; + const value = element.input.value; - textAreaLength = element.input.textLength; - elementMaxLength = element.maxlength; - return elementMaxLength - textAreaLength; + const maxLength = 160; + const textAreaLength = new Blob([value]).size; + return maxLength - textAreaLength; } onResponse(response) { @@ -33,6 +32,8 @@ class Controller extends Component { throw new Error(`The destination can't be empty`); if (!this.sms.message) throw new Error(`The message can't be empty`); + if (this.charactersRemaining() < 0) + throw new Error(`The message it's too long`); this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => { this.vnApp.showMessage(this.$translate.instant('SMS sent!')); diff --git a/modules/client/front/sms/index.spec.js b/modules/client/front/sms/index.spec.js index 26a597c17..03d9cbf1d 100644 --- a/modules/client/front/sms/index.spec.js +++ b/modules/client/front/sms/index.spec.js @@ -15,6 +15,11 @@ describe('Client', () => { controller = $componentController('vnClientSms', {$element, $scope}); controller.client = {id: 101}; controller.$params = {id: 101}; + controller.$scope.message = { + input: { + value: 'My SMS' + } + }; })); describe('onResponse()', () => { @@ -56,14 +61,13 @@ describe('Client', () => { it('should return the characters remaining in a element', () => { controller.$scope.message = { input: { - textLength: 50 - }, - maxlength: 150 + value: 'My message 0€' + } }; let result = controller.charactersRemaining(); - expect(result).toEqual(100); + expect(result).toEqual(145); }); }); }); diff --git a/modules/client/front/sms/locale/es.yml b/modules/client/front/sms/locale/es.yml index 4438e4fce..64c3fcca6 100644 --- a/modules/client/front/sms/locale/es.yml +++ b/modules/client/front/sms/locale/es.yml @@ -4,4 +4,6 @@ Message: Mensaje SMS sent!: ¡SMS enviado! Characters remaining: Carácteres restantes The destination can't be empty: El destinatario no puede estar vacio -The message can't be empty: El mensaje no puede estar vacio \ No newline at end of file +The message can't be empty: El mensaje no puede estar vacio +The message it's too long: El mensaje es demasiado largo +Special characters like accents counts as a multiple: Carácteres especiales como los acentos cuentan como varios \ No newline at end of file diff --git a/modules/ticket/front/sms/index.html b/modules/ticket/front/sms/index.html index f74bc29e5..2003aa4fd 100644 --- a/modules/ticket/front/sms/index.html +++ b/modules/ticket/front/sms/index.html @@ -18,15 +18,22 @@ vn-id="message" label="Message" ng-model="$ctrl.sms.message" + info="Special characters like accents counts as a multiple" rows="5" - maxlength="160" required="true" rule> - {{'Characters remaining' | translate}}: {{$ctrl.charactersRemaining()}} + {{'Characters remaining' | translate}}: + + {{$ctrl.charactersRemaining()}} + diff --git a/modules/ticket/front/sms/index.js b/modules/ticket/front/sms/index.js index 0d639d46e..ac1131513 100644 --- a/modules/ticket/front/sms/index.js +++ b/modules/ticket/front/sms/index.js @@ -17,13 +17,12 @@ class Controller extends Component { } charactersRemaining() { - let elementMaxLength; - let textAreaLength; const element = this.$scope.message; + const value = element.input.value; - textAreaLength = element.input.textLength; - elementMaxLength = element.maxlength; - return elementMaxLength - textAreaLength; + const maxLength = 160; + const textAreaLength = new Blob([value]).size; + return maxLength - textAreaLength; } onResponse(response) { @@ -33,6 +32,8 @@ class Controller extends Component { throw new Error(`The destination can't be empty`); if (!this.sms.message) throw new Error(`The message can't be empty`); + if (this.charactersRemaining() < 0) + throw new Error(`The message it's too long`); this.$http.post(`Tickets/${this.$params.id}/sendSms`, this.sms).then(res => { this.vnApp.showMessage(this.$translate.instant('SMS sent!')); diff --git a/modules/ticket/front/sms/index.spec.js b/modules/ticket/front/sms/index.spec.js index d02b3f3eb..96c10edd1 100644 --- a/modules/ticket/front/sms/index.spec.js +++ b/modules/ticket/front/sms/index.spec.js @@ -14,6 +14,11 @@ describe('Ticket', () => { $element = angular.element(''); controller = $componentController('vnTicketSms', {$element, $scope}); controller.$params = {id: 11}; + controller.$scope.message = { + input: { + value: 'My SMS' + } + }; })); describe('onResponse()', () => { @@ -55,14 +60,13 @@ describe('Ticket', () => { it('should return the characters remaining in a element', () => { controller.$scope.message = { input: { - textLength: 50 - }, - maxlength: 150 + value: 'My message 0€' + } }; let result = controller.charactersRemaining(); - expect(result).toEqual(100); + expect(result).toEqual(145); }); }); }); diff --git a/modules/ticket/front/sms/locale/es.yml b/modules/ticket/front/sms/locale/es.yml index 4438e4fce..64c3fcca6 100644 --- a/modules/ticket/front/sms/locale/es.yml +++ b/modules/ticket/front/sms/locale/es.yml @@ -4,4 +4,6 @@ Message: Mensaje SMS sent!: ¡SMS enviado! Characters remaining: Carácteres restantes The destination can't be empty: El destinatario no puede estar vacio -The message can't be empty: El mensaje no puede estar vacio \ No newline at end of file +The message can't be empty: El mensaje no puede estar vacio +The message it's too long: El mensaje es demasiado largo +Special characters like accents counts as a multiple: Carácteres especiales como los acentos cuentan como varios \ No newline at end of file From d9ed7cda384703c47bc0bbaa5bb746a4ace465e5 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 17 Feb 2020 07:22:55 +0100 Subject: [PATCH 80/95] Added form dialog --- modules/item/back/methods/item/getCard.js | 3 + modules/item/back/models/item.json | 112 +++++++++++----------- modules/item/front/basic-data/index.html | 46 ++++++++- modules/item/front/basic-data/index.js | 22 +++-- 4 files changed, 115 insertions(+), 68 deletions(-) diff --git a/modules/item/back/methods/item/getCard.js b/modules/item/back/methods/item/getCard.js index 9780c5601..50ff22321 100644 --- a/modules/item/back/methods/item/getCard.js +++ b/modules/item/back/methods/item/getCard.js @@ -55,6 +55,9 @@ module.exports = Self => { } }] } + }, + { + relation: 'taxClass' } ] }; diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index d8d1cb64d..dbaa3a409 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -1,13 +1,13 @@ { "name": "Item", - "base": "Loggable", - "log": { - "model":"ItemLog", + "base": "Loggable", + "log": { + "model": "ItemLog", "showField": "id" - }, + }, "options": { "mysql": { - "table": "item" + "table": "item" } }, "properties": { @@ -125,55 +125,55 @@ } }, "relations": { - "itemType": { - "type": "belongsTo", - "model": "ItemType", - "foreignKey": "typeFk" - }, - "ink": { - "type": "belongsTo", - "model": "Ink", - "foreignKey": "inkFk" - }, - "origin": { - "type": "belongsTo", - "model": "Origin", - "foreignKey": "originFk" - }, - "producer": { - "type": "belongsTo", - "model": "Producer", - "foreignKey": "producerFk" - }, - "intrastat": { - "type": "belongsTo", - "model": "Intrastat", - "foreignKey": "intrastatFk" - }, - "expense": { - "type": "belongsTo", - "model": "Expense", - "foreignKey": "expenseFk" - }, - "tags": { - "type": "hasMany", - "model": "ItemTag", - "foreignKey": "itemFk" - }, - "itemBarcode": { - "type": "hasMany", - "model": "ItemBarcode", - "foreignKey": "itemFk" - }, - "taxes": { - "type": "hasMany", - "model": "ItemTaxCountry", - "foreignKey": "itemFk" - }, - "itemNiche": { - "type": "hasMany", - "model": "ItemNiche", - "foreignKey": "itemFk" - } + "itemType": { + "type": "belongsTo", + "model": "ItemType", + "foreignKey": "typeFk" + }, + "ink": { + "type": "belongsTo", + "model": "Ink", + "foreignKey": "inkFk" + }, + "origin": { + "type": "belongsTo", + "model": "Origin", + "foreignKey": "originFk" + }, + "producer": { + "type": "belongsTo", + "model": "Producer", + "foreignKey": "producerFk" + }, + "intrastat": { + "type": "belongsTo", + "model": "Intrastat", + "foreignKey": "intrastatFk" + }, + "expense": { + "type": "belongsTo", + "model": "Expense", + "foreignKey": "expenseFk" + }, + "tags": { + "type": "hasMany", + "model": "ItemTag", + "foreignKey": "itemFk" + }, + "itemBarcode": { + "type": "hasMany", + "model": "ItemBarcode", + "foreignKey": "itemFk" + }, + "taxes": { + "type": "hasMany", + "model": "ItemTaxCountry", + "foreignKey": "itemFk" + }, + "itemNiche": { + "type": "hasMany", + "model": "ItemNiche", + "foreignKey": "itemFk" + } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index bd0cec86d..16d37ff04 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -55,6 +55,13 @@
{{::id}}
{{::description}}
+ + + + - + @@ -134,3 +141,38 @@ + + + + +
New intrastat
+ + + + + + + + + + +
+ + + + +
\ No newline at end of file diff --git a/modules/item/front/basic-data/index.js b/modules/item/front/basic-data/index.js index 123aa59cd..3c3d62c74 100644 --- a/modules/item/front/basic-data/index.js +++ b/modules/item/front/basic-data/index.js @@ -1,20 +1,22 @@ import ngModule from '../module'; +import Component from 'core/lib/component'; +class Controller extends Component { + showIntrastat(event) { + if (event.defaultPrevented) return; + event.preventDefault(); -class Controller { - constructor($scope, $timeout) { - this.$scope = $scope; - this.$timeout = $timeout; + this.newIntrastat = { + taxClassFk: this.item.taxClassFk + }; + this.$.intrastat.show(); } - $onChanges(data) { - this.$timeout(() => { - this.$scope.watcher.data = data.item.currentValue; - }); + onCustomAgentAccept() { + return this.$http.post(`CustomsAgents`, this.newCustomsAgent) + .then(res => this.address.customsAgentFk = res.data.id); } } -Controller.$inject = ['$scope', '$timeout']; - ngModule.component('vnItemBasicData', { template: require('./index.html'), bindings: { From 578556b1d553403d16ac679bc777275ba54d9e5e Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 17 Feb 2020 08:38:19 +0100 Subject: [PATCH 81/95] 2121 - Client balance fix balance on pagination --- modules/client/front/balance/index/index.html | 6 +-- modules/client/front/balance/index/index.js | 13 +++++- .../client/front/balance/index/index.spec.js | 43 +++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html index f42998bbd..8cdb5c971 100644 --- a/modules/client/front/balance/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -85,9 +85,9 @@
{{::balance.bankFk}} - {{::balance.debit | currency: 'EUR':2}} - {{::balance.credit | currency: 'EUR':2}} - {{balance.balance | currency: 'EUR':2}} + {{::balance.debit | currency: 'EUR':2}} + {{::balance.credit | currency: 'EUR':2}} + {{balance.balance | currency: 'EUR':2}} { expect(expectedBalances[2].balance).toEqual(213.24); }); }); + + describe('balances() setter', () => { + it('should set the balances data and not call the getBalances() method', () => { + spyOn(controller, 'getBalances'); + controller.$.riskModel.data = null; + controller.balances = [{ + id: 1, + debit: 1000, + credit: null + }, { + id: 2, + debit: null, + credit: 500 + }, { + id: 3, + debit: null, + credit: 300 + }]; + + expect(controller.balances).toBeDefined(); + expect(controller.getBalances).not.toHaveBeenCalledWith(); + }); + + it('should set the balances data and then call the getBalances() method', () => { + spyOn(controller, 'getBalances'); + controller.balances = [{ + id: 1, + debit: 1000, + credit: null + }, { + id: 2, + debit: null, + credit: 500 + }, { + id: 3, + debit: null, + credit: 300 + }]; + + expect(controller.balances).toBeDefined(); + expect(controller.getBalances).toHaveBeenCalledWith(); + }); + }); }); }); From 03f0a415f9f0c79cbc217ed8925f73b531c2cb83 Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 17 Feb 2020 12:01:11 +0100 Subject: [PATCH 82/95] zoneClosure fase 2 --- db/changes/10141-zoneDoCalc/00-ticket.sql | 4 +- .../01-zoneClosure_recalc.sql | 1 - .../10141-zoneDoCalc/02-insertPastTickets.sql | 62 +++++++ .../03-getOptionsForLanding.sql | 66 +++++++ .../10141-zoneDoCalc/03-rutasAnalyze.sql | 171 ++++++++++++++++++ db/changes/10141-zoneDoCalc/03-saleVolume.sql | 26 +++ .../10141-zoneDoCalc/03-viewSaleFreight__.sql | 24 +++ .../03-zone_geShippedWarehouse.sql | 41 +++++ .../10141-zoneDoCalc/03-zone_getAgency.sql | 42 +++++ .../10141-zoneDoCalc/03-zone_getAvailable.sql | 18 ++ .../10141-zoneDoCalc/03-zone_getWarehouse.sql | 41 +++++ 11 files changed, 493 insertions(+), 3 deletions(-) delete mode 100644 db/changes/10141-zoneDoCalc/01-zoneClosure_recalc.sql create mode 100644 db/changes/10141-zoneDoCalc/02-insertPastTickets.sql create mode 100644 db/changes/10141-zoneDoCalc/03-getOptionsForLanding.sql create mode 100644 db/changes/10141-zoneDoCalc/03-rutasAnalyze.sql create mode 100644 db/changes/10141-zoneDoCalc/03-saleVolume.sql create mode 100644 db/changes/10141-zoneDoCalc/03-viewSaleFreight__.sql create mode 100644 db/changes/10141-zoneDoCalc/03-zone_geShippedWarehouse.sql create mode 100644 db/changes/10141-zoneDoCalc/03-zone_getAgency.sql create mode 100644 db/changes/10141-zoneDoCalc/03-zone_getAvailable.sql create mode 100644 db/changes/10141-zoneDoCalc/03-zone_getWarehouse.sql diff --git a/db/changes/10141-zoneDoCalc/00-ticket.sql b/db/changes/10141-zoneDoCalc/00-ticket.sql index c116e5139..a756a11af 100644 --- a/db/changes/10141-zoneDoCalc/00-ticket.sql +++ b/db/changes/10141-zoneDoCalc/00-ticket.sql @@ -3,9 +3,9 @@ ADD COLUMN `zonePrice` DECIMAL(10,2) NULL DEFAULT NULL AFTER `collectionFk`, ADD COLUMN `zoneBonus` DECIMAL(10,2) NULL DEFAULT NULL AFTER `zonePrice`, ADD COLUMN `zoneClosure` TIME NULL AFTER `zoneBonus`; -CREATE TABLE vn.`zoneCalcTicket` ( +CREATE TABLE `vn`.`zoneCalcTicket` ( `zoneFk` int(11) NOT NULL PRIMARY KEY, - CONSTRAINT `zoneCalcTicketfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `zoneCalcTicketfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `vn`.`zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; DROP EVENT IF EXISTS vn.`zone_doCalc`; diff --git a/db/changes/10141-zoneDoCalc/01-zoneClosure_recalc.sql b/db/changes/10141-zoneDoCalc/01-zoneClosure_recalc.sql deleted file mode 100644 index f015eb894..000000000 --- a/db/changes/10141-zoneDoCalc/01-zoneClosure_recalc.sql +++ /dev/null @@ -1 +0,0 @@ -USE `vn`; diff --git a/db/changes/10141-zoneDoCalc/02-insertPastTickets.sql b/db/changes/10141-zoneDoCalc/02-insertPastTickets.sql new file mode 100644 index 000000000..4314e5d7d --- /dev/null +++ b/db/changes/10141-zoneDoCalc/02-insertPastTickets.sql @@ -0,0 +1,62 @@ +USE `vn`; +DROP procedure IF EXISTS `zone_doCalcInitialize`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `zone_doCalcInitialize`() +proc: BEGIN +/** + * Initialize ticket + */ + DECLARE vDone BOOL; + DECLARE vTicketFk INT; + DECLARE vLanded DATE; + DECLARE vZoneFk INT; + + DECLARE cCur CURSOR FOR + SELECT t.id, t.landed, t.zoneFk + FROM ticket t + WHERE (zonePrice IS NULL OR zoneBonus IS NULL OR zoneClosure IS NULL) + AND landed >= '2019-01-01' AND shipped >= '2019-01-01' + GROUP BY landed, zoneFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + OPEN cCur; + + myLoop: LOOP + SET vDone = FALSE; + FETCH cCur INTO vTicketFk, vLanded, vZoneFk; + + IF vDone THEN + LEAVE myLoop; + END IF; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE tmp.zone + (INDEX (id)) + ENGINE = MEMORY + SELECT vZoneFk id; + + CALL zone_getOptionsForLanding(vLanded, TRUE); + + UPDATE ticket t + LEFT JOIN tmp.zoneOption zo ON TRUE + SET zonePrice = zo.price, zoneBonus = zo.bonus, zoneClosure = zo.`hour` + WHERE t.zoneFk = vZoneFk AND landed = vLanded; + + UPDATE ticket t + LEFT JOIN vn.zone z ON z.id = t.zoneFk + SET zonePrice = z.price, zoneBonus = z.bonus, zoneClosure = z.`hour` + WHERE t.zonePrice IS NULL AND z.id = vZoneFk + AND landed >= '2019-01-01' AND shipped >= '2019-01-01'; + + END LOOP; + + CLOSE cCur; + + DELETE FROM zoneCalcTicket; +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/db/changes/10141-zoneDoCalc/03-getOptionsForLanding.sql b/db/changes/10141-zoneDoCalc/03-getOptionsForLanding.sql new file mode 100644 index 000000000..e0f5f9a48 --- /dev/null +++ b/db/changes/10141-zoneDoCalc/03-getOptionsForLanding.sql @@ -0,0 +1,66 @@ +USE `vn`; +DROP procedure IF EXISTS `zone_getOptionsForLanding`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `zone_getOptionsForLanding`(vLanded DATE, vShowExpiredZones BOOLEAN) +BEGIN +/** + * Gets computed options for the passed zones and delivery date. + * + * @table tmp.zones(id) The zones ids + * @param vLanded The delivery date + * @return tmp.zoneOption The computed options + */ + DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; + CREATE TEMPORARY TABLE tmp.zoneOption + ENGINE = MEMORY + SELECT + zoneFk, + `hour`, + travelingDays, + price, + bonus, + TIMESTAMPADD(DAY, -travelingDays, vLanded) shipped + FROM ( + SELECT t.id zoneFk, + TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, + IFNULL(e.travelingDays, z.travelingDays) travelingDays, + IFNULL(e.price, z.price) price, + IFNULL(e.bonus, z.bonus) bonus + FROM tmp.zone t + JOIN zone z ON z.id = t.id + JOIN zoneEvent e ON e.zoneFk = t.id + WHERE ( + e.`type` = 'day' + AND e.dated = vLanded + ) OR ( + e.`type` != 'day' + AND e.weekDays & (1 << WEEKDAY(vLanded)) + AND (e.`started` IS NULL OR vLanded >= e.`started`) + AND (e.`ended` IS NULL OR vLanded <= e.`ended`) + ) + ORDER BY + zoneFk, + CASE + WHEN e.`type` = 'day' + THEN 1 + WHEN e.`type` = 'range' + THEN 2 + ELSE 3 + END + ) t + GROUP BY zoneFk; + + DELETE t FROM tmp.zoneOption t + JOIN zoneExclusion e + ON e.zoneFk = t.zoneFk AND e.`dated` = vLanded; + + IF NOT vShowExpiredZones THEN + DELETE FROM tmp.zoneOption + WHERE shipped < CURDATE() + OR (shipped = CURDATE() AND CURTIME() > `hour`); + END IF; +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/db/changes/10141-zoneDoCalc/03-rutasAnalyze.sql b/db/changes/10141-zoneDoCalc/03-rutasAnalyze.sql new file mode 100644 index 000000000..313f2f797 --- /dev/null +++ b/db/changes/10141-zoneDoCalc/03-rutasAnalyze.sql @@ -0,0 +1,171 @@ +USE `vn`; +DROP procedure IF EXISTS `rutasAnalyze`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `rutasAnalyze`(vYear INT, vMonth INT) +BEGIN + +/* Analiza los costes de las rutas de reparto y lo almacena en la tabla Rutas_Master +* +* PAK 15/4/2019 +*/ + + DELETE FROM bi.rutasBoard + WHERE year = vYear AND month = vMonth; + + -- Rellenamos la tabla con los datos de las rutas VOLUMETRICAS, especialmente con los bultos "virtuales" + INSERT INTO bi.rutasBoard(year, + month, + warehouse_id, + Id_Ruta, + Id_Agencia, + km, + Dia, + Fecha, + Bultos, + Matricula, + Tipo, + Terceros) + SELECT YEAR(r.created), + MONTH(r.created), + GREATEST(1,a.warehouseFk), + r.id, + r.agencyModeFk, + r.kmEnd - r.kmStart, + DAYNAME(r.created), + r.created, + SUM(sv.volume / ebv.m3), + v.numberPlate, + IF(ISNULL(`r`.`cost`), 'P', 'A'), + r.cost + FROM vn.route r + JOIN vn.ticket t ON t.routeFk = r.id + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN vn.agency a ON a.id = am.agencyFk + LEFT JOIN vn.vehicle v ON v.id = r.vehicleFk + JOIN vn.saleVolume sv ON sv.ticketFk = t.id + JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = 71 + WHERE YEAR(r.created) = vYear AND MONTH(r.created) = vMonth + AND z.isVolumetric + GROUP BY r.id; + + -- Rellenamos la tabla con los datos de las rutas NO VOLUMETRICAS, especialmente con los bultos "virtuales" + INSERT INTO bi.rutasBoard(year, + month, + warehouse_id, + Id_Ruta, + Id_Agencia, + km, + Dia, + Fecha, + Bultos, + Matricula, + Tipo, + Terceros) + SELECT YEAR(r.created), + MONTH(r.created), + GREATEST(1,a.warehouseFk), + r.id, + r.agencyModeFk, + r.kmEnd - r.kmStart, + DAYNAME(r.created), + r.created, + SUM(t.packages), + v.numberPlate, + IF(ISNULL(`r`.`cost`), 'P', 'A'), + r.cost + FROM vn.route r + JOIN vn.ticket t ON t.routeFk = r.id + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN vn.agency a ON a.id = am.agencyFk + LEFT JOIN vn.vehicle v ON v.id = r.vehicleFk + WHERE YEAR(r.created) = vYear AND MONTH(r.created) = vMonth + AND z.isVolumetric = FALSE + GROUP BY r.id + ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos); + + -- Coste REAL de cada bulto "virtual", de acuerdo con el valor apuntado a mano en la ruta + UPDATE bi.rutasBoard r + INNER JOIN vn2008.Rutas_Master rm ON rm.año = r.year AND rm.mes = r.month AND rm.warehouse_id = r.warehouse_id + SET r.coste_bulto = IF(r.Tipo ='A', r.Terceros, r.km * rm.coste_km ) / r.Bultos + WHERE r.Bultos > 0 + AND rm.año = vYear + AND rm.mes = vMonth; + + -- Coste PRACTICO de cada bulto, de acuerdo con los componentes de tipo AGENCIA en cada linea de venta + UPDATE bi.rutasBoard r + JOIN ( + SELECT t.routeFk, sum(s.quantity * sc.value) practicoTotal + FROM vn.route r + JOIN vn.time tm ON tm.dated = r.created + JOIN vn.ticket t ON t.routeFk = r.id + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.saleComponent sc ON sc.saleFk = s.id + JOIN vn.`component` c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + WHERE ct.type = 'agencia' + AND tm.year = vYear + AND tm.month = vMonth + GROUP BY r.id + ) sub ON sub.routeFk = r.Id_Ruta + SET r.practico = sub.practicoTotal / r.Bultos; + + -- Coste TEORICO de una caja "virtual" para cada ruta, teniendo en cuenta que hay carros, pallets, etc + UPDATE bi.rutasBoard r + JOIN ( + SELECT t.routeFk, + SUM(t.zonePrice/ ebv.ratio)/ count(*) AS BultoTeoricoMedio + FROM vn.ticket t + JOIN vn.route r ON r.id = t.routeFk + JOIN vn.time tm ON tm.dated = r.created + JOIN vn.expedition e ON e.ticketFk = t.id + JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.isBox + JOIN vn.address ad ON ad.id = t.addressFk + JOIN vn.client c ON c.id = ad.clientFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + WHERE tm.year = vYear + AND tm.month = vMonth + AND z.isVolumetric = FALSE + GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk + SET r.teorico = sub.BultoTeoricoMedio; + + -- Coste VOLUMETRICO TEORICO de una caja "virtual" para cada ruta + UPDATE bi.rutasBoard r + JOIN ( + SELECT t.routeFk, + SUM(freight) AS BultoTeoricoMedio + FROM vn.ticket t + JOIN vn.route r ON r.id = t.routeFk + JOIN vn.time tm ON tm.dated = r.created + JOIN vn.saleVolume sf ON sf.ticketFk = t.id + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.zone z ON z.id = t.zoneFk + WHERE tm.year = vYear + AND tm.month = vMonth + AND z.isVolumetric != FALSE + GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk + SET r.teorico = sub.BultoTeoricoMedio / r.Bultos; + + -- La diferencia entre el teorico y el practico se deberia de cobrar en greuges, cada noche + UPDATE bi.rutasBoard r + JOIN ( + SELECT t.routeFk, + Sum(g.amount) AS greuge + FROM vn.ticket t + JOIN vn.route r ON r.id = t.routeFk + JOIN vn.time tm ON tm.dated = r.created + JOIN vn.greuge g ON g.ticketFk = t.id + JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk + WHERE tm.year = vYear + AND tm.month = vMonth + AND gt.name = 'Diferencia portes' + GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk + SET r.greuge = sub.greuge / r.Bultos; + +END$$ + +DELIMITER ; + diff --git a/db/changes/10141-zoneDoCalc/03-saleVolume.sql b/db/changes/10141-zoneDoCalc/03-saleVolume.sql new file mode 100644 index 000000000..2ded49a8d --- /dev/null +++ b/db/changes/10141-zoneDoCalc/03-saleVolume.sql @@ -0,0 +1,26 @@ +USE `vn`; +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `saleVolume` AS + SELECT + `s`.`ticketFk` AS `ticketFk`, + `s`.`id` AS `saleFk`, + IFNULL(ROUND(((((`i`.`compression` * (GREATEST(`i`.`density`, 167) / 167)) * `ic`.`cm3`) * `s`.`quantity`) / 1000), + 2), + 0) AS `litros`, + `t`.`routeFk` AS `routeFk`, + `t`.`shipped` AS `shipped`, + (((`s`.`quantity` * `ic`.`cm3`) * `i`.`compression`) / 1000000) AS `volume`, + ((((`s`.`quantity` * `ic`.`cm3`) * `i`.`compression`) * (GREATEST(`i`.`density`, 167) / 167)) / 1000000) AS `physicalWeight`, + (((`s`.`quantity` * `ic`.`cm3`) * `i`.`density`) / 1000000) AS `weight`, + (((`s`.`quantity` * `ic`.`cm3`) * `i`.`compression`) / 1000000) AS `physicalVolume`, + ((((`s`.`quantity` * `ic`.`cm3`) * `t`.`zonePrice`) * `i`.`compression`) / `cb`.`volume`) AS `freight` + FROM + ((((`sale` `s` + JOIN `item` `i` ON ((`i`.`id` = `s`.`itemFk`))) + JOIN `ticket` `t` ON ((`t`.`id` = `s`.`ticketFk`))) + JOIN `packaging` `cb` ON ((`cb`.`id` = '94'))) + JOIN `itemCost` `ic` ON (((`ic`.`itemFk` = `s`.`itemFk`) + AND (`ic`.`warehouseFk` = `t`.`warehouseFk`)))); diff --git a/db/changes/10141-zoneDoCalc/03-viewSaleFreight__.sql b/db/changes/10141-zoneDoCalc/03-viewSaleFreight__.sql new file mode 100644 index 000000000..903c8b48a --- /dev/null +++ b/db/changes/10141-zoneDoCalc/03-viewSaleFreight__.sql @@ -0,0 +1,24 @@ +DROP VIEW IF EXISTS `vn`.`saleFreight` ; +USE `vn`; +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `saleFreight__` AS + SELECT + `s`.`ticketFk` AS `ticketFk`, + `t`.`clientFk` AS `clientFk`, + `t`.`routeFk` AS `routeFk`, + `s`.`id` AS `saleFk`, + `t`.`zoneFk` AS `zoneFk`, + `t`.`companyFk` AS `companyFk`, + `t`.`shipped` AS `shipped`, + `t`.`zonePrice` AS `price`, + ((((`s`.`quantity` * `r`.`cm3`) * `t`.`zonePrice`) * `i`.`compression`) / `cb`.`volume`) AS `freight` + FROM + ((((`vn`.`sale` `s` + JOIN `vn`.`item` `i` ON ((`i`.`id` = `s`.`itemFk`))) + JOIN `vn`.`ticket` `t` ON ((`t`.`id` = `s`.`ticketFk`))) + JOIN `vn`.`packaging` `cb` ON ((`cb`.`id` = '94'))) + JOIN `bi`.`rotacion` `r` ON (((`r`.`Id_Article` = `s`.`itemFk`) + AND (`r`.`warehouse_id` = `t`.`warehouseFk`)))); diff --git a/db/changes/10141-zoneDoCalc/03-zone_geShippedWarehouse.sql b/db/changes/10141-zoneDoCalc/03-zone_geShippedWarehouse.sql new file mode 100644 index 000000000..14d5d8cd9 --- /dev/null +++ b/db/changes/10141-zoneDoCalc/03-zone_geShippedWarehouse.sql @@ -0,0 +1,41 @@ +USE `vn`; +DROP procedure IF EXISTS `zone_getShippedWarehouse`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `zone_getShippedWarehouse`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT) +BEGIN +/** + * Devuelve la mínima fecha de envío para cada warehouse + * + * @param vLanded La fecha de recepcion + * @param vAddressFk Id del consignatario + * @param vAgencyModeFk Id de la agencia + * @return tmp.zoneGetShipped + */ + + CALL zone_getFromGeo(address_getGeo(vAddressFk)); + CALL zone_getOptionsForLanding(vLanded,TRUE); + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetShipped; + CREATE TEMPORARY TABLE tmp.zoneGetShipped + ENGINE = MEMORY + SELECT * FROM ( + SELECT zo.zoneFk, + TIMESTAMPADD(DAY,-zo.travelingDays, vLanded) shipped, + zo.`hour`, + zw.warehouseFk, + z.agencyModeFk + FROM tmp.zoneOption zo + JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk + JOIN zone z ON z.id = zo.zoneFk + WHERE z.agencyModeFk = vAgencyModeFk + ORDER BY shipped) t + GROUP BY warehouseFk; + + DROP TEMPORARY TABLE + tmp.zone, + tmp.zoneOption; +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/db/changes/10141-zoneDoCalc/03-zone_getAgency.sql b/db/changes/10141-zoneDoCalc/03-zone_getAgency.sql new file mode 100644 index 000000000..b2837d43c --- /dev/null +++ b/db/changes/10141-zoneDoCalc/03-zone_getAgency.sql @@ -0,0 +1,42 @@ +USE `vn`; +DROP procedure IF EXISTS `zone_getAgency`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `zone_getAgency`(vAddress INT, vLanded DATE) +BEGIN +/** + * Devuelve el listado de agencias disponibles para la fecha + * y dirección pasadas. + * + * @param vAddress Id de dirección de envío, %NULL si es recogida + * @param vLanded Fecha de recogida + * @select Listado de agencias disponibles + */ + + CALL zone_getFromGeo(address_getGeo(vAddress)); + CALL zone_getOptionsForLanding(vLanded, FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetAgency; + CREATE TEMPORARY TABLE tmp.zoneGetAgency + (INDEX (agencyModeFk)) ENGINE = MEMORY + SELECT am.name agencyMode, + am.description, + z.agencyModeFk, + am.deliveryMethodFk, + TIMESTAMPADD(DAY,-zo.travelingDays, vLanded) shipped, + TRUE isIncluded, + zo.zoneFk + FROM tmp.zoneOption zo + JOIN zone z ON z.id = zo.zoneFk + JOIN agencyMode am ON am.id = z.agencyModeFk + GROUP BY agencyModeFk; + + DROP TEMPORARY TABLE + tmp.zone, + tmp.zoneOption; + +END$$ + +DELIMITER ; + diff --git a/db/changes/10141-zoneDoCalc/03-zone_getAvailable.sql b/db/changes/10141-zoneDoCalc/03-zone_getAvailable.sql new file mode 100644 index 000000000..2ef1a1ae9 --- /dev/null +++ b/db/changes/10141-zoneDoCalc/03-zone_getAvailable.sql @@ -0,0 +1,18 @@ +USE `vn`; +DROP procedure IF EXISTS `zone_getAvailable`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `zone_getAvailable`(vAddress INT, vLanded DATE) +BEGIN + CALL zone_getFromGeo(address_getGeo(vAddress)); + CALL zone_getOptionsForLanding(vLanded, FALSE); + + SELECT * FROM tmp.zoneOption; + + DROP TEMPORARY TABLE + tmp.zone, + tmp.zoneOption; +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/db/changes/10141-zoneDoCalc/03-zone_getWarehouse.sql b/db/changes/10141-zoneDoCalc/03-zone_getWarehouse.sql new file mode 100644 index 000000000..c1cea8b13 --- /dev/null +++ b/db/changes/10141-zoneDoCalc/03-zone_getWarehouse.sql @@ -0,0 +1,41 @@ +USE `vn`; +DROP procedure IF EXISTS `zone_getWarehouse`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT) +BEGIN +/** + * Devuelve el listado de agencias disponibles para la fecha, + * dirección y almacén pasados. + * + * @param vAddress + * @param vWarehouse warehouse + * @param vLanded Fecha de recogida + * @select Listado de agencias disponibles + */ + + CALL zone_getFromGeo(address_getGeo(vAddress)); + CALL zone_getOptionsForLanding(vLanded, FALSE); + + SELECT am.id agencyModeFk, + am.name agencyMode, + am.description, + am.deliveryMethodFk, + TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped, + zw.warehouseFk, + z.id zoneFk + FROM tmp.zoneOption zo + JOIN zone z ON z.id = zo.zoneFk + JOIN agencyMode am ON am.id = z.agencyModeFk + JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk + WHERE zw.warehouseFk + GROUP BY z.agencyModeFk + ORDER BY agencyMode; + + DROP TEMPORARY TABLE + tmp.zone, + tmp.zoneOption; +END$$ + +DELIMITER ; \ No newline at end of file From 844b27acb9511c5400f094640a47388c78104111 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 17 Feb 2020 12:47:03 +0100 Subject: [PATCH 83/95] 2118 - Create new intrastat --- db/changes/10160-postValentineDay/00-ACL.sql | 2 + .../00-taxClassCode.sql | 23 +++++++ db/dump/fixtures.sql | 8 ++- e2e/helpers/selectors.js | 4 ++ e2e/paths/04-item/02_basic_data.spec.js | 24 +++++++- .../item/back/methods/item/createIntrastat.js | 61 +++++++++++++++++++ modules/item/back/methods/item/getCard.js | 3 - .../item/specs/createIntrastat.spec.js | 22 +++++++ modules/item/back/model-config.json | 3 + modules/item/back/models/item.js | 1 + modules/item/back/models/tax-class-code.json | 47 ++++++++++++++ .../__snapshots__/index.spec.js.snap | 3 - modules/item/front/basic-data/index.html | 18 ++---- modules/item/front/basic-data/index.js | 7 ++- 14 files changed, 201 insertions(+), 25 deletions(-) create mode 100644 db/changes/10160-postValentineDay/00-ACL.sql create mode 100644 db/changes/10160-postValentineDay/00-taxClassCode.sql create mode 100644 modules/item/back/methods/item/createIntrastat.js create mode 100644 modules/item/back/methods/item/specs/createIntrastat.spec.js create mode 100644 modules/item/back/models/tax-class-code.json delete mode 100644 modules/item/front/basic-data/__snapshots__/index.spec.js.snap diff --git a/db/changes/10160-postValentineDay/00-ACL.sql b/db/changes/10160-postValentineDay/00-ACL.sql new file mode 100644 index 000000000..5b6301e3d --- /dev/null +++ b/db/changes/10160-postValentineDay/00-ACL.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES ('Intrastat', '*', '*', 'ALLOW', 'ROLE', 'buyer'); diff --git a/db/changes/10160-postValentineDay/00-taxClassCode.sql b/db/changes/10160-postValentineDay/00-taxClassCode.sql new file mode 100644 index 000000000..bdc7cb474 --- /dev/null +++ b/db/changes/10160-postValentineDay/00-taxClassCode.sql @@ -0,0 +1,23 @@ +ALTER TABLE `vn`.`taxClassCode` +DROP FOREIGN KEY `taxClassCode_ibfk_2`, +DROP FOREIGN KEY `taxClassCode_ibfk_1`; +ALTER TABLE `vn`.`taxClassCode` +ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST, +DROP PRIMARY KEY, +ADD PRIMARY KEY (`id`), +DROP INDEX `iva_codigo_id` ; + +ALTER TABLE `vn`.`taxClassCode` +ADD UNIQUE INDEX `taxClassCode_unique` (`taxClassFk` ASC, `effectived` ASC, `taxCodeFk` ASC) VISIBLE; + +ALTER TABLE `vn`.`taxClassCode` +ADD CONSTRAINT `taxClassCode_taxClassFk` + FOREIGN KEY (`taxClassFk`) + REFERENCES `vn`.`taxClass` (`id`) + ON DELETE RESTRICT + ON UPDATE CASCADE, +ADD CONSTRAINT `taxClassCode_taxCodeFk` + FOREIGN KEY (`taxCodeFk`) + REFERENCES `vn`.`taxCode` (`id`) + ON DELETE RESTRICT + ON UPDATE CASCADE; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index f3dd36976..80bb37709 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -684,8 +684,14 @@ INSERT INTO `vn`.`taxCode`(`id`, `dated`, `code`, `taxTypeFk`, `rate`, `equaliza INSERT INTO `vn`.`taxClass`(`id`, `description`, `code`) VALUES - (1, 'Reduced VAT','R'), + (1, 'Reduced VAT', 'R'), (2, 'General VAT', 'G'); + +INSERT INTO `vn`.`taxClassCode`(`id`, `taxClassFk`, `effectived`, `taxCodeFk`) + VALUES + (1, 1, CURDATE(), 1), + (2, 1, CURDATE(), 21), + (3, 2, CURDATE(), 2); INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`) VALUES diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 63d40f9d5..1510ff893 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -262,6 +262,10 @@ export default { longName: 'vn-textfield[ng-model="$ctrl.item.longName"]', isActiveCheckbox: 'vn-check[label="Active"]', priceInKgCheckbox: 'vn-check[label="Price in kg"]', + newIntrastatButton: 'vn-item-basic-data vn-icon-button[vn-tooltip="New intrastat"] > button', + newIntrastatId: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.newIntrastat.intrastatId"]', + newIntrastatDescription: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newIntrastat.description"]', + acceptIntrastatButton: '.vn-dialog.shown button[response="accept"]', submitBasicDataButton: `button[type=submit]` }, itemTags: { diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js index 2c8a8a7a1..64827ed9b 100644 --- a/e2e/paths/04-item/02_basic_data.spec.js +++ b/e2e/paths/04-item/02_basic_data.spec.js @@ -39,6 +39,26 @@ describe('Item Edit basic data path', () => { expect(result).toEqual('Data saved!'); }, 20000); + it(`should create a new intrastat`, async() => { + await page.waitToClick(selectors.itemBasicData.newIntrastatButton); + await page.write(selectors.itemBasicData.newIntrastatId, '588420239'); + await page.write(selectors.itemBasicData.newIntrastatDescription, 'Tropical Flowers'); + await page.waitToClick(selectors.itemBasicData.acceptIntrastatButton); + await page.waitForTextInField(selectors.itemBasicData.intrastat, 'Tropical Flowers'); + let newcode = await page.waitToGetProperty(selectors.itemBasicData.intrastat, 'value'); + + expect(newcode).toEqual('588420239 Tropical Flowers'); + }); + + it(`should save with the new intrastat`, async() => { + await page.waitFor(250); + await page.waitForTextInField(selectors.itemBasicData.intrastat, 'Tropical Flowers'); + await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); + const result = await page.waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + it(`should confirm the item name was edited`, async() => { await page.reloadSection('item.card.basicData'); const result = await page.waitToGetProperty(selectors.itemBasicData.name, 'value'); @@ -53,11 +73,11 @@ describe('Item Edit basic data path', () => { expect(result).toEqual('Anthurium'); }); - it(`should confirm the item intrastad was edited`, async() => { + it(`should confirm the item intrastat was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBasicData.intrastat, 'value'); - expect(result).toEqual('5080000 Coral y materiales similares'); + expect(result).toEqual('588420239 Tropical Flowers'); }); it(`should confirm the item relevancy was edited`, async() => { diff --git a/modules/item/back/methods/item/createIntrastat.js b/modules/item/back/methods/item/createIntrastat.js new file mode 100644 index 000000000..1a88d16e2 --- /dev/null +++ b/modules/item/back/methods/item/createIntrastat.js @@ -0,0 +1,61 @@ +let UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethod('createIntrastat', { + description: 'Creates a new item intrastat', + accessType: 'WRITE', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The item id', + http: {source: 'path'} + }, + { + arg: 'intrastatId', + type: 'number', + required: true + }, + { + arg: 'description', + type: 'string', + required: true + }], + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/:id/createIntrastat`, + verb: 'PATCH' + } + }); + + Self.createIntrastat = async(id, intrastatId, description) => { + const models = Self.app.models; + const country = await models.Country.findOne({ + where: {code: 'ES'} + }); + + const itemTaxCountry = await models.ItemTaxCountry.findOne({ + where: { + itemFk: id, + countryFk: country.id + }, + order: 'effectived DESC' + }); + const taxClassCode = await models.TaxClassCode.findOne({ + where: { + taxClassFk: itemTaxCountry.taxClassFk + }, + order: 'effectived DESC' + }); + + return models.Intrastat.create({ + id: intrastatId, + description: description, + taxClassFk: itemTaxCountry.taxClassFk, + taxCodeFk: taxClassCode.taxCodeFk + }); + }; +}; diff --git a/modules/item/back/methods/item/getCard.js b/modules/item/back/methods/item/getCard.js index 50ff22321..9780c5601 100644 --- a/modules/item/back/methods/item/getCard.js +++ b/modules/item/back/methods/item/getCard.js @@ -55,9 +55,6 @@ module.exports = Self => { } }] } - }, - { - relation: 'taxClass' } ] }; diff --git a/modules/item/back/methods/item/specs/createIntrastat.spec.js b/modules/item/back/methods/item/specs/createIntrastat.spec.js new file mode 100644 index 000000000..fb10de858 --- /dev/null +++ b/modules/item/back/methods/item/specs/createIntrastat.spec.js @@ -0,0 +1,22 @@ +const app = require('vn-loopback/server/server'); + +describe('createIntrastat()', () => { + let newIntrastat; + + afterAll(async done => { + await app.models.Intrastat.destroyById(newIntrastat.id); + + done(); + }); + + it('should create a new intrastat', async() => { + const intrastatId = 588420239; + const description = 'Tropical Flowers'; + const itemId = 9; + newIntrastat = await app.models.Item.createIntrastat(itemId, intrastatId, description); + + expect(newIntrastat.description).toEqual(description); + expect(newIntrastat.taxClassFk).toEqual(1); + expect(newIntrastat.taxCodeFk).toEqual(21); + }); +}); diff --git a/modules/item/back/model-config.json b/modules/item/back/model-config.json index db8eed9d5..d8ec5914a 100644 --- a/modules/item/back/model-config.json +++ b/modules/item/back/model-config.json @@ -62,6 +62,9 @@ "TaxClass": { "dataSource": "vn" }, + "TaxClassCode": { + "dataSource": "vn" + }, "TaxCode": { "dataSource": "vn" }, diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index 6c221e94d..01061ce99 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -12,6 +12,7 @@ module.exports = Self => { require('../methods/item/getVisibleAvailable')(Self); require('../methods/item/new')(Self); require('../methods/item/getWasteDetail')(Self); + require('../methods/item/createIntrastat')(Self); Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'}); diff --git a/modules/item/back/models/tax-class-code.json b/modules/item/back/models/tax-class-code.json new file mode 100644 index 000000000..efe6a13db --- /dev/null +++ b/modules/item/back/models/tax-class-code.json @@ -0,0 +1,47 @@ +{ + "name": "TaxClassCode", + "base": "VnModel", + "options": { + "mysql": { + "table": "taxClassCode" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "effectived": { + "type": "date", + "required": true + }, + "taxClassFk": { + "type": "number", + "required": true + }, + "taxCodeFk": { + "type": "number", + "required": true + } + }, + "relations": { + "taxClass": { + "type": "belongsTo", + "model": "TaxClass", + "foreignKey": "taxClassFk" + }, + "taxCode": { + "type": "belongsTo", + "model": "TaxCode", + "foreignKey": "taxCodeFk" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/item/front/basic-data/__snapshots__/index.spec.js.snap b/modules/item/front/basic-data/__snapshots__/index.spec.js.snap deleted file mode 100644 index 92219bb33..000000000 --- a/modules/item/front/basic-data/__snapshots__/index.spec.js.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`vnItemBasicData Component vnItemBasicData $onChanges() should pass the data to the watcher 1`] = `"the current value of an item"`; diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 16d37ff04..3cd879945 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -149,27 +149,19 @@
New intrastat
- - + + + - - - -
diff --git a/modules/item/front/basic-data/index.js b/modules/item/front/basic-data/index.js index 3c3d62c74..33a60b32d 100644 --- a/modules/item/front/basic-data/index.js +++ b/modules/item/front/basic-data/index.js @@ -11,9 +11,10 @@ class Controller extends Component { this.$.intrastat.show(); } - onCustomAgentAccept() { - return this.$http.post(`CustomsAgents`, this.newCustomsAgent) - .then(res => this.address.customsAgentFk = res.data.id); + onIntrastatAccept() { + const query = `Items/${this.$params.id}/createIntrastat`; + return this.$http.patch(query, this.newIntrastat) + .then(res => this.item.intrastatFk = res.data.id); } } From 7d8e88e884a4f558f06ac1b7134696775db48976 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 17 Feb 2020 13:32:12 +0100 Subject: [PATCH 84/95] Updated unit test --- modules/item/front/basic-data/index.spec.js | 25 ++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/item/front/basic-data/index.spec.js b/modules/item/front/basic-data/index.spec.js index e7578b54c..178fac278 100644 --- a/modules/item/front/basic-data/index.spec.js +++ b/modules/item/front/basic-data/index.spec.js @@ -2,26 +2,31 @@ import './index.js'; describe('vnItemBasicData', () => { describe('Component vnItemBasicData', () => { + let $httpBackend; let $scope; let controller; - let $timeout; + let $element; beforeEach(ngModule('item')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$timeout_) => { - $timeout = _$timeout_; + beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { + $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); - controller = $componentController('vnItemBasicData', {$scope, $timeout}); - controller.$scope.watcher = {}; + $element = angular.element(''); + controller = $componentController('vnItemBasicData', {$element, $scope}); + controller.$.watcher = {}; + controller.$params.id = 1; + controller.item = {id: 1, name: 'Rainbow Coral'}; })); - describe('$onChanges()', () => { + describe('onIntrastatAccept()', () => { it('should pass the data to the watcher', () => { - const data = {item: {currentValue: 'the current value of an item'}}; - controller.$onChanges(data); - $timeout.flush(); + const newIntrastatId = 20; + $httpBackend.expect('PATCH', 'Items/1/createIntrastat').respond({id: 20}); + controller.onIntrastatAccept(); + $httpBackend.flush(); - expect(controller.$scope.watcher.data).toMatchSnapshot(); + expect(controller.item.intrastatFk).toEqual(newIntrastatId); }); }); }); From a148daa36878748204d3275a009ff7ecafdebf60 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 17 Feb 2020 14:47:43 +0100 Subject: [PATCH 85/95] 2125 - ticket create invalid type fix --- modules/ticket/front/create/card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/create/card.js b/modules/ticket/front/create/card.js index 2e775c18b..54cc56c68 100644 --- a/modules/ticket/front/create/card.js +++ b/modules/ticket/front/create/card.js @@ -14,7 +14,7 @@ class Controller { $onInit() { if (this.$stateParams && this.$stateParams.clientFk) - this.clientId = this.$stateParams.clientFk; + this.clientId = parseInt(this.$stateParams.clientFk); this.warehouseId = this.vnConfig.warehouseFk; } From fe8a0b4583e877550310a69764687c87cc775e6e Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 18 Feb 2020 07:21:35 +0100 Subject: [PATCH 86/95] Added translation. taxClassCode.sql removed --- .../00-taxClassCode.sql | 23 ------------------- db/dump/fixtures.sql | 8 +++---- modules/item/back/models/tax-class-code.json | 19 ++++++++------- modules/item/front/basic-data/locale/es.yml | 4 +++- 4 files changed, 16 insertions(+), 38 deletions(-) delete mode 100644 db/changes/10160-postValentineDay/00-taxClassCode.sql diff --git a/db/changes/10160-postValentineDay/00-taxClassCode.sql b/db/changes/10160-postValentineDay/00-taxClassCode.sql deleted file mode 100644 index bdc7cb474..000000000 --- a/db/changes/10160-postValentineDay/00-taxClassCode.sql +++ /dev/null @@ -1,23 +0,0 @@ -ALTER TABLE `vn`.`taxClassCode` -DROP FOREIGN KEY `taxClassCode_ibfk_2`, -DROP FOREIGN KEY `taxClassCode_ibfk_1`; -ALTER TABLE `vn`.`taxClassCode` -ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST, -DROP PRIMARY KEY, -ADD PRIMARY KEY (`id`), -DROP INDEX `iva_codigo_id` ; - -ALTER TABLE `vn`.`taxClassCode` -ADD UNIQUE INDEX `taxClassCode_unique` (`taxClassFk` ASC, `effectived` ASC, `taxCodeFk` ASC) VISIBLE; - -ALTER TABLE `vn`.`taxClassCode` -ADD CONSTRAINT `taxClassCode_taxClassFk` - FOREIGN KEY (`taxClassFk`) - REFERENCES `vn`.`taxClass` (`id`) - ON DELETE RESTRICT - ON UPDATE CASCADE, -ADD CONSTRAINT `taxClassCode_taxCodeFk` - FOREIGN KEY (`taxCodeFk`) - REFERENCES `vn`.`taxCode` (`id`) - ON DELETE RESTRICT - ON UPDATE CASCADE; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 80bb37709..d56176713 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -687,11 +687,11 @@ INSERT INTO `vn`.`taxClass`(`id`, `description`, `code`) (1, 'Reduced VAT', 'R'), (2, 'General VAT', 'G'); -INSERT INTO `vn`.`taxClassCode`(`id`, `taxClassFk`, `effectived`, `taxCodeFk`) +INSERT INTO `vn`.`taxClassCode`(`taxClassFk`, `effectived`, `taxCodeFk`) VALUES - (1, 1, CURDATE(), 1), - (2, 1, CURDATE(), 21), - (3, 2, CURDATE(), 2); + (1, CURDATE(), 1), + (1, CURDATE(), 21), + (2, CURDATE(), 2); INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`) VALUES diff --git a/modules/item/back/models/tax-class-code.json b/modules/item/back/models/tax-class-code.json index efe6a13db..ef8c529d9 100644 --- a/modules/item/back/models/tax-class-code.json +++ b/modules/item/back/models/tax-class-code.json @@ -7,21 +7,20 @@ } }, "properties": { - "id": { - "type": "number", - "id": true - }, - "effectived": { - "type": "date", - "required": true - }, "taxClassFk": { "type": "number", - "required": true + "required": true, + "id": 1 }, "taxCodeFk": { "type": "number", - "required": true + "required": true, + "id": 2 + }, + "effectived": { + "type": "date", + "required": true, + "id": 3 } }, "relations": { diff --git a/modules/item/front/basic-data/locale/es.yml b/modules/item/front/basic-data/locale/es.yml index 67780557a..07e681770 100644 --- a/modules/item/front/basic-data/locale/es.yml +++ b/modules/item/front/basic-data/locale/es.yml @@ -5,4 +5,6 @@ Full name calculates based on tags 1-3. Is not recommended to change it manually No se recomienda cambiarlo manualmente Is active: Activo Expense: Gasto -Price in kg: Precio en kg \ No newline at end of file +Price in kg: Precio en kg +New intrastat: Nuevo intrastat +Identifier: Identificador \ No newline at end of file From 30e38802992e763badf6aad916b4a9fcaca4dcff Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 18 Feb 2020 07:50:18 +0100 Subject: [PATCH 87/95] Removed comments --- modules/order/front/catalog/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index ef33e493f..ff14c592b 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -245,7 +245,6 @@ class Controller { this.$state.go(this.$state.current.name, params); } - // Builds the tags filter buildTagsFilter(items) { const tagValues = []; items.forEach(item => { @@ -261,7 +260,6 @@ class Controller { this.tagValues = tagValues; } - // Builds the order filter buildOrderFilter(items) { const tags = []; items.forEach(item => { From 3f978bd32b5544c40d6e700cf0bcab2193ba95ee Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Tue, 18 Feb 2020 10:33:17 +0100 Subject: [PATCH 88/95] entry index refactor --- db/dump/fixtures.sql | 20 ++-- modules/entry/back/methods/entry/filter.js | 1 + .../back/methods/entry/specs/filter.spec.js | 6 +- modules/entry/front/index/index.html | 59 +++++++---- modules/entry/front/index/index.js | 12 ++- modules/entry/front/index/locale/es.yml | 15 +++ modules/entry/front/index/style.scss | 5 + modules/entry/front/locale/es.yml | 14 +-- modules/entry/front/routes.json | 1 + .../item/back/methods/item/getLastEntries.js | 1 + .../back/methods/travel/specs/filter.spec.js | 2 +- .../front/descriptor-popover/index.html | 12 +++ .../travel/front/descriptor-popover/index.js | 88 +++++++++++++++ .../front/descriptor-popover/index.spec.js | 100 ++++++++++++++++++ modules/travel/front/index.js | 2 +- .../worker/front/descriptor-popover/index.js | 1 - .../front/descriptor-popover/style.scss | 11 -- 17 files changed, 292 insertions(+), 58 deletions(-) create mode 100644 modules/entry/front/index/locale/es.yml create mode 100644 modules/entry/front/index/style.scss create mode 100644 modules/travel/front/descriptor-popover/index.html create mode 100644 modules/travel/front/descriptor-popover/index.js create mode 100644 modules/travel/front/descriptor-popover/index.spec.js delete mode 100644 modules/worker/front/descriptor-popover/style.scss diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index d56176713..f7d5d94f1 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1129,17 +1129,19 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO (4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500, 'fourth travel', 0), (5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 2, 1, 50.00, 500, 'fifth travel', 1), (6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 2, 1, 50.00, 500, 'sixth travel', 1), - (7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 1); + (7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 1), + (8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'eight travel', 1); -INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `companyFk`, `ref`, `notes`, `evaNotes`) +INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `companyFk`, `ref`,`isInventory`, `isRaid`, `notes`, `evaNotes`) VALUES - (1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 442, 'Movement 1', 'this is the note one', 'observation one'), - (2, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 442, 'Movement 2', 'this is the note two', 'observation two'), - (3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 442, 'Movement 3', 'this is the note three', 'observation three'), - (4, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 69, 'Movement 4', 'this is the note four', 'observation four'), - (5, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 442, 'Movement 5', 'this is the note five', 'observation five'), - (6, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 6, 442, 'Movement 6', 'this is the note six', 'observation six'), - (7, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 7, 442, 'Movement 7', 'this is the note seven', 'observation seven'); + (1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 442, 'Movement 1', 0, 0, '', ''), + (2, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 442, 'Movement 2', 0, 0, 'this is the note two', 'observation two'), + (3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 442, 'Movement 3', 0, 0, 'this is the note three', 'observation three'), + (4, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 69, 'Movement 4', 0, 0, 'this is the note four', 'observation four'), + (5, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 442, 'Movement 5', 0, 0, 'this is the note five', 'observation five'), + (6, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 6, 442, 'Movement 6', 0, 0, 'this is the note six', 'observation six'), + (7, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 7, 442, 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'), + (8, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 7, 442, 'Movement 8', 1, 1, '', ''); INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`) VALUES diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index 8cbe5e15e..93e9558a9 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -127,6 +127,7 @@ module.exports = Self => { e.companyFk, e.gestDocFk, e.invoiceInFk, + t.landed, s.name AS supplierName, co.code AS companyCode, cu.code AS currencyCode diff --git a/modules/entry/back/methods/entry/specs/filter.spec.js b/modules/entry/back/methods/entry/specs/filter.spec.js index 9b935d831..25d2da0b4 100644 --- a/modules/entry/back/methods/entry/specs/filter.spec.js +++ b/modules/entry/back/methods/entry/specs/filter.spec.js @@ -23,7 +23,7 @@ describe('Entry filter()', () => { let result = await app.models.Entry.filter(ctx); - expect(result.length).toEqual(7); + expect(result.length).toEqual(8); }); it('should return the entry matching the supplier', async() => { @@ -35,7 +35,7 @@ describe('Entry filter()', () => { let result = await app.models.Entry.filter(ctx); - expect(result.length).toEqual(5); + expect(result.length).toEqual(6); }); it('should return the entry matching the company', async() => { @@ -47,7 +47,7 @@ describe('Entry filter()', () => { let result = await app.models.Entry.filter(ctx); - expect(result.length).toEqual(6); + expect(result.length).toEqual(7); }); it('should return the entries matching isBooked', async() => { diff --git a/modules/entry/front/index/index.html b/modules/entry/front/index/index.html index 8ddd4d3a3..86d62b158 100644 --- a/modules/entry/front/index/index.html +++ b/modules/entry/front/index/index.html @@ -16,45 +16,68 @@ + Id - Created - Travel - Notes + Landed Reference - Booked - Is inventory - Confirmed - Ordered - Is raid - Commission Supplier Currency Company + Booked + Confirmed + Ordered + Notes + + + + + + {{::entry.id}} - {{::entry.created | date:'dd/MM/yyyy'}} - {{::entry.travelFk}} - {{::entry.notes}} + + + {{::entry.landed | date:'dd/MM/yyyy'}} + + {{::entry.ref}} - - - - - - {{::entry.commission}} {{::entry.supplierName}} {{::entry.currencyCode}} {{::entry.companyCode}} + + + + + + + + + diff --git a/modules/entry/front/index/index.js b/modules/entry/front/index/index.js index ec78c06df..53d2f45e0 100644 --- a/modules/entry/front/index/index.js +++ b/modules/entry/front/index/index.js @@ -1,5 +1,5 @@ import ngModule from '../module'; - +import './style.scss'; export default class Controller { constructor($scope) { this.$ = $scope; @@ -11,6 +11,16 @@ export default class Controller { else this.$.model.clear(); } + + showTravelDescriptor(event, travelFk) { + if (event.defaultPrevented) return; + event.preventDefault(); + event.stopPropagation(); + + this.selectedTravel = travelFk; + this.$.travelDescriptor.parent = event.target; + this.$.travelDescriptor.show(); + } } Controller.$inject = ['$scope']; diff --git a/modules/entry/front/index/locale/es.yml b/modules/entry/front/index/locale/es.yml new file mode 100644 index 000000000..8ef9b2c7a --- /dev/null +++ b/modules/entry/front/index/locale/es.yml @@ -0,0 +1,15 @@ +Inventory entry: Es inventario +Virtual entry: Es una redada +Supplier: Proveedor +Currency: Moneda +Company: Empresa +Confirmed: Confirmada +Ordered: Pedida +Is raid: Redada +Commission: Comisión +Landed: F. entrega +Reference: Referencia +Created: Creado +Booked: Facturado +Is inventory: Inventario +Notes: Notas \ No newline at end of file diff --git a/modules/entry/front/index/style.scss b/modules/entry/front/index/style.scss new file mode 100644 index 000000000..ab759d2cc --- /dev/null +++ b/modules/entry/front/index/style.scss @@ -0,0 +1,5 @@ +@import "variables"; + + vn-icon[icon=insert_drive_file]{ + color: $color-font-secondary; + } diff --git a/modules/entry/front/locale/es.yml b/modules/entry/front/locale/es.yml index 214be93d4..3de6c59a8 100644 --- a/modules/entry/front/locale/es.yml +++ b/modules/entry/front/locale/es.yml @@ -1,15 +1,3 @@ #Ordenar alfabeticamente -Reference: Referencia -Created: Creado -Booked: Facturado -Is inventory: Inventario -Notes: Notas -Travel: Envío -Supplier: Proveedor -Currency: Moneda -Company: Empresa -Confirmed: Confirmada -Ordered: Pedida -Is raid: Redada -Commission: Comisión + # Sections diff --git a/modules/entry/front/routes.json b/modules/entry/front/routes.json index f23ff02bf..bd1ace3f2 100644 --- a/modules/entry/front/routes.json +++ b/modules/entry/front/routes.json @@ -2,6 +2,7 @@ "module": "entry", "name": "Entries", "icon": "icon-entry", + "dependencies": ["travel"], "validations": true, "menus": { "main": [ diff --git a/modules/item/back/methods/item/getLastEntries.js b/modules/item/back/methods/item/getLastEntries.js index bab808cef..a438afcb6 100644 --- a/modules/item/back/methods/item/getLastEntries.js +++ b/modules/item/back/methods/item/getLastEntries.js @@ -22,6 +22,7 @@ module.exports = Self => { let where = filter.where; let query = `CALL vn.itemLastEntries(?, ?)`; let [lastEntries] = await Self.rawSql(query, [where.itemFk, where.date]); + return lastEntries; }; }; diff --git a/modules/travel/back/methods/travel/specs/filter.spec.js b/modules/travel/back/methods/travel/specs/filter.spec.js index f2fe44989..03849f2b0 100644 --- a/modules/travel/back/methods/travel/specs/filter.spec.js +++ b/modules/travel/back/methods/travel/specs/filter.spec.js @@ -23,7 +23,7 @@ describe('Travel filter()', () => { let result = await app.models.Travel.filter(ctx); - expect(result.length).toEqual(7); + expect(result.length).toEqual(8); }); it('should return the travel matching "total entries"', async() => { diff --git a/modules/travel/front/descriptor-popover/index.html b/modules/travel/front/descriptor-popover/index.html new file mode 100644 index 000000000..fc0fb0301 --- /dev/null +++ b/modules/travel/front/descriptor-popover/index.html @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/modules/travel/front/descriptor-popover/index.js b/modules/travel/front/descriptor-popover/index.js new file mode 100644 index 000000000..bac0d95fd --- /dev/null +++ b/modules/travel/front/descriptor-popover/index.js @@ -0,0 +1,88 @@ +import ngModule from '../module'; +import Component from 'core/lib/component'; + +class Controller extends Component { + constructor($element, $scope, $http, $timeout, $q) { + super($element, $scope); + this.$timeout = $timeout; + this.$http = $http; + this.$q = $q; + this.travel = null; + this._quicklinks = {}; + } + + set travelFk(travelFk) { + if (travelFk == this._travelFk) return; + + this._travelFk = travelFk; + this.travel = null; + this.loadData(); + } + + get travelFk() { + return this._travelFk; + } + + get quicklinks() { + return this._quicklinks; + } + + set quicklinks(value = {}) { + Object.keys(value).forEach(key => { + this._quicklinks[key] = value[key]; + }); + } + + show() { + this.$.popover.parent = this.parent; + this.$.popover.show(); + } + + loadData() { + let query = `Travels/findOne`; + let filter = { + fields: [ + 'id', + 'ref', + 'shipped', + 'landed', + 'totalEntries', + 'warehouseInFk', + 'warehouseOutFk' + ], + where: { + id: this._travelFk + }, + include: [ + { + relation: 'warehouseIn', + scope: { + fields: ['name'] + } + }, { + relation: 'warehouseOut', + scope: { + fields: ['name'] + } + } + ] + }; + + this.$http.get(query, {params: {filter}}).then(res => { + this.travel = res.data; + this.$.$applyAsync(() => { + this.$.popover.relocate(); + }); + }); + } +} +Controller.$inject = ['$element', '$scope', '$http', '$timeout', '$q']; + +ngModule.component('vnTravelDescriptorPopover', { + template: require('./index.html'), + controller: Controller, + bindings: { + travelFk: '<', + quicklinks: '<' + } +}); diff --git a/modules/travel/front/descriptor-popover/index.spec.js b/modules/travel/front/descriptor-popover/index.spec.js new file mode 100644 index 000000000..72ba3aeaf --- /dev/null +++ b/modules/travel/front/descriptor-popover/index.spec.js @@ -0,0 +1,100 @@ +import './index.js'; + +describe('travel Component vnTravelDescriptorPopover', () => { + let $httpBackend; + let $httpParamSerializer; + let $scope; + let controller; + let $element; + + beforeEach(ngModule('travel')); + + beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + $httpBackend = _$httpBackend_; + $httpParamSerializer = _$httpParamSerializer_; + $element = angular.element(`
`); + $scope = $rootScope.$new(); + $scope.popover = {relocate: () => {}, show: () => {}}; + controller = $componentController('vnTravelDescriptorPopover', {$scope, $element}); + })); + + describe('travelFk()', () => { + it(`should not apply any changes if the received id is the same stored in _travelFk`, () => { + controller.travel = 'I exist!'; + controller._travelFk = 1; + spyOn(controller, 'loadData'); + controller.travelFk = 1; + + expect(controller.travel).toEqual('I exist!'); + expect(controller._travelFk).toEqual(1); + expect(controller.loadData).not.toHaveBeenCalled(); + }); + + it(`should set the received id into _travelFk, set the travel to null and then call loadData()`, () => { + controller.travel = `Please don't`; + controller._travelFk = 1; + spyOn(controller, 'loadData'); + controller.travelFk = 999; + + expect(controller.travel).toBeNull(); + expect(controller._travelFk).toEqual(999); + expect(controller.loadData).toHaveBeenCalledWith(); + }); + }); + + describe('show()', () => { + it(`should call the show()`, () => { + spyOn(controller.$.popover, 'show'); + controller.show(); + + expect(controller.$.popover.show).toHaveBeenCalledWith(); + }); + }); + + describe('loadData()', () => { + it(`should perform a get query to store the worker data into the controller`, () => { + controller.travelFk = 1; + controller.canceler = null; + let response = {}; + + let config = { + filter: { + fields: [ + 'id', + 'ref', + 'shipped', + 'landed', + 'totalEntries', + 'warehouseInFk', + 'warehouseOutFk' + ], + where: { + id: controller.travelFk + }, + include: [ + { + relation: 'warehouseIn', + scope: { + fields: ['name'] + } + }, { + relation: 'warehouseOut', + scope: { + fields: ['name'] + } + } + ] + } + }; + + let json = $httpParamSerializer(config); + + $httpBackend.whenGET(`Travels/findOne?${json}`).respond(response); + $httpBackend.expectGET(`Travels/findOne?${json}`); + controller.loadData(); + $httpBackend.flush(); + + expect(controller.travel).toEqual(response); + }); + }); +}); diff --git a/modules/travel/front/index.js b/modules/travel/front/index.js index 1f5346e98..b72f9fd51 100644 --- a/modules/travel/front/index.js +++ b/modules/travel/front/index.js @@ -11,4 +11,4 @@ import './log'; import './create'; import './thermograph/index/'; import './thermograph/create/'; - +import './descriptor-popover'; diff --git a/modules/worker/front/descriptor-popover/index.js b/modules/worker/front/descriptor-popover/index.js index b648e8bd2..55843a67d 100644 --- a/modules/worker/front/descriptor-popover/index.js +++ b/modules/worker/front/descriptor-popover/index.js @@ -1,6 +1,5 @@ import ngModule from '../module'; import Component from 'core/lib/component'; -import './style.scss'; class Controller extends Component { constructor($element, $scope, $http, $timeout, $q) { diff --git a/modules/worker/front/descriptor-popover/style.scss b/modules/worker/front/descriptor-popover/style.scss deleted file mode 100644 index 58e65d320..000000000 --- a/modules/worker/front/descriptor-popover/style.scss +++ /dev/null @@ -1,11 +0,0 @@ -vn-ticket-descriptor-popover { - vn-ticket-descriptor { - display: block; - width: 16em; - max-height: 28em; - - & > vn-card { - margin: 0!important; - } - } -} \ No newline at end of file From 6540ef9598cfdae1e88ac1bcc62d0d1b8b3079a2 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Tue, 18 Feb 2020 11:07:55 +0100 Subject: [PATCH 89/95] change Fk to Id --- modules/entry/front/index/index.html | 2 +- .../travel/front/descriptor-popover/index.js | 14 ++++++------ .../front/descriptor-popover/index.spec.js | 22 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/modules/entry/front/index/index.html b/modules/entry/front/index/index.html index 86d62b158..f0f540489 100644 --- a/modules/entry/front/index/index.html +++ b/modules/entry/front/index/index.html @@ -76,7 +76,7 @@ + travel-id="$ctrl.selectedTravel"> { controller = $componentController('vnTravelDescriptorPopover', {$scope, $element}); })); - describe('travelFk()', () => { - it(`should not apply any changes if the received id is the same stored in _travelFk`, () => { + describe('travelId()', () => { + it(`should not apply any changes if the received id is the same stored in _travelId`, () => { controller.travel = 'I exist!'; - controller._travelFk = 1; + controller._travelId = 1; spyOn(controller, 'loadData'); - controller.travelFk = 1; + controller.travelId = 1; expect(controller.travel).toEqual('I exist!'); - expect(controller._travelFk).toEqual(1); + expect(controller._travelId).toEqual(1); expect(controller.loadData).not.toHaveBeenCalled(); }); - it(`should set the received id into _travelFk, set the travel to null and then call loadData()`, () => { + it(`should set the received id into _travelId, set the travel to null and then call loadData()`, () => { controller.travel = `Please don't`; - controller._travelFk = 1; + controller._travelId = 1; spyOn(controller, 'loadData'); - controller.travelFk = 999; + controller.travelId = 999; expect(controller.travel).toBeNull(); - expect(controller._travelFk).toEqual(999); + expect(controller._travelId).toEqual(999); expect(controller.loadData).toHaveBeenCalledWith(); }); }); @@ -53,7 +53,7 @@ describe('travel Component vnTravelDescriptorPopover', () => { describe('loadData()', () => { it(`should perform a get query to store the worker data into the controller`, () => { - controller.travelFk = 1; + controller.travelId = 1; controller.canceler = null; let response = {}; @@ -69,7 +69,7 @@ describe('travel Component vnTravelDescriptorPopover', () => { 'warehouseOutFk' ], where: { - id: controller.travelFk + id: controller.travelId }, include: [ { From 2460725d98a147bb8d39a61feff1d0c11f366df8 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 18 Feb 2020 11:14:02 +0100 Subject: [PATCH 90/95] Refactor + updated tests --- modules/client/front/sample/create/index.html | 5 +- modules/client/front/sample/create/index.js | 78 ++++--- .../client/front/sample/create/index.spec.js | 190 +++++++++--------- .../client/front/sample/create/locale/es.yml | 4 +- 4 files changed, 130 insertions(+), 147 deletions(-) diff --git a/modules/client/front/sample/create/index.html b/modules/client/front/sample/create/index.html index 6a87d55b6..cd3412868 100644 --- a/modules/client/front/sample/create/index.html +++ b/modules/client/front/sample/create/index.html @@ -15,7 +15,8 @@ + ng-model="$ctrl.clientSample.recipient" + info="Its only used when sample is sent"> @@ -30,7 +31,7 @@ { - this.$.showPreview.show(); - let dialog = document.body.querySelector('div.vn-dialog'); - let body = dialog.querySelector('tpl-body'); - let scroll = dialog.querySelector('div:first-child'); - - body.innerHTML = res.data; - scroll.scrollTop = 0; - }); + this.clientSample.companyId = value; } onSubmit() { @@ -73,28 +42,49 @@ class Controller extends Component { ); } + showPreview() { + this.send(true, res => { + this.$.showPreview.show(); + const dialog = document.body.querySelector('div.vn-dialog'); + const body = dialog.querySelector('tpl-body'); + const scroll = dialog.querySelector('div:first-child'); + + body.innerHTML = res.data; + scroll.scrollTop = 0; + }); + } + sendSample() { - let sampleType = this.$.sampleType.selection; - let params = { + this.send(false, () => { + this.vnApp.showSuccess(this.$translate.instant('Notification sent!')); + this.$state.go('client.card.sample.index'); + }); + } + + send(isPreview, cb) { + const sampleType = this.$.sampleType.selection; + const params = { clientId: this.$params.id, recipient: this.clientSample.recipient }; + if (!params.recipient) + return this.vnApp.showError(this.$translate.instant('Email cannot be blank')); + if (!sampleType) return this.vnApp.showError(this.$translate.instant('Choose a sample')); - if (sampleType.hasCompany && !this.clientSample.companyFk) + if (sampleType.hasCompany && !this.clientSample.companyId) return this.vnApp.showError(this.$translate.instant('Choose a company')); if (sampleType.hasCompany) - params.companyId = this.clientSample.companyFk; + params.companyId = this.clientSample.companyId; + + if (isPreview) params.isPreview = true; const serializedParams = this.$httpParamSerializer(params); const query = `email/${sampleType.code}?${serializedParams}`; - this.$http.get(query).then(res => { - this.vnApp.showSuccess(this.$translate.instant('Notification sent!')); - this.$state.go('client.card.sample.index'); - }); + this.$http.get(query).then(cb); } } Controller.$inject = ['$element', '$scope', 'vnApp', '$httpParamSerializer', 'vnConfig']; diff --git a/modules/client/front/sample/create/index.spec.js b/modules/client/front/sample/create/index.spec.js index efcda5401..da9a557f1 100644 --- a/modules/client/front/sample/create/index.spec.js +++ b/modules/client/front/sample/create/index.spec.js @@ -40,84 +40,16 @@ describe('Client', () => { $httpParamSerializer = _$httpParamSerializer_; $element = angular.element(''); controller = $componentController('vnClientSampleCreate', {$element, $scope}); + const element = document.createElement('div'); + document.body.querySelector = () => { + return { + querySelector: () => { + return element; + } + }; + }; })); - describe('showPreview()', () => { - it(`should perform a query (GET) and open a sample preview`, () => { - spyOn(controller.$.showPreview, 'show'); - const element = document.createElement('div'); - document.body.querySelector = () => { - return { - querySelector: () => { - return element; - } - }; - }; - - controller.$.sampleType.selection = { - hasCompany: false, - code: 'MyReport' - }; - - controller.clientSample = { - clientFk: 101 - }; - - let event = {preventDefault: () => {}}; - - const params = { - clientId: 101, - isPreview: true - }; - const serializedParams = $httpParamSerializer(params); - - $httpBackend.when('GET', `email/MyReport?${serializedParams}`).respond(true); - $httpBackend.expect('GET', `email/MyReport?${serializedParams}`); - controller.showPreview(event); - $httpBackend.flush(); - - expect(controller.$.showPreview.show).toHaveBeenCalledWith(); - }); - - it(`should perform a query (GET) with companyFk param and open a sample preview`, () => { - spyOn(controller.$.showPreview, 'show'); - const element = document.createElement('div'); - document.body.querySelector = () => { - return { - querySelector: () => { - return element; - } - }; - }; - - controller.$.sampleType.selection = { - hasCompany: true, - code: 'MyReport' - }; - - controller.clientSample = { - clientFk: 101, - companyFk: 442 - }; - - let event = {preventDefault: () => {}}; - - const params = { - clientId: 101, - companyId: 442, - isPreview: true - }; - const serializedParams = $httpParamSerializer(params); - - $httpBackend.when('GET', `email/MyReport?${serializedParams}`).respond(true); - $httpBackend.expect('GET', `email/MyReport?${serializedParams}`); - controller.showPreview(event); - $httpBackend.flush(); - - expect(controller.$.showPreview.show).toHaveBeenCalledWith(); - }); - }); - describe('onSubmit()', () => { it(`should call sendSample() method`, () => { spyOn(controller, 'sendSample'); @@ -127,55 +59,113 @@ describe('Client', () => { }); }); - describe('sendSample()', () => { - it(`should perform a query (GET) and call go() method`, () => { - spyOn(controller.$state, 'go'); + describe('send()', () => { + it(`should not perform an HTTP query if no recipient is specified`, () => { + spyOn(controller.$http, 'get'); controller.$.sampleType.selection = { hasCompany: false, code: 'MyReport' }; - controller.clientSample = { - clientFk: 101 - }; - - const params = { clientId: 101 }; - const serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `email/MyReport?${serializedParams}`).respond(true); - $httpBackend.expect('GET', `email/MyReport?${serializedParams}`); - controller.sendSample(); - $httpBackend.flush(); + controller.send(false, () => {}); - expect(controller.$state.go).toHaveBeenCalledWith('client.card.sample.index'); + expect(controller.$http.get).not.toHaveBeenCalled(); }); - it(`should perform a query (GET) with companyFk param and call go() method`, () => { - spyOn(controller.$state, 'go'); + it(`should not perform an HTTP query if no sample is specified`, () => { + spyOn(controller.$http, 'get'); + + controller.$.sampleType.selection = null; + controller.clientSample = { + clientId: 101, + recipient: 'client@email.com' + }; + + controller.send(false, () => {}); + + expect(controller.$http.get).not.toHaveBeenCalled(); + }); + + it(`should not perform an HTTP query if company is required and not specified`, () => { + spyOn(controller.$http, 'get'); controller.$.sampleType.selection = { hasCompany: true, code: 'MyReport' }; - controller.clientSample = { - clientFk: 101, - companyFk: 442 + clientId: 101, + recipient: 'client@email.com' }; - const params = { + controller.send(false, () => {}); + + expect(controller.$http.get).not.toHaveBeenCalled(); + }); + + it(`should perform an HTTP query without passing companyId param`, () => { + controller.$.sampleType.selection = { + hasCompany: false, + code: 'MyReport' + }; + controller.clientSample = { clientId: 101, + recipient: 'client@email.com' + }; + + const serializedParams = $httpParamSerializer(controller.clientSample); + $httpBackend.expect('GET', `email/MyReport?${serializedParams}`).respond(true); + controller.send(false, () => {}); + $httpBackend.flush(); + }); + + it(`should perform an HTTP query passing companyId param`, () => { + controller.$.sampleType.selection = { + hasCompany: true, + code: 'MyReport' + }; + controller.clientSample = { + clientId: 101, + recipient: 'client@email.com', companyId: 442 }; - const serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `email/MyReport?${serializedParams}`).respond(true); - $httpBackend.expect('GET', `email/MyReport?${serializedParams}`); - controller.sendSample(); + const serializedParams = $httpParamSerializer(controller.clientSample); + $httpBackend.expect('GET', `email/MyReport?${serializedParams}`).respond(true); + controller.send(false, () => {}); $httpBackend.flush(); + }); + }); + + describe('showPreview()', () => { + it(`should open a sample preview`, () => { + spyOn(controller.$.showPreview, 'show'); + + controller.send = (isPreview, cb) => { + cb({ + data: '
' + }); + }; + controller.showPreview(); + + expect(controller.$.showPreview.show).toHaveBeenCalledWith(); + }); + }); + + describe('sendSample()', () => { + it(`should perform a query (GET) and call go() method`, () => { + spyOn(controller.$state, 'go'); + + controller.send = (isPreview, cb) => { + cb({ + data: true + }); + }; + controller.sendSample(); expect(controller.$state.go).toHaveBeenCalledWith('client.card.sample.index'); }); diff --git a/modules/client/front/sample/create/locale/es.yml b/modules/client/front/sample/create/locale/es.yml index d1ef82c0e..6828e3e48 100644 --- a/modules/client/front/sample/create/locale/es.yml +++ b/modules/client/front/sample/create/locale/es.yml @@ -1,3 +1,5 @@ Choose a sample: Selecciona una plantilla Choose a company: Selecciona una empresa -Recipient: Destinatario \ No newline at end of file +Email cannot be blank: Debes introducir un email +Recipient: Destinatario +Its only used when sample is sent: Se utiliza únicamente cuando se envía la plantilla \ No newline at end of file From bfb8c5e138600242f17f2664092005e159b3b61c Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Tue, 18 Feb 2020 12:51:29 +0100 Subject: [PATCH 91/95] route.basicData validations --- loopback/locale/es.json | 3 ++- modules/route/back/models/route.js | 17 +++++++++++++++++ modules/route/front/basic-data/index.js | 6 ++++-- modules/route/front/basic-data/locale/es.yml | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 64fabd522..7577c5349 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -126,5 +126,6 @@ "MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} (#{{clientId}})]({{{url}}})", "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [#{{ticketId}}]({{{ticketUrl}}})", "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" + "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", + "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000" } \ No newline at end of file diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index 4dd9f3dc0..6d93cfe40 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -5,4 +5,21 @@ module.exports = Self => { require('../methods/route/guessPriority')(Self); require('../methods/route/updateVolume')(Self); require('../methods/route/getDeliveryPoint')(Self); + + Self.validate('kmStart', validateDistance, { + message: 'Distance must be lesser than 1000' + }); + + Self.validate('kmEnd', validateDistance, { + message: 'Distance must be lesser than 1000' + }); + + function validateDistance(err) { + const routeTotalKm = this.kmEnd - this.kmStart; + const routeMaxKm = 1000; + if ( routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd) + err(); + } }; + + diff --git a/modules/route/front/basic-data/index.js b/modules/route/front/basic-data/index.js index 810fd7511..d4a481dc5 100644 --- a/modules/route/front/basic-data/index.js +++ b/modules/route/front/basic-data/index.js @@ -1,8 +1,10 @@ import ngModule from '../module'; class Controller { - constructor($scope) { + constructor($scope, vnApp, $translate) { this.$ = $scope; + this.vnApp = vnApp; + this.$translate = $translate; } onSubmit() { @@ -11,7 +13,7 @@ class Controller { }); } } -Controller.$inject = ['$scope']; +Controller.$inject = ['$scope', 'vnApp', '$translate']; ngModule.component('vnRouteBasicData', { template: require('./index.html'), diff --git a/modules/route/front/basic-data/locale/es.yml b/modules/route/front/basic-data/locale/es.yml index 442a4fa82..f0414b5b1 100644 --- a/modules/route/front/basic-data/locale/es.yml +++ b/modules/route/front/basic-data/locale/es.yml @@ -2,4 +2,4 @@ Date finished: Fecha fin Date started: Fecha inicio Km start: Km de inicio Km end: Km de fin -Description: Descripción \ No newline at end of file +Description: Descripción From 774185e52e3ff7098e11ac8233bb75956f631a87 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 19 Feb 2020 10:04:29 +0100 Subject: [PATCH 92/95] #2120 e2e path agency.basicData --- e2e/helpers/selectors.js | 12 +++ e2e/paths/11-agency/01_basic-data.spec.js | 103 ++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 e2e/paths/11-agency/01_basic-data.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 63d40f9d5..24b341a8c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -772,5 +772,17 @@ export default { uploadIcon: 'vn-travel-thermograph-create vn-icon[icon="cloud_upload"]', createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr', upload: 'vn-travel-thermograph-create button[type=submit]' + }, + agencyBasicData: { + name: 'vn-zone-basic-data vn-textfield[ng-model="$ctrl.zone.name"]', + agency: 'vn-zone-basic-data vn-autocomplete[ng-model="$ctrl.zone.agencyModeFk"]', + maxVolume: 'vn-zone-basic-data vn-input-number[ng-model="$ctrl.zone.m3Max"]', + travelingDays: 'vn-zone-basic-data vn-input-number[ng-model="$ctrl.zone.travelingDays"]', + closing: 'vn-zone-basic-data vn-input-time[ng-model="$ctrl.zone.hour"]', + price: 'vn-zone-basic-data vn-input-number[ng-model="$ctrl.zone.price"]', + bonus: 'vn-zone-basic-data vn-input-number[ng-model="$ctrl.zone.bonus"]', + inflation: 'vn-zone-basic-data vn-input-number[ng-model="$ctrl.zone.inflation"]', + volumetric: 'vn-zone-basic-data vn-check[ng-model="$ctrl.zone.isVolumetric"]', + saveButton: 'vn-zone-basic-data vn-submit > button', } }; diff --git a/e2e/paths/11-agency/01_basic-data.spec.js b/e2e/paths/11-agency/01_basic-data.spec.js new file mode 100644 index 000000000..43369aeab --- /dev/null +++ b/e2e/paths/11-agency/01_basic-data.spec.js @@ -0,0 +1,103 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Agency basic data path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('deliveryBoss', 'zone'); // turns up the agency module name and route aint the same lol + await page.accessToSearchResult('10'); + await page.accessToSection('zone.card.basicData'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should reach the basic data section', async() => { + let url = await page.expectURL('#!/zone/10/basic-data'); + + expect(url).toBe(true); + }); + + it('should edit de form and then save', async() => { + await page.clearInput(selectors.agencyBasicData.name); + await page.write(selectors.agencyBasicData.name, 'Brimstone teleportation'); + await page.autocompleteSearch(selectors.agencyBasicData.agency, 'Quantum break device'); + await page.write(selectors.agencyBasicData.maxVolume, '10'); + await page.clearInput(selectors.agencyBasicData.travelingDays); + await page.write(selectors.agencyBasicData.travelingDays, '1'); + await page.clearInput(selectors.agencyBasicData.closing); + await page.type(selectors.agencyBasicData.closing, '2100'); + await page.clearInput(selectors.agencyBasicData.price); + await page.write(selectors.agencyBasicData.price, '999'); + await page.clearInput(selectors.agencyBasicData.bonus); + await page.write(selectors.agencyBasicData.bonus, '100'); + await page.clearInput(selectors.agencyBasicData.inflation); + await page.write(selectors.agencyBasicData.inflation, '200'); + await page.waitToClick(selectors.agencyBasicData.volumetric); + await page.waitToClick(selectors.agencyBasicData.saveButton); + }); + + it('should reload the section', async() => { + await page.reloadSection('zone.card.basicData'); + let url = await page.expectURL('#!/zone/10/basic-data'); + + expect(url).toBe(true); + }); + + it('should confirm the name was updated', async() => { + const result = await page.waitToGetProperty(selectors.agencyBasicData.name, 'value'); + + expect(result).toEqual('Brimstone teleportation'); + }); + + it('should confirm the agency was updated', async() => { + const result = await page.waitToGetProperty(selectors.agencyBasicData.agency, 'value'); + + expect(result).toEqual('Quantum break device'); + }); + + it('should confirm the max volume was updated', async() => { + const result = await page.waitToGetProperty(selectors.agencyBasicData.maxVolume, 'value'); + + expect(result).toEqual('10'); + }); + + it('should confirm the traveling days were updated', async() => { + const result = await page.waitToGetProperty(selectors.agencyBasicData.travelingDays, 'value'); + + expect(result).toEqual('1'); + }); + + it('should confirm the closing hour was updated', async() => { + const result = await page.waitToGetProperty(selectors.agencyBasicData.closing, 'value'); + + expect(result).toEqual('21:00'); + }); + + it('should confirm the price was updated', async() => { + const result = await page.waitToGetProperty(selectors.agencyBasicData.price, 'value'); + + expect(result).toEqual('999'); + }); + + it('should confirm the bonus was updated', async() => { + const result = await page.waitToGetProperty(selectors.agencyBasicData.bonus, 'value'); + + expect(result).toEqual('100'); + }); + + it('should confirm the inflation was updated', async() => { + const result = await page.waitToGetProperty(selectors.agencyBasicData.inflation, 'value'); + + expect(result).toEqual('200'); + }); + + it('should confirm the volumetric checkbox was checked', async() => { + await page.waitForClassPresent(selectors.agencyBasicData.volumetric, 'checked'); + }); +}); From c9fd48b0cde98f46ed289abeea7d31e93345386b Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 19 Feb 2020 11:57:39 +0100 Subject: [PATCH 93/95] 2112 - Catalog improvements --- e2e/helpers/selectors.js | 6 +- .../front/catalog-search-panel/index.html | 9 +- modules/order/front/catalog/index.html | 26 ++++- modules/order/front/catalog/index.js | 82 ++++++++++++++-- modules/order/front/catalog/index.spec.js | 97 ++++++++++++++----- modules/order/front/prices-popover/index.js | 24 ----- modules/order/front/routes.json | 2 +- 7 files changed, 176 insertions(+), 70 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 42480dafd..451aaf7f7 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -620,9 +620,9 @@ export default { orderCatalog: { plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]', type: 'vn-autocomplete[data="$ctrl.itemTypes"]', - itemId: 'vn-order-catalog > vn-side-menu vn-textfield[ng-model="$ctrl.itemId"]', - itemTagValue: 'vn-order-catalog > vn-side-menu vn-datalist[ng-model="$ctrl.value"]', - openTagSearch: 'vn-order-catalog > vn-side-menu > div > vn-vertical > vn-datalist[ng-model="$ctrl.value"] .append i', + itemId: 'vn-order-catalog > vn-side-menu vn-textfield[vn-id="itemId"]', + itemTagValue: 'vn-order-catalog > vn-side-menu vn-datalist[vn-id="search"]', + openTagSearch: 'vn-order-catalog > vn-side-menu > div > vn-vertical > vn-datalist[vn-id="search"] .append i', tag: 'vn-order-catalog-search-panel vn-autocomplete[ng-model="filter.tagFk"]', tagValue: 'vn-order-catalog-search-panel vn-textfield[ng-model="filter.value"]', searchTagButton: 'vn-order-catalog-search-panel button[type=submit]', diff --git a/modules/order/front/catalog-search-panel/index.html b/modules/order/front/catalog-search-panel/index.html index 3bd0ba3e2..d32ecaafa 100644 --- a/modules/order/front/catalog-search-panel/index.html +++ b/modules/order/front/catalog-search-panel/index.html @@ -1,13 +1,15 @@
-
+ + value-field="id" + required="true"> {{name}} @@ -15,7 +17,8 @@ + ng-model="filter.value" + required="true"> diff --git a/modules/order/front/catalog/index.html b/modules/order/front/catalog/index.html index 37767e81b..7131d6a6e 100644 --- a/modules/order/front/catalog/index.html +++ b/modules/order/front/catalog/index.html @@ -77,10 +77,9 @@
- + label="Item id"> @@ -89,7 +88,6 @@
+ + Id: {{$ctrl.itemId}} + - {{::tag.value}} +
+ + + {{::tag.tagSelection.name}} + + : + + + "{{::tag.value}}" + +
\ No newline at end of file diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index ff14c592b..87dff29e2 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -10,7 +10,7 @@ class Controller { this.$compile = $compile; this.$transitions = $transitions; this.itemTypes = []; - this.tags = []; + this._tags = []; // Static autocomplete data this.orderWays = [ @@ -52,11 +52,17 @@ class Controller { if (!value) return; this.$.$applyAsync(() => { + if (this.$stateParams.itemId) + this.itemId = parseInt(this.$stateParams.itemId); + if (this.$stateParams.categoryId) - this.categoryId = this.$stateParams.categoryId; + this.categoryId = parseInt(this.$stateParams.categoryId); if (this.$stateParams.typeId) - this.typeId = this.$stateParams.typeId; + this.typeId = parseInt(this.$stateParams.typeId); + + if (this.$stateParams.tags) + this.tags = JSON.parse(this.$stateParams.tags); }); } @@ -109,6 +115,30 @@ class Controller { this.applyFilters(); } + get itemId() { + return this._itemId; + } + + set itemId(value) { + this._itemId = value; + + this.updateStateParams(); + this.applyFilters(); + } + + get tags() { + return this._tags; + } + + set tags(value) { + this._tags = value; + + this.updateStateParams(); + + if (value.length) + this.applyFilters(); + } + /** * Get order way ASC/DESC */ @@ -169,23 +199,36 @@ class Controller { this.itemTypes = res.data); } + /** + * Search by item id filter + * @param {object} event + */ onSearchById(event) { - const hasValue = this.tags.length > 0 || this.itemId || this.typeId; - if (event.key === 'Enter' && hasValue) - this.applyFilters(); + const value = this.$.itemId.value; + if (event.key === 'Enter' && value) { + this.itemId = value; + this.$.itemId.value = null; + } } + /** + * Search by tag value + * @param {object} event + */ onSearchByTag(event) { - if (event.key !== 'Enter' || !this.value) return; + const value = this.$.search.value; + if (event.key !== 'Enter' || !value) return; this.tags.push({ - value: this.value, + value: value, }); this.$.search.value = null; + this.updateStateParams(); this.applyFilters(); } remove(index) { this.tags.splice(index, 1); + this.updateStateParams(); if (this.tags.length >= 0 || this.itemId || this.typeId) this.applyFilters(); @@ -225,6 +268,7 @@ class Controller { onPanelSubmit(filter) { this.$.popover.hide(); this.tags.push(filter); + this.updateStateParams(); this.applyFilters(); } @@ -242,6 +286,28 @@ class Controller { params.typeId = this.typeId; else params.typeId = undefined; + if (this.itemId) + params.itemId = this.itemId; + else params.itemId = undefined; + + if (this.tags.length) { + const tags = []; + for (let tag of this.tags) { + const tagParam = {value: tag.value}; + + if (tag.tagSelection) { + tagParam.tagFk = tag.tagFk; + tagParam.tagSelection = { + name: tag.tagSelection.name + }; + } + + tags.push(tagParam); + } + + params.tags = JSON.stringify(tags); + } else params.tags = undefined; + this.$state.go(this.$state.current.name, params); } diff --git a/modules/order/front/catalog/index.spec.js b/modules/order/front/catalog/index.spec.js index 01da61800..e2d2d0aff 100644 --- a/modules/order/front/catalog/index.spec.js +++ b/modules/order/front/catalog/index.spec.js @@ -15,6 +15,7 @@ describe('Order', () => { $scope = $rootScope.$new(); $scope.model = crudModel; $scope.search = {}; + $scope.itemId = {}; $state = _$state_; $state.params.categoryId = 1; $state.params.typeId = 2; @@ -37,8 +38,9 @@ describe('Order', () => { describe('items() setter', () => { it(`should return an object with order params`, () => { - spyOn(controller, 'buildTagsFilter'); - spyOn(controller, 'buildOrderFilter').and.callThrough(); + jest.spyOn(controller, 'buildTagsFilter'); + jest.spyOn(controller, 'buildOrderFilter'); + const expectedResult = [{field: 'showOrder, price', name: 'Color and price'}]; const items = [{id: 1, name: 'My Item', tags: [ {tagFk: 4, name: 'Length'}, @@ -55,14 +57,16 @@ describe('Order', () => { describe('categoryId() setter', () => { it(`should set category property to null, call updateStateParams() method and not call applyFilters()`, () => { - spyOn(controller, 'updateStateParams'); + jest.spyOn(controller, 'updateStateParams'); + controller.categoryId = null; expect(controller.updateStateParams).toHaveBeenCalledWith(); }); it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => { - spyOn(controller, 'updateStateParams'); + jest.spyOn(controller, 'updateStateParams'); + controller.categoryId = 2; expect(controller.updateStateParams).toHaveBeenCalledWith(); @@ -87,8 +91,9 @@ describe('Order', () => { describe('typeId() setter', () => { it(`should set type property to null, call updateStateParams() method and not call applyFilters()`, () => { - spyOn(controller, 'updateStateParams'); - spyOn(controller, 'applyFilters'); + jest.spyOn(controller, 'updateStateParams'); + jest.spyOn(controller, 'applyFilters'); + controller.typeId = null; expect(controller.updateStateParams).toHaveBeenCalledWith(); @@ -96,8 +101,9 @@ describe('Order', () => { }); it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => { - spyOn(controller, 'updateStateParams'); - spyOn(controller, 'applyFilters'); + jest.spyOn(controller, 'updateStateParams'); + jest.spyOn(controller, 'applyFilters'); + controller.typeId = 2; expect(controller.updateStateParams).toHaveBeenCalledWith(); @@ -105,21 +111,46 @@ describe('Order', () => { }); }); + describe('itemId() setter', () => { + it(`should set itemId property and then call updateStateParams() and applyFilters() methods`, () => { + jest.spyOn(controller, 'updateStateParams'); + jest.spyOn(controller, 'applyFilters'); + + controller.itemId = 1; + + expect(controller.updateStateParams).toHaveBeenCalledWith(); + expect(controller.applyFilters).toHaveBeenCalledWith(); + }); + }); + + describe('tags() setter', () => { + it(`should set tags property and then call updateStateParams() and applyFilters() methods`, () => { + jest.spyOn(controller, 'updateStateParams'); + jest.spyOn(controller, 'applyFilters'); + + controller.tags = [{tagFk: 11, value: 'Brown'}]; + + expect(controller.updateStateParams).toHaveBeenCalledWith(); + expect(controller.applyFilters).toHaveBeenCalledWith(); + }); + }); + describe('onSearchByTag()', () => { it(`should not add a new tag if the event key code doesn't equals to 'Enter'`, () => { - spyOn(controller, 'applyFilters'); + jest.spyOn(controller, 'applyFilters'); + controller.order = {id: 4}; - controller.value = 'Color'; + controller.$.search.value = 'Brown'; controller.onSearchByTag({key: 'Tab'}); expect(controller.applyFilters).not.toHaveBeenCalledWith(); }); it(`should add a new tag if the event key code equals to 'Enter' an then call applyFilters()`, () => { - spyOn(controller, 'applyFilters'); - controller.order = {id: 4}; - controller.value = 'Color'; + jest.spyOn(controller, 'applyFilters'); + controller.order = {id: 4}; + controller.$.search.value = 'Brown'; controller.onSearchByTag({key: 'Enter'}); expect(controller.applyFilters).toHaveBeenCalledWith(); @@ -128,17 +159,18 @@ describe('Order', () => { describe('onSearchById()', () => { it(`should not filter by id if the event key code doesn't equals to 'Enter'`, () => { - spyOn(controller, 'applyFilters'); - controller.itemId = 1; + jest.spyOn(controller, 'applyFilters'); + + controller.$.itemId.value = 1; controller.onSearchById({key: 'Tab'}); expect(controller.applyFilters).not.toHaveBeenCalledWith(); }); it(`should filter by id if the event key code equals to 'Enter' an then call applyFilters()`, () => { - spyOn(controller, 'applyFilters'); - controller.itemId = 1; + jest.spyOn(controller, 'applyFilters'); + controller.$.itemId.value = 1; controller.onSearchById({key: 'Enter'}); expect(controller.applyFilters).toHaveBeenCalledWith(); @@ -147,14 +179,14 @@ describe('Order', () => { describe('applyFilters()', () => { it(`should call model applyFilter() method with a new filter`, () => { - let model = controller.$.model; - spyOn(model, 'applyFilter'); + jest.spyOn(controller.$.model, 'applyFilter'); + controller._categoryId = 2; controller._typeId = 4; controller.applyFilters(); - expect(model.applyFilter).toHaveBeenCalledWith( + expect(controller.$.model.applyFilter).toHaveBeenCalledWith( {where: {categoryFk: 2, typeFk: 4}}, {orderFk: 4, orderBy: controller.getOrderBy(), tags: []}); }); @@ -162,7 +194,8 @@ describe('Order', () => { describe('remove()', () => { it(`should remove a tag from tags property`, () => { - spyOn(controller, 'applyFilters'); + jest.spyOn(controller, 'applyFilters'); + controller.tags = [{tagFk: 1, value: 'Blue'}, {tagFk: 2, value: '70'}]; controller.remove(0); @@ -172,7 +205,8 @@ describe('Order', () => { }); it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => { - spyOn(controller, 'applyFilters'); + jest.spyOn(controller, 'applyFilters'); + controller._categoryId = 1; controller._typeId = 1; controller.tags = [{tagFk: 1, value: 'Blue'}]; @@ -185,10 +219,19 @@ describe('Order', () => { describe('updateStateParams()', () => { it(`should call state go() method passing category and type state params`, () => { - spyOn(controller.$state, 'go'); + jest.spyOn(controller.$state, 'go'); + controller._categoryId = 2; controller._typeId = 4; - let result = {categoryId: 2, typeId: 4}; + controller._itemId = 1; + controller._tags = [ + {tagFk: 11, value: 'Precission', tagSelection: {name: 'Category'}} + ]; + const tags = JSON.stringify([{ + value: 'Precission', + tagFk: 11, tagSelection: {name: 'Category'}} + ]); + let result = {categoryId: 2, typeId: 4, itemId: 1, tags: tags}; controller.updateStateParams(); expect(controller.$state.go).toHaveBeenCalledWith('my.current.state', result); @@ -212,13 +255,15 @@ describe('Order', () => { describe('applyOrder()', () => { it(`should apply order param to model calling getOrderBy()`, () => { + jest.spyOn(controller, 'getOrderBy'); + jest.spyOn(controller.$.model, 'addFilter'); + controller.field = 'relevancy DESC, name'; controller.way = 'ASC'; controller._categoryId = 1; controller._typeId = 1; let expectedOrder = {orderBy: controller.getOrderBy()}; - spyOn(controller, 'getOrderBy').and.callThrough(); - spyOn(controller.$.model, 'addFilter'); + controller.applyOrder(); expect(controller.getOrderBy).toHaveBeenCalledWith(); diff --git a/modules/order/front/prices-popover/index.js b/modules/order/front/prices-popover/index.js index 2df8bea15..b732f2090 100644 --- a/modules/order/front/prices-popover/index.js +++ b/modules/order/front/prices-popover/index.js @@ -73,30 +73,6 @@ class Controller extends Component { addQuantity(price) { if (this.total + price.grouping <= this.max) price.quantity += price.grouping; - - this.validate(); - } - - validate() { - /* - this.$timeout(() => { - this.calculateTotal(); - let inputs = this.$element[0].querySelectorAll('vn-input-number[name="quantity"] div.infix:not(.validated)'); - - inputs.forEach(input => { - if (this.total > this.item.available) - input.classList.add('invalid'); - else - input.classList.remove('invalid'); - }); - let wrongInputs = this.$element[0].querySelectorAll('vn-input-number[name="quantity"] div.infix.invalid'); - - if (wrongInputs.length > 0) - this.$element[0].querySelector('vn-vertical.prices').classList.add('invalid'); - else - this.$element[0].querySelector('vn-vertical.prices').classList.remove('invalid'); - }); - */ } getFilledLines() { diff --git a/modules/order/front/routes.json b/modules/order/front/routes.json index 789870fd1..b607aef9d 100644 --- a/modules/order/front/routes.json +++ b/modules/order/front/routes.json @@ -41,7 +41,7 @@ "order": "$ctrl.order" } }, { - "url": "/catalog?categoryId&typeId", + "url": "/catalog?categoryId&typeId&itemId&tags", "state": "order.card.catalog", "component": "vn-order-catalog", "description": "Catalog", From 9e435e9553284fab80e403a193a40e9f3855ed73 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 19 Feb 2020 12:34:33 +0100 Subject: [PATCH 94/95] Some changes --- modules/order/front/catalog/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index 87dff29e2..e0ed61175 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -278,18 +278,19 @@ class Controller { updateStateParams() { const params = {}; + params.categoryId = undefined; if (this.categoryId) params.categoryId = this.categoryId; - else params.categoryId = undefined; + params.typeId = undefined; if (this.typeId) params.typeId = this.typeId; - else params.typeId = undefined; + params.itemId = undefined; if (this.itemId) params.itemId = this.itemId; - else params.itemId = undefined; + params.tags = undefined; if (this.tags.length) { const tags = []; for (let tag of this.tags) { @@ -306,7 +307,7 @@ class Controller { } params.tags = JSON.stringify(tags); - } else params.tags = undefined; + } this.$state.go(this.$state.current.name, params); } From 5e1f31ebdd3093453065cd770711839f49addee8 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 20 Feb 2020 09:32:47 +0100 Subject: [PATCH 95/95] hotfix #2135 - Don't enable inputs disabled by ACL directive --- front/core/components/button/index.js | 4 +++- front/core/directives/http-click.js | 7 +++++-- front/core/directives/http-submit.js | 8 ++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/front/core/components/button/index.js b/front/core/components/button/index.js index 96d68c23b..e8c998801 100644 --- a/front/core/components/button/index.js +++ b/front/core/components/button/index.js @@ -29,8 +29,10 @@ export default class Button extends FormInput { } onClick(event) { - if (this.disabled) + if (this.disabled) { + event.preventDefault(); event.stopImmediatePropagation(); + } } } Button.$inject = ['$element', '$scope']; diff --git a/front/core/directives/http-click.js b/front/core/directives/http-click.js index 5e69d81d1..9f8426cef 100644 --- a/front/core/directives/http-click.js +++ b/front/core/directives/http-click.js @@ -14,10 +14,13 @@ export function directive($parse) { const cb = $parse($attrs.vnHttpClick); const element = $element[0]; $element.on('click', () => { - element.$ctrl.disabled = true; + const controller = element.$ctrl; + controller.$oldDisabled = field.$ctrl.disabled; + controller.disabled = true; cb($scope).finally(() => { - element.$ctrl.disabled = false; + if (!controller.$oldDisabled) + controller.disabled = false; }); }); } diff --git a/front/core/directives/http-submit.js b/front/core/directives/http-submit.js index 0cf17866e..3d93f0220 100644 --- a/front/core/directives/http-submit.js +++ b/front/core/directives/http-submit.js @@ -19,12 +19,16 @@ export function directive($parse) { const fields = angular.element(elements); angular.forEach(fields, field => { - field.$ctrl.disabled = true; + const controller = field.$ctrl; + controller.$oldDisabled = controller.disabled; + controller.disabled = true; }); cb($scope).finally(() => { angular.forEach(fields, field => { - field.$ctrl.disabled = false; + const controller = field.$ctrl; + if (!controller.$oldDisabled) + controller.disabled = false; }); }); });