3347-worker_basic-data #925

Merged
carlosjr merged 8 commits from 3347-worker_basic-data into dev 2022-04-11 11:02:17 +00:00
10 changed files with 252 additions and 5 deletions

View File

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

View File

@ -0,0 +1,90 @@
ALTER TABLE `vn`.`country` ADD `a3Code` INT NULL COMMENT 'Código país para a3';
UPDATE `vn`.`country` c
JOIN `vn2008`.`payroll_pais` `p` ON `p`.`pais` = `c`.`country`
SET `c`.`a3Code` = `p`.`codpais`;
UPDATE `vn`.`country`
SET `a3Code` = 710
WHERE `country` = 'Sud-Africa'; -- ÁFRICA DEL SUR
UPDATE `vn`.`country`
SET `a3Code` = 643
WHERE `country` = 'Rusia'; -- FEDERACIÓN DE RUSIA
UPDATE `vn`.`country`
SET `a3Code` = 28
WHERE `country` = 'Antigua'; -- ANTIGUA Y BARBUDA
UPDATE `vn`.`country`
SET `a3Code` = 840
WHERE `country` = 'USA'; -- ESTADOS UNIDOS
UPDATE `vn`.`country`
SET `a3Code` = 404
WHERE `country` = 'Kenya'; -- KENIA
UPDATE `vn`.`country`
SET `a3Code` = 498
WHERE `country` = 'Moldavia'; -- REPÚBLICA DE MOLDAVIA
UPDATE `vn`.`country`
SET `a3Code` = 826
WHERE `country` = 'Gran Bretaña'; -- REINO UNIDO
UPDATE `vn`.`country`
SET `a3Code` = 484
WHERE `country` = 'Mexico'; -- MÉJICO
UPDATE `vn`.`country`
SET `a3Code` = 716
WHERE `country` = 'Zimbawe'; -- ZINBABWE
UPDATE `vn`.`country`
SET `a3Code` = 203
WHERE `country` = 'Chequia'; -- REPÚBLICA CHECA
UPDATE `vn`.`country`
SET `a3Code` = 764
WHERE `country` = 'Thailandia'; -- TAILANDIA
UPDATE `vn`.`country`
SET `a3Code` = 276
WHERE `country` = 'Alemania'; -- REPÚBLICA FEDERAL DE ALEMANIA
UPDATE `vn`.`country`
SET `a3Code` = 112
WHERE `country` = 'Bielorrusia'; -- BELARUS
UPDATE `vn`.`country`
SET `a3Code` = 528
WHERE `country` = 'Holanda'; -- PAÍSES BAJOS
UPDATE `vn`.`country`
SET `a3Code` = 410
WHERE `country` = 'Corea del Sur'; -- COREA (REPÚBLICA)
UPDATE `vn`.`country`
SET `a3Code` = 724
WHERE `country` = 'España exento'; -- ESPAÑA
-- Borrar registro USA de country:
UPDATE `vn`.`supplier` `s`
SET `s`.`countryFk` = 62
WHERE `s`.`countryFk` = 12;
UPDATE `vn`.`bankEntity`
SET `countryFk` = 62
WHERE `countryFk` = 12;
DELETE FROM `vn`.`country`
WHERE `id`= 12;
UPDATE `vn2008`.`payroll_pais`
SET `pais`='COREA NORTE (REPÚBLICA DEM. POPULAR)'
WHERE `codpais`=408;
UPDATE `vn2008`.`payroll_pais`
SET `pais`='COREA SUR (REPÚBLICA) '
WHERE `codpais`=410;
RENAME TABLE `vn2008`.`payroll_pais` TO `vn2008`.`payroll_pais__`;

View File

