Merge branches 'master' and 'master' of ssh://git.verdnatura.es:/var/lib/git/salix
This commit is contained in:
commit
93cd67a551
|
@ -15,7 +15,7 @@ export function factory() {
|
||||||
className: DEFAULT_CLASS,
|
className: DEFAULT_CLASS,
|
||||||
label: ""
|
label: ""
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_module.factory(NAME, factory);
|
_module.factory(NAME, factory);
|
||||||
|
|
|
@ -18,4 +18,3 @@
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</form>
|
</form>
|
||||||
<vn-confirm-client client="create.model" client-old="create.model" state="create.state"></vn-confirm-client>
|
|
||||||
|
|
|
@ -7,11 +7,12 @@ export const COMPONENT = {
|
||||||
controllerAs: "create",
|
controllerAs: "create",
|
||||||
controller: function($http, $state) {
|
controller: function($http, $state) {
|
||||||
this.submit = function() {
|
this.submit = function() {
|
||||||
|
this.model.active = true;
|
||||||
$http.post('/client/api/Clients', this.model).then(
|
$http.post('/client/api/Clients', this.model).then(
|
||||||
json => $state.go('clientCard.basicData', {id: json.data.id})
|
json => $state.go('clientCard.basicData', {id: json.data.id})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
COMPONENT.controller.$inject = ["$http", "$state"];
|
COMPONENT.controller.$inject = ['$http', '$state'];
|
||||||
module.component(NAME, COMPONENT);
|
module.component(NAME, COMPONENT);
|
||||||
|
|
|
@ -8,6 +8,32 @@ export const COMPONENT = {
|
||||||
controllerAs: 'descriptor',
|
controllerAs: 'descriptor',
|
||||||
bindings: {
|
bindings: {
|
||||||
client: '<'
|
client: '<'
|
||||||
|
},
|
||||||
|
controller: function($http, $scope, copyObject) {
|
||||||
|
var self = this;
|
||||||
|
this.$onChanges = function(changes) {
|
||||||
|
if (this.client) {
|
||||||
|
this.copyClient();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$watch('descriptor.client.active', function(newValue, oldValue) {
|
||||||
|
if (self.client && self.clientOld && self.client.active !== self.clientOld.active) {
|
||||||
|
self.client.modify = "Active";
|
||||||
|
$http.put('/client/api/Clients', self.client).then(
|
||||||
|
json => {
|
||||||
|
self.client = json.data;
|
||||||
|
self.copyClient();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.copyClient = function() {
|
||||||
|
this.clientOld = {};
|
||||||
|
copyObject(this.client, this.clientOld);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
COMPONENT.controller.$inject = ['$http', '$scope', 'copyObject'];
|
||||||
module.component(NAME, COMPONENT);
|
module.component(NAME, COMPONENT);
|
||||||
|
|
Loading…
Reference in New Issue