Get phone from address and client

This commit is contained in:
Joan Sanchez 2020-02-21 08:37:37 +01:00
parent a86c7c9b8a
commit 893b634d33
7 changed files with 56 additions and 48 deletions

View File

@ -5,60 +5,60 @@ module.exports = function(Self) {
description: 'Creates client address updating default address',
accepts: [{
arg: 'id',
type: 'Number',
type: 'number',
description: 'The client id',
http: {source: 'path'}
},
{
arg: 'nickname',
type: 'String',
type: 'string',
required: true
},
{
arg: 'city',
type: 'String',
type: 'string',
required: true
},
{
arg: 'street',
type: 'String',
type: 'string',
required: true
},
{
arg: 'phone',
type: 'String'
type: 'string'
},
{
arg: 'mobile',
type: 'String'
type: 'string'
},
{
arg: 'postalCode',
type: 'String'
type: 'string'
},
{
arg: 'provinceId',
type: 'Number'
type: 'number'
},
{
arg: 'agencyModeId',
type: 'Number'
type: 'number'
},
{
arg: 'incotermsId',
type: 'String'
type: 'string'
},
{
arg: 'customsAgentId',
type: 'Number'
type: 'number'
},
{
arg: 'isActive',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'isDefaultAddress',
type: 'Boolean'
type: 'boolean'
}],
returns: {
root: true,

View File

@ -10,55 +10,55 @@ module.exports = function(Self) {
},
{
arg: 'clientId',
type: 'Number',
type: ['number', 'null'],
description: 'The client id',
http: {source: 'path'}
},
{
arg: 'addressId',
type: 'Number',
type: ['number', 'null'],
description: 'The address id',
http: {source: 'path'}
},
{
arg: 'nickname',
type: 'String'
type: ['string']
},
{
arg: 'city',
type: 'String'
type: ['string']
},
{
arg: 'street',
type: 'String'
type: ['string']
},
{
arg: 'phone',
type: 'String'
type: 'any'
},
{
arg: 'mobile',
type: 'String'
type: 'any'
},
{
arg: 'postalCode',
type: 'String'
type: 'any'
},
{
arg: 'provinceFk',
type: 'Number'
type: 'any'
},
{
arg: 'agencyModeFk',
type: 'Number'
type: 'any'
},
{
arg: 'incotermsFk',
type: 'String'
type: 'any'
},
{
arg: 'customsAgentFk',
type: 'Number'
type: 'any'
},
{
arg: 'isActive',

View File

@ -17,75 +17,75 @@ module.exports = Self => {
},
{
arg: 'socialName',
type: 'String'
type: 'string'
},
{
arg: 'fi',
type: 'String'
type: 'string'
},
{
arg: 'street',
type: 'String'
type: 'string'
},
{
arg: 'postcode',
type: 'String'
type: 'string'
},
{
arg: 'city',
type: 'String'
type: 'string'
},
{
arg: 'countryFk',
type: 'Number'
type: 'number'
},
{
arg: 'provinceFk',
type: 'Number'
type: 'number'
},
{
arg: 'hasToInvoiceByAddress',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'hasToInvoice',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'isActive',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'isFreezed',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'isVies',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'isToBeMailed',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'isEqualizated',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'isTaxDataVerified',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'isTaxDataChecked',
type: 'Boolean'
type: 'boolean'
},
{
arg: 'despiteOfClient',
type: 'Number'
type: 'number'
}],
returns: {
arg: 'res',
type: 'String',
type: 'string',
root: true
},
http: {

View File

@ -55,10 +55,11 @@ class Controller extends Component {
}
showSMSDialog() {
const phone = this.$params.phone || this.client.phone;
const client = this.client;
const phone = this.$params.phone || client.mobile || client.phone;
const message = this.$params.message || '';
this.newSMS = {
destinationFk: this.client.id,
destinationFk: client.id,
destination: phone,
message: message
};

View File

@ -27,7 +27,9 @@ class Controller extends ModuleCard {
'isFreezed',
'isTaxDataChecked',
'credit',
'email'
'email',
'phone',
'mobile'
],
include: {
relation: 'salesPerson',

View File

@ -241,7 +241,9 @@ class Controller extends Component {
showSMSDialog() {
const address = this.ticket.address;
const phone = this.$params.phone || address.mobile;
const client = this.ticket.client;
const phone = this.$params.phone || address.mobile || address.phone ||
client.mobile || client.phone;
const message = this.$params.message || this.$translate.instant('SMSPayment');
this.newSMS = {
destinationFk: this.ticket.clientFk,

View File

@ -431,6 +431,9 @@ class Controller {
showSMSDialog() {
const address = this.ticket.address;
const client = this.ticket.client;
const phone = address.mobile || address.phone ||
client.mobile || client.phone;
const sales = this.checkedLines();
const items = sales.map(sale => {
return `${sale.quantity} ${sale.concept}`;
@ -443,7 +446,7 @@ class Controller {
};
this.newSMS = {
destinationFk: this.ticket.clientFk,
destination: address.mobile || null,
destination: phone,
message: this.$translate.instant('SMSAvailability', params)
};
this.$scope.sms.open();