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
- (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
- (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) => {
const myOptions = {};
const conn = Self.dataSource.connector;
if (typeof options == 'object')
Object.assign(myOptions, options);
const stmt = new ParameterizedSQL(
`SELECT
`SELECT *
FROM (
SELECT
e.id,
e.ticketFk,
e.freightItemFk,
@ -56,8 +59,11 @@ module.exports = Self => {
LEFT JOIN account.user u ON u.id = e.workerFk
LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id
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);
};

View File

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

View File

@ -6,6 +6,30 @@ class Controller extends Section {
super($element, $scope);
this.landed = Date.vnNew();
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() {