From ac344d6edda14eb8823d8eb62af624f8e70a5b67 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 14 Jul 2022 09:54:28 +0200 Subject: [PATCH] refactor: add column id PK and updated column code UQ --- db/changes/10480-june/00-shelving.sql | 14 ++++++ modules/shelving/back/models/shelving.json | 17 ++++--- modules/shelving/back/models/shelvingLog.json | 48 +++++++++++++++++++ modules/shelving/front/basic-data/index.html | 2 +- modules/shelving/front/create/index.html | 33 ++++++++++--- modules/shelving/front/create/index.js | 2 +- modules/shelving/front/create/locale/es.yml | 11 ----- modules/shelving/front/descriptor/index.html | 4 +- .../shelving/front/descriptor/locale/es.yml | 7 --- modules/shelving/front/index/index.html | 10 ++-- modules/shelving/front/index/locale/es.yml | 7 +-- modules/shelving/front/locale/es.yml | 1 - modules/shelving/front/log/index.html | 1 + modules/shelving/front/log/index.js | 7 +++ modules/shelving/front/main/index.html | 2 +- modules/shelving/front/main/index.js | 6 +-- modules/shelving/front/main/locale/es.yml | 1 + modules/shelving/front/routes.json | 2 +- .../shelving/front/search-panel/locale/es.yml | 5 +- modules/shelving/front/summary/index.html | 10 ++-- modules/shelving/front/summary/locale/es.yml | 17 ++----- 21 files changed, 133 insertions(+), 74 deletions(-) create mode 100644 db/changes/10480-june/00-shelving.sql create mode 100644 modules/shelving/back/models/shelvingLog.json delete mode 100644 modules/shelving/front/create/locale/es.yml delete mode 100644 modules/shelving/front/descriptor/locale/es.yml delete mode 100644 modules/shelving/front/locale/es.yml create mode 100644 modules/shelving/front/log/index.html create mode 100644 modules/shelving/front/log/index.js create mode 100644 modules/shelving/front/main/locale/es.yml diff --git a/db/changes/10480-june/00-shelving.sql b/db/changes/10480-june/00-shelving.sql new file mode 100644 index 000000000..045698e8f --- /dev/null +++ b/db/changes/10480-june/00-shelving.sql @@ -0,0 +1,14 @@ +ALTER TABLE `vn`.`itemShelving` DROP FOREIGN KEY itemShelving_fk2; +ALTER TABLE `vn`.`shelvingLog` DROP FOREIGN KEY shelvingLog_FK_ibfk_1; +ALTER TABLE `vn`.`smartTag` DROP FOREIGN KEY smartTag_shelving_fk; +ALTER TABLE `vn`.`workerShelving` DROP FOREIGN KEY workerShelving_shelving_fk; + +ALTER TABLE `vn`.`shelving` DROP PRIMARY KEY; +ALTER TABLE `vn`.`shelving` ADD id INT auto_increment PRIMARY KEY NULL; +ALTER TABLE `vn`.`shelving` CHANGE id id int(11) auto_increment NOT NULL FIRST; +ALTER TABLE `vn`.`shelving` ADD CONSTRAINT shelving_UN UNIQUE KEY (code); + +ALTER TABLE `vn`.`itemShelving` ADD CONSTRAINT itemShelving_fk2 FOREIGN KEY (shelvingFk) REFERENCES `vn`.`shelving`(code) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `vn`.`shelvingLog` ADD CONSTRAINT shelvingLog_FK_ibfk_1 FOREIGN KEY (originFk) REFERENCES `vn`.`shelving`(code) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `vn`.`smartTag` ADD CONSTRAINT smartTag_FK FOREIGN KEY (shelvingFk) REFERENCES `vn`.`shelving`(code) ON DELETE RESTRICT ON UPDATE CASCADE; +ALTER TABLE `vn`.`workerShelving` ADD CONSTRAINT workerShelving_FK_1 FOREIGN KEY (shelvingFk) REFERENCES `vn`.`shelving`(code) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/modules/shelving/back/models/shelving.json b/modules/shelving/back/models/shelving.json index b28539942..c7fcb2560 100644 --- a/modules/shelving/back/models/shelving.json +++ b/modules/shelving/back/models/shelving.json @@ -8,20 +8,19 @@ }, "properties": { "id": { - "type": "string", + "type": "number", "id": true, - "description": "Identifier", - "mysql": { - "columnName": "code" - } + "description": "Identifier" + }, + "code": { + "type": "string", + "required": true }, "parkingFk": { - "type": "number", - "required": true + "type": "number" }, "isPrinted": { - "type": "boolean", - "required": true + "type": "boolean" }, "priority": { "type": "number" diff --git a/modules/shelving/back/models/shelvingLog.json b/modules/shelving/back/models/shelvingLog.json new file mode 100644 index 000000000..61eb0813f --- /dev/null +++ b/modules/shelving/back/models/shelvingLog.json @@ -0,0 +1,48 @@ +{ + "name": "ShelvingLog", + "base": "VnModel", + "options": { + "mysql": { + "table": "shelvingLog" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "originFk": { + "type": "string", + "required": true + }, + "userFk": { + "type": "number", + "required": true + }, + "action": { + "type": "string" + }, + "creationDate": { + "type": "date" + }, + "description": { + "type": "string" + }, + "changedModel": { + "type": "string" + }, + "oldInstance": { + "type": "string" + }, + "newInstance": { + "type": "string" + }, + "changedModelId": { + "type": "number" + }, + "changedModelValue": { + "type": "string" + } + } +} diff --git a/modules/shelving/front/basic-data/index.html b/modules/shelving/front/basic-data/index.html index cf66cc917..68d61e169 100644 --- a/modules/shelving/front/basic-data/index.html +++ b/modules/shelving/front/basic-data/index.html @@ -11,7 +11,7 @@ diff --git a/modules/shelving/front/create/index.html b/modules/shelving/front/create/index.html index c462b54a6..edb3a7d3b 100644 --- a/modules/shelving/front/create/index.html +++ b/modules/shelving/front/create/index.html @@ -8,12 +8,33 @@
- - + + + + + + + + + + + + diff --git a/modules/shelving/front/create/index.js b/modules/shelving/front/create/index.js index bb0e441eb..22c28f496 100644 --- a/modules/shelving/front/create/index.js +++ b/modules/shelving/front/create/index.js @@ -4,7 +4,7 @@ import Section from 'salix/components/section'; export default class Controller extends Section { onSubmit() { return this.$.watcher.submit().then(res => - this.$state.go('shelving.card.basicData', {id: res.data.id}) + this.$state.go('shelving.card.summary', {id: res.data.id}) ); } } diff --git a/modules/shelving/front/create/locale/es.yml b/modules/shelving/front/create/locale/es.yml deleted file mode 100644 index 31b7cd403..000000000 --- a/modules/shelving/front/create/locale/es.yml +++ /dev/null @@ -1,11 +0,0 @@ -Name: Nombre -Tax number: NIF/CIF -Business name: Razón social -Web user: Usuario Web -Email: E-mail -Create and edit: Crear y editar -You can save multiple emails: >- - Puede guardar varios correos electrónicos encadenándolos mediante comas - sin espacios, ejemplo: user@dominio.com, user2@dominio.com siendo el primer - correo electrónico el principal -The type of business must be filled in basic data: El tipo de negocio debe estar rellenado en datos básicos diff --git a/modules/shelving/front/descriptor/index.html b/modules/shelving/front/descriptor/index.html index 7ec836ed4..1344bb52a 100644 --- a/modules/shelving/front/descriptor/index.html +++ b/modules/shelving/front/descriptor/index.html @@ -1,6 +1,6 @@ + value="{{$ctrl.shelving.code}}"> -
{{::shelving.id}}
-
{{::shelving.parking.code}}
-
{{::shelving.priority}}
+
{{::shelving.code}}
+ + + +
\ No newline at end of file diff --git a/modules/shelving/front/log/index.js b/modules/shelving/front/log/index.js new file mode 100644 index 000000000..588e0995a --- /dev/null +++ b/modules/shelving/front/log/index.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +ngModule.vnComponent('vnShelvingLog', { + template: require('./index.html'), + controller: Section, +}); diff --git a/modules/shelving/front/main/index.html b/modules/shelving/front/main/index.html index 20e29b5f9..485ecd342 100644 --- a/modules/shelving/front/main/index.html +++ b/modules/shelving/front/main/index.html @@ -7,7 +7,7 @@ diff --git a/modules/shelving/front/main/index.js b/modules/shelving/front/main/index.js index 63c5689b1..96689fbd9 100644 --- a/modules/shelving/front/main/index.js +++ b/modules/shelving/front/main/index.js @@ -11,14 +11,10 @@ export default class Shelving extends ModuleMain { }; } - $onInit() { - console.log(this.$params); - } - exprBuilder(param, value) { switch (param) { case 'search': - return {id: {like: `%${value}%`}}; + return {code: {like: `%${value}%`}}; case 'parkingFk': case 'userFk': case 'isRecyclable': diff --git a/modules/shelving/front/main/locale/es.yml b/modules/shelving/front/main/locale/es.yml new file mode 100644 index 000000000..367908d36 --- /dev/null +++ b/modules/shelving/front/main/locale/es.yml @@ -0,0 +1 @@ +Search shelving by code, parking or worker: Busca matrículas por código, parking o trabajador \ No newline at end of file diff --git a/modules/shelving/front/routes.json b/modules/shelving/front/routes.json index e51ff9d25..53fe8957a 100644 --- a/modules/shelving/front/routes.json +++ b/modules/shelving/front/routes.json @@ -2,7 +2,7 @@ "module": "shelving", "name": "Shelvings", "icon" : "contact_support", - "dependencies": [], + "dependencies": ["worker"], "validations" : true, "menus": { "main": [ diff --git a/modules/shelving/front/search-panel/locale/es.yml b/modules/shelving/front/search-panel/locale/es.yml index 77253a4ef..592ba0b0d 100644 --- a/modules/shelving/front/search-panel/locale/es.yml +++ b/modules/shelving/front/search-panel/locale/es.yml @@ -1,4 +1 @@ -Province: Provincia -Country: País -Tax number: NIF / CIF -Search suppliers by id, name or alias: Busca proveedores por id, nombre o alias \ No newline at end of file +Search shelvings by code: Busca matriculas por código \ No newline at end of file diff --git a/modules/shelving/front/summary/index.html b/modules/shelving/front/summary/index.html index 8b193c3ee..61e44d278 100644 --- a/modules/shelving/front/summary/index.html +++ b/modules/shelving/front/summary/index.html @@ -1,12 +1,12 @@
- - {{::$ctrl.summary.id}} + {{::$ctrl.summary.code}}
@@ -20,7 +20,7 @@ + value="{{::$ctrl.summary.code}}"> {{$ctrl.summary.worker.user.nickname}} diff --git a/modules/shelving/front/summary/locale/es.yml b/modules/shelving/front/summary/locale/es.yml index 35291e579..d5d14d52a 100644 --- a/modules/shelving/front/summary/locale/es.yml +++ b/modules/shelving/front/summary/locale/es.yml @@ -1,12 +1,5 @@ -Verified: Verificado -Country: País -Tax number: NIF / CIF -Search suppliers by id, name or alias: Busca proveedores por id, nombre o alias -Is Farmer: Es agrícola -Sage tax type: Tipo de impuesto Sage -Sage transaction type: Tipo de transacción Sage -Sage withholding: Retencion Sage -Go to the supplier: Ir al proveedor -Responsible: Responsable -Supplier activity: Actividad proveedor -Healt register: Pasaporte sanitario \ No newline at end of file +Code: Código +Parking: Parking +Priority: Prioridad +Worker: Trabajador +Recyclable: Reciclable \ No newline at end of file