item.index default columns and filter with like
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-11-09 11:47:54 +01:00
parent bd51ff3761
commit 469c544536
4 changed files with 54 additions and 35 deletions

View File

@ -3,4 +3,10 @@ CREATE TABLE `salix`.`defaultViewConfig`
tableCode VARCHAR(25) not null, tableCode VARCHAR(25) not null,
columns JSON not null columns JSON not null
) )
comment 'The default configuration of columns for views'; comment 'The default configuration of columns for views';
INSERT INTO `salix`.`defaultViewConfig` (tableCode, columns)
VALUES (
'itemIndex',
'{"id":true,"grouping":true,"packing":true,"name":true,"stems":true,"size":true,"typeFk":true,"category":true,"intrastat":false,"origin":true,"buyerFk":true,"density":false,"stemMultiplier":false,"active":false,"landed":true}'
);

View File

@ -37,9 +37,8 @@ export default class SmartTable extends Component {
set model(value) { set model(value) {
this._model = value; this._model = value;
if (value) { if (value)
this.$.model = value; this.$.model = value;
}
} }
get viewConfigId() { get viewConfigId() {
@ -239,6 +238,11 @@ export default class SmartTable extends Component {
if (columnOptions) if (columnOptions)
options = columnOptions.find(column => column.field == field); options = columnOptions.find(column => column.field == field);
if (options && options.searchable == false) {
searchRow.appendChild(cell);
continue;
}
if (options && options.autocomplete) { if (options && options.autocomplete) {
let props = ``; let props = ``;

View File

@ -12,49 +12,49 @@
<thead> <thead>
<tr> <tr>
<th shrink></th> <th shrink></th>
<th field="id" shrink> <th field="id">
<span translate>Id</span> <span translate>Identifier</span>
</th> </th>
<th field="grouping" shrink> <th field="grouping">
<span translate>Grouping</span> <span translate>Grouping</span>
</th> </th>
<th field="packing" shrink> <th field="packing">
<span translate>Packing</span> <span translate>Packing</span>
</th> </th>
<th field="name"> <th field="name">
<span translate>Description</span> <span translate>Description</span>
</th> </th>
<th field="stems" shrink> <th field="stems">
<span translate>Stems</span> <span translate>Stems</span>
</th> </th>
<th field="size" shrink> <th field="size">
<span translate>Size</span> <span translate>Size</span>
</th> </th>
<th field="typeFk" shrink> <th field="typeFk">
<span translate>Type</span> <span translate>Type</span>
</th> </th>
<th field="category" shrink> <th field="category">
<span translate>Category</span> <span translate>Category</span>
</th> </th>
<th field="intrastat" shrink> <th field="intrastat">
<span translate>Intrastat</span> <span translate>Intrastat</span>
</th> </th>
<th field="origin" shrink> <th field="origin">
<span translate>Origin</span> <span translate>Origin</span>
</th> </th>
<th field="buyerFk" shrink> <th field="buyerFk">
<span translate>Buyer</span> <span translate>Buyer</span>
</th> </th>
<th field="density" shrink> <th field="density">
<span translate>Density</span> <span translate>Density</span>
</th> </th>
<th field="stemMultiplier" shrink> <th field="stemMultiplier">
<span translate>Multiplier</span> <span translate>Multiplier</span>
</th> </th>
<th field="active" shrink> <th field="active">
<span translate>Active</span> <span translate>Active</span>
</th> </th>
<th field="landed" shrink-date> <th field="landed">
<span translate>Landed</span> <span translate>Landed</span>
</th> </th>
<th></th> <th></th>
@ -66,22 +66,22 @@
state: 'item.card.summary', state: 'item.card.summary',
params: {id: item.id} params: {id: item.id}
}"> }">
<td shrink> <td>
<img <img
ng-src="{{::$root.imagePath('catalog', '50x50', item.id)}}" ng-src="{{::$root.imagePath('catalog', '50x50', item.id)}}"
zoom-image="{{::$root.imagePath('catalog', '1600x900', item.id)}}" zoom-image="{{::$root.imagePath('catalog', '1600x900', item.id)}}"
vn-click-stop vn-click-stop
on-error-src/> on-error-src/>
</td> </td>
<td shrink> <td>
<span <span
vn-click-stop="itemDescriptor.show($event, item.id)" vn-click-stop="itemDescriptor.show($event, item.id)"
class="link"> class="link">
{{::item.id}} {{::item.id}}
</span> </span>
</td> </td>
<td shrink>{{::item.grouping | dashIfEmpty}}</td> <td>{{::item.grouping | dashIfEmpty}}</td>
<td shrink>{{::item.packing | dashIfEmpty}}</td> <td>{{::item.packing | dashIfEmpty}}</td>
<td vn-fetched-tags> <td vn-fetched-tags>
<div> <div>
<vn-one title="{{::item.name}}">{{::item.name}}</vn-one> <vn-one title="{{::item.name}}">{{::item.name}}</vn-one>
@ -95,35 +95,35 @@
tabindex="-1"> tabindex="-1">
</vn-fetched-tags> </vn-fetched-tags>
</td> </td>
<td shrink>{{::item.stems}}</td> <td>{{::item.stems}}</td>
<td shrink>{{::item.size}}</td> <td>{{::item.size}}</td>
<td shrink title="{{::item.typeName}}"> <td title="{{::item.typeName}}">
{{::item.typeName}} {{::item.typeName}}
</td> </td>
<td shrink title="{{::item.category}}"> <td title="{{::item.category}}">
{{::item.category}} {{::item.category}}
</td> </td>
<td shrink title="{{::item.intrastat}}"> <td title="{{::item.intrastat}}">
{{::item.intrastat}} {{::item.intrastat}}
</td> </td>
<td shrink>{{::item.origin}}</td> <td>{{::item.origin}}</td>
<td shrink title="{{::item.userName}}"> <td title="{{::item.userName}}">
<span <span
class="link" class="link"
vn-click-stop="workerDescriptor.show($event, item.buyerFk)"> vn-click-stop="workerDescriptor.show($event, item.buyerFk)">
{{::item.userName}} {{::item.userName}}
</span> </span>
</td> </td>
<td shrink>{{::item.density}}</td> <td>{{::item.density}}</td>
<td shrink >{{::item.stemMultiplier}}</td> <td>{{::item.stemMultiplier}}</td>
<td shrink> <td>
<vn-check <vn-check
disabled="true" disabled="true"
ng-model="::item.isActive"> ng-model="::item.isActive">
</vn-check> </vn-check>
</td> </td>
<td shrink-date>{{::item.landed | date:'dd/MM/yyyy'}}</td> <td shrink-date>{{::item.landed | date:'dd/MM/yyyy'}}</td>
<td shrink> <td>
<vn-horizontal class="buttons"> <vn-horizontal class="buttons">
<vn-icon-button <vn-icon-button
vn-click-stop="clone.show(item.id)" vn-click-stop="clone.show(item.id)"

View File

@ -23,7 +23,7 @@ class Controller extends Section {
field: 'origin', field: 'origin',
autocomplete: { autocomplete: {
url: 'Origins', url: 'Origins',
showField: 'name', showField: 'code',
valueField: 'code' valueField: 'code'
} }
}, },
@ -51,6 +51,14 @@ class Controller extends Section {
valueField: 'id', valueField: 'id',
} }
}, },
{
field: 'active',
searchable: false
},
{
field: 'landed',
searchable: false
},
] ]
}; };
} }
@ -71,9 +79,10 @@ class Controller extends Section {
return {'i.typeFk': value}; return {'i.typeFk': value};
case 'intrastat': case 'intrastat':
return {'intr.description': value}; return {'intr.description': value};
case 'name':
return {'i.name': {like: `%${value}%`}};
case 'id': case 'id':
case 'size': case 'size':
case 'name':
case 'subname': case 'subname':
case 'isActive': case 'isActive':
case 'density': case 'density':