refs #5635 smart-table, counter, filter
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2023-05-24 12:35:07 +02:00
parent 9b363bc7a4
commit d6d72ed289
4 changed files with 123 additions and 85 deletions

View File

@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador' - (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador'
- (Tickets -> Expediciones) Interfaz mejorada y contador añadido
### Fixed ### Fixed
- (Tickets -> Líneas) Se permite hacer split de líneas al mismo ticket - (Tickets -> Líneas) Se permite hacer split de líneas al mismo ticket

View File

@ -24,12 +24,15 @@ module.exports = Self => {
Self.filter = async(filter, options) => { Self.filter = async(filter, options) => {
const myOptions = {}; const myOptions = {};
const conn = Self.dataSource.connector;
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
const stmt = new ParameterizedSQL( const stmt = new ParameterizedSQL(
`SELECT `SELECT *
FROM (
SELECT
e.id, e.id,
e.ticketFk, e.ticketFk,
e.freightItemFk, e.freightItemFk,
@ -56,8 +59,11 @@ module.exports = Self => {
LEFT JOIN account.user u ON u.id = e.workerFk LEFT JOIN account.user u ON u.id = e.workerFk
LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id
LEFT JOIN account.user su ON su.id = es.workerFk LEFT JOIN account.user su ON su.id = es.workerFk
) e
`); `);
stmt.merge(Self.buildSuffix(filter, 'e')); stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeOrderBy(filter.order));
stmt.merge(conn.makeLimit(filter));
return Self.rawStmt(stmt, myOptions); return Self.rawStmt(stmt, myOptions);
}; };

View File

@ -7,10 +7,12 @@
order="created DESC" order="created DESC"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-data-viewer model="model"> <vn-card class="vn-pa-lg">
<vn-card class="vn-pa-lg"> <smart-table model="model"
<vn-horizontal class="header"> view-config-id="expeditionIndex"
<vn-tool-bar class="vn-mb-md"> options="$ctrl.smartTableOptions"
expr-builder="$ctrl.exprBuilder(param, value)">
<slot-actions>
<vn-button icon="keyboard_arrow_down" <vn-button icon="keyboard_arrow_down"
label="Move" label="Move"
ng-click="moreOptions.show($event)" ng-click="moreOptions.show($event)"
@ -22,17 +24,7 @@
icon="delete" icon="delete"
vn-tooltip="Delete expedition"> vn-tooltip="Delete expedition">
</vn-button> </vn-button>
</vn-tool-bar> </slot-actions>
<vn-one class="taxes" ng-if="$ctrl.sales.length > 0">
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}</p>
<p><vn-label translate>VAT</vn-label> {{$ctrl.ticket.totalWithVat - $ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}</p>
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.ticket.totalWithVat | currency: 'EUR':2}}</strong></p>
</vn-one>
</vn-horizontal>
<smart-table model="model"
view-config-id="expeditionIndex"
options="$ctrl.smartTableOptions"
expr-builder="$ctrl.exprBuilder(param, value)">
<slot-table> <slot-table>
<table> <table>
<thead> <thead>
@ -42,31 +34,46 @@
model="model"> model="model">
</multi-check> </multi-check>
</th> </th>
<th field="itemFk" number>Expedition</th> <th field="expeditionFk" number>
<th field="itemFk" number>Item</th> <span translate>Expedition</span>
<th field="packageItemName">Name</th> </th>
<th field="freightItemName">Package type</th> <th field="itemFk" number>
<th field="counter" number>Counter</th> <span translate>Item</span>
<th field="externalId" number>externalId</th> </th>
<th field="created" expand>Created</th> <th field="packageItemName">
<th field="state" expand>State</th> <span translate>Name</span>
</th>
<th field="freightItemName">
<span translate>Package Type</span>
</th>
<th field="counter" number>
<span translate>Counter</span>
</th>
<th field="externalId" number>
<span translate>externalId</span>
</th>
<th field="created" expand>
<span translate>Created</span>
</th>
<th field="state" expand>
<span translate>State</span>
</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
</slot-table>
<tbody> <tbody>
<tr ng-repeat="expedition in expeditions"> <tr ng-repeat="expedition in expeditions">
<td shrink> <td shrink>
<check tabindex="-1" <vn-check tabindex="-1"
ng-model="expedition.checked"> ng-model="expedition.checked">
</check> </vn-check>
</td> </td>
<td number expand>{{expedition.id}}</td> <td number expand>{{expedition.id}}</td>
<td number> <td number>
<span <span
ng-class="{link: expedition.packagingItemFk}" ng-class="{link: expedition.packagingItemFk}"
ng-click="itemDescriptor.show($event, expedition.packagingItemFk)"> ng-click="itemDescriptor.show($event, expedition.packagingItemFk)">
{{expedition.packagingFk}} {{expedition.packagingItemFk}}
</span> </span>
</td> </td>
<td>{{::expedition.packageItemName}}</td> <td>{{::expedition.packageItemName}}</td>
@ -76,17 +83,18 @@
<td shrink-datetime>{{::expedition.created | date:'dd/MM/yyyy HH:mm'}}</td> <td shrink-datetime>{{::expedition.created | date:'dd/MM/yyyy HH:mm'}}</td>
<td>{{::expedition.state}}</td> <td>{{::expedition.state}}</td>
<td> <td>
<icon-button <vn-icon-button
vn-click-stop="$ctrl.showLog(expedition)" vn-click-stop="$ctrl.showLog(expedition)"
vn-tooltip="Status log" vn-tooltip="Status log"
icon="history"> icon="history">
</icon-button> </vn-icon-button>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</vn-card> </slot-table>
</vn-data-viewer> </smart-table>
</vn-card>
<vn-item-descriptor-popover <vn-item-descriptor-popover
vn-id="item-descriptor" vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk", warehouse-fk="$ctrl.ticket.warehouseFk",

View File

@ -6,6 +6,30 @@ class Controller extends Section {
super($element, $scope); super($element, $scope);
this.landed = Date.vnNew(); this.landed = Date.vnNew();
this.newRoute = null; this.newRoute = null;
this.smartTableOptions = {
activeButtons: {
search: true,
shownColumns: true,
},
columns: [
{
field: 'packageItemName',
autocomplete: {
url: 'Items',
valueField: 'id',
}
}
]
};
}
exprBuilder(param, value) {
switch (param) {
case 'expeditionFk':
return {'id': value};
case 'packageItemName':
return {'packagingItemFk': value};
}
} }
get checked() { get checked() {