4002-item.itemType #974

Merged
carlosjr merged 10 commits from 4002-item.itemType into dev 2022-05-23 12:31:24 +00:00
8 changed files with 55 additions and 47 deletions
Showing only changes of commit 3335cb8a01 - Show all commits

View File

@ -1,3 +1,7 @@
INSERT INTO salix.ACL INSERT INTO `salix`.`ACL`
vicent marked this conversation as resolved Outdated

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');

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');
(model, property, accessType, permission, principalType, principalId) (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES('ItemType', '*', '*', 'ALLOW', 'ROLE', 'employee'); VALUES('ItemType', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL`
(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES('ItemType', '*', 'WRITE', 'ALLOW', 'ROLE', 'buyer');

View File

@ -26,6 +26,18 @@
}, },
"temperatureFk": { "temperatureFk": {
"type": "string" "type": "string"
},
"life": {
vicent marked this conversation as resolved Outdated

relation still missing

relation still missing
"type": "number"
},
"promo": {
"type": "number"
},
"itemPackingTypeFk": {
"type": "string"
},
"isUnconventionalSize": {
"type": "number"
} }
}, },
"relations": { "relations": {

View File

@ -3,7 +3,14 @@ import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard { class Controller extends ModuleCard {
reload() { 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); .then(res => this.itemType = res.data);
} }
} }

View File

@ -2,14 +2,6 @@
module="item" module="item"
base-state="item.itemType" base-state="item.itemType"
description="$ctrl.itemType.code"> description="$ctrl.itemType.code">
<slot-menu>
<vn-item
ng-click="deleteItemType.show()"
name="deleteItemType"
translate>
Delete
</vn-item>
</slot-menu>
<slot-body> <slot-body>
<div class="attributes"> <div class="attributes">
<vn-label-value <vn-label-value
@ -20,6 +12,14 @@
label="Name" label="Name"
value="{{$ctrl.itemType.name}}"> value="{{$ctrl.itemType.name}}">
</vn-label-value> </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> </div>
</slot-body> </slot-body>
</vn-descriptor-content> </vn-descriptor-content>

View File

@ -9,12 +9,6 @@ class Controller extends Descriptor {
set itemType(value) { set itemType(value) {
this.entity = 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', { ngModule.component('vnItemTypeDescriptor', {

View File

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

View File

@ -29,6 +29,22 @@
label="Temperature" label="Temperature"
value="{{summary.temperatureFk}}"> value="{{summary.temperatureFk}}">
</vn-label-value> </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-one>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>

View File

@ -0,0 +1,4 @@
Life: Vida
Promo: Promoción
Item packing type: Tipo de embalaje
Is unconventional size: Es de tamaño poco convencional