This commit is contained in:
Juan Ferrer Toribio 2018-02-01 12:55:06 +01:00
commit aae0cd9128
8 changed files with 94 additions and 17 deletions

View File

@ -13,8 +13,6 @@ describe('Directive focus', () => {
_$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
$element = angular.element(_element);
if (_childElement) {
let childElement = angular.element(_childElement);
$element[0] < childElement; // FIXME
$element[0].firstChild.focus = jasmine.createSpy(focus);
}
$element[0].focus = jasmine.createSpy('focus');

View File

@ -16,7 +16,8 @@ class ItemCard {
{relation: "producer"},
{relation: "intrastat"},
{relation: "expence"},
{relation: "taxClass"}
{relation: "taxClass"},
{relation: "itemTag", scope: {order: "priority ASC", include: {relation: "tag"}}}
]
};
this.$http.get(`/item/api/Items/${this.$state.params.id}?filter=${JSON.stringify(filter)}`).then(

View File

@ -9,9 +9,10 @@
<vn-auto pad-medium>
<div><span translate>Id</span>: <b>{{$ctrl.item.id}}</b></div>
<div><span translate>Name</span>: <b>{{$ctrl.item.name}}</b></div>
<div><span translate>Description</span>: <b>{{$ctrl.item.description}}</b></div>
<div><span translate>Size</span>: <b>{{$ctrl.item.size}}</b></div>
<div><span translate>Type</span>: <b>{{$ctrl.item.itemType.name}}</b></div>
<div><span translate>{{$ctrl.item.itemTag[0].tag.name}}</span>: <b>{{$ctrl.item.itemTag[0].value}}</b></div>
<div><span translate>{{$ctrl.item.itemTag[1].tag.name}}</span>: <b>{{$ctrl.item.itemTag[1].value}}</b></div>
<div><span translate>{{$ctrl.item.itemTag[2].tag.name}}</span>: <b>{{$ctrl.item.itemTag[2].value}}</b></div>
<div><span translate>{{$ctrl.item.itemTag[3].tag.name}}</span>: <b>{{$ctrl.item.itemTag[3].value}}</b></div>
</vn-auto>
</vn-vertical>
</vn-card>

View File

@ -606,16 +606,16 @@ INSERT INTO `salix`.`user`(`id`,`username`,`password`,`email`)
INSERT INTO `vn`.`tag`(`id`,`name`,`free`,`isQuantitatif`,`sourceTable`,`unit`)
VALUES
(1, 'color', 1, 0, null, null),
(2, 'power', 1, 0, null, null),
(3, 'shape', 1, 0, null, null),
(4, 'location', 1, 0, null, null),
(5, 'owner', 1, 1, null, null);
(1, 'Color', 1, 0, null, null),
(2, 'Power', 1, 0, null, null),
(3, 'Shape', 1, 0, null, null),
(4, 'Location', 1, 0, null, null),
(5, 'Owner', 1, 1, null, null);
INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
VALUES
(1, 1, 1, 'Yellow', 0),
(2, 1, 2, 'Manipulates time', 0),
(3, 1, 3, 'round', 0),
(4, 1, 4, 'given to Gamora by the Warlock', 0),
(5, 1, 5, 'Gamora', 0);
(1, 1, 1, 'Yellow', 5),
(2, 1, 2, 'Manipulates time', 4),
(3, 1, 3, 'round', 3),
(4, 1, 4, 'Gamoras hideout', 2),
(5, 1, 5, 'Gamora', 1);

View File

@ -79,6 +79,11 @@
"type": "belongsTo",
"model": "TaxClass",
"foreignKey": "taxClassFk"
},
"itemTag": {
"type": "hasMany",
"model": "ItemTag",
"foreignKey": "itemFk"
}
}
}

View File

@ -0,0 +1,36 @@
{
"name": "ItemTag",
"base": "VnModel",
"options": {
"mysql": {
"table": "itemTag",
"database": "vn"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"value": {
"type": "String",
"required": true
},
"priority": {
"type": "Number"
}
},
"relations": {
"item": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "itemFk"
},
"tag": {
"type": "belongsTo",
"model": "Tag",
"foreignKey": "tagFk"
}
}
}

View File

@ -0,0 +1,30 @@
{
"name": "Tag",
"base": "VnModel",
"options": {
"mysql": {
"table": "tag",
"database": "vn"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "String",
"required": true
},
"free": {
"type": "Number"
},
"sourceTable": {
"type": "String"
},
"unit": {
"type": "String"
}
}
}

View File

@ -28,5 +28,11 @@
},
"Expence": {
"dataSource": "vn"
},
"ItemTag": {
"dataSource": "vn"
},
"Tag": {
"dataSource": "vn"
}
}