Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5077-horaEnvio-ticketBasicData
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-01-31 11:43:26 +01:00
commit c121f184b6
12 changed files with 67 additions and 74 deletions

View File

@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas. - (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas.
- (Tickets -> Datos básicos) Permite guardar la hora de envío - (Tickets -> Datos básicos) Permite guardar la hora de envío
- (Tickets -> Añadir pago) Eliminado "null" en las referencias
## [2302.01] - 2023-01-26 ## [2302.01] - 2023-01-26

View File

@ -23,6 +23,7 @@ describe('Worker time control path', () => {
it('should go to the next month, go to current month and go 1 month in the past', async() => { it('should go to the next month, go to current month and go 1 month in the past', async() => {
let date = new Date(); let date = new Date();
date.setDate(1);
date.setMonth(date.getMonth() + 1); date.setMonth(date.getMonth() + 1);
let month = date.toLocaleString('default', {month: 'long'}); let month = date.toLocaleString('default', {month: 'long'});
@ -32,6 +33,7 @@ describe('Worker time control path', () => {
expect(result).toContain(month); expect(result).toContain(month);
date = new Date(); date = new Date();
date.setDate(1);
month = date.toLocaleString('default', {month: 'long'}); month = date.toLocaleString('default', {month: 'long'});
await page.click(selectors.workerTimeControl.previousMonthButton); await page.click(selectors.workerTimeControl.previousMonthButton);
@ -40,6 +42,7 @@ describe('Worker time control path', () => {
expect(result).toContain(month); expect(result).toContain(month);
date = new Date(); date = new Date();
date.setDate(1);
date.setMonth(date.getMonth() - 1); date.setMonth(date.getMonth() - 1);
const timestamp = Math.round(date.getTime() / 1000); const timestamp = Math.round(date.getTime() / 1000);
month = date.toLocaleString('default', {month: 'long'}); month = date.toLocaleString('default', {month: 'long'});

View File

@ -87,6 +87,7 @@ ngModule.vnComponent('vnButtonMenu', {
selectFields: '<?', selectFields: '<?',
initialData: '<?', initialData: '<?',
showFilter: '<?', showFilter: '<?',
fields: '<?',
field: '=?', field: '=?',
url: '@?', url: '@?',
data: '<?', data: '<?',

View File

@ -59,13 +59,11 @@ class Controller extends Dialog {
if (value) { if (value) {
const accountingType = value.accountingType; const accountingType = value.accountingType;
if (this.originalDescription) { if (accountingType.receiptDescription != null) {
this.receipt.description = this.receipt.description = accountingType.receiptDescription;
`${accountingType && accountingType.receiptDescription}, ${this.originalDescription}`; if (this.originalDescription) this.receipt.description += `, ${this.originalDescription}`;
} else { } else if (this.originalDescription)
this.receipt.description = this.receipt.description = this.originalDescription;
`${accountingType && accountingType.receiptDescription}`;
}
this.maxAmount = accountingType && accountingType.maxAmount; this.maxAmount = accountingType && accountingType.maxAmount;
this.receipt.payed = new Date(); this.receipt.payed = new Date();

View File

@ -47,44 +47,32 @@ module.exports = function(Self) {
} }
try { try {
const promises = [];
if (args.deletes) { if (args.deletes) {
for (const itemTagId of args.deletes) { for (const itemTagId of args.deletes)
const itemTagDeleted = models.ItemTag.destroyById(itemTagId, myOptions); await models.ItemTag.destroyById(itemTagId, myOptions);
promises.push(itemTagDeleted);
}
} }
if (args.updates) { if (args.updates) {
for (const row of args.updates) { for (const row of args.updates) {
if (row.data.priority) { if (row.data.priority) {
const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions); const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions);
const itemTagUpdatedPriority = itemTag.updateAttributes({ await itemTag.updateAttributes({
priority: row.data.priority + args.maxPriority priority: row.data.priority + args.maxPriority
}, myOptions); }, myOptions);
promises.push(itemTagUpdatedPriority);
} }
} }
for (const row of args.updates) { for (const row of args.updates) {
const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions); const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions);
const itemTagUpdated = itemTag.updateAttributes(row.data, myOptions); await itemTag.updateAttributes(row.data, myOptions);
promises.push(itemTagUpdated);
} }
} }
if (args.creates) { if (args.creates) {
for (const itemTag of args.creates) { for (const itemTag of args.creates)
const newItemTag = models.ItemTag.create(itemTag, myOptions); await models.ItemTag.create(itemTag, myOptions);
promises.push(newItemTag);
}
} }
const resolvedPromises = await Promise.all(promises);
if (tx) await tx.commit(); if (tx) await tx.commit();
return resolvedPromises;
} catch (e) { } catch (e) {
if (tx) await tx.rollback(); if (tx) await tx.rollback();
throw e; throw e;

View File

@ -12,9 +12,8 @@ describe('tag onSubmit()', () => {
deletes: deletes deletes: deletes
} }
}; };
const result = await models.Tag.onSubmit(ctx, options); await models.Tag.onSubmit(ctx, options);
expect(result.length).toEqual(1);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();
@ -33,9 +32,8 @@ describe('tag onSubmit()', () => {
updates: updates updates: updates
} }
}; };
const result = await models.Tag.onSubmit(ctx, options); await models.Tag.onSubmit(ctx, options);
expect(result.length).toEqual(1);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();
@ -62,9 +60,8 @@ describe('tag onSubmit()', () => {
creates: creates creates: creates
} }
}; };
const result = await models.Tag.onSubmit(ctx, options); await models.Tag.onSubmit(ctx, options);
expect(result.length).toEqual(1);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();
@ -88,9 +85,8 @@ describe('tag onSubmit()', () => {
} }
}; };
const result = await models.Tag.onSubmit(ctx, options); await models.Tag.onSubmit(ctx, options);
expect(result.length).toEqual(4);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();

View File

@ -24,36 +24,42 @@
</vn-textfield> </vn-textfield>
<vn-input-number <vn-input-number
type="number" type="number"
step="0.01"
label="Minimum M3" label="Minimum M3"
ng-model="supplierAgencyTerm.minimumM3" ng-model="supplierAgencyTerm.minimumM3"
rule> rule>
</vn-input-number> </vn-input-number>
<vn-input-number <vn-input-number
type="number" type="number"
step="0.01"
label="Package Price" label="Package Price"
ng-model="supplierAgencyTerm.packagePrice" ng-model="supplierAgencyTerm.packagePrice"
rule> rule>
</vn-input-number> </vn-input-number>
<vn-input-number <vn-input-number
type="number" type="number"
step="0.01"
label="Km Price" label="Km Price"
ng-model="supplierAgencyTerm.kmPrice" ng-model="supplierAgencyTerm.kmPrice"
rule> rule>
</vn-input-number> </vn-input-number>
<vn-input-number <vn-input-number
type="number" type="number"
step="0.01"
label="M3 Price" label="M3 Price"
ng-model="supplierAgencyTerm.m3Price" ng-model="supplierAgencyTerm.m3Price"
rule> rule>
</vn-input-number> </vn-input-number>
<vn-input-number <vn-input-number
type="number" type="number"
step="0.01"
label="Route Price" label="Route Price"
ng-model="supplierAgencyTerm.routePrice" ng-model="supplierAgencyTerm.routePrice"
rule> rule>
</vn-input-number> </vn-input-number>
<vn-input-number <vn-input-number
type="number" type="number"
step="0.01"
label="Minimum Km" label="Minimum Km"
ng-model="supplierAgencyTerm.minimumKm" ng-model="supplierAgencyTerm.minimumKm"
rule> rule>

View File

@ -24,7 +24,7 @@ module.exports = Self => {
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
let statesList = await models.State.find({where: filter.where}, myOptions); let statesList = await models.State.find(filter, myOptions);
const isProduction = await models.Account.hasRole(userId, 'production', myOptions); const isProduction = await models.Account.hasRole(userId, 'production', myOptions);
const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson', myOptions); const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson', myOptions);
const isAdministrative = await models.Account.hasRole(userId, 'administrative', myOptions); const isAdministrative = await models.Account.hasRole(userId, 'administrative', myOptions);

View File

@ -22,6 +22,7 @@
disabled="!$ctrl.isEditable" disabled="!$ctrl.isEditable"
label="State" label="State"
value-field="code" value-field="code"
fields="['id', 'name', 'alertLevel', 'code']"
url="States/editableStates" url="States/editableStates"
on-change="$ctrl.changeState(value)"> on-change="$ctrl.changeState(value)">
</vn-button-menu> </vn-button-menu>

View File

@ -1,6 +1,6 @@
<vn-card class="summary"> <vn-card class="summary">
<h5> <h5>
<a <a
ng-if="::$ctrl.summary.id" ng-if="::$ctrl.summary.id"
vn-tooltip="Go to the ticket" vn-tooltip="Go to the ticket"
ui-sref="ticket.card.summary({id: {{::$ctrl.summary.id}}})" ui-sref="ticket.card.summary({id: {{::$ctrl.summary.id}}})"
@ -8,36 +8,37 @@
<vn-icon-button icon="launch"></vn-icon-button> <vn-icon-button icon="launch"></vn-icon-button>
</a> </a>
<span> <span>
Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}}
({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}} ({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}}
</span> </span>
<vn-button-menu <vn-button-menu
disabled="!$ctrl.isEditable" disabled="!$ctrl.isEditable"
class="message" class="message"
label="Change state" label="Change state"
value-field="code" value-field="code"
fields="['id', 'name', 'alertLevel', 'code']"
url="States/editableStates" url="States/editableStates"
on-change="$ctrl.changeState(value)"> on-change="$ctrl.changeState(value)">
</vn-button-menu> </vn-button-menu>
<vn-ticket-descriptor-menu <vn-ticket-descriptor-menu
ng-if="!$ctrl.isOnTicketCard" ng-if="!$ctrl.isOnTicketCard"
ticket-id="$ctrl.summary.id" ticket-id="$ctrl.summary.id"
parent-reload="$ctrl.reload()" parent-reload="$ctrl.reload()"
/> />
</h5> </h5>
<vn-horizontal> <vn-horizontal>
<vn-one> <vn-one>
<vn-label-value label="State" <vn-label-value label="State"
value="{{$ctrl.summary.ticketState.state.name}}"> value="{{$ctrl.summary.ticketState.state.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Salesperson"> <vn-label-value label="Salesperson">
<span <span
ng-click="workerDescriptor.show($event, $ctrl.summary.client.salesPersonFk)" ng-click="workerDescriptor.show($event, $ctrl.summary.client.salesPersonFk)"
class="link"> class="link">
{{$ctrl.summary.client.salesPersonUser.name}} {{$ctrl.summary.client.salesPersonUser.name}}
</span> </span>
</vn-label-value> </vn-label-value>
<vn-label-value label="Agency" <vn-label-value label="Agency"
value="{{$ctrl.summary.agencyMode.name}}"> value="{{$ctrl.summary.agencyMode.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Zone"> <vn-label-value label="Zone">
@ -47,11 +48,11 @@
{{$ctrl.summary.zone.name}} {{$ctrl.summary.zone.name}}
</span> </span>
</vn-label-value> </vn-label-value>
<vn-label-value label="Warehouse" <vn-label-value label="Warehouse"
value="{{$ctrl.summary.warehouse.name}}"> value="{{$ctrl.summary.warehouse.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Route"> <vn-label-value label="Route">
<span <span
ng-click="routeDescriptor.show($event, $ctrl.summary.routeFk)" ng-click="routeDescriptor.show($event, $ctrl.summary.routeFk)"
class="link"> class="link">
{{$ctrl.summary.routeFk}} {{$ctrl.summary.routeFk}}
@ -66,17 +67,17 @@
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-two> <vn-two>
<vn-label-value label="Shipped" <vn-label-value label="Shipped"
value="{{$ctrl.summary.shipped | date: 'dd/MM/yyyy HH:mm'}}"> value="{{$ctrl.summary.shipped | date: 'dd/MM/yyyy HH:mm'}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Landed" <vn-label-value label="Landed"
value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy'}}"> value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy'}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Package size" <vn-label-value label="Package size"
value="{{$ctrl.summary.packages}}"> value="{{$ctrl.summary.packages}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Address phone" <vn-label-value label="Address phone"
ng-if="$ctrl.summary.address.phone != null" ng-if="$ctrl.summary.address.phone != null"
value="{{$ctrl.summary.address.phone}}"> value="{{$ctrl.summary.address.phone}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Address mobile" <vn-label-value label="Address mobile"
@ -109,7 +110,7 @@
</vn-one> </vn-one>
<vn-auto name="sales"> <vn-auto name="sales">
<h4> <h4>
<a <a
ui-sref="ticket.card.sale({id:$ctrl.ticket.id})" ui-sref="ticket.card.sale({id:$ctrl.ticket.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Sale</span> <span translate vn-tooltip="Go to">Sale</span>
@ -146,13 +147,13 @@
vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}"> vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}">
</vn-icon> </vn-icon>
</a> </a>
<vn-icon <vn-icon
ng-show="::(sale.visible < 0)" ng-show="::(sale.visible < 0)"
color-main color-main
icon="warning" icon="warning"
vn-tooltip="Visible: {{::sale.visible || 0}}"> vn-tooltip="Visible: {{::sale.visible || 0}}">
</vn-icon> </vn-icon>
<vn-icon ng-show="sale.reserved" <vn-icon ng-show="sale.reserved"
icon="icon-reserve" icon="icon-reserve"
translate-attr="{title: 'Reserved'}"> translate-attr="{title: 'Reserved'}">
</vn-icon> </vn-icon>
@ -170,22 +171,22 @@
</vn-icon> </vn-icon>
</vn-td> </vn-td>
<vn-td number shrink> <vn-td number shrink>
<span <span
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)" ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)"
class="link"> class="link">
{{sale.itemFk | zeroFill:6}} {{sale.itemFk | zeroFill:6}}
</span> </span>
</vn-td> </vn-td>
<vn-td number shrink> <vn-td number shrink>
<vn-chip <vn-chip
class="transparent" class="transparent"
ng-class="{'alert': sale.visible < 0}"> ng-class="{'alert': sale.visible < 0}">
{{::sale.visible}} {{::sale.visible}}
</vn-chip> </vn-chip>
</vn-td> </vn-td>
<vn-td number shrink> <vn-td number shrink>
<vn-chip <vn-chip
class="transparent" class="transparent"
ng-class="{'alert': sale.available < 0}"> ng-class="{'alert': sale.available < 0}">
{{::sale.available}} {{::sale.available}}
</vn-chip> </vn-chip>
@ -216,7 +217,7 @@
</vn-auto> </vn-auto>
<vn-one ng-if="$ctrl.summary.packagings.length != 0"> <vn-one ng-if="$ctrl.summary.packagings.length != 0">
<h4> <h4>
<a <a
ui-sref="ticket.card.package({id:$ctrl.ticket.id})" ui-sref="ticket.card.package({id:$ctrl.ticket.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Packages</span> <span translate vn-tooltip="Go to">Packages</span>
@ -241,7 +242,7 @@
</vn-one> </vn-one>
<vn-one class="services" ng-if="$ctrl.summary.services.length != 0"> <vn-one class="services" ng-if="$ctrl.summary.services.length != 0">
<h4> <h4>
<a <a
ui-sref="ticket.card.service({id:$ctrl.ticket.id})" ui-sref="ticket.card.service({id:$ctrl.ticket.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Service</span> <span translate vn-tooltip="Go to">Service</span>
@ -276,7 +277,7 @@
<vn-horizontal> <vn-horizontal>
<vn-auto ng-if="$ctrl.summary.requests.length != 0"> <vn-auto ng-if="$ctrl.summary.requests.length != 0">
<h4> <h4>
<a <a
ui-sref="ticket.card.request.index({id:$ctrl.ticket.id})" ui-sref="ticket.card.request.index({id:$ctrl.ticket.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Purchase request</span> <span translate vn-tooltip="Go to">Purchase request</span>
@ -304,7 +305,7 @@
<vn-td number>{{::request.quantity}}</vn-td> <vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price}}</vn-td> <vn-td number>{{::request.price}}</vn-td>
<vn-td number> <vn-td number>
<span <span
ng-show="::request.saleFk" ng-show="::request.saleFk"
ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)" ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)"
class="link"> class="link">
@ -336,9 +337,9 @@
<vn-invoice-out-descriptor-popover <vn-invoice-out-descriptor-popover
vn-id="invoice-out-descriptor"> vn-id="invoice-out-descriptor">
</vn-invoice-out-descriptor-popover> </vn-invoice-out-descriptor-popover>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor"> vn-id="workerDescriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>
<vn-zone-descriptor-popover <vn-zone-descriptor-popover
vn-id="zoneDescriptor"> vn-id="zoneDescriptor">
</vn-zone-descriptor-popover> </vn-zone-descriptor-popover>

