refactor: add column id PK and updated column code UQ
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-07-14 09:54:28 +02:00
parent 762ec3045f
commit ac344d6edd
21 changed files with 133 additions and 74 deletions

View File

@ -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;

View File

@ -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"

View File

@ -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"
}
}
}

View File

@ -11,7 +11,7 @@
<vn-horizontal>
<vn-textfield
label="Code"
ng-model="$ctrl.shelving.id"
ng-model="$ctrl.shelving.code"
rule
vn-focus>
</vn-textfield>

View File

@ -8,12 +8,33 @@
<form name="form" vn-http-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg">
<vn-vertical>
<vn-textfield
label="Code"
ng-model="$ctrl.shelving.id"
rule
vn-focus>
</vn-textfield>
<vn-horizontal>
<vn-textfield
label="Code"
ng-model="$ctrl.shelving.code"
rule
vn-focus>
</vn-textfield>
<vn-autocomplete
vn-one
url="Parkings"
label="Parking"
show-field="code"
value-field="id"
ng-model="$ctrl.shelving.parkingFk">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-input-number vn-one
label="Priority"
ng-model="$ctrl.shelving.priority"
rule>
</vn-input-number>
<vn-check
label="Recyclable"
ng-model="$ctrl.shelving.isRecyclable">
</vn-check>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-button-bar>

View File

@ -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})
);
}
}

View File

@ -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

View File

@ -1,6 +1,6 @@
<vn-descriptor-content
module="shelving"
description="$ctrl.shelving.id"
description="$ctrl.shelving.code"
summary="$ctrl.$.summary">
<slot-menu>
<vn-item
@ -14,7 +14,7 @@
<div class="attributes">
<vn-label-value
label="Code"
value="{{$ctrl.shelving.id}}">
value="{{$ctrl.shelving.code}}">
</vn-label-value>
<vn-label-value
label="Parking"

View File

@ -1,7 +0,0 @@
Tax number: NIF / CIF
All entries with current supplier: Todas las entradas con el proveedor actual
Go to client: Ir al cliente
Verified supplier: Proveedor verificado
Unverified supplier: Proveedor no verificado
Inactive supplier: Proveedor inactivo
Create invoiceIn: Crear factura recibida

View File

@ -13,9 +13,13 @@
translate-attr="{title: 'View shelving'}"
class="vn-item search-result">
<vn-item-section>
<h6>{{::shelving.id}}</h6>
<div>{{::shelving.parking.code}}</div>
<div>{{::shelving.priority}}</div>
<h6>{{::shelving.code}}</h6>
<vn-label-value label="Parking"
value="{{::shelving.parking.code}}">
</vn-label-value>
<vn-label-value label="Priority"
value="{{::shelving.priority}}">
</vn-label-value>
</vn-item-section>
<vn-item-section side>
<vn-icon-button

View File

@ -1,5 +1,2 @@
Payment deadline: Plazo de pago
Pay day: Dia de pago
Account: Cuenta
Pay method: Metodo de pago
Tax number: Nif
Parking: Parking
Priority: Prioridad

View File

@ -1 +0,0 @@
Accounts: Cuentas

View File

@ -0,0 +1 @@
<vn-log url="ShelvingLog" origin-id="$ctrl.$params.id"></vn-log>

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
ngModule.vnComponent('vnShelvingLog', {
template: require('./index.html'),
controller: Section,
});

View File

@ -7,7 +7,7 @@
<vn-portal slot="topbar">
<vn-searchbar
panel="vn-shelving-search-panel"
info="Search shelving by code"
info="Search shelving by code, parking or worker"
model="model"
expr-builder="$ctrl.exprBuilder(param, value)">
</vn-searchbar>

View File

@ -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':

View File

@ -0,0 +1 @@
Search shelving by code, parking or worker: Busca matrículas por código, parking o trabajador

View File

@ -2,7 +2,7 @@
"module": "shelving",
"name": "Shelvings",
"icon" : "contact_support",
"dependencies": [],
"dependencies": ["worker"],
"validations" : true,
"menus": {
"main": [

View File

@ -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
Search shelvings by code: Busca matriculas por código

View File

@ -1,12 +1,12 @@
<vn-card class="summary">
<h5>
<a ng-if="::$ctrl.summary.id"
<a ng-if="::$ctrl.summary.code"
vn-tooltip="Go to the shelving"
ui-sref="shelving.card.summary({id: {{::$ctrl.summary.id}}})"
ui-sref="shelving.card.summary({id: {{::$ctrl.summary.code}}})"
name="goToSummary">
<vn-icon-button icon="launch"></vn-icon-button>
</a>
<span>{{::$ctrl.summary.id}}</span>
<span>{{::$ctrl.summary.code}}</span>
</h5>
<vn-horizontal>
<vn-one>
@ -20,7 +20,7 @@
<vn-vertical>
<vn-label-value
label="Code"
value="{{::$ctrl.summary.id}}">
value="{{::$ctrl.summary.code}}">
</vn-label-value>
<vn-label-value
label="Parking"
@ -32,7 +32,7 @@
</vn-label-value>
<vn-label-value label="Worker">
<span
ng-click="workerDescriptor.show($event, $ctrl.summary.userFk)"
ng-click="workerDescriptor.show($event, $ctrl.summary.worker.user.id)"
class="link">
{{$ctrl.summary.worker.user.nickname}}
</span>

View File

@ -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
Code: Código
Parking: Parking
Priority: Prioridad
Worker: Trabajador
Recyclable: Reciclable