diff --git a/client/claim/routes.json b/client/claim/routes.json index 3d0af1acf1..7cb4be051d 100644 --- a/client/claim/routes.json +++ b/client/claim/routes.json @@ -33,6 +33,18 @@ "claim": "$ctrl.claim" } }, + { + "url": "/basic-data", + "state": "claim.card.basicData", + "component": "vn-claim-basic-data", + "description": "Basic data", + "params": { + "claim": "$ctrl.claim" + }, + "menu": { + "icon": "settings" + } + }, { "url": "/detail", "state": "claim.card.detail", diff --git a/client/claim/src/basic-data/index.html b/client/claim/src/basic-data/index.html new file mode 100644 index 0000000000..774ebe3154 --- /dev/null +++ b/client/claim/src/basic-data/index.html @@ -0,0 +1,76 @@ + + +
+ + Basic data + + + + + {{firstName}} {{name}} + + + + + + + + + + + + + + + + + + + + + +
diff --git a/client/claim/src/basic-data/index.js b/client/claim/src/basic-data/index.js new file mode 100644 index 0000000000..be5ab2fde0 --- /dev/null +++ b/client/claim/src/basic-data/index.js @@ -0,0 +1,9 @@ +import ngModule from '../module'; +import './style.scss'; + +ngModule.component('vnClaimBasicData', { + template: require('./index.html'), + bindings: { + claim: '<' + } +}); diff --git a/client/claim/src/basic-data/locale/es.yml b/client/claim/src/basic-data/locale/es.yml new file mode 100644 index 0000000000..221b17cdc1 --- /dev/null +++ b/client/claim/src/basic-data/locale/es.yml @@ -0,0 +1,6 @@ +Contact: Contacto +Claim state: Estado de la reclamación +Is paid with mana: Cargado al maná +Responsability: Responsabilidad +Company: Empresa +Sales/Client: Comercial/Cliente \ No newline at end of file diff --git a/client/claim/src/basic-data/style.scss b/client/claim/src/basic-data/style.scss new file mode 100644 index 0000000000..5f14328798 --- /dev/null +++ b/client/claim/src/basic-data/style.scss @@ -0,0 +1,3 @@ +vn-claim-basic-data vn-date-picker { + padding-left: 5em; +} diff --git a/client/claim/src/card/index.js b/client/claim/src/card/index.js index f778341489..59692f6f65 100644 --- a/client/claim/src/card/index.js +++ b/client/claim/src/card/index.js @@ -7,7 +7,6 @@ class Controller { this.order = {}; this.filter = { include: [ - {relation: 'claimResponsible', scope: {fields: ['description', 'responsability']}}, {relation: 'worker', scope: {fields: ['name', 'firstName']}}, {relation: 'claimState', scope: {fields: ['id', 'description']}}, { diff --git a/client/claim/src/index.js b/client/claim/src/index.js index e3775c5d3c..54099a5ba2 100644 --- a/client/claim/src/index.js +++ b/client/claim/src/index.js @@ -3,4 +3,5 @@ export * from './module'; import './index/'; import './card'; import './descriptor'; +import './basic-data'; // import './summary'; diff --git a/client/claim/src/index/index.html b/client/claim/src/index/index.html index 281c38b88d..399111f325 100644 --- a/client/claim/src/index/index.html +++ b/client/claim/src/index/index.html @@ -26,7 +26,6 @@ Created Worker Observation - Responsible State @@ -39,7 +38,6 @@ {{::claim.created | date:'dd/MM/yyyy'}} {{::claim.worker.firstName}} {{::claim.worker.name}} {{::claim.observation}} - {{::claim.claimResponsible.description}} {{::claim.claimState.description}} clear diff --git a/client/core/src/components/input-range/index.html b/client/core/src/components/input-range/index.html index 558b320a5e..649e4de9fe 100644 --- a/client/core/src/components/input-range/index.html +++ b/client/core/src/components/input-range/index.html @@ -1,3 +1,9 @@
- + + + +
\ No newline at end of file diff --git a/client/core/src/components/input-range/index.js b/client/core/src/components/input-range/index.js index 83a46d98bf..c3c0c37da8 100644 --- a/client/core/src/components/input-range/index.js +++ b/client/core/src/components/input-range/index.js @@ -2,30 +2,71 @@ import ngModule from '../../module'; import Input from '../../lib/input'; import './style.scss'; -export default class InputRange extends Input { - constructor($element, $scope, $attrs, vnTemplate, $transclude) { +export default class inputRange extends Input { + constructor($element, $scope) { super($element, $scope); + this.mdlElement = this.element.querySelector('.mdl-slider'); + componentHandler.upgradeElement(this.mdlElement); + this.mdlElement.addEventListener('change', () => { + this._value = this.input.value; + this.$.$applyAsync(); + }); + } + + get value() { + return this._value; + } + + set value(value) { + this._value = value; + this.mdlElement.MaterialSlider.change(value); + } + + get max() { + return this.input.max; + } + + set max(value) { + this.input.max = value; + } + + get min() { + return this.input.min; + } + + set min(value) { + this.input.min = value; + } + + get step() { + return this.input.step; + } + + set step(value) { + this.input.step = value; + } + + get() { + return this._model; + } + + set model(value) { + this._model = value; } } -InputRange.$inject = ['$element', '$scope', '$attrs', '$transclude']; +inputRange.$inject = ['$element', '$scope']; ngModule.component('vnInputRange', { template: require('./index.html'), -/* transclude: { - leftIcons: '?tLeftIcons', - rightIcons: '?tRightIcons' - }, */ - controller: InputRange, + controller: inputRange, bindings: { -/* value: '=model', label: '@?', - name: '@?', disabled: ' clear diff --git a/client/core/src/filters/dateTime.js b/client/core/src/filters/dateTime.js index 5152ee2287..75e629e754 100644 --- a/client/core/src/filters/dateTime.js +++ b/client/core/src/filters/dateTime.js @@ -9,7 +9,9 @@ dateTime.$inject = ['$filter']; export default function dateTime($filter) { return function(input, format) { - return $filter('date')(new Date(input), format); + let value = typeof input === 'string' ? new Date(input) : input; + + return $filter('date')(value, format); }; } ngModule.filter('dateTime', dateTime); diff --git a/services/claim/common/models/claim.json b/services/claim/common/models/claim.json index d6562e8677..7ca5d15b28 100644 --- a/services/claim/common/models/claim.json +++ b/services/claim/common/models/claim.json @@ -21,12 +21,16 @@ "required": true }, "isChargedToMana": { - "type": "Number", + "type": "boolean", "required": true }, "created": { "type": "date", "required": true + }, + "responsibility": { + "type": "Number", + "required": true } }, "relations": { @@ -44,11 +48,6 @@ "type": "belongsTo", "model": "Worker", "foreignKey": "workerFk" - }, - "claimResponsible": { - "type": "belongsTo", - "model": "ClaimResponsible", - "foreignKey": "claimResponsibleFk" - } + } } } diff --git a/services/db/install/dump/01-structure.sql b/services/db/install/dump/01-structure.sql index 101e1a2743..afeb366631 100644 --- a/services/db/install/dump/01-structure.sql +++ b/services/db/install/dump/01-structure.sql @@ -17197,7 +17197,7 @@ BEGIN DECLARE datINV DATE; SELECT FechaInventario INTO datINV FROM tblContadores; - ALTER TABLE `article_inventory` + ALTER TABLE `article_inventory` ADD `buy_date` datetime NOT NULL; UPDATE article_inventory INNER JOIN @@ -17224,7 +17224,7 @@ BEGIN GROUP BY article_id ) AS buy ON article_inventory.article_id = buy.article_id - SET article_inventory.buy_date = buy.bdate; + SET article_inventory.buy_date = buy.bdate; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -22626,7 +22626,8 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `calling`() BEGIN - DROP TEMPORARY TABLE IF EXISTS Agenda, Agenda2; + +DROP TEMPORARY TABLE IF EXISTS Agenda, Agenda2; CREATE TEMPORARY TABLE IF NOT EXISTS Agenda (Telefono varchar(15) PRIMARY KEY, Cliente VARCHAR(45)); @@ -25283,7 +25284,8 @@ BEGIN -- Insertamos los tickets que ya tienen expediciones, que fallaran si se repite la clave primaria. - INSERT INTO zeleVOL(Provincia, Id_Ticket, Bultos) SELECT p.name, e.ticket_id, COUNT(e.ticket_id) + INSERT INTO zeleVOL(Provincia, Id_Ticket, Bultos) + SELECT p.name, e.ticket_id, COUNT(e.ticket_id) FROM expeditions e JOIN Tickets t ON ticket_id = Id_Ticket JOIN Consignatarios c USING(Id_Consigna) @@ -25317,7 +25319,8 @@ BEGIN GROUP BY p.name, Id_Ticket ) sub GROUP BY province ON DUPLICATE KEY UPDATE Faltan = Faltan; - -- Mostramos el resultado + + -- Mostramos el resultado SELECT Provincia, COUNT(Id_Ticket) expediciones, SUM(Bultos) Bultos, SUM(Faltan) Prevision FROM zeleVOL @@ -31855,7 +31858,8 @@ BEGIN INSERT INTO Mensajes(Mensaje,Fecha,Remitente,Destinatario) VALUES(memTXT, NOW(),idREM, idDES); - SELECT LAST_INSERT_ID() INTO last_ID; + + SELECT LAST_INSERT_ID() INTO last_ID; INSERT INTO Incidencias(Incidencia,Id_Trabajador,Destino,Fecha,Fecha_Mod) @@ -43405,7 +43409,7 @@ SET character_set_client = utf8; 1 AS `observation`, 1 AS `clientFk`, 1 AS `workerFk`, - 1 AS `claimResponsibleFk`, + 1 AS `responsibility`, 1 AS `isChargedToMana`, 1 AS `created`*/; SET character_set_client = @saved_cs_client; @@ -48227,38 +48231,38 @@ DELIMITER ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`z-developer`@`%`*/ /*!50106 EVENT `printingQueueChecker` ON SCHEDULE EVERY 10 MINUTE STARTS '2018-05-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN - - DECLARE vCurrentCount INT; - DECLARE vCheckSum INT; - DECLARE vIsAlreadyNotified BOOLEAN; - - SELECT COUNT(*), SUM(id) INTO vCurrentCount, vCheckSum - FROM printingQueue WHERE state = 1; - - SELECT isAlreadyNotified INTO vIsAlreadyNotified - FROM printingQueueCheck; - - IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND - (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND - vIsAlreadyNotified = FALSE - THEN - INSERT INTO vn2008.mail (`to`, subject, text) - VALUES ('cau@verdnatura.es', - 'servidor de impresion parado', - CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas')); - UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; - END IF; - - IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND - vIsAlreadyNotified = TRUE - THEN - UPDATE printingQueueCheck SET isAlreadyNotified = FALSE; - END IF; - - UPDATE printingQueueCheck - SET lastCount = vCurrentCount, - lastCheckSum = vCheckSum; +/*!50106 CREATE*/ /*!50117 DEFINER=`z-developer`@`%`*/ /*!50106 EVENT `printingQueueChecker` ON SCHEDULE EVERY 10 MINUTE STARTS '2018-05-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN + + DECLARE vCurrentCount INT; + DECLARE vCheckSum INT; + DECLARE vIsAlreadyNotified BOOLEAN; + + SELECT COUNT(*), SUM(id) INTO vCurrentCount, vCheckSum + FROM printingQueue WHERE state = 1; + + SELECT isAlreadyNotified INTO vIsAlreadyNotified + FROM printingQueueCheck; + + IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND + (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND + vIsAlreadyNotified = FALSE + THEN + INSERT INTO vn2008.mail (`to`, subject, text) + VALUES ('cau@verdnatura.es', + 'servidor de impresion parado', + CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas')); + UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; + END IF; + + IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND + vIsAlreadyNotified = TRUE + THEN + UPDATE printingQueueCheck SET isAlreadyNotified = FALSE; + END IF; + + UPDATE printingQueueCheck + SET lastCount = vCurrentCount, + lastCheckSum = vCheckSum; END */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; @@ -71331,15 +71335,15 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `myTicketGetRows`(`vTicket` INT) -BEGIN - - SELECT r.itemFk, r.quantity, r.concept, r.price, r.discount, - i.image, i.category, i.size, i.stems, i.inkFk, - i.tag5, i.value5, i.tag6, i.value6, i.tag7, i.value7 - FROM myTicketRow r - JOIN vn.item i ON i.id = r.itemFk - WHERE r.ticketFk = vTicket - ORDER BY r.concept; +BEGIN + + SELECT r.itemFk, r.quantity, r.concept, r.price, r.discount, + i.image, i.category, i.size, i.stems, i.inkFk, + i.tag5, i.value5, i.tag6, i.value6, i.tag7, i.value7 + FROM myTicketRow r + JOIN vn.item i ON i.id = r.itemFk + WHERE r.ticketFk = vTicket + ORDER BY r.concept; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75226,7 +75230,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `claim` AS select `c`.`id` AS `id`,`c`.`Fecha` AS `ticketCreated`,`c`.`cl_est_id` AS `claimStateFk`,`c`.`notas` AS `observation`,`c`.`Id_Cliente` AS `clientFk`,`c`.`Id_Trabajador` AS `workerFk`,`c`.`sensib` AS `claimResponsibleFk`,`c`.`mana` AS `isChargedToMana`,`c`.`odbc_date` AS `created` from `vn2008`.`cl_main` `c` */; +/*!50001 VIEW `claim` AS select `c`.`id` AS `id`,`c`.`Fecha` AS `ticketCreated`,`c`.`cl_est_id` AS `claimStateFk`,`c`.`notas` AS `observation`,`c`.`Id_Cliente` AS `clientFk`,`c`.`Id_Trabajador` AS `workerFk`,`c`.`sensib` AS `responsibility`,`c`.`mana` AS `isChargedToMana`,`c`.`odbc_date` AS `created` from `vn2008`.`cl_main` `c` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index db9ede044d..9ed2fff656 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -809,10 +809,10 @@ INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk ( 4, 102, 2, CURDATE(), 18, 18, 567), ( 5, 102, 3, CURDATE(), 19, 19, 567); -INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `claimResponsibleFk`, `isChargedToMana`, `created` ) +INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created` ) VALUES - ( 1, CURDATE(), 1, 'observation one' , 101, 18, 3, 0, CURDATE()), - ( 2, CURDATE(), 2, 'observation two' , 101, 18, 3, 0, CURDATE()), + ( 1, CURDATE(), 1, 'observation one' , 101, 18, 1, 0, CURDATE()), + ( 2, CURDATE(), 2, 'observation two' , 101, 18, 2, 0, CURDATE()), ( 3, CURDATE(), 3, 'observation three' , 101, 18, 3, 0, CURDATE()); INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`) diff --git a/services/loopback/common/locale/es.json b/services/loopback/common/locale/es.json index 3536a10b87..f68d6861ef 100644 --- a/services/loopback/common/locale/es.json +++ b/services/loopback/common/locale/es.json @@ -41,5 +41,6 @@ "The value should be a number": "El valor debe ser un numero", "This order is not editable": "Esta orden no se puede modificar", "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado", - "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda" + "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda", + "is not a valid date": "No es una fecha valida" } \ No newline at end of file