4077-login_recover-password & account_verifyEmail #1063

Merged
alexm merged 52 commits from 4077-login_recover-password into dev 2022-11-28 11:34:03 +00:00
10 changed files with 71 additions and 3 deletions
Showing only changes of commit 8c137b57f4 - Show all commits

View File

@ -188,7 +188,7 @@ module.exports = Self => {
async function createSaleComponent(saleId, value, componentId, myOptions) {
const models = Self.app.models;
return models.SaleComponent.create({
return models.SaleComponent.upsert({
saleFk: saleId,
value: value,
componentFk: componentId

View File

@ -5,6 +5,13 @@
<vn-menu vn-id="menu">
<vn-list>
<vn-item
vn-acl="administrative"
vn-acl-action="remove"
ng-click="transferClient.show()"
translate>
Transfer client
</vn-item>
<vn-item
ng-click="addTurn.show()"
vn-acl="buyer"
@ -242,6 +249,36 @@
</tpl-buttons>
</vn-dialog>
<!-- Transfer Client popup -->
<vn-dialog
vn-id="transferClient"
title="transferClient"
size="sm"
on-accept="$ctrl.transferClient($client)">
<tpl-body>
<vn-autocomplete
vn-one
vn-id="client"
required="true"
url="Clients"
label="Client"
show-field="name"
value-field="id"
search-function="{or: [{id: $search}, {name: {like: '%'+ $search +'%'}}]}"
ng-model="$ctrl.ticket.client.id"
initial-data="$ctrl.ticket.client.id"
order="id">
<tpl-item>
#{{id}} - {{::name}}
</tpl-item>
</vn-autocomplete>
</tpl-body>
<tpl-buttons>
<button response="accept" translate>Transfer client</button>
</tpl-buttons>
</vn-dialog>
<!-- Send SMS popup -->
<vn-ticket-sms
vn-id="sms"

View File

@ -95,6 +95,23 @@ class Controller extends Section {
});
}
transferClient() {
this.$http.get(`Clients/${this.ticket.client.id}`).then(client => {
const ticket = this.ticket;
const params =
{
clientFk: client.data.id,
addressFk: client.data.defaultAddressFk,
};
this.$http.patch(`Tickets/${ticket.id}`, params).then(() => {
this.vnApp.showSuccess(this.$t('Data saved!'));
this.reload();
});
});
}
isTicketEditable() {
if (!this.ticket) return;

View File

@ -281,4 +281,17 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
$httpBackend.flush();
});
});
describe('transferClient()', () => {
it(`should perform two queries, a get to obtain the clientData and a patch to update the ticket`, () => {
const client =
{
clientFk: 1101,
addressFk: 1,
};
$httpBackend.expect('GET', `Clients/${ticket.client.id}`).respond(client);
$httpBackend.expect('PATCH', `Tickets/${ticket.id}`).respond();
controller.transferClient();
});
});
});

View File

@ -9,4 +9,5 @@ Send CSV Delivery Note: Enviar albarán en CSV
Send PDF Delivery Note: Enviar albarán en PDF
Show Proforma: Ver proforma
Refund all: Abonar todo
The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}"
The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}"
Transfer client: Transferir cliente

View File

@ -22,4 +22,4 @@ SMS Pending payment: 'SMS Pago pendiente'
Restore ticket: Restaurar ticket
You are going to restore this ticket: Vas a restaurar este ticket
Are you sure you want to restore this ticket?: ¿Seguro que quieres restaurar el ticket?
Are you sure you want to refund all?: ¿Seguro que quieres abonar todo?
Are you sure you want to refund all?: ¿Seguro que quieres abonar todo?