4002-item.itemType #974
|
@ -1,3 +1,7 @@
|
|||
INSERT INTO salix.ACL
|
||||
(model, property, accessType, permission, principalType, principalId)
|
||||
VALUES('ItemType', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
||||
INSERT INTO `salix`.`ACL`
|
||||
vicent marked this conversation as resolved
Outdated
|
||||
(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('ItemType', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
||||
|
||||
INSERT INTO `salix`.`ACL`
|
||||
(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('ItemType', '*', 'WRITE', 'ALLOW', 'ROLE', 'buyer');
|
|
@ -26,6 +26,18 @@
|
|||
},
|
||||
"temperatureFk": {
|
||||
"type": "string"
|
||||
},
|
||||
"life": {
|
||||
vicent marked this conversation as resolved
Outdated
carlosjr
commented
relation still missing relation still missing
|
||||
"type": "number"
|
||||
},
|
||||
"promo": {
|
||||
"type": "number"
|
||||
},
|
||||
"itemPackingTypeFk": {
|
||||
"type": "string"
|
||||
},
|
||||
"isUnconventionalSize": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -3,7 +3,14 @@ import ModuleCard from 'salix/components/module-card';
|
|||
|
||||
class Controller extends ModuleCard {
|
||||
reload() {
|
||||
this.$http.get(`ItemTypes/${this.$params.id}`)
|
||||
const filter = {
|
||||
include: [
|
||||
{relation: 'worker'},
|
||||
{relation: 'category'}
|
||||
]
|
||||
};
|
||||
|
||||
this.$http.get(`ItemTypes/${this.$params.id}`, {filter})
|
||||
.then(res => this.itemType = res.data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,6 @@
|
|||
module="item"
|
||||
base-state="item.itemType"
|
||||
description="$ctrl.itemType.code">
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="deleteItemType.show()"
|
||||
name="deleteItemType"
|
||||
translate>
|
||||
Delete
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
<slot-body>
|
||||
<div class="attributes">
|
||||
<vn-label-value
|
||||
|
@ -20,6 +12,14 @@
|
|||
label="Name"
|
||||
value="{{$ctrl.itemType.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Worker"
|
||||
value="{{$ctrl.itemType.worker.firstName}} {{$ctrl.itemType.worker.lastName}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Category"
|
||||
value="{{$ctrl.itemType.category.name}}">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
|
|
|
@ -9,12 +9,6 @@ class Controller extends Descriptor {
|
|||
set itemType(value) {
|
||||
this.entity = value;
|
||||
}
|
||||
|
||||
onDelete() {
|
||||
return this.$http.delete(`ItemTypes/${this.id}`)
|
||||
.then(() => this.$state.go('item.itemType'))
|
||||
.then(() => this.vnApp.showSuccess(this.$t('ItemType removed')));
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnItemTypeDescriptor', {
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
import './index';
|
||||
|
||||
describe('component vnItemTypeDescriptor', () => {
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
|
||||
let itemType = {id: 1, name: 'foo'};
|
||||
|
||||
beforeEach(ngModule('item'));
|
||||
|
||||
beforeEach(inject(($componentController, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
controller = $componentController('vnItemTypeDescriptor', {$element: null}, {itemType});
|
||||
}));
|
||||
|
||||
describe('onDelete()', () => {
|
||||
it('should delete entity and go to index', () => {
|
||||
controller.$state.go = jest.fn();
|
||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||
|
||||
$httpBackend.expectDELETE('ItemTypes/1').respond();
|
||||
controller.onDelete();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.$state.go).toHaveBeenCalledWith('item.itemType');
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -29,6 +29,22 @@
|
|||
label="Temperature"
|
||||
value="{{summary.temperatureFk}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Life"
|
||||
value="{{summary.life}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Promo"
|
||||
value="{{summary.promo}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Item packing type"
|
||||
value="{{summary.itemPackingTypeFk}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Is unconventional size"
|
||||
value="{{summary.isUnconventionalSize}}">
|
||||
</vn-label-value>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
|
@ -0,0 +1,4 @@
|
|||
Life: Vida
|
||||
Promo: Promoción
|
||||
Item packing type: Tipo de embalaje
|
||||
Is unconventional size: Es de tamaño poco convencional
|
Loading…
Reference in New Issue
you are inserting in the same table using the INSERT INTO twice...
you can wrap both in the same insert ie:
INSERT INTO
salix
.ACL
(model
,property
,accessType
,permission
,principalType
,principalId
)VALUES
('ItemType', '', 'READ', 'ALLOW', 'ROLE', 'employee'),
('ItemType', '', 'WRITE', 'ALLOW', 'ROLE', 'buyer');