View File

@ -4,9 +4,9 @@
<div class="content"> <div class="content">
<h1 class="title centered uppercase">{{$t('title')}}</h1> <h1 class="title centered uppercase">{{$t('title')}}</h1>
<p class="centered"> <p class="centered">
Recibo de <strong class="uppercase">{{client.socialName}}</strong>, la cantidad de Recibo de <strong class="uppercase">{{client.socialName}}</strong>,
<strong>{{receipt.amountPaid}} €</strong> en concepto de 'entrega a cuenta', quedando pendiente en la cantidad de <strong>{{receipt.amountPaid}} €</strong>
la cuenta del cliente un saldo de <strong>{{receipt.amountUnpaid}} €</strong>. en concepto de 'entrega a cuenta'.
</p> </p>
<div class="signature"> <div class="signature">
<img v-bind:src="getReportSrc('signature.png')" /> <img v-bind:src="getReportSrc('signature.png')" />

View File

@ -1,11 +1,10 @@
SELECT SELECT
r.id, r.id,
r.amountPaid, r.amountPaid,
cr.amount AS amountUnpaid, r.payed,
r.payed,
r.companyFk r.companyFk
FROM receipt r FROM receipt r
JOIN client c ON c.id = r.clientFk JOIN client c ON c.id = r.clientFk
JOIN vn.clientRisk cr ON cr.clientFk = c.id JOIN vn.clientRisk cr ON cr.clientFk = c.id
AND cr.companyFk = r.companyFk AND cr.companyFk = r.companyFk
WHERE r.id = ? WHERE r.id = ?