refactor item

This commit is contained in:
Javi Gallego 2018-12-17 14:15:39 +01:00
parent 8cd6e1411e
commit 8726540342
7 changed files with 70 additions and 35 deletions

View File

@ -19,9 +19,7 @@
field="$ctrl.item.longName"
info="Full name calculates based on tags 1-3. Is not recommended to change it manually">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
<vn-autocomplete vn-one
url="/item/api/ItemTypes"
label="Type"
show-field="name"
@ -29,6 +27,8 @@
field="$ctrl.item.typeFk"
initial-data="$ctrl.item.itemType">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
url="/item/api/Intrastats"
label="Intrastat"
@ -42,22 +42,12 @@
<div>{{::description}}</div>
</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Reference"
field="$ctrl.item.description">
</vn-textfield>
<vn-autocomplete vn-one
url="/item/api/Expences"
label="Expence"
field="$ctrl.item.expenceFk"
initial-data="$ctrl.item.expence">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield>
<vn-autocomplete vn-one
url="/item/api/Origins"
label="Origin"
@ -65,12 +55,29 @@
value-field="id"
field="$ctrl.item.originFk"
initial-data="$ctrl.item.origin">
</vn-autocomplete>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Reference"
field="$ctrl.item.comment">
</vn-textfield>
<vn-textfield vn-one label="Size" field="$ctrl.item.size"></vn-textfield>
<vn-textfield vn-one label="stems" field="$ctrl.item.stems"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="density" field="$ctrl.item.density"></vn-textfield>
<!-- <vn-textfield vn-one label="compression" field="$ctrl.item.compression"></vn-textfield> -->
<vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-check
vn-one
label="Active"
field="$ctrl.item.isActive">
</vn-check>
<vn-textarea vn-one label="description" field="$ctrl.item.description"></vn-textarea>
</vn-horizontal>
</vn-card>
<vn-button-bar>

View File

@ -4,3 +4,4 @@ Full name calculates based on tags 1-3. Is not recommended to change it manually
basado en los tags 1-3.
No se recomienda cambiarlo manualmente
Is active: Activo
Expence: Gasto

View File

@ -2,7 +2,7 @@ Item: Artículo
View item: Ver artículo
Category: Categoría
Description: Descripción
Size: Tamaño
Size: Medida
Type: Tipo
Name: Nombre
Full name: Nombre completo
@ -41,6 +41,9 @@ Available: Disponible
Create: Crear
Client card: Ficha del cliente
Shipped: F. envio
stems: Tallos
Compression: Compresión
Density: Densidad
#Sections
Items: Artículos

View File

@ -25,7 +25,7 @@
</vn-auto>
<vn-one margin-medium>
<vn-vertical name="basicData">
<h5 translate>Basic data</h5>
<h5 translate>Basic data (I)</h5>
<vn-label-value label="Name"
value="{{$ctrl.summary.item.name}}">
</vn-label-value>
@ -35,20 +35,14 @@
<vn-label-value label="Type"
value="{{$ctrl.summary.item.itemType.name}}">
</vn-label-value>
<vn-label-value label="Intrastat code"
value="{{$ctrl.summary.item.intrastat.id}}">
</vn-label-value>
<vn-label-value label="Intrastat"
value="{{$ctrl.summary.item.intrastat.description}}">
</vn-label-value>
<vn-label-value label="Relevancy"
value="{{$ctrl.summary.item.relevancy}}">
<vn-label-value label="Size"
value="{{$ctrl.summary.item.itemType.size}}">
</vn-label-value>
<vn-label-value label="Origin"
value="{{$ctrl.summary.item.origin.name}}">
</vn-label-value>
<vn-label-value label="Expence"
value="{{$ctrl.summary.item.expence.name}}">
<vn-label-value label="stems"
value="{{$ctrl.summary.item.origin.stems}}">
</vn-label-value>
<vn-label-value label="Buyer"
value="{{$ctrl.summary.item.itemType.worker.firstName}} {{$ctrl.summary.item.itemType.worker.name}}">
@ -56,20 +50,45 @@
</vn-vertical>
</vn-one>
<vn-one margin-medium>
<vn-vertical name="tax">
<h5 translate>Tax</h5>
<vn-label-value label="{{tax.country.country}}" ng-repeat="tax in $ctrl.summary.item.taxes"
value="{{tax.taxClass.description}}">
<vn-vertical name="basicData">
<h5 translate>Basic data (II)</h5>
<vn-label-value label="Intrastat code"
value="{{$ctrl.summary.item.intrastat.id}}">
</vn-label-value>
<vn-label-value label="Intrastat"
value="{{$ctrl.summary.item.intrastat.description}}">
</vn-label-value>
<vn-label-value label="Reference"
value="{{$ctrl.summary.item.comment}}">
</vn-label-value>
<vn-label-value label="Relevancy"
value="{{$ctrl.summary.item.relevancy}}">
</vn-label-value>
<vn-label-value label="Density"
value="{{$ctrl.summary.item.density}}">
</vn-label-value>
<vn-label-value label="Compression"
value="{{$ctrl.summary.item.compression}}">
</vn-label-value>
<vn-label-value label="Expence"
value="{{$ctrl.summary.item.expence.name}}">
</vn-label-value>
</vn-one>
<vn-one margin-medium>
<vn-vertical name="tags">
<h5 translate>Tags</h5>
<vn-label-value label="{{tag.priority}} {{tag.tag.name}}" ng-repeat="tag in $ctrl.summary.tags track by tag.id"
value="{{tag.value}}">
</vn-label-value>
</vn-vertical>
</vn-one>
</vn-horizontal>
<vn-horizontal>
<vn-one margin-medium>
<vn-vertical name="tags">
<h5 translate>Tags</h5>
<vn-label-value label="{{tag.tag.name}}" ng-repeat="tag in $ctrl.summary.tags track by tag.id"
value="{{tag.value}}">
<vn-vertical name="tax">
<h5 translate>Tax</h5>
<vn-label-value label="{{tax.country.country}}" ng-repeat="tax in $ctrl.summary.item.taxes"
value="{{tax.taxClass.description}}">
</vn-label-value>
</vn-vertical>
</vn-one>

View File

@ -39,6 +39,7 @@ module.exports = Self => {
delete copy.itemTag;
delete copy.description;
delete copy.image;
delete copy.comment;
let newItem = await Self.create(copy);
let promises = [];

View File

@ -67,6 +67,7 @@ module.exports = Self => {
where: {
itemFk: id
},
order: 'priority',
include: {
relation: 'tag'
}

View File

@ -43,6 +43,9 @@
"relevancy": {
"type": "Number"
},
"density": {
"type": "Number"
},
"image": {
"type": "String"
},