This commit is contained in:
parent
5a375ebfda
commit
fd64cb7e80
|
@ -1,5 +1,5 @@
|
||||||
CREATE TABLE `vn`.`locker` (
|
CREATE TABLE `vn`.`locker` (
|
||||||
`code` varchar(10) NOT NULL,
|
`code` varchar(10) DEFAULT NULL,
|
||||||
`gender` varchar(255) DEFAULT NULL,
|
`gender` varchar(255) DEFAULT NULL,
|
||||||
`workerFk` int(10) unsigned DEFAULT NULL,
|
`workerFk` int(10) unsigned DEFAULT NULL,
|
||||||
PRIMARY KEY (`code`),
|
PRIMARY KEY (`code`),
|
||||||
|
@ -17,3 +17,7 @@ INSERT INTO `vn`.`locker` (code, gender, workerFk) VALUES
|
||||||
INSERT INTO `vn`.`locker` (code, gender, workerFk) VALUES
|
INSERT INTO `vn`.`locker` (code, gender, workerFk) VALUES
|
||||||
('200A', 'F', NULL), ('201A', 'F', NULL), ('202A', 'F', NULL), ('203A', 'F', NULL), ('204A', 'F', NULL), ('205A', 'F', NULL), ('206A', 'F', NULL),
|
('200A', 'F', NULL), ('201A', 'F', NULL), ('202A', 'F', NULL), ('203A', 'F', NULL), ('204A', 'F', NULL), ('205A', 'F', NULL), ('206A', 'F', NULL),
|
||||||
('200B', 'F', NULL), ('201B', 'F', NULL), ('202B', 'F', NULL), ('203B', 'F', NULL), ('204B', 'F', NULL), ('205B', 'F', NULL), ('206B', 'F', NULL);
|
('200B', 'F', NULL), ('201B', 'F', NULL), ('202B', 'F', NULL), ('203B', 'F', NULL), ('204B', 'F', NULL), ('205B', 'F', NULL), ('206B', 'F', NULL);
|
||||||
|
|
||||||
|
|
||||||
|
-- Eliminar locker
|
||||||
|
ALTER TABLE `vn`.`worker` DROP COLUMN `locker`;
|
||||||
|
|
|
@ -21,7 +21,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.chooseLocker = async filter => {
|
Self.chooseLocker = async filter => {
|
||||||
const query =
|
const query =
|
||||||
`SELECT l.code AS locker_code
|
`SELECT l.code
|
||||||
FROM worker w
|
FROM worker w
|
||||||
JOIN locker l ON w.sex = l.gender
|
JOIN locker l ON w.sex = l.gender
|
||||||
WHERE w.id = ? AND l.workerFk IS NULL;
|
WHERE w.id = ? AND l.workerFk IS NULL;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "locker",
|
"name": "locker",
|
||||||
"description": "Employee´s locker",
|
"description": "Employee's locker",
|
||||||
"base": "Loggable",
|
"base": "Loggable",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
@ -13,13 +13,10 @@
|
||||||
},
|
},
|
||||||
"gender": {
|
"gender": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
|
||||||
"workerFk": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
"id": {
|
"worker": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "worker",
|
"model": "worker",
|
||||||
"foreignKey": "workerFk"
|
"foreignKey": "workerFk"
|
||||||
|
|
|
@ -44,9 +44,6 @@
|
||||||
},
|
},
|
||||||
"code": {
|
"code": {
|
||||||
"type" : "string"
|
"type" : "string"
|
||||||
},
|
|
||||||
"locker": {
|
|
||||||
"type" : "number"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -77,8 +77,8 @@
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
label="Locker"
|
label="Locker"
|
||||||
ng-model="$ctrl.locker"
|
url="Lockers"
|
||||||
data="chooseLocker">
|
data="$ctrl.locker.code">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
value="{{worker.client.phone}}">
|
value="{{worker.client.phone}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Locker"
|
<vn-label-value label="Locker"
|
||||||
value="{{worker.locker}}">
|
value="{{::locker.code}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Controller extends Summary {
|
||||||
scope: {fields: ['id', 'code', 'name']}
|
scope: {fields: ['id', 'code', 'name']}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue