Merge branch 'dev' into test
gitea/salix/test This commit looks good
Details
gitea/salix/test This commit looks good
Details
This commit is contained in:
commit
0e40d11c6d
|
@ -29,8 +29,8 @@ module.exports = Self => {
|
|||
const accessToken = ctx.options && ctx.options.accessToken || ctx.req && ctx.req.accessToken;
|
||||
const userId = accessToken.userId;
|
||||
const models = Self.app.models;
|
||||
const sender = await models.Account.findById(userId, options);
|
||||
const recipient = await models.Account.findById(data.recipientFk, options);
|
||||
const sender = await models.Account.findById(userId, null, options);
|
||||
const recipient = await models.Account.findById(data.recipientFk, null, options);
|
||||
|
||||
await Self.create({
|
||||
sender: sender.name,
|
||||
|
|
|
@ -10,7 +10,10 @@ module.exports = function createNightmare(width = 1280, height = 720) {
|
|||
typeInterval: 10,
|
||||
x: 0,
|
||||
y: 0,
|
||||
waitTimeout: 2000
|
||||
waitTimeout: 2000,
|
||||
// openDevTools: {
|
||||
// mode: 'detach'
|
||||
// }
|
||||
}).viewport(width, height);
|
||||
|
||||
nightmare.on('console', (type, message, ...args) => {
|
||||
|
|
|
@ -429,7 +429,7 @@ export default {
|
|||
firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-input-number input',
|
||||
firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)',
|
||||
firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)',
|
||||
firstSaleColour: 'vn-tr:nth-child(1) vn-fetched-tags section',
|
||||
firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-fetched-tags section',
|
||||
firstSaleLength: 'vn-ticket-sale vn-tr:nth-child(1) vn-td-editable:nth-child(6) section:nth-child(3)',
|
||||
firstSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(1) vn-check[ng-model="sale.checked"]',
|
||||
secondSaleColour: 'vn-tr:nth-child(2) vn-fetched-tags section',
|
||||
|
|
|
@ -37,7 +37,6 @@ describe('Ticket descriptor path', () => {
|
|||
.wait(selectors.ticketDescriptor.changeShippedHourInput)
|
||||
.isVisible(selectors.ticketDescriptor.changeShippedHourInput);
|
||||
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
|
@ -127,16 +126,6 @@ describe('Ticket descriptor path', () => {
|
|||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should navigate to the added ticket using the descriptors ship button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.closeStowawayDialog)
|
||||
.waitToClick(selectors.ticketDescriptor.shipButton)
|
||||
.waitForURL('#!/ticket/17/summary')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('#!/ticket/17/summary');
|
||||
});
|
||||
|
||||
it(`should check the state of the stowaway ticket is embarked`, async() => {
|
||||
const state = await nightmare
|
||||
.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
||||
|
@ -144,15 +133,6 @@ describe('Ticket descriptor path', () => {
|
|||
expect(state).toEqual('State Embarcando');
|
||||
});
|
||||
|
||||
it(`should navigate to the ship ticket using the descriptors ship button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.shipButton)
|
||||
.waitForURL('#!/ticket/16/summary')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('#!/ticket/16/summary');
|
||||
});
|
||||
|
||||
it(`should navigate back to the added ticket using the descriptors ship button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.closeStowawayDialog)
|
||||
|
|
|
@ -78,7 +78,7 @@ describe('Ticket services path', () => {
|
|||
.waitToClick(selectors.ticketService.saveDescriptionButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`can't be blank`);
|
||||
expect(result).toEqual(`Name can't be empty`);
|
||||
});
|
||||
|
||||
it('should create a new description then add price then create the service', async() => {
|
||||
|
|
|
@ -134,7 +134,7 @@ module.exports = function(Self) {
|
|||
break;
|
||||
}
|
||||
|
||||
val = recordSet && recordSet.id || val; // FIXME preparar todos los modelos con campo name
|
||||
val = recordSet && recordSet.id || val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,5 +108,6 @@
|
|||
"This postal code is not valid": "This postal code is not valid",
|
||||
"is invalid": "is invalid",
|
||||
"The postcode doesn't exists. Ensure you put the correct format": "El código postal no existe. Asegúrate de ponerlo con el formato correcto",
|
||||
"The department name can't be repeated": "El nombre del departamento no puede repetirse"
|
||||
"The department name can't be repeated": "El nombre del departamento no puede repetirse",
|
||||
"You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado"
|
||||
}
|
|
@ -27,24 +27,3 @@ exports.getFinalState = function(ctx) {
|
|||
exports.isMultiple = function(ctx) {
|
||||
return !ctx.isNewInstance && !ctx.currentInstance;
|
||||
};
|
||||
|
||||
/* exports.fkToValue = async function(instance, ctx, model) {
|
||||
let transaction = ctx.options && ctx.options.transaction;
|
||||
let cleanInstance = JSON.parse(JSON.stringify(instance));
|
||||
let result = {};
|
||||
for (let key in cleanInstance) {
|
||||
let val = cleanInstance[key];
|
||||
if (val === undefined || val === null) continue;
|
||||
for (let key1 in model.relations) {
|
||||
let val1 = model.relations[key1];
|
||||
if (val1.keyFrom == key && key != 'id') {
|
||||
let recordSet = await val1.modelTo.findById(val, {}, {transaction});
|
||||
val = recordSet.name || recordSet.id; // FIXME preparar todos los modelos con campo name
|
||||
break;
|
||||
}
|
||||
}
|
||||
result[key] = val;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Traveling days: Días de viaje
|
||||
Closure hour (ETD): Hora de cierre (ETD)
|
||||
Closing hour (ETD): Hora de cierre (ETD)
|
||||
Bonus: Bonificación
|
|
@ -30,7 +30,7 @@
|
|||
<vn-label-value label="Agency"
|
||||
value="{{$ctrl.zone.agencyMode.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Closure hour (ETD)"
|
||||
<vn-label-value label="Closing hour (ETD)"
|
||||
value="{{$ctrl.zone.hour | dateTime: 'HH:mm'}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Traveling days"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</vn-label-value>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-label-value label="Estimated hour (ETD)"
|
||||
<vn-label-value label="Closing hour (ETD)"
|
||||
value="{{$ctrl.summary.hour | dateTime: 'HH:mm'}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Traveling days"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('createFromSales', {
|
||||
description: 'Create a claim',
|
||||
|
@ -25,13 +27,19 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.createFromSales = async(ctx, params) => {
|
||||
let model = Self.app.models;
|
||||
let models = Self.app.models;
|
||||
let userId = ctx.req.accessToken.userId;
|
||||
let tx = await Self.beginTransaction({});
|
||||
|
||||
try {
|
||||
let options = {transaction: tx};
|
||||
const worker = await Self.app.models.Worker.findOne({
|
||||
|
||||
const ticketId = params.claim.ticketFk;
|
||||
const ticket = await models.Ticket.findById(ticketId, null, options);
|
||||
if (ticket.isDeleted)
|
||||
throw new UserError(`You can't create a claim for a removed ticket`);
|
||||
|
||||
const worker = await models.Worker.findOne({
|
||||
where: {userFk: userId}
|
||||
}, options);
|
||||
|
||||
|
@ -40,7 +48,7 @@ module.exports = Self => {
|
|||
let promises = [];
|
||||
|
||||
for (const sale of params.sales) {
|
||||
const newClaimBeginning = model.ClaimBeginning.create({
|
||||
const newClaimBeginning = models.ClaimBeginning.create({
|
||||
saleFk: sale.id,
|
||||
claimFk: newClaim.id,
|
||||
quantity: sale.quantity
|
||||
|
|
|
@ -26,7 +26,7 @@ module.exports = function(Self) {
|
|||
|
||||
let address = data.address;
|
||||
let newAddress = await Address.create(address, options);
|
||||
let client = await Client.findById(address.clientFk, options);
|
||||
let client = await Client.findById(address.clientFk, null, options);
|
||||
|
||||
if (data.isDefaultAddress) {
|
||||
await client.updateAttributes({
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = function(Self) {
|
|||
|
||||
Self.validateBinded('credit', Self.validateCredit, {
|
||||
message: 'The credit must be an integer greater than or equal to zero',
|
||||
allowNull: false, // FIXME: Ignored by loopback when it's false
|
||||
allowNull: false,
|
||||
allowBlank: false
|
||||
});
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ module.exports = Self => {
|
|||
Self.regenerate = async(ctx, id) => {
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const models = Self.app.models;
|
||||
const invoiceReportFk = 30; // FIXME - Should be deprecated
|
||||
const invoiceReportFk = 30; // Should be deprecated
|
||||
const worker = await models.Worker.findOne({where: {userFk: userId}});
|
||||
const tx = await Self.beginTransaction({});
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('invoiceOut regenerate()', () => {
|
||||
const invoiceReportFk = 30; // FIXME - Should be deprecated
|
||||
const invoiceReportFk = 30;
|
||||
const invoiceOutId = 1;
|
||||
|
||||
afterAll(async done => {
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
</vn-check>
|
||||
</vn-td>
|
||||
<vn-td>{{::order.sourceApp}}</vn-td>
|
||||
<vn-td center>{{::order.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td center>{{::order.created | dateTime: 'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td center>{{::order.landed | date:'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td>{{::order.companyCode}}</vn-td>
|
||||
<vn-td number>{{::order.total | currency: 'EUR': 2 | dashIfEmpty}}</vn-td>
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
class="modal-form"
|
||||
on-open="model.refresh()">
|
||||
<tpl-body>
|
||||
<vn-horizontal class="header vn-pa-md">
|
||||
<section class="header vn-pa-md">
|
||||
<h5><span translate>Stowaways to add</span></h5>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-pa-md"> <!-- FIXME: Dialog width -->
|
||||
</section>
|
||||
<vn-horizontal class="vn-pa-md">
|
||||
<vn-data-viewer model="model">
|
||||
<vn-table model="model" auto-load="false">
|
||||
<vn-thead>
|
||||
|
|
|
@ -15,7 +15,6 @@ class Controller {
|
|||
{name: 'Delete ticket', callback: this.showDeleteTicketDialog},
|
||||
{name: 'Change shipped hour', callback: this.showChangeShipped},
|
||||
{name: 'Send SMS', callback: this.showSMSDialog},
|
||||
{name: 'Show pallet report', callback: this.openRptRoute},
|
||||
{
|
||||
name: 'Add stowaway',
|
||||
callback: this.showAddStowaway,
|
||||
|
@ -147,11 +146,6 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
openRptRoute() {
|
||||
let url = `/api/report/rpt-route?routeFk=${this.ticket.routeFk}`;
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
showAddStowaway() {
|
||||
this.$scope.addStowaway.show();
|
||||
}
|
||||
|
|
|
@ -7,9 +7,10 @@ vn-add-stowaway {
|
|||
}
|
||||
|
||||
vn-dialog.modal-form {
|
||||
vn-horizontal.header {
|
||||
section.header {
|
||||
background-color: $color-main;
|
||||
color: $color-font-dark;
|
||||
text-align: center;
|
||||
|
||||
h5 {
|
||||
color: inherit;
|
||||
|
|
|
@ -11,11 +11,27 @@ class Controller {
|
|||
this.$http = $http;
|
||||
this.edit = {};
|
||||
this.moreOptions = [
|
||||
{callback: this.markAsReserved, name: 'Mark as reserved'},
|
||||
{callback: this.unmarkAsReserved, name: 'Unmark as reserved'},
|
||||
{callback: this.showEditDialog, name: 'Update discount', show: () => !this.hasInvoice()},
|
||||
{callback: this.createClaim, name: 'Add claim'},
|
||||
{callback: this.showSMSDialog, name: 'Send SMS'}
|
||||
{name: 'Send SMS', callback: this.showSMSDialog},
|
||||
{
|
||||
name: 'Mark as reserved',
|
||||
callback: this.markAsReserved,
|
||||
show: () => this.isEditable
|
||||
},
|
||||
{
|
||||
name: 'Unmark as reserved',
|
||||
callback: this.unmarkAsReserved,
|
||||
show: () => this.isEditable
|
||||
},
|
||||
{
|
||||
name: 'Update discount',
|
||||
callback: this.showEditDialog,
|
||||
show: () => this.isEditable
|
||||
},
|
||||
{
|
||||
name: 'Add claim',
|
||||
callback: this.createClaim,
|
||||
show: () => this.isEditable
|
||||
},
|
||||
];
|
||||
this._sales = [];
|
||||
this.imagesPath = '//verdnatura.es/vn-image-data/catalog';
|
||||
|
@ -431,15 +447,6 @@ class Controller {
|
|||
this.$scope.sms.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the current ticket
|
||||
* is already invoiced
|
||||
* @return {Boolean} - True if invoiced
|
||||
*/
|
||||
hasInvoice() {
|
||||
return this.ticket.refFk !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a new instance
|
||||
*/
|
||||
|
|
|
@ -105,7 +105,6 @@
|
|||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<!-- FIXME - APPLY CSS POST-RENDER -->
|
||||
<tr >
|
||||
<td colspan="7"></td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue