{{ $t('title') }}
+{{$t('description.instructions')}}
+diff --git a/.eslintrc.yml b/.eslintrc.yml index 3b82d0a90..247319137 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -31,4 +31,3 @@ rules: curly: [error, multi-or-nest] indent: [error, 4] arrow-parens: [error, as-needed] - jasmine/no-focused-tests: 0 \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 3b409aca3..ccc722c44 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -440,9 +440,12 @@ INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES - ( 1, 1 , 1, 'ready' ), - ( 2, 2 , 2, 'do it fast please'), - ( 3, 3 , 3, ''); + (1, 1 , 1, 'ready' ), + (2, 2 , 2, 'do it fast please'), + (3, 3 , 3, 'Faster faster fasteeeeeer!!!'), + (4, 4 , 3, 'Deliver before 8am'), + (5, 13 , 3, 'You can run from the disappointments you are trying to forget. But its only when you embrace your past that you truly move forward. Maybe I never get to go home again, but I found my way there. And I am glad I did.'), + (6, 14, 3, 'Careful, armed warhead'); INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `created`) VALUES diff --git a/modules/client/back/methods/sms/send.js b/modules/client/back/methods/sms/send.js index 539b6e546..d11b722f5 100644 --- a/modules/client/back/methods/sms/send.js +++ b/modules/client/back/methods/sms/send.js @@ -6,11 +6,11 @@ module.exports = Self => { Self.remoteMethodCtx('send', { description: 'Sends SMS to a destination phone', accepts: [{ - arg: 'recipientFk', + arg: 'destinationFk', type: 'Integer' }, { - arg: 'recipient', + arg: 'destination', type: 'String', required: true, }, @@ -20,7 +20,7 @@ module.exports = Self => { required: true, }], returns: { - type: 'boolean', + type: 'Object', root: true }, http: { @@ -29,7 +29,7 @@ module.exports = Self => { } }); - Self.send = async(ctx, recipientFk, recipient, message) => { + Self.send = async(ctx, destinationFk, destination, message) => { const userId = ctx.req.accessToken.userId; const smsConfig = await Self.app.models.SmsConfig.findOne(); const soapClient = await soap.createClientAsync(smsConfig.uri); @@ -37,7 +37,7 @@ module.exports = Self => { user: smsConfig.user, pass: smsConfig.password, src: smsConfig.title, - dst: recipient, + dst: destination, msg: message }; @@ -61,18 +61,21 @@ module.exports = Self => { console.error(e); } + const statusCode = status.codigo[0]; + const statusDescription = status.descripcion[0]; + const newSms = { senderFk: userId, - destinationFk: recipientFk || null, - destination: recipient, + destinationFk: destinationFk || null, + destination: destination, message: message, - statusCode: status.codigo, - status: status.descripcion + statusCode: statusCode, + status: statusDescription }; - const sms = Self.create(newSms); + const sms = await Self.create(newSms); - if (status.codigo != 200) + if (statusCode != 200) throw new UserError(`We weren't able to send this SMS`); return sms; diff --git a/modules/client/back/models/sms.json b/modules/client/back/models/sms.json index ec458e73d..aa9737478 100644 --- a/modules/client/back/models/sms.json +++ b/modules/client/back/models/sms.json @@ -1,7 +1,11 @@ { "name": "Sms", "description": "Sms sent to client", - "base": "VnModel", + "base": "Loggable", + "log": { + "model":"ClientLog", + "relation": "recipient" + }, "options": { "mysql": { "table": "sms" diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html index 30bf2dcc8..9d907e5c2 100644 --- a/modules/client/front/sms/index.html +++ b/modules/client/front/sms/index.html @@ -5,8 +5,8 @@
{{$t('description.instructions')}}
+{{$t('Route')}} | +{{route.id}} | +{{$t('Driver')}} | +{{route.userNickName}} | +
---|---|---|---|
{{$t('Date')}} | +{{date(route.created)}} | +{{$t('Vehicle')}} | +{{route.vehicleTradeMark}} {{route.vehicleModel}} | +
{{$t('Time')}} | +{{time(route.time)}} | ++ | {{route.plateNumber}} | +
{{$t('Volume')}} | +{{route.m3}} | +{{$t('Agency')}} | +{{route.agencyName}} | +
+ Hora inicio + |
+
+ Hora fin + |
+ + |
+ Km inicio + |
+
+ Km fin + |
+
+ |
+ + |
+ |
+
{{$t('Order')}} | +{{$t('Ticket')}} | +{{$t('Client')}} | +{{$t('Address')}} | +{{$t('Packages')}} | +
{{ticket.priority}} | +{{ticket.id}} | +{{ticket.clientFk}} {{ticket.addressName}} | ++ {{ticket.addressFk.toString().substr(0, ticket.addressFk.toString().length - 3)}} + + {{ticket.addressFk.toString().substr(-3, 3)}} + + | +{{ticket.packages}} | +
{{$t('Street')}} | +{{ticket.street}} | +{{$t('Postcode')}} | +{{ticket.postalCode}} | +
---|---|---|---|
{{$t('City')}} | +{{ticket.city}} | +{{$t('Agency')}} | +{{ticket.ticketAgency}} | +
{{$t('Mobile')}} | +{{ticket.mobile}} | +{{$t('Phone')}} | +{{ticket.phone}} | +
{{$t('Warehouse')}} | +{{ticket.warehouseName}} | +{{$t('salesPerson')}} | +{{ticket.salesPersonName}} | +
{{$t('Import')}} | +{{ticket.import}} | +
{{ticket.description}}
+{{$t('stowaway')}}: {{ticket.shipFk}}
+