This commit is contained in:
Gerard 2019-02-13 09:27:11 +01:00
parent 8bbf924573
commit 5063bd8137
5 changed files with 119 additions and 25 deletions

View File

@ -171,9 +171,9 @@ export default {
itemsIndex: {
goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`,
createItemButton: `${components.vnFloatButton}`,
searchResult: `vn-item-product a`,
searchResultPreviewButton: `vn-item-product .buttons > [icon="desktop_windows"]`,
searchResultCloneButton: `vn-item-product .buttons > [icon="icon-clone"]`,
searchResult: `vn-item-index a.vn-tr`,
searchResultPreviewButton: `vn-item-index .buttons > [icon="desktop_windows"]`,
searchResultCloneButton: `vn-item-index .buttons > [icon="icon-clone"]`,
acceptClonationAlertButton: `vn-item-index [vn-id="clone"] [response="ACCEPT"]`,
searchItemInput: `vn-searchbar vn-textfield input`,
searchButton: `vn-searchbar vn-icon[icon="search"]`,

View File

@ -32,12 +32,19 @@ module.exports = Self => {
let stmt = new ParameterizedSQL(
`SELECT i.id, i.image, i.name, i.description,
i.size, i.tag5, i.value5, i.tag6, i.value6,
i.tag7, i.value7, i.tag8, i.value8,
t.name type, u.nickname userNickname
i.tag7, i.value7, i.tag8, i.value8, i.isActive,
t.name type, u.nickname userNickname,
intr.description AS intrastat, i.stems,
ori.code AS origin, t.name AS type,
ic.name AS category
FROM item i
JOIN itemType t ON t.id = i.typeFk
LEFT JOIN itemCategory ic ON ic.id = t.categoryFk
JOIN worker w ON w.id = t.workerFk
JOIN account.user u ON u.id = w.userFk`
JOIN account.user u ON u.id = w.userFk
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
LEFT JOIN producer pr ON pr.id = i.producerFk
LEFT JOIN origin ori ON ori.id = i.originFk`
);
if (tags) {

View File

@ -1,10 +1,10 @@
<vn-crud-model
vn-id="model"
url="/item/api/Items/filter"
limit="8"
limit="12"
order="isActive DESC, name, id"
data="items"
auto-load="false">
auto-load="true">
</vn-crud-model>
<div class="content-block">
<div class="vn-list">
@ -17,23 +17,76 @@
vn-focus>
</vn-searchbar>
</vn-card>
<vn-card margin-medium-v>
<vn-item-product
class="searchResult"
ng-repeat="item in items track by item.id"
item="::item">
</vn-item-product>
<vn-empty-rows class="vn-list-item" style="text-align: center"
ng-if="model.data.length === 0" translate>
</div>
<vn-card margin-medium-v>
<vn-table model="model" show-fields="$ctrl.showFields" vn-uvc="itemIndex">
<vn-thead>
<vn-tr>
<vn-th th-id="picture"></vn-th>
<vn-th field="id" number>Id</vn-th>
<vn-th th-id="description" style="text-align: center">Description</vn-th>
<vn-th th-id="stems">Stems</vn-th>
<vn-th th-id="type">Type</vn-th>
<vn-th th-id="category">Category</vn-th>
<vn-th th-id="intrastat">Intrastat</vn-th>
<vn-th th-id="origin">Origin</vn-th>
<vn-th th-id="salesperson">Sales person</vn-th>
<vn-th th-id="active">Active</vn-th>
<vn-th></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<a ng-repeat="item in items"
class="clickable vn-tr searchResult"
ui-sref="item.card.summary({id: item.id})">
<vn-td shrink>
<img
ng-src="{{::$ctrl.imagesPath}}/50x50/{{::item.image}}"
zoom-image="{{::$ctrl.imagesPath}}/1600x900/{{::item.image}}"
on-error-src/>
</vn-td>
<vn-td number>{{::item.id | zeroFill:6}}</vn-td>
<vn-td expand>
<vn-fetched-tags
max-length="6"
item="item"
title="item.name">
</vn-fetched-tags>
</vn-td>
<vn-td number>{{::item.stems}}</vn-td>
<vn-td>{{::item.type}}</vn-td>
<vn-td>{{::item.category}}</vn-td>
<vn-td>{{::item.intrastat}}</vn-td>
<vn-td>{{::item.origin}}</vn-td>
<vn-td>{{::item.userNickname}}</vn-td>
<vn-td>
<vn-check
disabled="true"
field="item.isActive">
</vn-check>
</vn-td>
<vn-td shrink>
<vn-horizontal class="buttons">
<vn-icon-button
ng-click="$ctrl.cloneItem($event, item)"
vn-tooltip="Clone"
icon="icon-clone">
</vn-icon-button>
<vn-icon-button
ng-click="$ctrl.preview($event, item)"
vn-tooltip="Preview"
icon="desktop_windows">
</vn-icon-button>
</vn-horizontal>
</vn-td>
</a>
</vn-tbody>
<vn-empty-rows ng-if="items.length === 0" translate>
No results
</vn-empty-rows>
<vn-empty-rows class="vn-list-item" style="text-align: center"
ng-if="model.data === null" translate>
Enter a new search
</vn-empty-rows>
</vn-card>
<vn-pagination model="model"></vn-pagination>
</div>
</vn-table>
<vn-card margin-medium-v>
<vn-pagination model="model"></vn-pagination>
</div>
<a ui-sref="item.create" vn-tooltip="New item" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>

View File

@ -8,6 +8,12 @@ class Controller {
this.$state = $state;
this.$ = $scope;
this.itemSelected = null;
this.imagesPath = '//verdnatura.es/vn-image-data/catalog';
this.showFields = {
id: false,
actions: false
};
}
exprBuilder(param, value) {
@ -25,6 +31,23 @@ class Controller {
}
}
showDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk},
warehouseFk: ${this.ticket.warehouseFk},
ticketFk: ${this.ticket.id}
})`,
tooltip: 'Item diary'
}
};
this.$scope.descriptor.itemFk = itemFk;
this.$scope.descriptor.parent = event.target;
this.$scope.descriptor.show();
}
paramBuilder(param, value) {
switch (param) {
case 'tags':
@ -32,7 +55,9 @@ class Controller {
}
}
cloneItem(item) {
cloneItem(event, item) {
event.preventDefault();
event.stopImmediatePropagation();
this.itemSelected = item;
this.$.clone.show();
}
@ -49,7 +74,9 @@ class Controller {
this.itemSelected = null;
}
showItemPreview(item) {
preview(event, item) {
event.preventDefault();
event.stopImmediatePropagation();
this.itemSelected = item;
this.$.preview.show();
}

View File

@ -25,3 +25,10 @@ vn-item-product {
margin-top: 0.9em;
}
}
vn-table {
img {
border-radius: 50%;
max-width: 50px;
}
}