@ -0,0 +1,51 @@
ALTER TABLE `vn`.`worker` MODIFY COLUMN `maritalStatus__` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
UPDATE `vn`.`worker` `w`
SET `w`.`maritalStatus__` = NULL;
UPDATE `vn`.`worker` `w`
JOIN `vn`.`person` `p` ON `p`.`workerFk` = `w`.`id`
JOIN `postgresql`.`profile` `pr` ON `pr`.`person_id` = `p`.`id`
JOIN `vn2008`.`profile_labour_payroll` `pl` ON `pl`.`profile_id` = `pr`.`profile_id`
SET `w`.`maritalStatus__` = `pl`.`estadocivil`;
ALTER TABLE `vn`.`worker` ADD `originCountryFk` mediumint(8) unsigned NULL COMMENT 'País de origen';
ALTER TABLE `vn`.`worker` ADD `educationLevelFk` SMALLINT NULL;
ALTER TABLE `vn`.`worker` ADD `SSN` varchar(15) NULL;
ALTER TABLE `vn`.`worker` CHANGE `maritalStatus__` `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `vn`.`worker` MODIFY COLUMN `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `vn`.`worker` CHANGE `maritalStatus` maritalStatus enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER sectorFk;
ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_2` FOREIGN KEY (`educationLevelFk`) REFERENCES `vn`.`educationLevel`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_1` FOREIGN KEY (`originCountryFk`) REFERENCES `vn`.`country`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
INSERT INTO `vn`.`country` (`country`, `CEE`, `code`, `politicalCountryFk`, `isUeeMember`, `a3Code`)
VALUES
('Argentina',2,'AR',80,0,32),
('Cuba',2,'CU',81,0,192),
('Guinea Ecuatorial',2,'GQ',82,0,226),
('Guinea',2,'GN',83,0,324),
('Honduras',2,'HN',84,0,340),
('Mali',2,'ML',85,0,466),
('Nicaragua',2,'NI',86,0,558),
('Pakistán',2,'PK',87,0,586),
('Paraguay',2,'PY',88,0,600),
('Senegal',2,'SN',89,0,686),
('Uruguay',2,'UY',90,0,858),
('Venezuela',2,'VE',91,0,862),
('Bulgaria',2,'BG',92,1,100),
('Georgia',2,'GE',93,0,268);
UPDATE `vn`.`worker` `w`
JOIN `vn`.`person` `p` ON `p`.`workerFk` = `w`.`id`
JOIN `postgresql`.`profile` `pr` ON `pr`.`person_id` = `p`.`id`
JOIN `vn2008`.`profile_labour_payroll` `pl` ON `pl`.`profile_id` = `pr`.`profile_id`
JOIN `vn`.`country` `co` ON `co`.`a3Code` = `pl`.`codpais`
SET `w`.`originCountryFk` = `co`.`id`;
UPDATE `vn`.`worker` `w`
JOIN `vn`.`person` `p` ON `p`.`workerFk` = `w`.`id`
JOIN `postgresql`.`profile` `pr` ON `pr`.`person_id` = `p`.`id`
JOIN `vn2008`.`profile_labour_payroll` pl ON `pl`.`profile_id` = `pr`.`profile_id`
SET `w`.`SSN` = CONCAT(`pl`.`NSSProvincia`, `pl`.`NssNumero`, `pl`.`NssDC`);
RENAME TABLE `vn2008`.`profile_labour_payroll` TO `vn2008`.`profile_labour_payroll__`;

View File

