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,40 +24,46 @@ 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
e.id,
e.ticketFk,
e.freightItemFk,
e.workerFk,
i1.name packageItemName,
e.counter,
i2.name freightItemName,
u.name userName,
e.created,
e.externalId,
i3.name packagingName,
i3.id packagingItemFk,
e.packagingFk,
es.workerFk expeditionScanWorkerFk,
su.name scannerUserName,
es.scanned,
est.description state
FROM vn.expedition e
LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk
INNER JOIN vn.item i1 ON i1.id = e.freightItemFk
LEFT JOIN vn.packaging p ON p.id = e.packagingFk
LEFT JOIN vn.item i3 ON i3.id = p.itemFk
LEFT JOIN vn.item i2 ON i2.id = p.itemFk
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
`SELECT *
FROM (
SELECT
e.id,
e.ticketFk,
e.freightItemFk,
e.workerFk,
i1.name packageItemName,
e.counter,
i2.name freightItemName,
u.name userName,
e.created,
e.externalId,
i3.name packagingName,
i3.id packagingItemFk,
e.packagingFk,
es.workerFk expeditionScanWorkerFk,
su.name scannerUserName,
es.scanned,
est.description state
FROM vn.expedition e
LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk
INNER JOIN vn.item i1 ON i1.id = e.freightItemFk
LEFT JOIN vn.packaging p ON p.id = e.packagingFk
LEFT JOIN vn.item i3 ON i3.id = p.itemFk
LEFT JOIN vn.item i2 ON i2.id = p.itemFk
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,51 +34,67 @@
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>
<tbody>
<tr ng-repeat="expedition in expeditions">
<td shrink>
<vn-check tabindex="-1"
ng-model="expedition.checked">
</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.packagingItemFk}}
</span>
</td>
<td>{{::expedition.packageItemName}}</td>
<td>{{::expedition.freightItemName}}</td>
<td number>{{::expedition.counter}}</td>
<td expand>{{::expedition.externalId}}</td>
<td shrink-datetime>{{::expedition.created | date:'dd/MM/yyyy HH:mm'}}</td>
<td>{{::expedition.state}}</td>
<td>
<vn-icon-button
vn-click-stop="$ctrl.showLog(expedition)"
vn-tooltip="Status log"
icon="history">
</vn-icon-button>
</td>
</tr>
</tbody>
</table>
</slot-table>
<tbody>
<tr ng-repeat="expedition in expeditions">
<td shrink>
<check tabindex="-1"
ng-model="expedition.checked">
</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}}
</span>
</td>
<td>{{::expedition.packageItemName}}</td>
<td>{{::expedition.freightItemName}}</td>
<td number>{{::expedition.counter}}</td>
<td expand>{{::expedition.externalId}}</td>
<td shrink-datetime>{{::expedition.created | date:'dd/MM/yyyy HH:mm'}}</td>
<td>{{::expedition.state}}</td>
<td>
<icon-button
vn-click-stop="$ctrl.showLog(expedition)"
vn-tooltip="Status log"
icon="history">
</icon-button>
</td>
</tr>
</tbody>
</table>
</vn-card>
</vn-data-viewer>
</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() {