Merge branch '1945-item_type_category' of verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-12-26 12:59:33 +00:00 committed by Gitea
commit e4279733f4
5 changed files with 41 additions and 11 deletions

View File

@ -31,7 +31,15 @@
show-field="name" show-field="name"
value-field="id" value-field="id"
ng-model="$ctrl.item.typeFk" ng-model="$ctrl.item.typeFk"
initial-data="$ctrl.item.itemType"> initial-data="$ctrl.item.itemType"
fields="['categoryFk']"
include="'category'">
<tpl-item>
<div>{{name}}</div>
<div class="text-caption text-secondary">
{{category.name}}
</div>
</tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>

View File

@ -19,13 +19,19 @@
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="ItemTypes" url="ItemTypes"
label="Type" label="Type"
fields="['code', 'name']" fields="['code', 'name', 'categoryFk']"
value-field="id" value-field="id"
ng-model="$ctrl.item.typeFk" ng-model="$ctrl.item.typeFk"
search-function="{or: [{code: {like: $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}"> search-function="{or: [{code: {like: $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}"
<tpl-item style="display: flex;"> include="'category'">
<div style="width: 3em; padding-right: 1em;">{{::code}}</div> <tpl-item>
<div>{{::name}}</div> <div style="display: flex;">
<div style="width: 3em; padding-right: 1em;">{{::code}}</div>
<div>{{::name}}</div>
</div>
<div class="text-caption text-secondary">
{{category.name}}
</div>
</tpl-item> </tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-one <vn-autocomplete vn-one

View File

@ -20,14 +20,21 @@
value-field="id" value-field="id"
ng-model="filter.categoryFk"> ng-model="filter.categoryFk">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete <vn-autocomplete vn-one
vn-one
url="ItemTypes" url="ItemTypes"
label="Type" label="Type"
where="{categoryFk: filter.categoryFk}" where="{categoryFk: filter.categoryFk}"
show-field="name" show-field="name"
value-field="id" value-field="id"
ng-model="filter.typeFk"> ng-model="filter.typeFk"
fields="['categoryFk']"
include="'category'">
<tpl-item>
<div>{{name}}</div>
<div class="text-caption text-secondary">
{{category.name}}
</div>
</tpl-item>>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>

View File

@ -38,11 +38,12 @@ module.exports = Self => {
order.agencyModeFk order.agencyModeFk
]); ]);
stmts.push(stmt); stmts.push(stmt);
stmt = new ParameterizedSQL(`SELECT it.id, it.name stmt = new ParameterizedSQL(`SELECT it.id, it.name, ic.name categoryName
FROM tmp.availableCalc ac FROM tmp.availableCalc ac
JOIN cache.available a ON a.calc_id = ac.calcFk JOIN cache.available a ON a.calc_id = ac.calcFk
JOIN item i ON i.id = a.item_id JOIN item i ON i.id = a.item_id
JOIN itemType it ON it.id = i.typeFk JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk
WHERE it.categoryFk = ? WHERE it.categoryFk = ?
GROUP BY it.id`, [ GROUP BY it.id`, [
itemCategoryId itemCategoryId

View File

@ -29,7 +29,15 @@
ng-model="$ctrl.type.id" ng-model="$ctrl.type.id"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Type"> label="Type"
fields="['categoryFk']"
include="'category'">
<tpl-item>
<div>{{name}}</div>
<div class="text-caption text-secondary">
{{categoryName}}
</div>
</tpl-item>
<prepend> <prepend>
<vn-icon icon="search"></vn-icon> <vn-icon icon="search"></vn-icon>
</prepend> </prepend>