refs #6335 style(ticketAdvance): fix with split-progress
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-11-03 07:57:53 +01:00
parent 740d2fb976
commit a523e32373
10 changed files with 23 additions and 47 deletions

View File

@ -722,7 +722,7 @@ export default {
isFullMovable: 'vn-check[ng-model="filter.isFullMovable"]', isFullMovable: 'vn-check[ng-model="filter.isFullMovable"]',
warehouseFk: 'vn-autocomplete[label="Warehouse"]', warehouseFk: 'vn-autocomplete[label="Warehouse"]',
tableButtonSearch: 'vn-button[vn-tooltip="Search"]', tableButtonSearch: 'vn-button[vn-tooltip="Search"]',
moveButton: 'vn-button[vn-tooltip="Advance tickets"]', moveButton: 'vn-button[vn-tooltip="Advance tickets with negatives"]',
acceptButton: '.vn-confirm.shown button[response="accept"]', acceptButton: '.vn-confirm.shown button[response="accept"]',
firstCheck: 'tbody > tr:nth-child(2) > td > vn-check', firstCheck: 'tbody > tr:nth-child(2) > td > vn-check',
tableId: 'vn-textfield[name="id"]', tableId: 'vn-textfield[name="id"]',

View File

@ -196,6 +196,7 @@
"Negative basis of tickets: 23": "Negative basis of tickets: 23", "Negative basis of tickets: 23": "Negative basis of tickets: 23",
"Booking completed": "Booking complete", "Booking completed": "Booking complete",
"The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation", "The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation",
"You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets" "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets",
"newTicket": "New ticket",
"keepPrice": "Keep prices"
} }

View File

@ -111,7 +111,6 @@ module.exports = Self => {
Self.componentUpdate = async(ctx, options) => { Self.componentUpdate = async(ctx, options) => {
const args = ctx.args; const args = ctx.args;
const originalTicketId = args.id;
const myOptions = {userId: ctx.req.accessToken.userId}; const myOptions = {userId: ctx.req.accessToken.userId};
let tx; let tx;
@ -284,7 +283,6 @@ module.exports = Self => {
} }
response.id = args.id; response.id = args.id;
console.log(originalTicketId, args.newTicket ? ` TRANSFER TO → ` : ` CREATE NEW TICKET → `, args.id);
if (tx) await tx.commit(); if (tx) await tx.commit();
return response; return response;

View File

@ -210,7 +210,7 @@ describe('ticket componentUpdate()', () => {
} }
}); });
describe('ticket componentUpdate()', () => { describe('componentUpdate() keepPrice', () => {
it('should change shipped and keep price', async() => { it('should change shipped and keep price', async() => {
const tx = await models.Ticket.beginTransaction({}); const tx = await models.Ticket.beginTransaction({});

View File

@ -156,13 +156,7 @@
</td> </td>
<td>{{::ticket.futureLiters | dashIfEmpty}}</td> <td>{{::ticket.futureLiters | dashIfEmpty}}</td>
<td>{{::ticket.futureZoneName | dashIfEmpty}}</td> <td>{{::ticket.futureZoneName | dashIfEmpty}}</td>
<td> <td>{{::ticket.notMovableLines | dashIfEmpty}}</td>
<span
class="chip"
ng-class="{success: !ticket.notMovableLines}">
{{::ticket.notMovableLines | dashIfEmpty}}
</span>
</td>
<td>{{::ticket.futureLines | dashIfEmpty}}</td> <td>{{::ticket.futureLines | dashIfEmpty}}</td>
<td> <td>
<span <span
@ -194,7 +188,7 @@
<vn-dialog <vn-dialog
vn-id="splitProgress" vn-id="splitProgress"
message="Progress"> message="Progress">
<tpl-body> <tpl-body class="split-progress">
<vn-vertical> <vn-vertical>
<vn-spinner <vn-spinner
enable="splitProgress.enable"> enable="splitProgress.enable">

View File

@ -153,11 +153,10 @@ export default class Controller extends Section {
return this.$http.get(query, {params}).then(res => { return this.$http.get(query, {params}).then(res => {
if (res.data) if (res.data)
return res.data; return res.data;
else {
return this.vnApp.showError( return this.vnApp.showError(
this.$t(`No delivery zone available for this landing date`) this.$t(`No delivery zone available for this landing date`)
); );
}
}); });
} }
@ -201,7 +200,6 @@ export default class Controller extends Section {
async requestComponentUpdate(ticket, isWithoutNegatives) { async requestComponentUpdate(ticket, isWithoutNegatives) {
const query = `tickets/${ticket.futureId}/componentUpdate`; const query = `tickets/${ticket.futureId}/componentUpdate`;
if (!ticket.landed) { if (!ticket.landed) {
console.log(ticket);
const newLanded = await this.getLanded({ const newLanded = await this.getLanded({
shipped: this.$.model.userParams.dateToAdvance, shipped: this.$.model.userParams.dateToAdvance,
addressFk: ticket.addressFk, addressFk: ticket.addressFk,
@ -229,7 +227,7 @@ export default class Controller extends Section {
newTicket: ticket.id ?? undefined, newTicket: ticket.id ?? undefined,
keepPrice: true keepPrice: true
}; };
console.log(params);
return {query, params}; return {query, params};
} }

View File

@ -24,31 +24,6 @@ describe('Component vnTicketAdvance', () => {
}]; }];
})); }));
describe('compareDate()', () => {
it('should return warning when the date is the present', () => {
let today = Date.vnNew();
let result = controller.compareDate(today);
expect(result).toEqual('warning');
});
it('should return sucess when the date is in the future', () => {
let futureDate = Date.vnNew();
futureDate = futureDate.setDate(futureDate.getDate() + 10);
let result = controller.compareDate(futureDate);
expect(result).toEqual('success');
});
it('should return undefined when the date is in the past', () => {
let pastDate = Date.vnNew();
pastDate = pastDate.setDate(pastDate.getDate() - 10);
let result = controller.compareDate(pastDate);
expect(result).toEqual(undefined);
});
});
describe('checked()', () => { describe('checked()', () => {
it('should return an array of checked tickets', () => { it('should return an array of checked tickets', () => {
const result = controller.checked; const result = controller.checked;

View File

@ -1,4 +1,6 @@
Advance tickets: Adelantar tickets Advance tickets: Adelantar tickets
Advance tickets with negatives: Adelantar tickets con negativos
Advance tickets without negatives: Adelantar tickets sin negativos
Search advance tickets by date: Busca tickets para adelantar por fecha Search advance tickets by date: Busca tickets para adelantar por fecha
Advance confirmation: ¿Desea adelantar {{checked}} tickets? Advance confirmation: ¿Desea adelantar {{checked}} tickets?
Success: "{{tickets}} Tickets movidos correctamente" Success: "{{tickets}} Tickets movidos correctamente"

View File

@ -5,3 +5,12 @@ vn-ticket-advance{
color: #f7931e color: #f7931e
} }
} }
.split-progress {
width: 40em;
}
@media screen and (max-width: 600px) {
.split-progress {
width: 100%;
}
}

View File

@ -115,7 +115,6 @@ class Controller extends Component {
option: parseInt(this.ticket.option), option: parseInt(this.ticket.option),
isWithoutNegatives: this.ticket.withoutNegatives, isWithoutNegatives: this.ticket.withoutNegatives,
withWarningAccept: this.ticket.withWarningAccept, withWarningAccept: this.ticket.withWarningAccept,
newTicket: null,
keepPrice: false keepPrice: false
}; };