activar/desactivar clientes
This commit is contained in:
parent
c2e91a63c6
commit
915bb464cb
|
@ -15,7 +15,7 @@ export function factory() {
|
||||||
className: DEFAULT_CLASS,
|
className: DEFAULT_CLASS,
|
||||||
label: ""
|
label: ""
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_module.factory(NAME, factory);
|
_module.factory(NAME, factory);
|
||||||
|
|
|
@ -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