#96 - Email validation errors fixed

This commit is contained in:
Juan 2018-02-28 12:07:56 +01:00
parent 8ee649b9d0
commit a1ee22d153
13 changed files with 33 additions and 28 deletions

View File

@ -30,7 +30,7 @@
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
field="$ctrl.address.agencyFk"
field="$ctrl.address.agencyModeFk"
url="/client/api/AgencyModes"
show-field="name"
value-field="id"

View File

@ -1,4 +1,8 @@
<mg-ajax path="/client/api/Addresses/{{edit.params.addressId}}" actions="$ctrl.address=edit.model;$ctrl._setIconAdd();" options="mgEdit"></mg-ajax>
<mg-ajax
path="/client/api/Addresses/{{edit.params.addressId}}"
actions="$ctrl.address = edit.model; $ctrl._setIconAdd();"
options="mgEdit">
</mg-ajax>
<vn-watcher
vn-id="watcher"
url="/client/api/Addresses"
@ -37,7 +41,7 @@
<vn-horizontal>
<vn-autocomplete vn-one
initial-data="$ctrl.address.agency"
field="$ctrl.address.agencyFk"
field="$ctrl.address.agencyModeFk"
url="/client/api/AgencyModes"
show-field="name"
value-field="id"

View File

@ -1,8 +1,7 @@
<vn-watcher
vn-id="watcher"
data="$ctrl.route"
form="form"
>
form="form">
</vn-watcher>
<form name="form" pad-medium>
<vn-card>
@ -13,21 +12,20 @@
<vn-autocomplete vn-one
label="Agency"
url="/route/api/Agencies"
field="$ctrl.route.agency"
>
field="$ctrl.route.agency">
</vn-autocomplete>
<vn-autocomplete vn-one
field="$ctrl.route.driver"
url="/route/api/Vehicles/activeDrivers"
label="Driver"></vn-autocomplete>
label="Driver">
</vn-autocomplete>
<vn-autocomplete vn-one
field="$ctrl.route.vehicle"
url="/route/api/Vehicles/comboVehicles"
label="Vehicle"
order="tradeMark ASC"
filter="{where: {isActive:1, warehouseFk:1}}"
></vn-autocomplete>
filter="{where: {isActive: 1, warehouseFk: 1}}">
</vn-autocomplete>
</vn-horizontal>
</vn-vertical>
</vn-card>

View File

@ -87,8 +87,8 @@ export default {
cityInput: `${components.vnTextfield}[name="city"]`,
provinceInput: `${components.vnAutocomplete}[field="$ctrl.address.provinceFk"] > vn-vertical > ${components.vnTextfield}`,
provinceSecondOption: `${components.vnAutocomplete}[field="$ctrl.address.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`,
agencyInput: `${components.vnAutocomplete}[field="$ctrl.address.agencyFk"] > vn-vertical > ${components.vnTextfield}`,
agenctySecondOption: `${components.vnAutocomplete}[field="$ctrl.address.agencyFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`,
agencyInput: `${components.vnAutocomplete}[field="$ctrl.address.agencyModeFk"] > vn-vertical > ${components.vnTextfield}`,
agenctySecondOption: `${components.vnAutocomplete}[field="$ctrl.address.agencyModeFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`,
phoneInput: `${components.vnTextfield}[name="phone"]`,
mobileInput: `${components.vnTextfield}[name="mobile"]`,
defaultAddress: 'vn-client-addresses > vn-vertical > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one > vn-horizontal > vn-one > div:nth-child(2)',

View File

@ -2,9 +2,6 @@
"AddressObservation": {
"dataSource": "vn"
},
"AgencyMode": {
"dataSource": "vn"
},
"ClientCredit": {
"dataSource": "vn"
},

View File

@ -139,7 +139,7 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city
(9, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1),
(10, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1);
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `isDefaultAddress`, `clientFk`, `agencyFk`, `longitude`, `latitude`, `isEqualizated`)
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `isDefaultAddress`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`)
VALUES
(101, '01', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(102, '02', 'Somewhere in Poland', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),

View File

@ -17,7 +17,7 @@ VIEW `vn`.`address` AS
`t`.`longitude` AS `longitude`,
`t`.`latitude` AS `latitude`,
`t`.`warehouse_id` AS `warehouseFk`,
`t`.`Id_Agencia` AS `agencyFk`,
`t`.`Id_Agencia` AS `agencyModeFk`,
`t`.`isEqualizated` AS `isEqualizated`,
`t`.`active` AS `isActive`
FROM

View File

@ -0,0 +1,3 @@
UPDATE vn.client
SET email = REPLACE(REPLACE(email, ' ', ''), ';', ',')
WHERE email REGEXP '[ |;]';

View File

@ -18,7 +18,7 @@ module.exports = function(Self) {
fields: ['id', 'name']
}
}, {
relation: 'agency',
relation: 'agencyMode',
scope: {
fields: ['id', 'name']
}

View File

@ -62,10 +62,10 @@
"model": "Client",
"foreignKey": "clientFk"
},
"agency": {
"agencyMode": {
"type": "belongsTo",
"model": "AgencyMode",
"foreignKey": "agencyFk"
"foreignKey": "agencyModeFk"
},
"observations": {
"type": "hasMany",

View File

@ -33,7 +33,7 @@ module.exports = function(Self) {
message: 'Correo electrónico inválido',
allowNull: true,
allowBlank: true,
with: /^[\w|.|-]+@\w[\w|.|-]*\w(,[\w|.|-]+@\w[\w|.|-]*\w)*$/
with: /^[\w|-|.]+@[\w|-]+(\.[\w|-]+)*(,[\w|-|.]+@[\w|-]+(\.[\w|-]+)*)*$/
});
Self.validatesLengthOf('postcode', {
allowNull: true,

View File

@ -30,6 +30,9 @@
"Agency": {
"dataSource": "vn"
},
"AgencyMode": {
"dataSource": "vn"
},
"Client": {
"dataSource": "vn"
},