Merge
This commit is contained in:
commit
9455ac5d63
|
@ -0,0 +1,5 @@
|
|||
import {module} from './module';
|
||||
|
||||
export const NAME = 'copyObject';
|
||||
|
||||
module.value(NAME, angular.copy);
|
|
@ -7,6 +7,8 @@ export {SplitingRegister as splitingRegister} from './splitingregister';
|
|||
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents';
|
||||
export {NAME as INTERPOLATE, Interpolate} from './interpolate';
|
||||
export {NAME as ROUTES_LOADER, RoutesLoader} from './routesLoader';
|
||||
export {NAME as COPY_OBJECT} from './copy';
|
||||
export {NAME as EQUALS_OBJECT} from './equals';
|
||||
|
||||
export {NAME as FOCUS, directive as Focus} from './focus';
|
||||
export {NAME as RULE, directive as Rule} from './rule';
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import {module} from './module';
|
||||
|
||||
export const NAME = 'equalsObject';
|
||||
|
||||
module.value(NAME, angular.equals);
|
|
@ -25,7 +25,7 @@
|
|||
<option ng-repeat="a in addressData.agencies | orderBy:'name'" value="{{a.id}}">{{a.name}}</ng-repeat>
|
||||
</vn-combo>
|
||||
</vn-horizontal>
|
||||
<vn-empty>
|
||||
<vn-empty margin-large-top>
|
||||
<vn-submit label="Guardar" id="save"></vn-submit>
|
||||
</vn-empty>
|
||||
</vn-vertical>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<vn-two></vn-two>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<vn-one margin-large-top>
|
||||
<vn-submit label="Guardar" id="save"></vn-submit>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -6,20 +6,39 @@ export const COMPONENT = {
|
|||
template: template,
|
||||
controllerAs: 'basicData',
|
||||
bindings: {
|
||||
client: '='
|
||||
client: '<'
|
||||
},
|
||||
controller: function($http) {
|
||||
controller: function($http, $rootScope, copyObject, equalsObject, $state) {
|
||||
|
||||
this.currentstate = $state.current;
|
||||
var self = this;
|
||||
|
||||
this.$onChanges = function (changes) {
|
||||
if(this.client)
|
||||
this.clientOld = copyObject(this.client);
|
||||
}
|
||||
|
||||
$rootScope.$on("$stateChangeStart", function(event, next) {
|
||||
//if(!equalsObject(self.client, self.clientOld)){
|
||||
event.preventDefault();
|
||||
//}
|
||||
});
|
||||
|
||||
$http.get('/client/api/SalesPeople').then(
|
||||
json => this.sales = json.data,
|
||||
json => console.error(json.data.error.message)
|
||||
);
|
||||
|
||||
this.submit = function() {
|
||||
$http.put('/client/api/Clients', this.client).then(
|
||||
json => console.log(json.statusText),
|
||||
json => console.error(json.data.error.message)
|
||||
);
|
||||
if(!equalsObject(this.client, this.clientOld)){
|
||||
this.client.modify = "BasicData";
|
||||
$http.put('/client/api/Clients', this.client).then(
|
||||
json => console.log(json.statusText),
|
||||
json => console.error(json.data.error.message)
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
COMPONENT.controller.$inject = ['$http'];
|
||||
COMPONENT.controller.$inject = ['$http', '$rootScope', 'copyObject', 'equalsObject', '$state'];
|
||||
module.component(NAME, COMPONENT);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<vn-topbar></vn-topbar>
|
||||
<vn-horizontal class="full-height">
|
||||
<vn-empty pad-medium-left >
|
||||
<vn-descriptor descriptor="card.descriptor" class="display-block" ></vn-descriptor>
|
||||
<vn-descriptor client="card.client" class="display-block" ></vn-descriptor>
|
||||
<vn-left-menu items="card.items"></vn-left-menu>
|
||||
</vn-empty>
|
||||
<vn-auto >
|
||||
|
|
|
@ -13,12 +13,6 @@ export const COMPONENT = {
|
|||
$http.get(`/client/api/Clients/${$stateParams.id}`).then(
|
||||
json => {
|
||||
this.client = json.data;
|
||||
this.descriptor = {
|
||||
clientId: this.client.id,
|
||||
name: this.client.name,
|
||||
phone: this.client.phone,
|
||||
active: this.client.active
|
||||
};
|
||||
},
|
||||
json => console.error(json.data.error.message)
|
||||
);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<vn-one></vn-one>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<vn-one margin-large-top>
|
||||
<vn-submit label="Crear" id="create"></vn-submit>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
<i class="material-icons descriptor-icon">person</i>
|
||||
</vn-one>
|
||||
<vn-vertical vn-two>
|
||||
<div class="margin-none">{{descriptor.descriptor.clientId}}</div>
|
||||
<div class="margin-none">{{descriptor.descriptor.name}}</div>
|
||||
<div class="margin-none">{{descriptor.descriptor.phone}}</div>
|
||||
<div class="margin-none">{{descriptor.client.clientId}}</div>
|
||||
<div class="margin-none">{{descriptor.client.name}}</div>
|
||||
<div class="margin-none">{{descriptor.client.phone}}</div>
|
||||
</vn-vertical>
|
||||
</vn-horizontal>
|
||||
<vn-switch label="Activo" field="descriptor.descriptor.active"></vn-switch>
|
||||
<vn-switch label="Activo" field="descriptor.client.active"></vn-switch>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
|
|
@ -7,7 +7,7 @@ export const COMPONENT = {
|
|||
template: template,
|
||||
controllerAs: 'descriptor',
|
||||
bindings: {
|
||||
descriptor: '<'
|
||||
client: '<'
|
||||
}
|
||||
};
|
||||
module.component(NAME, COMPONENT);
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Código postal" field="fiscal.client.postcode"></vn-textfield>
|
||||
<vn-combo vn-one label="Provincia" field="fiscal.client.province">
|
||||
<option ng-repeat="p in fiscal.provinces" value="{{p.id}}">{{p.name}}</option>
|
||||
<option ng-repeat="p in fiscal.provinces | orderBy:'name'" value="{{p.id}}">{{p.name}}</option>
|
||||
</vn-combo>
|
||||
<vn-combo vn-one label="País" field="fiscal.client.country">
|
||||
<option ng-repeat="c in fiscal.countries" value="{{c.id}}">{{c.name}}</option>
|
||||
<option ng-repeat="c in fiscal.countries | orderBy:'name'" value="{{c.id}}">{{c.name}}</option>
|
||||
</vn-combo>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
@ -54,9 +54,9 @@
|
|||
<vn-check vn-two label="Recibido core VNL" field="fiscal.client.coreVnl"></vn-check>
|
||||
<vn-check vn-two label="Recibido B2B VNL" field="fiscal.client.sepaVnl"></vn-check>
|
||||
</vn-horizontal>
|
||||
<vn-empty class="margin-large-top">
|
||||
<vn-submit label="Guardar"></vn-submit>
|
||||
</vn-empty>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
<vn-empty margin-large-top>
|
||||
<vn-submit label="Guardar"></vn-submit>
|
||||
</vn-empty>
|
||||
</form>
|
|
@ -3,7 +3,7 @@
|
|||
<vn-vertical pad-large>
|
||||
<vn-title>Notas</vn-title>
|
||||
<vn-textfield label="Notas" class="padd-medium-top" field="note.model.notes"></vn-textfield>
|
||||
<vn-submit label="Guardar"></vn-submit>
|
||||
<vn-submit margin-large-top label="Guardar"></vn-submit>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<vn-vertical pad-large>
|
||||
<vn-title>Acceso Web</vn-title>
|
||||
<vn-check label="Acceso web activo" field="web.client.active"></vn-check>
|
||||
<vn-textfield label="Usuario" class="padd-medium-top margin-medium-top margin-medium-bottom" field="web.client.user" focus></vn-textfield>
|
||||
<vn-submit label="Guardar"></vn-submit>
|
||||
<vn-textfield label="Usuario" class="padd-medium-top margin-medium-top" field="web.client.user" focus></vn-textfield>
|
||||
<vn-submit margin-large-top label="Guardar"></vn-submit>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
</form>
|
|
@ -9,15 +9,15 @@
|
|||
},
|
||||
"street": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
},
|
||||
"consignee": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
},
|
||||
"city": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
module.exports = function(Client) {
|
||||
|
||||
// prueba uno
|
||||
// Client.validatesUniquenessOf('name', {message: 'el nombre debe ser unico'});
|
||||
|
||||
// prueba dos
|
||||
Client.validate('name',hasCC,{message: 'Introducir cuenta bancaria'});
|
||||
|
||||
function hasCC(err) {
|
||||
if (this.payMethod == 2) err();
|
||||
|
||||
}
|
||||
|
||||
};
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "Client",
|
||||
"base": "PersistedModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
|
@ -9,7 +10,7 @@
|
|||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
},
|
||||
"fi": {
|
||||
"type": "string",
|
||||
|
@ -36,12 +37,6 @@
|
|||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"province": {
|
||||
"type": "Number"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -63,9 +58,6 @@
|
|||
"iban": {
|
||||
"type": "string"
|
||||
},
|
||||
"payMethod": {
|
||||
"type": "string"
|
||||
},
|
||||
"dueDay": {
|
||||
"type": "Number"
|
||||
},
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": "true"
|
||||
"required": true
|
||||
},
|
||||
"active": {
|
||||
"type": "boolean"
|
||||
|
|
Loading…
Reference in New Issue