diff --git a/db/changes/10460-motherDay/00-aclItemType.sql b/db/changes/10460-motherDay/00-aclItemType.sql
new file mode 100644
index 000000000..86fae1b1f
--- /dev/null
+++ b/db/changes/10460-motherDay/00-aclItemType.sql
@@ -0,0 +1,3 @@
+INSERT INTO salix.ACL
+(model, property, accessType, permission, principalType, principalId)
+VALUES('ItemType', '*', '*', 'ALLOW', 'ROLE', 'employee');
\ No newline at end of file
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index e03027b36..1d794c359 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -773,14 +773,19 @@ INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`, `code`
(7, 'Accessories', 1, NULL, 'icon-accessory', 'accessory'),
(8, 'Fruit', 1, NULL, 'icon-fruit', 'fruit');
-INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `warehouseFk`, `life`,`workerFk`, `isPackaging`)
+INSERT INTO `vn`.`temperature`(`code`, `name`, `description`)
VALUES
- (1, 'CRI', 'Crisantemo', 2, 1, 31, 35, 0),
- (2, 'ITG', 'Anthurium', 1, 1, 31, 35, 0),
- (3, 'WPN', 'Paniculata', 2, 1, 31, 35, 0),
- (4, 'PRT', 'Delivery ports', 3, 1, NULL, 35, 1),
- (5, 'CON', 'Container', 3, 1, NULL, 35, 1),
- (6, 'ALS', 'Alstroemeria', 1, 1, 31, 16, 0);
+ ('warm', 'Warm', 'Warm'),
+ ('cool', 'Cool', 'Cool');
+
+INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `warehouseFk`, `life`,`workerFk`, `isPackaging`, `temperatureFk`)
+ VALUES
+ (1, 'CRI', 'Crisantemo', 2, 1, 31, 35, 0, 'cool'),
+ (2, 'ITG', 'Anthurium', 1, 1, 31, 35, 0, 'cool'),
+ (3, 'WPN', 'Paniculata', 2, 1, 31, 35, 0, 'cool'),
+ (4, 'PRT', 'Delivery ports', 3, 1, NULL, 35, 1, 'warm'),
+ (5, 'CON', 'Container', 3, 1, NULL, 35, 1, 'warm'),
+ (6, 'ALS', 'Alstroemeria', 1, 1, 31, 16, 0, 'warm');
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
VALUES
@@ -2309,11 +2314,6 @@ INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `week
(1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000);
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
-
-INSERT INTO `vn`.`temperature`(`code`, `name`, `description`)
- VALUES
- ('warm', 'Warm', 'Warm'),
- ('cool', 'Cool', 'Cool');
INSERT INTO `vn`.`thermograph`(`id`, `model`)
VALUES
diff --git a/modules/account/front/role/summary/index.js b/modules/account/front/role/summary/index.js
index eb528a894..4f321fa98 100644
--- a/modules/account/front/role/summary/index.js
+++ b/modules/account/front/role/summary/index.js
@@ -6,8 +6,6 @@ class Controller extends Component {
this._role = value;
this.$.summary = null;
if (!value) return;
- console.log(value);
-
this.$http.get(`Roles/${value.id}`)
.then(res => this.$.summary = res.data);
}
diff --git a/modules/item/back/models/item-type.json b/modules/item/back/models/item-type.json
index b7a8ced2f..c7a90aea9 100644
--- a/modules/item/back/models/item-type.json
+++ b/modules/item/back/models/item-type.json
@@ -22,10 +22,10 @@
"type": "number"
},
"categoryFk": {
- "type": "boolean"
+ "type": "number"
},
"temperatureFk": {
- "type": "boolean"
+ "type": "string"
}
},
"relations": {
diff --git a/modules/item/front/item-type/basic-data/index.html b/modules/item/front/item-type/basic-data/index.html
index f2888fcdf..1417a05ab 100644
--- a/modules/item/front/item-type/basic-data/index.html
+++ b/modules/item/front/item-type/basic-data/index.html
@@ -1,7 +1,7 @@
diff --git a/modules/item/front/item-type/create/index.js b/modules/item/front/item-type/create/index.js
index 1474ad5e5..ccf7744be 100644
--- a/modules/item/front/item-type/create/index.js
+++ b/modules/item/front/item-type/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('account.role.card.basicData', {id: res.data.id})
+ this.$state.go('item.itemType.card.basicData', {id: res.data.id})
);
}
}
diff --git a/modules/item/front/item-type/descriptor/index.html b/modules/item/front/item-type/descriptor/index.html
index e4b8a6bbf..63bbf8726 100644
--- a/modules/item/front/item-type/descriptor/index.html
+++ b/modules/item/front/item-type/descriptor/index.html
@@ -1,7 +1,7 @@
+ description="$ctrl.itemType.code">
+
+
diff --git a/modules/item/front/item-type/descriptor/index.js b/modules/item/front/item-type/descriptor/index.js
index 83c9a1da2..02fd59932 100644
--- a/modules/item/front/item-type/descriptor/index.js
+++ b/modules/item/front/item-type/descriptor/index.js
@@ -2,10 +2,6 @@ import ngModule from '../../module';
import Descriptor from 'salix/components/descriptor';
class Controller extends Descriptor {
- $onInit() {
- console.log(this.itemType, this.entity);
- }
-
get itemType() {
return this.entity;
}
diff --git a/modules/item/front/item-type/descriptor/index.spec.js b/modules/item/front/item-type/descriptor/index.spec.js
index e2761c639..3da1bad1a 100644
--- a/modules/item/front/item-type/descriptor/index.spec.js
+++ b/modules/item/front/item-type/descriptor/index.spec.js
@@ -1,16 +1,16 @@
import './index';
-describe('component vnRoleDescriptor', () => {
+describe('component vnItemTypeDescriptor', () => {
let controller;
let $httpBackend;
- let role = {id: 1, name: 'foo'};
+ let itemType = {id: 1, name: 'foo'};
- beforeEach(ngModule('account'));
+ beforeEach(ngModule('item'));
beforeEach(inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
- controller = $componentController('vnRoleDescriptor', {$element: null}, {role});
+ controller = $componentController('vnItemTypeDescriptor', {$element: null}, {itemType});
}));
describe('onDelete()', () => {
@@ -18,11 +18,11 @@ describe('component vnRoleDescriptor', () => {
controller.$state.go = jest.fn();
jest.spyOn(controller.vnApp, 'showSuccess');
- $httpBackend.expectDELETE('Roles/1').respond();
+ $httpBackend.expectDELETE('ItemTypes/1').respond();
controller.onDelete();
$httpBackend.flush();
- expect(controller.$state.go).toHaveBeenCalledWith('account.role');
+ expect(controller.$state.go).toHaveBeenCalledWith('item.itemType');
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
});
});
diff --git a/modules/item/front/item-type/index.js b/modules/item/front/item-type/index.js
index c8282e196..f33658da3 100644
--- a/modules/item/front/item-type/index.js
+++ b/modules/item/front/item-type/index.js
@@ -3,6 +3,5 @@ import './index/';
import './summary';
import './card';
import './descriptor';
-import './search-panel';
import './create';
import './basic-data';
diff --git a/modules/item/front/item-type/index/index.html b/modules/item/front/item-type/index/index.html
index 459b5d71c..50b9eb172 100644
--- a/modules/item/front/item-type/index/index.html
+++ b/modules/item/front/item-type/index/index.html
@@ -33,14 +33,11 @@
-
+
-
\ No newline at end of file
diff --git a/modules/item/front/item-type/index/index.js b/modules/item/front/item-type/index/index.js
index 5530e5cf3..54ecba997 100644
--- a/modules/item/front/item-type/index/index.js
+++ b/modules/item/front/item-type/index/index.js
@@ -4,7 +4,6 @@ import Section from 'salix/components/section';
export default class Controller extends Section {
preview(itemType) {
this.selectedItemType = itemType;
- console.log(this.selectedItemType);
this.$.summary.show();
}
}
diff --git a/modules/item/front/item-type/index/locale/es.yml b/modules/item/front/item-type/index/locale/es.yml
index 3a36f7c96..1a71ff212 100644
--- a/modules/item/front/item-type/index/locale/es.yml
+++ b/modules/item/front/item-type/index/locale/es.yml
@@ -1 +1,2 @@
-Item Type: Familia
\ No newline at end of file
+Item Type: Familia
+New itemType: Nueva familia
\ No newline at end of file
diff --git a/modules/item/front/item-type/search-panel/index.html b/modules/item/front/item-type/search-panel/index.html
deleted file mode 100644
index ce2919910..000000000
--- a/modules/item/front/item-type/search-panel/index.html
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/modules/item/front/item-type/search-panel/index.js b/modules/item/front/item-type/search-panel/index.js
deleted file mode 100644
index 3a6ed4f86..000000000
--- a/modules/item/front/item-type/search-panel/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import ngModule from '../../module';
-import SearchPanel from 'core/components/searchbar/search-panel';
-
-ngModule.component('vnItemTypePanel', {
- template: require('./index.html'),
- controller: SearchPanel
-});
diff --git a/modules/item/front/item-type/summary/index.html b/modules/item/front/item-type/summary/index.html
index f7971190c..d6704fc8b 100644
--- a/modules/item/front/item-type/summary/index.html
+++ b/modules/item/front/item-type/summary/index.html
@@ -1,5 +1,7 @@
- {{summary.name}}
+
+ {{summary.id}} - {{summary.name}} - {{summary.worker.firstName}} {{summary.worker.lastName}}
+
Basic data
@@ -7,13 +9,25 @@
label="Id"
value="{{summary.id}}">
+
+
+ label="Worker"
+ value="{{summary.worker.firstName}} {{summary.worker.lastName}}">
+
+
+
+
diff --git a/modules/item/front/item-type/summary/index.js b/modules/item/front/item-type/summary/index.js
index 1048fa88d..0a3bdc13c 100644
--- a/modules/item/front/item-type/summary/index.js
+++ b/modules/item/front/item-type/summary/index.js
@@ -6,10 +6,15 @@ class Controller extends Component {
this._itemType = value;
this.$.summary = null;
if (!value) return;
- console.log(value);
- this.$http.get(`ItemTypes/${value.id}`)
- .then(res => console.log(res.data));
+ const filter = {
+ include: [
+ {relation: 'worker'},
+ {relation: 'category'}
+ ]
+ };
+ this.$http.get(`ItemTypes/${value.id}`, {filter})
+ .then(res => this.$.summary = res.data);
}
get itemType() {
diff --git a/modules/item/front/routes.json b/modules/item/front/routes.json
index 400399c38..5743d0ce7 100644
--- a/modules/item/front/routes.json
+++ b/modules/item/front/routes.json
@@ -21,6 +21,9 @@
{"state": "item.card.diary", "icon": "icon-transaction"},
{"state": "item.card.last-entries", "icon": "icon-regentry"},
{"state": "item.card.log", "icon": "history"}
+ ],
+ "itemType": [
+ {"state": "item.itemType.card.basicData", "icon": "settings"}
]
},
"keybindings": [
@@ -198,7 +201,7 @@
"component": "vn-item-type-summary",
"description": "Summary",
"params": {
- "itemType": "$ctrl.itemType"
+ "item-type": "$ctrl.itemType"
},
"acl": ["buyer"]
},
@@ -208,7 +211,7 @@
"component": "vn-item-type-basic-data",
"description": "Basic data",
"params": {
- "itemType": "$ctrl.itemType"
+ "item-type": "$ctrl.itemType"
},
"acl": ["buyer"]
}