Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
This commit is contained in:
commit
e1e65e8b2e
|
@ -0,0 +1,10 @@
|
|||
ALTER TABLE `vn`.`route`
|
||||
ADD COLUMN `zoneFk` INT NULL AFTER `description`,
|
||||
ADD INDEX `fk_route_1_idx` (`zoneFk` ASC);
|
||||
;
|
||||
ALTER TABLE `vn`.`route`
|
||||
ADD CONSTRAINT `fk_route_1`
|
||||
FOREIGN KEY (`zoneFk`)
|
||||
REFERENCES `vn`.`zone` (`id`)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
|
@ -0,0 +1,74 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const soap = require('soap');
|
||||
|
||||
describe('sms send()', () => {
|
||||
it('should return the expected message and status code', async() => {
|
||||
const code = 200;
|
||||
const smsConfig = await app.models.SmsConfig.findOne();
|
||||
const soapClient = await soap.createClientAsync(smsConfig.uri);
|
||||
spyOn(soap, 'createClientAsync').and.returnValue(soapClient);
|
||||
spyOn(soapClient, 'sendSMSAsync').and.returnValue([{
|
||||
result: {
|
||||
$value:
|
||||
`<xtratelecom-sms-response>
|
||||
<sms>
|
||||
<codigo>
|
||||
${code}
|
||||
</codigo>
|
||||
<descripcion>
|
||||
Envio en procesamiento
|
||||
</descripcion>
|
||||
<messageId>
|
||||
1
|
||||
</messageId>
|
||||
</sms>
|
||||
<procesoId>
|
||||
444328681
|
||||
</procesoId>
|
||||
</xtratelecom-sms-response>`
|
||||
}
|
||||
}]);
|
||||
let ctx = {req: {accessToken: {userId: 1}}};
|
||||
let result = await app.models.Sms.send(ctx, 105, 'destination', 'My SMS Body');
|
||||
|
||||
expect(result.statusCode).toEqual(200);
|
||||
expect(result.status).toContain('Envio en procesamiento');
|
||||
});
|
||||
|
||||
it(`should throw if the response code isn't 200`, async() => {
|
||||
let error;
|
||||
const code = 400;
|
||||
const smsConfig = await app.models.SmsConfig.findOne();
|
||||
const soapClient = await soap.createClientAsync(smsConfig.uri);
|
||||
spyOn(soap, 'createClientAsync').and.returnValue(soapClient);
|
||||
spyOn(soapClient, 'sendSMSAsync').and.returnValue([{
|
||||
result: {
|
||||
$value:
|
||||
`<xtratelecom-sms-response>
|
||||
<sms>
|
||||
<codigo>
|
||||
${code}
|
||||
</codigo>
|
||||
<descripcion>
|
||||
Envio en procesamiento
|
||||
</descripcion>
|
||||
<messageId>
|
||||
1
|
||||
</messageId>
|
||||
</sms>
|
||||
<procesoId>
|
||||
444328681
|
||||
</procesoId>
|
||||
</xtratelecom-sms-response>`
|
||||
}
|
||||
}]);
|
||||
let ctx = {req: {accessToken: {userId: 1}}};
|
||||
try {
|
||||
await app.models.Sms.send(ctx, 105, 'destination', 'My SMS Body');
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
|
||||
expect(error.message).toEqual(`We weren't able to send this SMS`);
|
||||
});
|
||||
});
|
|
@ -69,6 +69,11 @@
|
|||
"type": "hasMany",
|
||||
"model": "Ticket",
|
||||
"foreignKey": "routeFk"
|
||||
}
|
||||
},
|
||||
"zone": {
|
||||
"type": "belongsTo",
|
||||
"model": "Zone",
|
||||
"foreignKey": "zoneFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@ export default class Controller {
|
|||
'kmEnd',
|
||||
'started',
|
||||
'finished',
|
||||
'cost'
|
||||
'cost',
|
||||
'zoneFk'
|
||||
],
|
||||
|
||||
where: {id: $stateParams.id},
|
||||
|
@ -35,6 +36,12 @@ export default class Controller {
|
|||
scope: {
|
||||
fields: ['id', 'm3']
|
||||
}
|
||||
},
|
||||
{
|
||||
relation: 'zone',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
<vn-label-value label="Agency"
|
||||
value="{{$ctrl.route.agencyMode.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Zone"
|
||||
value="{{$ctrl.route.zone.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Volume"
|
||||
value="{{$ctrl.route.m3 | dashIfEmpty}} / {{$ctrl.route.vehicle.m3 | dashIfEmpty}} m³">
|
||||
</vn-label-value>
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
</vn-multi-check>
|
||||
</vn-th>
|
||||
<vn-th>Order</vn-th>
|
||||
<vn-th number>Ticket id</vn-th>
|
||||
<vn-th>Alias</vn-th>
|
||||
<vn-th number>Ticket</vn-th>
|
||||
<vn-th>Client</vn-th>
|
||||
<vn-th number shrink>Packages</vn-th>
|
||||
<vn-th shrink>m³</vn-th>
|
||||
<vn-th shrink>Warehouse</vn-th>
|
||||
|
@ -53,13 +53,11 @@
|
|||
</vn-check>
|
||||
</vn-td>
|
||||
<vn-td>
|
||||
<vn-textfield
|
||||
tab-index="-1"
|
||||
type="number"
|
||||
<vn-input-number
|
||||
on-change="$ctrl.setPriority(ticket.id, ticket.priority)"
|
||||
ng-model="ticket.priority"
|
||||
rule="Ticket">
|
||||
</vn-textfield>
|
||||
</vn-input-number>
|
||||
</vn-td>
|
||||
<vn-td number>
|
||||
<span
|
||||
|
@ -81,15 +79,15 @@
|
|||
<vn-td shrink>{{ticket.client.postcode}}</vn-td>
|
||||
<vn-td expand title="{{ticket.client.street}}">{{ticket.client.street}}</vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-icon
|
||||
<vn-icon-button
|
||||
ng-if="ticket.notes.length"
|
||||
vn-tooltip="{{ticket.notes[0].description}}"
|
||||
title="::{{ticket.notes[0].description}}"
|
||||
icon="insert_drive_file">
|
||||
</vn-icon>
|
||||
</vn-icon-button>
|
||||
</vn-td>
|
||||
<vn-td>
|
||||
<vn-icon-button
|
||||
vn-tooltip="Remove ticket"
|
||||
translate-attr="::{title: 'Remove ticket'}"
|
||||
icon="delete"
|
||||
ng-click="$ctrl.showDeleteConfirm(ticket.id)"
|
||||
tabindex="-1">
|
||||
|
|
Loading…
Reference in New Issue