Merge pull request '2764-Ticket_sale_consignee' (#537) from 2764-Ticket_sale_consignee into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #537 Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
commit
2e838d9b97
|
@ -174,4 +174,9 @@ vn-table {
|
||||||
.vn-check {
|
.vn-check {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
.empty-rows {
|
||||||
|
color: $color-font-secondary;
|
||||||
|
font-size: 1.375rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -26,12 +26,22 @@ module.exports = Self => {
|
||||||
Self.lastActiveTickets = async(id, ticketId) => {
|
Self.lastActiveTickets = async(id, ticketId) => {
|
||||||
const ticket = await Self.app.models.Ticket.findById(ticketId);
|
const ticket = await Self.app.models.Ticket.findById(ticketId);
|
||||||
const query = `
|
const query = `
|
||||||
SELECT t.id, t.shipped, a.name AS agencyName, w.name AS warehouseName, ad.city AS address
|
SELECT
|
||||||
FROM vn.ticket t
|
t.id,
|
||||||
|
t.shipped,
|
||||||
|
a.name AS agencyName,
|
||||||
|
w.name AS warehouseName,
|
||||||
|
ad.nickname AS nickname,
|
||||||
|
ad.city AS city,
|
||||||
|
ad.postalCode AS postalCode,
|
||||||
|
ad.street AS street,
|
||||||
|
pr.name AS name
|
||||||
|
FROM ticket t
|
||||||
JOIN vn.ticketState ts ON t.id = ts.ticketFk
|
JOIN vn.ticketState ts ON t.id = ts.ticketFk
|
||||||
JOIN vn.agencyMode a ON t.agencyModeFk = a.id
|
JOIN vn.agencyMode a ON t.agencyModeFk = a.id
|
||||||
JOIN vn.warehouse w ON t.warehouseFk = w.id
|
JOIN vn.warehouse w ON t.warehouseFk = w.id
|
||||||
JOIN vn.address ad ON t.addressFk = ad.id
|
JOIN vn.address ad ON t.addressFk = ad.id
|
||||||
|
JOIN vn.province pr ON ad.provinceFk = pr.id
|
||||||
WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0
|
WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0
|
||||||
AND t.id <> ? AND t.warehouseFk = ?
|
AND t.id <> ? AND t.warehouseFk = ?
|
||||||
ORDER BY t.shipped
|
ORDER BY t.shipped
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
|
describe('Client last active tickets', () => {
|
||||||
|
it('should receive an array of last active tickets of Bruce Wayne', async() => {
|
||||||
|
const ticketId = 22;
|
||||||
|
const clientId = 109;
|
||||||
|
const warehouseId = 5;
|
||||||
|
const result = await app.models.Client.lastActiveTickets(clientId, ticketId, warehouseId);
|
||||||
|
|
||||||
|
const length = result.length;
|
||||||
|
const anyResult = result[Math.floor(Math.random() * Math.floor(length))];
|
||||||
|
|
||||||
|
const properties = Object.keys(anyResult);
|
||||||
|
|
||||||
|
expect(properties.length).toEqual(9);
|
||||||
|
expect(result.length).toEqual(3);
|
||||||
|
});
|
||||||
|
});
|
|
@ -326,31 +326,49 @@
|
||||||
icon="info">
|
icon="info">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-table class="destinationTable">
|
<table class="destinationTable vn-table">
|
||||||
<vn-thead>
|
<thead>
|
||||||
<vn-tr>
|
<tr>
|
||||||
<vn-th number>Id</vn-th>
|
<th translate shrink>Id</th>
|
||||||
<vn-th number>Shipped</vn-th>
|
<th translate>Shipped</th>
|
||||||
<vn-th number>Agency</vn-th>
|
<th translate shrink>Agency</th>
|
||||||
<vn-th number>Warehouse</vn-th>
|
<th translate expand>Address</th>
|
||||||
<vn-th number>Address</vn-th>
|
</tr>
|
||||||
</vn-tr>
|
</thead>
|
||||||
</vn-thead>
|
<tbody>
|
||||||
<vn-tbody>
|
<tr
|
||||||
<vn-data-viewer data="$ctrl.transfer.lastActiveTickets">
|
|
||||||
</vn-data-viewer>
|
|
||||||
<vn-tr
|
|
||||||
class="clickable"
|
class="clickable"
|
||||||
ng-repeat="ticket in $ctrl.transfer.lastActiveTickets track by ticket.id"
|
ng-repeat="ticket in $ctrl.transfer.lastActiveTickets track by ticket.id"
|
||||||
ng-click="$ctrl.transferSales(ticket.id)">
|
ng-click="$ctrl.transferSales(ticket.id)">
|
||||||
<vn-td number>{{::ticket.id}}</vn-td>
|
<td shrink>{{::ticket.id}}</td>
|
||||||
<vn-td number>{{::ticket.shipped | date: 'dd/MM/yyyy'}}</vn-td>
|
<td>{{::ticket.shipped | date: 'dd/MM/yyyy'}}</td>
|
||||||
<vn-td number>{{::ticket.agencyName}}</vn-td>
|
<td shrink>{{::ticket.agencyName}}</td>
|
||||||
<vn-td number>{{::ticket.warehouseName}}</vn-td>
|
<td expand>{{::ticket.address}}
|
||||||
<vn-td number>{{::ticket.address}}</vn-td>
|
<span vn-tooltip="
|
||||||
</vn-tr>
|
{{::ticket.nickname}}
|
||||||
</vn-tbody>
|
{{::ticket.name}}
|
||||||
</vn-table>
|
{{::ticket.street}}
|
||||||
|
{{::ticket.postalCode}}
|
||||||
|
{{::ticket.city}}">
|
||||||
|
{{::ticket.nickname}}
|
||||||
|
{{::ticket.name}}
|
||||||
|
{{::ticket.street}}
|
||||||
|
{{::ticket.postalCode}}
|
||||||
|
{{::ticket.city}}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td
|
||||||
|
ng-if="!$ctrl.transfer.lastActiveTickets.length"
|
||||||
|
class="empty-rows"
|
||||||
|
colspan="4"
|
||||||
|
translate>
|
||||||
|
No results
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<form name="form">
|
<form name="form">
|
||||||
<vn-horizontal class="vn-py-md">
|
<vn-horizontal class="vn-py-md">
|
||||||
<vn-input-number vn-one
|
<vn-input-number vn-one
|
||||||
|
|
Loading…
Reference in New Issue