@ -47,10 +47,36 @@ INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`
INSERT INTO `account`.`account`(`id`) INSERT INTO `account`.`account`(`id`)
SELECT id FROM `account`.`user`; SELECT id FROM `account`.`user`;
INSERT INTO `vn`.`educationLevel` (`id`, `name`)
VALUES
(1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
(2, 'ENSEÑANZAS DE BACHILLERATO');
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`) INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`)
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9 SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9
FROM `vn`.`user`; FROM `vn`.`user`;
ALTER TABLE `vn`.`worker` ADD `originCountryFk` mediumint(8) unsigned NULL COMMENT 'País de origen';
ALTER TABLE `vn`.`worker` ADD `educationLevelFk` SMALLINT NULL;
ALTER TABLE `vn`.`worker` ADD `SSN` varchar(15) NULL;
ALTER TABLE `vn`.`worker` CHANGE `maritalStatus__` `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `vn`.`worker` MODIFY COLUMN `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `vn`.`worker` CHANGE `maritalStatus` maritalStatus enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER sectorFk;
ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_2` FOREIGN KEY (`educationLevelFk`) REFERENCES `vn`.`educationLevel`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_1` FOREIGN KEY (`originCountryFk`) REFERENCES `vn`.`country`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
UPDATE `vn`.`worker` `w`
SET `maritalStatus` = 'S';
UPDATE `vn`.`worker` `w`
SET `originCountryFk` = '1';
UPDATE `vn`.`worker` `w`
SET `educationLevelFk` = '2';
UPDATE `vn`.`worker` `w`
SET `SSN` = '123456789123';
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20; UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9; UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18; UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18;

View File

@ -17,6 +17,9 @@
"Department": { "Department": {
"dataSource": "vn" "dataSource": "vn"
}, },
"EducationLevel": {
"dataSource": "vn"
},
"WorkCenter": { "WorkCenter": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,18 @@
{
"name": "EducationLevel",
"base": "VnModel",
"options": {
"mysql": {
"table": "educationLevel"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"name": {
"type": "string"
}
}
}

View File

@ -13,7 +13,7 @@
}, },
"properties": { "properties": {
"id": { "id": {
"type": "Number", "type": "number",
"id": true, "id": true,
"description": "Identifier" "description": "Identifier"
}, },
@ -26,14 +26,26 @@
"required": true "required": true
}, },
"phone": { "phone": {
"type" : "String" "type" : "string"
}, },
"userFk": { "userFk": {
"type" : "Number", "type" : "number",
"required": true "required": true
}, },
"bossFk": { "bossFk": {
"type" : "Number" "type" : "number"
},
"maritalStatus": {
"type" : "string"
},
"originCountryFk": {
"type" : "number"
},
"educationLevelFk": {
"type" : "number"
},
"SSN": {
"type" : "string"
} }
}, },
"relations": { "relations": {

View File

@ -30,7 +30,6 @@
rule> rule>
</vn-textfield> </vn-textfield>
<vn-autocomplete <vn-autocomplete
disabled="false"
ng-model="$ctrl.worker.bossFk" ng-model="$ctrl.worker.bossFk"
url="Workers/activeWithInheritedRole" url="Workers/activeWithInheritedRole"
show-field="nickname" show-field="nickname"
@ -39,6 +38,39 @@
label="Boss"> label="Boss">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-autocomplete
label="Marital status"
data="$ctrl.maritalStatus"
vicent marked this conversation as resolved
Review

disabled "false" is a default value.

disabled "false" is a default value.
show-field="name"
value-field="code"
ng-model="$ctrl.worker.maritalStatus">
</vn-autocomplete>
<vn-autocomplete
ng-model="$ctrl.worker.originCountryFk"
url="Countries"
fields="['id', 'country', 'code']"
vicent marked this conversation as resolved
Review

disabled "false" is a default value.

disabled "false" is a default value.
show-field="country"
value-field="id"
label="Origin country">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
ng-model="$ctrl.worker.educationLevelFk"
url="EducationLevels"
fields="['id', 'name']"
show-field="name"
vicent marked this conversation as resolved
Review

disabled "false" is a default value.

disabled "false" is a default value.
value-field="id"
label="Education level">
</vn-autocomplete>
<vn-textfield
vn-one
label="SSN"
ng-model="$ctrl.worker.SSN"
rule>
</vn-textfield>
</vn-horizontal>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>

View File

@ -2,6 +2,13 @@ import ngModule from '../module';
import Section from 'salix/components/section'; import Section from 'salix/components/section';
class Controller extends Section { class Controller extends Section {
constructor($element, $) {
super($element, $);
this.maritalStatus = [
{code: 'M', name: this.$t('Married')},
{code: 'S', name: this.$t('Single')}
];
}
onSubmit() { onSubmit() {
return this.$.watcher.submit() return this.$.watcher.submit()
.then(() => this.card.reload()); .then(() => this.card.reload());

View File

@ -0,0 +1,6 @@
Marital status: Estado civil
Origin country: País origen
Education level: Nivel educación
SSN: NSS
Married: Casado/a
Single: Soltero/a
vicent marked this conversation as resolved Outdated

Soltero/a

Soltero/a