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" field="$ctrl.item.longName"
info="Full name calculates based on tags 1-3. Is not recommended to change it manually"> info="Full name calculates based on tags 1-3. Is not recommended to change it manually">
</vn-textfield> </vn-textfield>
</vn-horizontal> <vn-autocomplete vn-one
<vn-horizontal>
<vn-autocomplete vn-one
url="/item/api/ItemTypes" url="/item/api/ItemTypes"
label="Type" label="Type"
show-field="name" show-field="name"
@ -29,6 +27,8 @@
field="$ctrl.item.typeFk" field="$ctrl.item.typeFk"
initial-data="$ctrl.item.itemType"> initial-data="$ctrl.item.itemType">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/item/api/Intrastats" url="/item/api/Intrastats"
label="Intrastat" label="Intrastat"
@ -42,22 +42,12 @@
<div>{{::description}}</div> <div>{{::description}}</div>
</tpl-item> </tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Reference"
field="$ctrl.item.description">
</vn-textfield>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/item/api/Expences" url="/item/api/Expences"
label="Expence" label="Expence"
field="$ctrl.item.expenceFk" field="$ctrl.item.expenceFk"
initial-data="$ctrl.item.expence"> initial-data="$ctrl.item.expence">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="/item/api/Origins" url="/item/api/Origins"
label="Origin" label="Origin"
@ -65,12 +55,29 @@
value-field="id" value-field="id"
field="$ctrl.item.originFk" field="$ctrl.item.originFk"
initial-data="$ctrl.item.origin"> 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-check
vn-one vn-one
label="Active" label="Active"
field="$ctrl.item.isActive"> field="$ctrl.item.isActive">
</vn-check> </vn-check>
<vn-textarea vn-one label="description" field="$ctrl.item.description"></vn-textarea>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-button-bar> <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. basado en los tags 1-3.
No se recomienda cambiarlo manualmente No se recomienda cambiarlo manualmente
Is active: Activo Is active: Activo
Expence: Gasto

View File

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

View File

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

View File

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

View File

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

View File

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