#166 - Item list ordered by name
This commit is contained in:
parent
04ac260738
commit
ded0c6a53a
|
@ -0,0 +1,34 @@
|
||||||
|
<form name="form" ng-submit="$ctrl.submit()">
|
||||||
|
<vn-card pad-large>
|
||||||
|
<vn-title>Item barcode</vn-title>
|
||||||
|
<vn-horizontal ng-repeat="barcode in $ctrl.barcodes track by $index">
|
||||||
|
<vn-textfield
|
||||||
|
vn-three
|
||||||
|
label="Code"
|
||||||
|
model="barcode.code"
|
||||||
|
vn-acl="buyer, replenisher">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-one pad-medium-top>
|
||||||
|
<vn-icon
|
||||||
|
vn-acl="buyer, replenisher"
|
||||||
|
pointer
|
||||||
|
medium-grey
|
||||||
|
icon="remove_circle_outline"
|
||||||
|
ng-click="$ctrl.removeBarcode($index)">
|
||||||
|
</vn-icon>
|
||||||
|
<vn-icon
|
||||||
|
vn-acl="buyer, replenisher"
|
||||||
|
pointer
|
||||||
|
margin-medium-left
|
||||||
|
orange
|
||||||
|
icon="add_circle"
|
||||||
|
ng-if = "barcode.showAddIcon"
|
||||||
|
ng-click="$ctrl.addBarcode()"
|
||||||
|
></vn-icon>
|
||||||
|
</vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-submit label="Save"></vn-submit>
|
||||||
|
</vn-button-bar>
|
||||||
|
</form>
|
|
@ -125,6 +125,6 @@ export default class Controller {
|
||||||
Controller.$inject = ['$state', '$scope', '$http', '$q', '$translate', 'vnApp'];
|
Controller.$inject = ['$state', '$scope', '$http', '$q', '$translate', 'vnApp'];
|
||||||
|
|
||||||
ngModule.component('vnItemBarcode', {
|
ngModule.component('vnItemBarcode', {
|
||||||
template: require('./item-barcode.html'),
|
template: require('./barcode.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
});
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
import './item-barcode.js';
|
import './barcode.js';
|
||||||
|
|
||||||
describe('Item', () => {
|
describe('Item', () => {
|
||||||
describe('Component vnItemBarcode', () => {
|
describe('Component vnItemBarcode', () => {
|
|
@ -31,6 +31,6 @@ class ItemBotanical {
|
||||||
ItemBotanical.$inject = ['$http', '$state'];
|
ItemBotanical.$inject = ['$http', '$state'];
|
||||||
|
|
||||||
ngModule.component('vnItemBotanical', {
|
ngModule.component('vnItemBotanical', {
|
||||||
template: require('./item-botanical.html'),
|
template: require('./botanical.html'),
|
||||||
controller: ItemBotanical
|
controller: ItemBotanical
|
||||||
});
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
import './item-botanical.js';
|
import './botanical.js';
|
||||||
|
|
||||||
describe('ItemBotanical', () => {
|
describe('ItemBotanical', () => {
|
||||||
describe('Component vnItemBotanical', () => {
|
describe('Component vnItemBotanical', () => {
|
|
@ -60,6 +60,6 @@ class ItemCard {
|
||||||
ItemCard.$inject = ['$http', '$state', '$timeout'];
|
ItemCard.$inject = ['$http', '$state', '$timeout'];
|
||||||
|
|
||||||
ngModule.component('vnItemCard', {
|
ngModule.component('vnItemCard', {
|
||||||
template: require('./item-card.html'),
|
template: require('./card.html'),
|
||||||
controller: ItemCard
|
controller: ItemCard
|
||||||
});
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
import './item-card.js';
|
import './card.js';
|
||||||
|
|
||||||
describe('Item', () => {
|
describe('Item', () => {
|
||||||
describe('Component vnItemCard', () => {
|
describe('Component vnItemCard', () => {
|
|
@ -18,6 +18,6 @@ class ItemCreate {
|
||||||
ItemCreate.$inject = ['$scope', '$state'];
|
ItemCreate.$inject = ['$scope', '$state'];
|
||||||
|
|
||||||
ngModule.component('vnItemCreate', {
|
ngModule.component('vnItemCreate', {
|
||||||
template: require('./item-create.html'),
|
template: require('./create.html'),
|
||||||
controller: ItemCreate
|
controller: ItemCreate
|
||||||
});
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
import './item-create.js';
|
import './create.js';
|
||||||
|
|
||||||
describe('Item', () => {
|
describe('Item', () => {
|
||||||
describe('Component vnItemCreate', () => {
|
describe('Component vnItemCreate', () => {
|
|
@ -15,7 +15,7 @@ class ItemData {
|
||||||
ItemData.$inject = ['$scope', '$timeout'];
|
ItemData.$inject = ['$scope', '$timeout'];
|
||||||
|
|
||||||
ngModule.component('vnItemData', {
|
ngModule.component('vnItemData', {
|
||||||
template: require('./item-data.html'),
|
template: require('./data.html'),
|
||||||
bindings: {
|
bindings: {
|
||||||
item: '<'
|
item: '<'
|
||||||
},
|
},
|
|
@ -1,7 +1,7 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
|
||||||
ngModule.component('vnItemDescriptor', {
|
ngModule.component('vnItemDescriptor', {
|
||||||
template: require('./item-descriptor.html'),
|
template: require('./descriptor.html'),
|
||||||
bindings: {
|
bindings: {
|
||||||
item: '<',
|
item: '<',
|
||||||
itemTags: '<',
|
itemTags: '<',
|
|
@ -1,22 +1,47 @@
|
||||||
<div pad-large style="min-width: 30em">
|
<div pad-large style="min-width: 30em">
|
||||||
<form ng-submit="$ctrl.onSearch()">
|
<form ng-submit="$ctrl.onSearch()">
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Id" model="$ctrl.filter.id" vn-focus></vn-textfield>
|
<vn-textfield
|
||||||
<vn-textfield vn-three label="Description" model="$ctrl.filter.description"></vn-textfield>
|
vn-one
|
||||||
|
label="Id"
|
||||||
|
model="$ctrl.filter.id"
|
||||||
|
vn-focus>
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
vn-three
|
||||||
|
label="Description"
|
||||||
|
model="$ctrl.filter.description">
|
||||||
|
</vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Category" type="number" model="$ctrl.filter.category"></vn-textfield>
|
<vn-autocomplete
|
||||||
<vn-textfield vn-one label="Size" type="number" model="$ctrl.filter.itemSize"></vn-textfield>
|
vn-one
|
||||||
</vn-horizontal>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-autocomplete vn-one
|
|
||||||
url="/item/api/ItemTypes"
|
url="/item/api/ItemTypes"
|
||||||
label="Type"
|
label="Type"
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
field="$ctrl.filter.typeFk">
|
field="$ctrl.filter.typeFk">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete
|
||||||
|
vn-one
|
||||||
|
url="/item/api/Producers"
|
||||||
|
label="Producer"
|
||||||
|
show-field="name"
|
||||||
|
value-field="id"
|
||||||
|
field="$ctrl.filter.producerFk">
|
||||||
|
</vn-autocomplete>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-autocomplete
|
||||||
|
vn-one
|
||||||
|
url="/item/api/Origins"
|
||||||
|
label="Origin"
|
||||||
|
show-field="name"
|
||||||
|
value-field="id"
|
||||||
|
field="$ctrl.filter.originFk">
|
||||||
|
</vn-autocomplete>
|
||||||
|
<vn-autocomplete
|
||||||
|
vn-one
|
||||||
url="/item/api/Inks"
|
url="/item/api/Inks"
|
||||||
label="Ink"
|
label="Ink"
|
||||||
show-field="name"
|
show-field="name"
|
||||||
|
@ -25,20 +50,17 @@
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-autocomplete vn-one
|
<vn-textfield
|
||||||
url="/item/api/Origins"
|
vn-one
|
||||||
label="Origin"
|
label="Category"
|
||||||
show-field="name"
|
model="$ctrl.filter.category">
|
||||||
value-field="id"
|
</vn-textfield>
|
||||||
field="$ctrl.filter.originFk">
|
<vn-textfield
|
||||||
</vn-autocomplete>
|
vn-one
|
||||||
<vn-autocomplete vn-one
|
label="Size"
|
||||||
url="/item/api/Producers"
|
type="number"
|
||||||
label="Producer"
|
model="$ctrl.filter.itemSize">
|
||||||
show-field="name"
|
</vn-textfield>
|
||||||
value-field="id"
|
|
||||||
field="$ctrl.filter.producerFk">
|
|
||||||
</vn-autocomplete>
|
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal margin-large-top>
|
<vn-horizontal margin-large-top>
|
||||||
<vn-submit label="Search"></vn-submit>
|
<vn-submit label="Search"></vn-submit>
|
||||||
|
|
|
@ -2,6 +2,6 @@ import ngModule from '../module';
|
||||||
import FilterItemList from '../filter-item-list';
|
import FilterItemList from '../filter-item-list';
|
||||||
|
|
||||||
ngModule.component('vnItemHistory', {
|
ngModule.component('vnItemHistory', {
|
||||||
template: require('./item-history.html'),
|
template: require('./history.html'),
|
||||||
controller: FilterItemList
|
controller: FilterItemList
|
||||||
});
|
});
|
|
@ -3,15 +3,15 @@ export * from './module';
|
||||||
import './filter-item-list';
|
import './filter-item-list';
|
||||||
import './list/list';
|
import './list/list';
|
||||||
import './filter-panel/filter-panel';
|
import './filter-panel/filter-panel';
|
||||||
import './create/item-create';
|
import './create/create';
|
||||||
import './card/item-card';
|
import './card/card';
|
||||||
import './descriptor/item-descriptor';
|
import './descriptor/descriptor';
|
||||||
import './data/item-data';
|
import './data/data';
|
||||||
import './tags/item-tags';
|
import './tags/tags';
|
||||||
import './tax/item-tax';
|
import './tax/tax';
|
||||||
import './history/item-history';
|
import './history/history';
|
||||||
import './niche/item-niche';
|
import './niche/niche';
|
||||||
import './botanical/item-botanical';
|
import './botanical/botanical';
|
||||||
import './barcode/item-barcode';
|
import './barcode/barcode';
|
||||||
import './summary/item-summary';
|
import './summary/summary';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import './item-product';
|
import './product';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class ItemList {
|
class ItemList {
|
||||||
|
|
|
@ -18,7 +18,7 @@ class ItemProduct {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnItemProduct', {
|
ngModule.component('vnItemProduct', {
|
||||||
template: require('./item-product.html'),
|
template: require('./product.html'),
|
||||||
bindings: {
|
bindings: {
|
||||||
item: '<'
|
item: '<'
|
||||||
},
|
},
|
|
@ -0,0 +1,58 @@
|
||||||
|
<vn-watcher
|
||||||
|
vn-id="watcher"
|
||||||
|
data="$ctrl.item"
|
||||||
|
form="form">
|
||||||
|
</vn-watcher>
|
||||||
|
<form name="form" ng-submit="$ctrl.submit()">
|
||||||
|
<vn-card pad-large>
|
||||||
|
<vn-title>Item niches</vn-title>
|
||||||
|
<vn-horizontal ng-repeat="itemNiche in $ctrl.niches track by $index">
|
||||||
|
<vn-autocomplete
|
||||||
|
ng-if="!itemNiche.id"
|
||||||
|
vn-one
|
||||||
|
data="$ctrl.warehouses"
|
||||||
|
show-field="name"
|
||||||
|
value-field="id"
|
||||||
|
initial-data="itemNiche.warehouse"
|
||||||
|
field="itemNiche.warehouseFk"
|
||||||
|
label="Warehouse"
|
||||||
|
vn-acl="buyer,replenisher">
|
||||||
|
</vn-autocomplete>
|
||||||
|
<vn-textfield
|
||||||
|
ng-if="itemNiche.id"
|
||||||
|
vn-one
|
||||||
|
label="Warehouse"
|
||||||
|
model="itemNiche.warehouse.name"
|
||||||
|
disabled="true">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
vn-two
|
||||||
|
label="Code"
|
||||||
|
model="itemNiche.code"
|
||||||
|
rule="itemNiche.code"
|
||||||
|
vn-acl="buyer,replenisher">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-one pad-medium-top>
|
||||||
|
<vn-icon
|
||||||
|
vn-acl="buyer,replenisher"
|
||||||
|
pointer
|
||||||
|
medium-grey
|
||||||
|
icon="remove_circle_outline"
|
||||||
|
ng-click="$ctrl.removeNiche($index)">
|
||||||
|
</vn-icon>
|
||||||
|
<vn-icon
|
||||||
|
vn-acl="buyer, replenisher"
|
||||||
|
pointer
|
||||||
|
margin-medium-left
|
||||||
|
orange
|
||||||
|
icon="add_circle"
|
||||||
|
ng-if="itemNiche.showAddIcon"
|
||||||
|
ng-click="$ctrl.addNiche()">
|
||||||
|
</vn-icon>
|
||||||
|
</vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-submit label="Save"></vn-submit>
|
||||||
|
</vn-button-bar>
|
||||||
|
</form>
|
|
@ -144,6 +144,6 @@ export default class Controller {
|
||||||
Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp'];
|
Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp'];
|
||||||
|
|
||||||
ngModule.component('vnItemNiche', {
|
ngModule.component('vnItemNiche', {
|
||||||
template: require('./item-niche.html'),
|
template: require('./niche.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
});
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
import './item-niche.js';
|
import './niche.js';
|
||||||
|
|
||||||
describe('Item', () => {
|
describe('Item', () => {
|
||||||
describe('Component vnItemNiche', () => {
|
describe('Component vnItemNiche', () => {
|
|
@ -86,7 +86,7 @@ class ItemSummary {
|
||||||
ItemSummary.$inject = ['$http'];
|
ItemSummary.$inject = ['$http'];
|
||||||
|
|
||||||
ngModule.component('vnItemSummary', {
|
ngModule.component('vnItemSummary', {
|
||||||
template: require('./item-summary.html'),
|
template: require('./summary.html'),
|
||||||
controller: ItemSummary,
|
controller: ItemSummary,
|
||||||
bindings: {
|
bindings: {
|
||||||
item: '<'
|
item: '<'
|
|
@ -144,7 +144,7 @@ class ItemTags {
|
||||||
ItemTags.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp'];
|
ItemTags.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp'];
|
||||||
|
|
||||||
ngModule.component('vnItemTags', {
|
ngModule.component('vnItemTags', {
|
||||||
template: require('./item-tags.html'),
|
template: require('./tags.html'),
|
||||||
controller: ItemTags,
|
controller: ItemTags,
|
||||||
bindings: {
|
bindings: {
|
||||||
itemTags: '='
|
itemTags: '='
|
|
@ -1,4 +1,4 @@
|
||||||
import './item-tags.js';
|
import './tags.js';
|
||||||
|
|
||||||
describe('Item', () => {
|
describe('Item', () => {
|
||||||
describe('Component vnItemTags', () => {
|
describe('Component vnItemTags', () => {
|
|
@ -38,7 +38,7 @@ export default class Controller {
|
||||||
Controller.$inject = ['$stateParams', '$http'];
|
Controller.$inject = ['$stateParams', '$http'];
|
||||||
|
|
||||||
ngModule.component('vnItemTax', {
|
ngModule.component('vnItemTax', {
|
||||||
template: require('./item-tax.html'),
|
template: require('./tax.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
bindings: {
|
bindings: {
|
||||||
item: '<'
|
item: '<'
|
|
@ -42,11 +42,11 @@ module.exports = function(Self) {
|
||||||
provinceFk: data.provinceFk,
|
provinceFk: data.provinceFk,
|
||||||
isEqualizated: data.isEqualizated
|
isEqualizated: data.isEqualizated
|
||||||
};
|
};
|
||||||
newClient = await Self.create(client, {transaction});
|
newClient = await Self.create(client);
|
||||||
await transaction.commit();
|
await transaction.commit();
|
||||||
return newClient;
|
return newClient;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
transaction.rollback();
|
await transaction.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,15 +2,15 @@ module.exports = Self => {
|
||||||
Self.installMethod('filter', filterParams);
|
Self.installMethod('filter', filterParams);
|
||||||
|
|
||||||
function filterParams(params) {
|
function filterParams(params) {
|
||||||
let filters = {
|
let filter = {
|
||||||
where: {},
|
where: {},
|
||||||
skip: (params.page - 1) * params.size,
|
skip: (params.page - 1) * params.size,
|
||||||
limit: params.size,
|
limit: params.size,
|
||||||
order: params.order || 'relevancy DESC',
|
order: params.order || 'name, relevancy DESC',
|
||||||
include: {
|
include: {
|
||||||
relation: "itemType",
|
relation: 'itemType',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ["id", "name"]
|
fields: ['id', 'name']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -20,7 +20,7 @@ module.exports = Self => {
|
||||||
delete params.order;
|
delete params.order;
|
||||||
|
|
||||||
if (params.search) {
|
if (params.search) {
|
||||||
filters.where.and = [
|
filter.where.and = [
|
||||||
{
|
{
|
||||||
or: [
|
or: [
|
||||||
{id: params.search},
|
{id: params.search},
|
||||||
|
@ -38,16 +38,16 @@ module.exports = Self => {
|
||||||
|
|
||||||
Object.keys(params).forEach(
|
Object.keys(params).forEach(
|
||||||
key => {
|
key => {
|
||||||
if (filters.where.and) {
|
if (filter.where.and) {
|
||||||
let filter = {};
|
let filter = {};
|
||||||
filter[key] = (key === 'description' || key === 'name') ? {regexp: params[key]} : params[key];
|
filter[key] = (key === 'description' || key === 'name') ? {regexp: params[key]} : params[key];
|
||||||
filters.where.and.push(filter);
|
filter.where.and.push(filter);
|
||||||
} else {
|
} else {
|
||||||
filters.where[key] = (key === 'description' || key === 'name') ? {regexp: params[key]} : params[key];
|
filter.where[key] = (key === 'description' || key === 'name') ? {regexp: params[key]} : params[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return filters;
|
return filter;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue