Activate solucionado sus errores

This commit is contained in:
nelo 2017-03-01 10:48:27 +01:00
parent 2cc7d96dce
commit 8ed24880bc
4 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<vn-horizontal>
<vn-empty style="min-width: 18em; padding-left: 1em; padding-bottom: 1em;">
<vn-descriptor client="card.client" class="display-block" ></vn-descriptor>
<vn-descriptor client="card.client" active="card.client.active" class="display-block" ></vn-descriptor>
<vn-left-menu items="card.items"></vn-left-menu>
</vn-empty>
<vn-auto>

View File

@ -8,7 +8,7 @@
<div class="margin-none">{{descriptor.client.id}}</div>
<div class="margin-none">{{descriptor.client.name}}</div>
<div class="margin-none">{{descriptor.client.phone}}</div>
<vn-switch label="Activo" field="descriptor.client.active"></vn-switch>
<vn-switch label="Activo" model="descriptor.active"></vn-switch>
</vn-vertical>
</vn-horizontal>
</vn-vertical>

View File

@ -6,11 +6,12 @@ export const COMPONENT = {
template: require('./index.html'),
controllerAs: 'descriptor',
bindings: {
client: '<'
client: '<',
active: '<'
},
controller: function($http, $scope) {
var self = this;
$scope.$watch('descriptor.client.active', function(newValue, oldValue) {
$scope.$watch('descriptor.active', function(newValue, oldValue) {
if (oldValue !== undefined)
$http.put(`/client/api/Clients/${self.client.id}/activate`);
});

View File

@ -1,4 +1,4 @@
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input type="checkbox" class="*[className]*" ng-model="*[model]*">
<input type="checkbox" class="*[className]*" ng-model="*[model]*" ng-change="*[change]*">
<span class="mdl-switch__label">*[label]*</span>
</label>