merge
gitea/salix/test This commit looks good
Details
gitea/salix/test This commit looks good
Details
This commit is contained in:
commit
7f394ed671
|
@ -41,21 +41,10 @@ describe('Ticket Create packages path', () => {
|
|||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should attempt create a new package but receive an error if the quantity is invalid`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketPackages.firstQuantityInput, -99)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checkValidity();
|
||||
}, selectors.ticketPackages.firstQuantityInput);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it(`should create a new package with correct data`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, 99)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, -99)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
@ -73,9 +62,9 @@ describe('Ticket Create packages path', () => {
|
|||
|
||||
it(`should confirm the first quantity is just a number and the string part was ignored by the imput number`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
|
||||
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99')
|
||||
.waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value');
|
||||
|
||||
expect(result).toEqual('99');
|
||||
expect(result).toEqual('-99');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
"Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
|
||||
"ORDER_EMPTY": "Cesta vacía",
|
||||
"You don't have enough privileges to do that": "No tienes permisos para cambiar esto",
|
||||
"You can't create a ticket for a client that has a debt": "No puedes crear un ticket para un client con deuda",
|
||||
"NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT",
|
||||
"Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido",
|
||||
"Street cannot be empty": "Dirección no puede estar en blanco",
|
||||
|
|
|
@ -70,14 +70,16 @@ module.exports = Self => {
|
|||
discount: 100
|
||||
}, {transaction: transaction});
|
||||
|
||||
await sendMessage(ctx, {
|
||||
itemFk: sale.itemFk,
|
||||
ticketFk: sale.ticketFk,
|
||||
recipientFk: sale.item().itemType().worker().userFk,
|
||||
quantity: sale.quantity,
|
||||
concept: sale.concept,
|
||||
nickname: address.nickname
|
||||
}, transaction);
|
||||
if (sale.ticket().client().salesPerson()) {
|
||||
await sendMessage(ctx, {
|
||||
itemFk: sale.itemFk,
|
||||
ticketFk: sale.ticketFk,
|
||||
recipientFk: sale.ticket().client().salesPerson().userFk,
|
||||
quantity: sale.quantity,
|
||||
concept: sale.concept,
|
||||
nickname: address.nickname
|
||||
}, transaction);
|
||||
}
|
||||
}
|
||||
|
||||
let claim = await Self.findById(params.claimFk);
|
||||
|
@ -99,23 +101,14 @@ module.exports = Self => {
|
|||
include: [
|
||||
{
|
||||
relation: 'ticket',
|
||||
scope: {fields: ['warehouseFk', 'companyFk']}
|
||||
},
|
||||
{
|
||||
relation: 'item',
|
||||
scope: {
|
||||
fields: ['typeFk'],
|
||||
fields: ['clientFk', 'warehouseFk', 'companyFk'],
|
||||
include: {
|
||||
relation: 'itemType',
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['workerFk'],
|
||||
include: {
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['id', 'userFk'],
|
||||
}
|
||||
relation: 'salesPerson'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
order="name"
|
||||
show-field="name"
|
||||
value-field="field"
|
||||
label="Order by">
|
||||
label="Order by"
|
||||
disabled="!model.data">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete vn-one
|
||||
data="$ctrl.wayList"
|
||||
|
@ -32,7 +33,8 @@
|
|||
translate-fields="['name']"
|
||||
show-field="name"
|
||||
value-field="way"
|
||||
label="Order">
|
||||
label="Order"
|
||||
disabled="!model.data">
|
||||
</vn-autocomplete>
|
||||
</vn-auto>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -74,8 +74,7 @@ class Controller {
|
|||
set way(value) {
|
||||
this._way = value;
|
||||
|
||||
if (value)
|
||||
this.applyOrder();
|
||||
if (value) this.applyOrder();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,8 +87,7 @@ class Controller {
|
|||
set field(value) {
|
||||
this._field = value;
|
||||
|
||||
if (value)
|
||||
this.applyOrder();
|
||||
if (value) this.applyOrder();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -64,7 +64,7 @@ class Controller {
|
|||
if (this.tags.length > 0)
|
||||
this.applyFilters();
|
||||
|
||||
if (value)
|
||||
if (this._category)
|
||||
this.updateItemTypes();
|
||||
}
|
||||
|
||||
|
@ -97,8 +97,8 @@ class Controller {
|
|||
}
|
||||
|
||||
onSearchById(event) {
|
||||
if (event.key !== 'Enter' || !this.itemFk) return;
|
||||
this.applyFilters();
|
||||
if (event.key === 'Enter' && (this.tags.length > 0 || this.itemFk || this.type))
|
||||
this.applyFilters();
|
||||
}
|
||||
|
||||
onSearchByTag(event) {
|
||||
|
@ -113,7 +113,7 @@ class Controller {
|
|||
remove(index) {
|
||||
this.tags.splice(index, 1);
|
||||
|
||||
if (this.tags.length == 0 && this.category && this.type)
|
||||
if (this.tags.length >= 0 || this.itemFk || this.type)
|
||||
this.applyFilters();
|
||||
}
|
||||
|
||||
|
|
|
@ -137,11 +137,13 @@ describe('Order', () => {
|
|||
|
||||
describe('remove()', () => {
|
||||
it(`should remove a tag from tags property`, () => {
|
||||
spyOn(controller, 'applyFilters');
|
||||
controller.tags = [{tagFk: 1, value: 'Blue'}, {tagFk: 2, value: '70'}];
|
||||
controller.remove(0);
|
||||
|
||||
expect(controller.tags.length).toEqual(1);
|
||||
expect(controller.tags[0].tagFk).toEqual(2);
|
||||
expect(controller.applyFilters).toHaveBeenCalledWith();
|
||||
});
|
||||
|
||||
it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => {
|
||||
|
|
|
@ -26,7 +26,6 @@ module.exports = Self => {
|
|||
throw new UserError(`The value should be a number`);
|
||||
|
||||
let model = Self.app.models;
|
||||
let thisTicketIsEditable = await model.Ticket.isEditable(params.editLines[0].ticketFk);
|
||||
let ticket = await model.Ticket.find({
|
||||
where: {
|
||||
id: params.editLines[0].ticketFk
|
||||
|
@ -40,13 +39,9 @@ module.exports = Self => {
|
|||
fields: ['id', 'clientFk', 'refFk']
|
||||
});
|
||||
|
||||
let userId = ctx.req.accessToken.userId;
|
||||
let isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant');
|
||||
|
||||
if ((!thisTicketIsEditable && !isSalesAssistant) || (ticket.refFk && isSalesAssistant))
|
||||
if (ticket.refFk)
|
||||
throw new UserError(`The sales of this ticket can't be modified`);
|
||||
|
||||
|
||||
let componentToUse;
|
||||
let usesMana = await model.WorkerMana.findOne({where: {workerFk: ticket[0].client().salesPersonFk}, fields: 'amount'});
|
||||
|
||||
|
|
|
@ -49,13 +49,6 @@ module.exports = Self => {
|
|||
|
||||
if (!address.client().isActive)
|
||||
throw new UserError(`You can't create a ticket for a inactive client`);
|
||||
|
||||
let clientFk = address.clientFk;
|
||||
let query = `SELECT vn.clientGetDebt(?, CURDATE()) AS debt`;
|
||||
let clientDebt = await Self.rawSql(query, [clientFk]);
|
||||
|
||||
if (address.client().credit - clientDebt[0].debt <= 0)
|
||||
throw new UserError(`You can't create a ticket for a client that has a debt`);
|
||||
}
|
||||
|
||||
if (!transaction || !transaction.commit)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
field="package.packagingFk">
|
||||
<tpl-item>{{itemFk}} : {{name}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-input-number vn-one min="1" step="1"
|
||||
<vn-input-number vn-one step="1"
|
||||
label="Quantity"
|
||||
model="package.quantity"
|
||||
rule="TicketPackaging.quantity">
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
</vn-icon>
|
||||
</a>
|
||||
<vn-icon
|
||||
ng-show="sale.visible || sale.available"
|
||||
ng-show="sale.visible < 0 || sale.available < 0"
|
||||
color-main
|
||||
icon="warning"
|
||||
vn-tooltip="Visible: {{::sale.visible || 0}} <br> {{::$ctrl.$translate.instant('Available')}}: {{::sale.available || 0}}">
|
||||
|
|
|
@ -63,8 +63,8 @@
|
|||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th number>Item</vn-th>
|
||||
<vn-th number>Quantity</vn-th>
|
||||
<vn-th number shrink>Item</vn-th>
|
||||
<vn-th number shrink>Quantity</vn-th>
|
||||
<vn-th>Description</vn-th>
|
||||
<vn-th number>Price</vn-th>
|
||||
<vn-th number>Discount</vn-th>
|
||||
|
@ -89,14 +89,14 @@
|
|||
</vn-icon>
|
||||
<vn-icon ng-show="sale.reserved" icon="icon-reserva"></vn-icon>
|
||||
</vn-td>
|
||||
<vn-td number>
|
||||
<vn-td number shrink>
|
||||
<span
|
||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)"
|
||||
class="link">
|
||||
{{sale.itemFk | zeroFill:6}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td number>{{::sale.quantity}}</vn-td>
|
||||
<vn-td number shrink>{{::sale.quantity}}</vn-td>
|
||||
<vn-td expand>
|
||||
<vn-fetched-tags
|
||||
max-length="6"
|
||||
|
|
|
@ -40,10 +40,14 @@ class Controller {
|
|||
const holidays = data.holidays;
|
||||
const events = [];
|
||||
holidays.forEach(holiday => {
|
||||
const holidayDetail = holiday.detail && holiday.detail.description;
|
||||
const holidayType = holiday.type && holiday.type.name;
|
||||
const holidayName = holidayDetail || holidayType;
|
||||
|
||||
events.push({
|
||||
dated: holiday.dated,
|
||||
className: 'red',
|
||||
title: holiday.detail.description || holiday.type.name,
|
||||
title: holidayName,
|
||||
isRemovable: false
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue