fix test and refactor transferlines
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2020-09-30 12:24:33 +02:00
parent eb99ce2f43
commit 1bff4e3c4e
8 changed files with 37 additions and 35 deletions

View File

@ -20,7 +20,8 @@ export default {
userConfigFirstAutocomplete: '#localWarehouse',
userConfigSecondAutocomplete: '#localBank',
userConfigThirdAutocomplete: '#localCompany',
acceptButton: '.vn-confirm.shown button[response=accept]'
acceptButton: '.vn-confirm.shown button[response=accept]',
searchButton: 'vn-searchbar vn-icon[icon="search"]',
},
clientsIndex: {
topbarSearch: 'vn-topbar',

View File

@ -124,7 +124,6 @@ describe('Item regularize path', () => {
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
page.waitToClick(selectors.globalItems.ticketsButton)
]);
await page.waitForTransitionEnd('vn-searchbar');
await page.waitForState('ticket.index');
});

View File

@ -20,7 +20,7 @@ describe('Ticket index payout path', () => {
});
it('should check the second ticket from a client and 1 of another', async() => {
await page.keyboard.press('Enter');
await page.waitToClick(selectors.globalItems.searchButton);
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.payoutButton);

View File

@ -18,7 +18,7 @@ describe('Entry lastest buys path', () => {
it('should access the latest buys seccion and search not seeing the edit buys button yet', async() => {
await page.waitToClick(selectors.entryLatestBuys.latestBuysSectionButton);
await page.waitFor(250);
await page.keyboard.press('Enter');
await page.waitToClick(selectors.globalItems.searchButton);
await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false});
});

View File

@ -25,6 +25,9 @@ module.exports = Self => {
Self.lastActiveTickets = async(id, ticketId) => {
const ticket = await Self.app.models.Ticket.findById(ticketId);
let shipped = ticket.shipped;
shipped.setDate(shipped.getDate() + 15);
const query = `
SELECT t.id, t.shipped, a.name AS agencyName, w.name AS warehouseName, ad.city AS address
FROM vn.ticket t
@ -32,11 +35,11 @@ module.exports = Self => {
JOIN vn.agencyMode a ON t.agencyModeFk = a.id
JOIN vn.warehouse w ON t.warehouseFk = w.id
JOIN vn.address ad ON t.addressFk = ad.id
WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0
WHERE t.shipped BETWEEN CURDATE() AND ? AND t.clientFk = ? AND ts.alertLevel = 0
AND t.id <> ? AND t.warehouseFk = ?
ORDER BY t.shipped
LIMIT 3`;
LIMIT 10`;
return Self.rawSql(query, [id, ticketId, ticket.warehouseFk]);
return Self.rawSql(query, [shipped, id, ticketId, ticket.warehouseFk]);
};
};

View File

@ -2,11 +2,11 @@ const app = require('vn-loopback/server/server');
describe('client lastActiveTickets()', () => {
it('should return the last three active tickets', async() => {
const clientId = 109;
const ticketId = 19;
const clientId = 104;
const ticketId = 9;
let result = await app.models.Client.lastActiveTickets(clientId, ticketId);
expect(result.length).toEqual(3);
expect(result.length).toEqual(1);
});
});

View File

@ -323,32 +323,31 @@
icon="info">
</vn-icon>
</vn-horizontal>
<table class="vn-table">
<thead>
<tr>
<th number>Id</th>
<th number translate>Shipped</th>
<th number translate>Agency</th>
<th number translate>Warehouse</th>
<th number translate>Address</th>
</tr>
</thead>
<tbody>
<tr ng-if="$ctrl.transfer.lastActiveTickets.length === 0" >
<td colspan="4" style="text-align: center" translate>No results</td>
</tr>
<tr
<vn-table class="destinationTable">
<vn-thead>
<vn-tr>
<vn-th number>Id</vn-th>
<vn-th number>Shipped</vn-th>
<vn-th number>Agency</vn-th>
<vn-th number>Warehouse</vn-th>
<vn-th number>Address</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-data-viewer data="$ctrl.transfer.lastActiveTickets">
</vn-data-viewer>
<vn-tr
class="clickable"
ng-repeat="ticket in $ctrl.transfer.lastActiveTickets track by ticket.id"
ng-click="$ctrl.transferSales(ticket.id)">
<td number>{{::ticket.id}}</td>
<td number>{{::ticket.shipped | date: 'dd/MM/yyyy'}}</td>
<td number>{{::ticket.agencyName}}</td>
<td number>{{::ticket.warehouseName}}</td>
<td number>{{::ticket.address}}</td>
</tr>
</tbody>
</table>
<vn-td number>{{::ticket.id}}</vn-td>
<vn-td number>{{::ticket.shipped | date: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{::ticket.agencyName}}</vn-td>
<vn-td number>{{::ticket.warehouseName}}</vn-td>
<vn-td number>{{::ticket.address}}</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
<form name="form">
<vn-horizontal class="vn-py-md">
<vn-input-number vn-one

View File

@ -80,8 +80,8 @@ vn-ticket-sale {
max-height: 400px;
width: 480px;
}
table {
width: 400px
.destinationTable {
width: 700px
}
}
.vn-popover .edit-popover {