Merge branch 'dev' of https://git.verdnatura.es/salix into dev

* 'dev' of https://git.verdnatura.es/salix:
  billing data with acls
This commit is contained in:
Carlos 2017-09-21 10:27:10 +02:00
commit ec4adc7552
2 changed files with 21 additions and 15 deletions

View File

@ -11,23 +11,24 @@
<vn-title>Billing information</vn-title> <vn-title>Billing information</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-two <vn-autocomplete vn-two
vn-acl="administrative"
field="$ctrl.client.payMethodFk" field="$ctrl.client.payMethodFk"
url="/client/api/PayMethods" url="/client/api/PayMethods"
select-fields="ibanRequired" select-fields="ibanRequired"
initial-data="$ctrl.client.payMethod" initial-data="$ctrl.client.payMethod"
label="Forma de pago"> label="Forma de pago">
</vn-autocomplete> </vn-autocomplete>
<vn-textfield vn-two label="IBAN" field="$ctrl.client.iban"></vn-textfield> <vn-textfield vn-two label="IBAN" field="$ctrl.client.iban" vn-acl="administrative"></vn-textfield>
<vn-textfield vn-one label="Vencimiento" field="$ctrl.client.dueDay"></vn-textfield> <vn-textfield vn-one label="Vencimiento" field="$ctrl.client.dueDay" vn-acl="administrative"></vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Descuento" field="$ctrl.client.discount"></vn-textfield> <vn-textfield vn-one label="Descuento" field="$ctrl.client.discount" vn-acl="administrative"></vn-textfield>
<vn-textfield vn-one label="Crédito" field="$ctrl.client.credit"></vn-textfield> <vn-textfield vn-one label="Crédito" field="$ctrl.client.credit" vn-acl="administrative"></vn-textfield>
<vn-textfield vn-one label="Crédito asegurado" field="$ctrl.client.creditInsurance"></vn-textfield> <vn-textfield vn-one label="Crédito asegurado" field="$ctrl.client.creditInsurance" vn-acl="administrative"></vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-check vn-one label="Recargo de equivalencia" field="$ctrl.client.equalizationTax"></vn-check> <vn-check vn-one label="Recargo de equivalencia" field="$ctrl.client.equalizationTax" vn-acl="administrative"></vn-check>
<vn-check vn-one label="Vies" field="$ctrl.client.vies"></vn-check> <vn-check vn-one label="Vies" field="$ctrl.client.vies" vn-acl="administrative"></vn-check>
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
@ -35,14 +36,14 @@
<vn-vertical pad-large> <vn-vertical pad-large>
<vn-title>Documentación</vn-title> <vn-title>Documentación</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-check vn-one label="Recibido core VNH" field="$ctrl.client.coreVnh"></vn-check> <vn-check vn-one label="Recibido core VNH" field="$ctrl.client.coreVnh" vn-acl="administrative"></vn-check>
<vn-check vn-one label="Recibido core VNL" field="$ctrl.client.coreVnl"></vn-check> <vn-check vn-one label="Recibido core VNL" field="$ctrl.client.coreVnl" vn-acl="administrative"></vn-check>
<vn-check vn-one label="Recibido B2B VNL" field="$ctrl.client.sepaVnl"></vn-check> <vn-check vn-one label="Recibido B2B VNL" field="$ctrl.client.sepaVnl" vn-acl="administrative"></vn-check>
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit label="Guardar"></vn-submit> <vn-submit label="Guardar" vn-acl="administrative"></vn-submit>
</vn-button-bar> </vn-button-bar>
</form> </form>
<vn-dialog <vn-dialog

View File

@ -1,8 +1,9 @@
import {module} from '../module'; import {module} from '../module';
function vnAcl(aclService, $compile) { function vnAcl(aclService, $timeout) {
return { return {
restrict: 'A', restrict: 'A',
priority: -1,
link: function($scope, $element, $attrs) { link: function($scope, $element, $attrs) {
let acls = $attrs.vnAcl.split(','); let acls = $attrs.vnAcl.split(',');
let action = $attrs.vnAclAction || 'disabled'; let action = $attrs.vnAclAction || 'disabled';
@ -15,8 +16,12 @@ function vnAcl(aclService, $compile) {
input = input.querySelector(selector); input = input.querySelector(selector);
if (input) { if (input) {
input.setAttribute("ng-disabled", "true"); $timeout(() => {
$compile(input)($scope); input.setAttribute("disabled", "true");
});
$element[0].querySelectorAll('i, vn-drop-down').forEach(i => {
i.parentNode.removeChild(i);
});
} }
} else { } else {
$element.remove(); $element.remove();
@ -25,6 +30,6 @@ function vnAcl(aclService, $compile) {
} }
}; };
} }
vnAcl.$inject = ['aclService', '$compile']; vnAcl.$inject = ['aclService', '$timeout'];
module.directive('vnAcl', vnAcl); module.directive('vnAcl', vnAcl);