Arreglado problema con las provincias
El objeto cliente se copia hacia abajo Se ha generado la función copy y la función equals Añadidos márgenes a los botones de guardar
This commit is contained in:
parent
a52ffbc9a3
commit
69ebeb9d0f
|
@ -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,36 @@ export const COMPONENT = {
|
|||
template: template,
|
||||
controllerAs: 'basicData',
|
||||
bindings: {
|
||||
client: '='
|
||||
client: '<'
|
||||
},
|
||||
controller: function($http) {
|
||||
controller: function($http, $rootScope, copyObject, equalsObject) {
|
||||
|
||||
this.$onChanges = function (changes) {
|
||||
if(this.client)
|
||||
this.clientOld = copyObject(this.client);
|
||||
}
|
||||
|
||||
/*$rootScope.$on("$locationChangeStart", function(event) {
|
||||
if(!equalsObject(this.client, this.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'];
|
||||
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>
|
|
@ -36,12 +36,6 @@
|
|||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"province": {
|
||||
"type": "Number"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -63,9 +57,6 @@
|
|||
"iban": {
|
||||
"type": "string"
|
||||
},
|
||||
"payMethod": {
|
||||
"type": "string"
|
||||
},
|
||||
"dueDay": {
|
||||
"type": "Number"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue