ng-easycommerce 0.0.683 → 0.0.684

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/README.md +9 -0
  2. package/bundles/ng-easycommerce.umd.js +427 -38
  3. package/bundles/ng-easycommerce.umd.js.map +1 -1
  4. package/bundles/ng-easycommerce.umd.min.js +1 -1
  5. package/bundles/ng-easycommerce.umd.min.js.map +1 -1
  6. package/esm2015/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +317 -8
  7. package/esm2015/lib/ec-component/checkout-ec/payment-ec/payment-ec.component.js +2 -2
  8. package/esm2015/lib/ec-component/widgets-ec/redsys-redirect-ec/redsys-redirect-ec.component.js +41 -24
  9. package/esm2015/lib/services/checkout/addressing.service.js +21 -1
  10. package/esm2015/lib/services/checkout/shipment.service.js +5 -4
  11. package/esm5/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +359 -8
  12. package/esm5/lib/ec-component/checkout-ec/payment-ec/payment-ec.component.js +2 -2
  13. package/esm5/lib/ec-component/widgets-ec/redsys-redirect-ec/redsys-redirect-ec.component.js +41 -24
  14. package/esm5/lib/services/checkout/addressing.service.js +21 -1
  15. package/esm5/lib/services/checkout/shipment.service.js +10 -9
  16. package/fesm2015/ng-easycommerce.js +380 -33
  17. package/fesm2015/ng-easycommerce.js.map +1 -1
  18. package/fesm5/ng-easycommerce.js +427 -38
  19. package/fesm5/ng-easycommerce.js.map +1 -1
  20. package/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.d.ts +26 -0
  21. package/lib/ec-component/widgets-ec/redsys-redirect-ec/redsys-redirect-ec.component.d.ts +4 -3
  22. package/lib/services/checkout/addressing.service.d.ts +5 -0
  23. package/ng-easycommerce.metadata.json +1 -1
  24. package/package.json +1 -1
@@ -4035,6 +4035,26 @@ var AddressingService = /** @class */ (function (_super) {
4035
4035
  return new Promise(function (resolve, reject) { return reject(new Error(err.error)); });
4036
4036
  }).catch(function (err) { return console.error(err); });
4037
4037
  };
4038
+ _this.setHeadquarterByIds = function (data) {
4039
+ return _this.connection.put(_this.headquarterApi(), data)
4040
+ .pipe(map(function (order) {
4041
+ var _a;
4042
+ if (order && order.error) {
4043
+ _this.cartService.changeHaveToUpdate(false);
4044
+ return false;
4045
+ }
4046
+ _this.checkoutService.updateAsociatedData(order);
4047
+ _this.checkoutService.setCheckoutNotes(((_a = data) === null || _a === void 0 ? void 0 : _a.notes) || '');
4048
+ _this.setStepReady(data, order);
4049
+ if (_this.consts.getCheckoutView() === 'single') {
4050
+ _this.checkoutService.prefetchPaymentMethods();
4051
+ }
4052
+ _this.analyticsService.callEvent('payment_info', order);
4053
+ return order;
4054
+ })).toPromise().then(function (res) { return res; }, function (err) {
4055
+ return new Promise(function (resolve, reject) { return reject(new Error(err.error)); });
4056
+ }).catch(function (err) { return console.error(err); });
4057
+ };
4038
4058
  _this.setAddress = function (user_data) {
4039
4059
  user_data.locale = _this.consts.getLocale();
4040
4060
  // se modifica el código postal para castearlo a String antes de enviarlo
@@ -6027,29 +6047,30 @@ var ShipmentService = /** @class */ (function (_super) {
6027
6047
  };
6028
6048
  _this.setMethod = function (method) { return __awaiter$6(_this, void 0, void 0, function () {
6029
6049
  var res, costs, err_1;
6030
- return __generator$6(this, function (_a) {
6031
- switch (_a.label) {
6050
+ var _a, _b;
6051
+ return __generator$6(this, function (_c) {
6052
+ switch (_c.label) {
6032
6053
  case 0:
6033
6054
  // Deshabilitar todos los botones
6034
6055
  this.buttonsDisabled = true;
6035
6056
  this.errorSubject.next(null);
6036
6057
  this.costsSubject.next([]);
6037
6058
  this.stateSubject.next({ doing: true, ok: false, data: { method: method } });
6038
- _a.label = 1;
6059
+ _c.label = 1;
6039
6060
  case 1:
6040
- _a.trys.push([1, 4, 5, 6]);
6061
+ _c.trys.push([1, 4, 5, 6]);
6041
6062
  return [4 /*yield*/, this.putShipment()];
6042
6063
  case 2:
6043
- res = _a.sent();
6064
+ res = _c.sent();
6044
6065
  this.checkoutService.updateAsociatedData(res);
6045
6066
  this.order = res;
6046
6067
  return [4 /*yield*/, this.getCalculatedCosts()];
6047
6068
  case 3:
6048
- costs = _a.sent();
6049
- this.modifyCostsResponse(costs, this.getUserData().shippingAddress.postcode, method);
6069
+ costs = _c.sent();
6070
+ this.modifyCostsResponse(costs, (_b = (_a = this.getUserData()) === null || _a === void 0 ? void 0 : _a.shippingAddress) === null || _b === void 0 ? void 0 : _b.postcode, method);
6050
6071
  return [3 /*break*/, 6];
6051
6072
  case 4:
6052
- err_1 = _a.sent();
6073
+ err_1 = _c.sent();
6053
6074
  console.error(err_1);
6054
6075
  this.errorSubject.next('operation-error');
6055
6076
  throw new Error(err_1.error);
@@ -8934,11 +8955,13 @@ var DataFormEcComponent = /** @class */ (function (_super) {
8934
8955
  _this.allready_data = false;
8935
8956
  _this.addressBook = [];
8936
8957
  _this.addressBookSelected = { id: 0, notes: "" };
8958
+ _this.addressBookSelectedFacturacion = { id: 0, notes: "" };
8937
8959
  _this.finish = false; //Esta variable se usa para mostrar el boton de finalizar.
8938
8960
  _this.validado = false;
8939
8961
  _this.viewDataFacturacion = true;
8940
8962
  _this.params = {};
8941
8963
  _this.selectAddres = false;
8964
+ _this.selectAddressFacturacion = false;
8942
8965
  _this.addressSearch = '';
8943
8966
  _this.addressDropdownOpen = false;
8944
8967
  _this.formReadonly = false;
@@ -8946,6 +8969,10 @@ var DataFormEcComponent = /** @class */ (function (_super) {
8946
8969
  _this.tempAddressId = 0;
8947
8970
  _this.postalCodeErrorMessage = "";
8948
8971
  _this.postalCodeErrorMessageFacturacion = "";
8972
+ _this.postalCodeVisible = true;
8973
+ _this.postalCodeVisibleFacturacion = true;
8974
+ _this.postalCodeRequired = true;
8975
+ _this.postalCodeRequiredFacturacion = true;
8949
8976
  _this.documentErrorMessage = "";
8950
8977
  _this.documentErrorMessageFacturacion = "";
8951
8978
  _this.customerHasCustomerTaxRate = false;
@@ -9100,6 +9127,57 @@ var DataFormEcComponent = /** @class */ (function (_super) {
9100
9127
  var current = _this.checkoutFormFacturacion.controls['documentType'].value;
9101
9128
  return ((_b = (_a = documentTypes) === null || _a === void 0 ? void 0 : _a.find(function (doc) { return doc.code == current; })) === null || _b === void 0 ? void 0 : _b.name) || '';
9102
9129
  };
9130
+ _this.getBasePostalCodeEnabled = function () { var _a, _b, _c, _d; return _d = (_c = (_b = (_a = _this.addressingService.getTypeForm()) === null || _a === void 0 ? void 0 : _a.viewForms) === null || _b === void 0 ? void 0 : _b.postcode) === null || _c === void 0 ? void 0 : _c.enabled, (_d !== null && _d !== void 0 ? _d : true); };
9131
+ _this.getBasePostalCodeRequired = function () { var _a, _b, _c, _d; return _d = (_c = (_b = (_a = _this.addressingService.getTypeForm()) === null || _a === void 0 ? void 0 : _a.viewForms) === null || _b === void 0 ? void 0 : _b.postcode) === null || _c === void 0 ? void 0 : _c.required, (_d !== null && _d !== void 0 ? _d : true); };
9132
+ _this.getDefaultPostalCodeFieldState = function () {
9133
+ var visible = _this.getBasePostalCodeEnabled();
9134
+ return {
9135
+ visible: visible,
9136
+ required: visible && _this.getBasePostalCodeRequired()
9137
+ };
9138
+ };
9139
+ _this.resolveCountryByCode = function (code) {
9140
+ if (!code)
9141
+ return null;
9142
+ var countryFromSubjects = __spread$4((_this.countriesSubject.value || []), (_this.countriesFacturacionSubject.value || [])).find(function (country) { return country.code == code; });
9143
+ return countryFromSubjects
9144
+ || _this.addressingService.countriesList.find(function (country) { return country.code == code; })
9145
+ || null;
9146
+ };
9147
+ _this.resolveCountryForPostalCode = function (selectedCountry) {
9148
+ if (!selectedCountry)
9149
+ return null;
9150
+ if (selectedCountry.checkoutRequiredFields || selectedCountry.isPostalCodeNumeric !== undefined) {
9151
+ return selectedCountry;
9152
+ }
9153
+ return _this.resolveCountryByCode(selectedCountry.code || selectedCountry.countryCode);
9154
+ };
9155
+ _this.resolvePostalCodeFieldState = function (country) {
9156
+ var _a, _b;
9157
+ var checkoutPostalCode = (_b = (_a = country) === null || _a === void 0 ? void 0 : _a.checkoutRequiredFields) === null || _b === void 0 ? void 0 : _b.postalCode;
9158
+ if (checkoutPostalCode === false) {
9159
+ return { visible: false, required: false };
9160
+ }
9161
+ if (checkoutPostalCode === true) {
9162
+ return { visible: true, required: true };
9163
+ }
9164
+ return _this.getDefaultPostalCodeFieldState();
9165
+ };
9166
+ _this.isPostalCodeFieldVisible = function (billing) {
9167
+ if (billing === void 0) { billing = false; }
9168
+ return billing ? _this.postalCodeVisibleFacturacion : _this.postalCodeVisible;
9169
+ };
9170
+ _this.isPostalCodeFieldRequired = function (billing) {
9171
+ if (billing === void 0) { billing = false; }
9172
+ return billing ? _this.postalCodeRequiredFacturacion : _this.postalCodeRequired;
9173
+ };
9174
+ _this.shouldShowPostalCodeByCountryCode = function (code) {
9175
+ var country = _this.resolveCountryByCode(code);
9176
+ if (!country) {
9177
+ return _this.getDefaultPostalCodeFieldState().visible;
9178
+ }
9179
+ return _this.resolvePostalCodeFieldState(country).visible;
9180
+ };
9103
9181
  _this.toggleDocumentTypeDropdown = function (event) {
9104
9182
  var _a;
9105
9183
  event.stopPropagation();
@@ -9356,6 +9434,260 @@ var DataFormEcComponent = /** @class */ (function (_super) {
9356
9434
  _this.setCheckoutFormReadonly(_this.compactAddressView && !_this.getMode());
9357
9435
  _this.evaluateDirtyState();
9358
9436
  };
9437
+ _this.getModeFacturacion = function () {
9438
+ switch (_this.addressingService.modeSelectAddress) {
9439
+ case 'ONLY_LOAD_ADDRESS':
9440
+ return true;
9441
+ case 'ONLY_ADDRESS_SELECTION':
9442
+ return !_this.authService.isAuthenticated();
9443
+ case 'LOAD_ADDRESS_AND_SELECTION':
9444
+ return _this.authService.isAuthenticated() ? _this.selectAddressFacturacion : true;
9445
+ }
9446
+ };
9447
+ _this.setModeFacturacion = function (mode) {
9448
+ _this.selectAddressFacturacion = mode === 'carga';
9449
+ _this.onFormChange();
9450
+ _this.evaluateDirtyState();
9451
+ };
9452
+ _this.setSelectAddressFacturacion = function (addressSelect) {
9453
+ var _a;
9454
+ (_this.addressBook || []).forEach(function (address) {
9455
+ var _a;
9456
+ address.selectedFacturacion = String(address.id) === String((_a = addressSelect) === null || _a === void 0 ? void 0 : _a.id);
9457
+ });
9458
+ _this.addressBookSelectedFacturacion.id = ((_a = (_this.addressBook || []).find(function (address) { return address.selectedFacturacion; })) === null || _a === void 0 ? void 0 : _a.id) || 0;
9459
+ };
9460
+ _this.buildAddressFromBook = function (bookAddress) {
9461
+ var _a, _b;
9462
+ var contact = ((_a = bookAddress) === null || _a === void 0 ? void 0 : _a.addressContact) || {};
9463
+ return {
9464
+ firstName: contact.firstName || '',
9465
+ lastName: contact.lastName || '',
9466
+ phoneNumber: contact.phoneNumber || '',
9467
+ email: contact.email || '',
9468
+ documentType: contact.documentType || '',
9469
+ documentNumber: contact.documentNumber || '',
9470
+ countryCode: bookAddress.countryCode,
9471
+ provinceCode: bookAddress.provinceCode,
9472
+ city: bookAddress.city,
9473
+ street: bookAddress.street,
9474
+ postcode: ((_b = bookAddress.postcode) === null || _b === void 0 ? void 0 : _b.toString()) || ''
9475
+ };
9476
+ };
9477
+ _this.handleBillingFormSubmit = function (event) {
9478
+ event.preventDefault();
9479
+ if (_this.getMode()) {
9480
+ _this.verifyValidate(null, null);
9481
+ }
9482
+ };
9483
+ _this.onSelectAddress = function (items) { return __awaiter$9(_this, void 0, void 0, function () {
9484
+ var notesCfg, previousTotals, addressSelected, request, resultSede_2, totalsChanged, e_3;
9485
+ var _this = this;
9486
+ return __generator$9(this, function (_a) {
9487
+ switch (_a.label) {
9488
+ case 0:
9489
+ if (this.canCompleteLegacyAddressOnlyCheckout()) {
9490
+ this.nextStep();
9491
+ return [2 /*return*/];
9492
+ }
9493
+ notesCfg = this.addressingService.getTypeForm().viewForms.notes;
9494
+ if (notesCfg.required && (!this.addressBookSelected.notes || !this.addressBookSelected.notes.trim())) {
9495
+ this.toast.show('required-fields');
9496
+ return [2 /*return*/];
9497
+ }
9498
+ previousTotals = __assign$j({}, this.lastSummaryTotalsSnapshot);
9499
+ this.loading = true;
9500
+ _a.label = 1;
9501
+ case 1:
9502
+ _a.trys.push([1, 3, 4, 5]);
9503
+ addressSelected = this.addressBook.find(function (address) { return address.selected; });
9504
+ if (!addressSelected) {
9505
+ this.showError('invalid-form');
9506
+ return [2 /*return*/];
9507
+ }
9508
+ if (!this.addressBookSelected.id)
9509
+ this.addressBookSelected.id = addressSelected.id || 0;
9510
+ request = {
9511
+ shippingAddressId: addressSelected.id,
9512
+ billingAddressId: addressSelected.id,
9513
+ notes: this.addressBookSelected.notes || ""
9514
+ };
9515
+ return [4 /*yield*/, this.addressingService.setHeadquarterByIds(request)];
9516
+ case 2:
9517
+ resultSede_2 = _a.sent();
9518
+ if (!resultSede_2) {
9519
+ this.toast.show('operation-error');
9520
+ return [2 /*return*/];
9521
+ }
9522
+ if (this.cartService.channelConfig.applyOrderLot) {
9523
+ (items || []).forEach(function (item) {
9524
+ var _a, _b, _c, _d;
9525
+ if (!item.lot[0]) {
9526
+ _this.cartService.addToLot(item.product, 0, item.variant_id, 0, item.item_id, item.quantity, item.product.price, item.quantity, item.discount, item.product.price * item.quantity, 'new', '', '', 0, ((_b = (_a = resultSede_2) === null || _a === void 0 ? void 0 : _a.shippingAddress) === null || _b === void 0 ? void 0 : _b.city) + ' - ' + ((_d = (_c = resultSede_2) === null || _c === void 0 ? void 0 : _c.shippingAddress) === null || _d === void 0 ? void 0 : _d.street), 'newlot');
9527
+ }
9528
+ });
9529
+ }
9530
+ this.form_ready = true;
9531
+ this.allready_data = true;
9532
+ this.setSavedStateFromCurrent();
9533
+ totalsChanged = this.haveTotalsChanged(previousTotals, resultSede_2);
9534
+ if (this.compactAddressView && this.nextStep) {
9535
+ this.nextStep();
9536
+ }
9537
+ else if (this.isLegacyAddressOnlyCheckout()) {
9538
+ totalsChanged && this.scrollToLegacySummary();
9539
+ return [2 /*return*/];
9540
+ }
9541
+ else {
9542
+ this.nextStep();
9543
+ }
9544
+ return [3 /*break*/, 5];
9545
+ case 3:
9546
+ e_3 = _a.sent();
9547
+ this.toast.show('operation-error');
9548
+ return [3 /*break*/, 5];
9549
+ case 4:
9550
+ this.loading = false;
9551
+ return [7 /*endfinally*/];
9552
+ case 5: return [2 /*return*/];
9553
+ }
9554
+ });
9555
+ }); };
9556
+ _this.onSelectAddressFacturacion = function (items) { return __awaiter$9(_this, void 0, void 0, function () {
9557
+ var addressSelectedFacturacion, addressSelectedEnvio, previousTotals, request, resultSede, totalsChanged, e_4;
9558
+ var _this = this;
9559
+ return __generator$9(this, function (_a) {
9560
+ switch (_a.label) {
9561
+ case 0:
9562
+ addressSelectedFacturacion = this.addressBook.find(function (address) { return address.selectedFacturacion; });
9563
+ addressSelectedEnvio = this.addressBook.find(function (address) { return address.selected; });
9564
+ if (!addressSelectedFacturacion || !addressSelectedEnvio) {
9565
+ this.showError('invalid-form');
9566
+ return [2 /*return*/];
9567
+ }
9568
+ previousTotals = __assign$j({}, this.lastSummaryTotalsSnapshot);
9569
+ this.loading = true;
9570
+ _a.label = 1;
9571
+ case 1:
9572
+ _a.trys.push([1, 3, 4, 5]);
9573
+ this.addressBookSelected.id = addressSelectedEnvio.id || 0;
9574
+ this.addressBookSelectedFacturacion.id = addressSelectedFacturacion.id || 0;
9575
+ request = {
9576
+ shippingAddressId: addressSelectedEnvio.id,
9577
+ billingAddressId: addressSelectedFacturacion.id,
9578
+ notes: this.addressBookSelected.notes || ""
9579
+ };
9580
+ return [4 /*yield*/, this.addressingService.setHeadquarterByIds(request)];
9581
+ case 2:
9582
+ resultSede = _a.sent();
9583
+ if (!resultSede) {
9584
+ this.toast.show('operation-error');
9585
+ return [2 /*return*/];
9586
+ }
9587
+ if (this.cartService.channelConfig.applyOrderLot) {
9588
+ (items || []).forEach(function (item) {
9589
+ if (!item.lot[0]) {
9590
+ _this.cartService.addToLot(item.product, 0, item.variant_id, 0, item.item_id, item.quantity, item.product.price, item.quantity, item.discount, item.product.price * item.quantity, 'new', '', '', 0, addressSelectedEnvio.city + ' - ' + addressSelectedEnvio.street, 'newlot');
9591
+ }
9592
+ });
9593
+ }
9594
+ this.form_ready = true;
9595
+ this.allready_data = true;
9596
+ this.setSavedStateFromCurrent();
9597
+ totalsChanged = this.haveTotalsChanged(previousTotals, resultSede);
9598
+ if (this.compactAddressView && this.nextStep) {
9599
+ this.nextStep();
9600
+ }
9601
+ else if (this.isLegacyAddressOnlyCheckout()) {
9602
+ totalsChanged && this.scrollToLegacySummary();
9603
+ return [2 /*return*/];
9604
+ }
9605
+ else {
9606
+ this.nextStep();
9607
+ }
9608
+ return [3 /*break*/, 5];
9609
+ case 3:
9610
+ e_4 = _a.sent();
9611
+ this.toast.show('operation-error');
9612
+ return [3 /*break*/, 5];
9613
+ case 4:
9614
+ this.loading = false;
9615
+ return [7 /*endfinally*/];
9616
+ case 5: return [2 /*return*/];
9617
+ }
9618
+ });
9619
+ }); };
9620
+ _this.onSubmitNewBillingAddress = function (items) { return __awaiter$9(_this, void 0, void 0, function () {
9621
+ var addressSelectedEnvio, previousTotals, billingFormData, addressData, result, totalsChanged, e_5;
9622
+ var _this = this;
9623
+ var _a;
9624
+ return __generator$9(this, function (_b) {
9625
+ switch (_b.label) {
9626
+ case 0:
9627
+ if (!this.checkoutFormFacturacion.valid) {
9628
+ this.showError('invalid-form');
9629
+ return [2 /*return*/];
9630
+ }
9631
+ addressSelectedEnvio = this.addressBook.find(function (address) { return address.selected; });
9632
+ if (!addressSelectedEnvio) {
9633
+ this.showError('invalid-form');
9634
+ return [2 /*return*/];
9635
+ }
9636
+ previousTotals = __assign$j({}, this.lastSummaryTotalsSnapshot);
9637
+ this.loading = true;
9638
+ _b.label = 1;
9639
+ case 1:
9640
+ _b.trys.push([1, 3, 4, 5]);
9641
+ billingFormData = __assign$j({}, this.checkoutFormFacturacion.getRawValue());
9642
+ billingFormData.postcode = (_a = billingFormData.postcode) === null || _a === void 0 ? void 0 : _a.toString();
9643
+ addressData = {
9644
+ shippingAddress: this.buildAddressFromBook(addressSelectedEnvio),
9645
+ billingAddress: billingFormData,
9646
+ notes: this.addressBookSelected.notes || ""
9647
+ };
9648
+ return [4 /*yield*/, this.addressingService.setAddress(addressData)];
9649
+ case 2:
9650
+ result = _b.sent();
9651
+ if (result === false) {
9652
+ this.require_login = true;
9653
+ this.toast.show('email_already_registered');
9654
+ return [2 /*return*/];
9655
+ }
9656
+ if (result !== undefined) {
9657
+ if (this.cartService.channelConfig.applyOrderLot) {
9658
+ (items || []).forEach(function (item) {
9659
+ if (!item.lot[0]) {
9660
+ _this.cartService.addToLot(item.product, 0, item.variant_id, 0, item.item_id, item.quantity, item.product.price, item.quantity, item.discount, item.product.price * item.quantity, 'new', '', '', 0, addressSelectedEnvio.city + ' - ' + addressSelectedEnvio.street, 'newlot');
9661
+ }
9662
+ });
9663
+ }
9664
+ this.form_ready = true;
9665
+ this.allready_data = true;
9666
+ this.setSavedStateFromCurrent();
9667
+ totalsChanged = this.haveTotalsChanged(previousTotals, result);
9668
+ if (this.compactAddressView && this.nextStep) {
9669
+ this.nextStep();
9670
+ }
9671
+ else if (this.isLegacyAddressOnlyCheckout()) {
9672
+ totalsChanged && this.scrollToLegacySummary();
9673
+ return [2 /*return*/];
9674
+ }
9675
+ else {
9676
+ this.nextStep();
9677
+ }
9678
+ }
9679
+ return [3 /*break*/, 5];
9680
+ case 3:
9681
+ e_5 = _b.sent();
9682
+ this.toast.show('operation-error');
9683
+ return [3 /*break*/, 5];
9684
+ case 4:
9685
+ this.loading = false;
9686
+ return [7 /*endfinally*/];
9687
+ case 5: return [2 /*return*/];
9688
+ }
9689
+ });
9690
+ }); };
9359
9691
  _this.toggleAddressDropdown = function () {
9360
9692
  _this.addressDropdownOpen = !_this.addressDropdownOpen;
9361
9693
  };
@@ -9689,24 +10021,26 @@ var DataFormEcComponent = /** @class */ (function (_super) {
9689
10021
  _this.updateDocumentValidation(selectedDoc);
9690
10022
  }
9691
10023
  }
10024
+ var selectedBillingCountry = _this.countriesFacturacionSubject.value.find(function (country) { return country.code == _this.checkoutFormFacturacion.controls['countryCode'].value; });
10025
+ _this.updatePostalCodeValidationFacturacion(selectedBillingCountry);
9692
10026
  _this.onFormChange();
9693
10027
  }
9694
10028
  _this.suppressDirty = false;
9695
10029
  _this.setDirtyState(false);
9696
10030
  };
9697
10031
  _this.ecOnConstruct();
9698
- _this.checkoutForm = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formAddres), { postcode: ['', [Validators.required]] // Se agrega para que sólo acepte códigos postales mayores que cero
9699
- }));
10032
+ _this.checkoutForm = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formAddres), { postcode: [''] }));
9700
10033
  _this.checkoutForm.statusChanges
9701
10034
  .pipe(filter(function () { _this.onFormChange(); return _this.checkoutForm.valid; }))
9702
10035
  .subscribe(function () { return _this.onFormValid(); });
9703
10036
  _this.checkoutForm.valueChanges.subscribe(function () { return _this.evaluateDirtyState(); });
9704
- _this.checkoutFormFacturacion = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formBilling), { postcode: ['', [Validators.required]] // Se agrega para que sólo acepte códigos postales mayores que cero
9705
- }));
10037
+ _this.checkoutFormFacturacion = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formBilling), { postcode: [''] }));
9706
10038
  _this.checkoutFormFacturacion.statusChanges
9707
10039
  .pipe(filter(function () { _this.onFormChange(); return _this.checkoutFormFacturacion.valid; }))
9708
10040
  .subscribe(function () { return _this.onFormValid(); });
9709
10041
  _this.checkoutFormFacturacion.valueChanges.subscribe(function () { return _this.evaluateDirtyState(); });
10042
+ _this.updatePostalCodeValidation(null);
10043
+ _this.updatePostalCodeValidationFacturacion(null);
9710
10044
  return _this;
9711
10045
  }
9712
10046
  DataFormEcComponent.prototype.ngOnInit = function () {
@@ -9813,10 +10147,48 @@ var DataFormEcComponent = /** @class */ (function (_super) {
9813
10147
  form.controls[formControlName].updateValueAndValidity();
9814
10148
  };
9815
10149
  DataFormEcComponent.prototype.updatePostalCodeValidation = function (selectedCountry) {
9816
- this.updateValidation(selectedCountry, 'postcode', this.checkoutForm, 'postalCodeErrorMessage', 'isPostalCodeNumeric', 'postal-code-pattern-error');
10150
+ var _a, _b;
10151
+ var country = this.resolveCountryForPostalCode(selectedCountry);
10152
+ var _c = country
10153
+ ? this.resolvePostalCodeFieldState(country)
10154
+ : this.getDefaultPostalCodeFieldState(), visible = _c.visible, required = _c.required;
10155
+ var isNumeric = (_b = (_a = country) === null || _a === void 0 ? void 0 : _a.isPostalCodeNumeric, (_b !== null && _b !== void 0 ? _b : false));
10156
+ var validators = [];
10157
+ if (required) {
10158
+ validators.push(Validators.required);
10159
+ }
10160
+ if (visible && isNumeric) {
10161
+ validators.push(Validators.pattern(/^\d+$/));
10162
+ }
10163
+ this.postalCodeVisible = visible;
10164
+ this.postalCodeRequired = required;
10165
+ this.postalCodeErrorMessage = isNumeric
10166
+ ? 'postal-code-pattern-error.numeric'
10167
+ : 'postal-code-pattern-error.default';
10168
+ this.checkoutForm.controls['postcode'].setValidators(validators);
10169
+ this.checkoutForm.controls['postcode'].updateValueAndValidity({ emitEvent: false });
9817
10170
  };
9818
10171
  DataFormEcComponent.prototype.updatePostalCodeValidationFacturacion = function (selectedCountry) {
9819
- this.updateValidation(selectedCountry, 'postcode', this.checkoutFormFacturacion, 'postalCodeErrorMessageFacturacion', 'isPostalCodeNumeric', 'postal-code-pattern-error');
10172
+ var _a, _b;
10173
+ var country = this.resolveCountryForPostalCode(selectedCountry);
10174
+ var _c = country
10175
+ ? this.resolvePostalCodeFieldState(country)
10176
+ : this.getDefaultPostalCodeFieldState(), visible = _c.visible, required = _c.required;
10177
+ var isNumeric = (_b = (_a = country) === null || _a === void 0 ? void 0 : _a.isPostalCodeNumeric, (_b !== null && _b !== void 0 ? _b : false));
10178
+ var validators = [];
10179
+ if (required) {
10180
+ validators.push(Validators.required);
10181
+ }
10182
+ if (visible && isNumeric) {
10183
+ validators.push(Validators.pattern(/^\d+$/));
10184
+ }
10185
+ this.postalCodeVisibleFacturacion = visible;
10186
+ this.postalCodeRequiredFacturacion = required;
10187
+ this.postalCodeErrorMessageFacturacion = isNumeric
10188
+ ? 'postal-code-pattern-error.numeric'
10189
+ : 'postal-code-pattern-error.default';
10190
+ this.checkoutFormFacturacion.controls['postcode'].setValidators(validators);
10191
+ this.checkoutFormFacturacion.controls['postcode'].updateValueAndValidity({ emitEvent: false });
9820
10192
  };
9821
10193
  DataFormEcComponent.prototype.updateDocumentValidation = function (selectedDocumentType) {
9822
10194
  this.updateValidation(selectedDocumentType, 'documentNumber', this.checkoutForm, 'documentErrorMessage', 'isNumeric', 'document-pattern-error', this.addressingService.getTypeForm().viewForms.documentNumber.required);
@@ -9858,7 +10230,7 @@ var DataFormEcComponent = /** @class */ (function (_super) {
9858
10230
  DataFormEcComponent = __decorate$P([
9859
10231
  Component({
9860
10232
  selector: 'app-dataform-ec',
9861
- template: "<ng-container\n *ngIf=\"this.channelConfig.channelType != 'b2b' || (this.channelConfig.channelType == 'b2b' && authService.isAuthenticated()); else pleaseLogin\">\n <ng-container\n *ngIf=\"this.addressingService.modeSelectAddress == 'LOAD_ADDRESS_AND_SELECTION' && this.authService.isAuthenticated() && this.addressBook != null && !compactAddressView\">\n <div class=\"container card p-4 mb-3\">\n <div class=\"row justify-content-center\">\n <div class=\"col-12 col-md-10 col-lg-8 text-center\">\n <div class=\"btn-group btn-group-toggle\" data-bs-toggle=\"buttons\">\n <label [class]=\"'btn btn-outline-secondary ' + (!getMode() ? 'active' : '')\">\n <input type=\"radio\" name=\"options\" id=\"option1\" autocomplete=\"off\" checked\n (change)=\"setMode('seleccion')\"> {{'select-address' | translate | titlecase}}\n </label>\n\n <label [class]=\"'btn btn-outline-secondary ' + (getMode() ? 'active' : '')\"\n *ngIf=\"!getParamByChannelAndLanguage('btn_new_address_') && !customerHasCustomerTaxRate\">\n <input type=\"radio\" name=\"options\" id=\"option2\" autocomplete=\"off\"\n (change)=\"setMode('carga')\">\n {{ 'new-address' | translate | titlecase}}\n </label>\n\n <label [class]=\"'btn btn-outline-secondary ' + (selectAddress ? 'active' : '')\"\n *ngIf=\"getParamByChannelAndLanguage('btn_new_address_') as param\">\n <input type=\"radio\" name=\"options\" id=\"option2\" autocomplete=\"off\"\n (change)=\"setMode('carga')\">\n {{ param.value}}\n </label>\n\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"compactAddressView || getMode(); else addressSelection\">\n <div *ngIf=\"!require_login; else requireLoginView\">\n <div class=\"single-step-surface\">\n <div class=\"single-step-overlay\" *ngIf=\"compactAddressView && loading\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n\n <ng-container *ngIf=\"this.addressingService.modeSelectAddress == 'ONLY_LOAD_ADDRESS'\">\n <div class=\"checkout-title my-2\">\n <h3>{{'billing-details'|translate}}</h3>\n </div>\n </ng-container>\n\n <app-dataform-ec-single\n *ngIf=\"compactAddressView\"\n [showToggle]=\"this.addressingService.modeSelectAddress == 'LOAD_ADDRESS_AND_SELECTION' && this.authService.isAuthenticated() && this.addressBook != null\"\n [isNewAddressMode]=\"getMode()\"\n [showDefaultNewAddressButton]=\"!getParamByChannelAndLanguage('btn_new_address_') && !customerHasCustomerTaxRate\"\n [customNewAddressLabel]=\"getParamByChannelAndLanguage('btn_new_address_')?.value\"\n [isTemporarySelected]=\"selectedAddress?.isTemporary\"\n [selectedAddressLabel]=\"getSelectedAddressLabel()\"\n [addressDropdownOpen]=\"addressDropdownOpen\"\n [addressSearch]=\"addressSearch\"\n [addressOptions]=\"getFilteredAddressOptions()\"\n [showSelectBlock]=\"!getMode()\"\n [hasSelectedAddress]=\"hasSelectedAddress()\"\n (modeChange)=\"setMode($event)\"\n (toggleDropdown)=\"toggleAddressDropdown()\"\n (closeDropdown)=\"addressDropdownOpen = false\"\n (selectAddress)=\"selectAddressFromDropdown($event)\"\n (addressSearchChange)=\"addressSearch = $event\">\n </app-dataform-ec-single>\n\n <form (submit)=\"verifyValidate(false,this.cartService.items)\"\n [class.compact-address-form]=\"compactAddressView\"\n *ngIf=\"!compactAddressView || getMode() || hasSelectedAddress()\">\n <div class=\"row mt-df\"><!--Fila 1-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.enabled\">\n <label class=\"field-label\">{{'first-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"firstName\"\n [formControl]=\"checkoutForm.controls['firstName']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.firstName.dirty || checkoutForm.controls.firstName.touched) && checkoutForm.controls.firstName.errors?.required\">\n <span class=\"text-danger\">{{'first-name-help1'|translate}}</span>\n\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.firstName.dirty || checkoutForm.controls.firstName.touched) && checkoutForm.controls.firstName.errors?.pattern\">\n <span class=\"text-danger\">\n {{'first-name-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.enabled\">\n <label class=\"field-label\">{{'last-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"lastName\"\n [formControl]=\"checkoutForm.controls['lastName']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.lastName.dirty || checkoutForm.controls.lastName.touched) && checkoutForm.controls.lastName.errors?.required\">\n <span class=\"text-danger\">{{'last-name-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.lastName.dirty || checkoutForm.controls.lastName.touched) && checkoutForm.controls.lastName.errors?.pattern\">\n <span class=\"text-danger\">{{'last-name-help2'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\"><!--Fila 2-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.enabled\">\n <label class=\"field-label\">{{'phone'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"tel\" name=\"phoneNumber\"\n [formControl]=\"checkoutForm.controls['phoneNumber']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.phoneNumber.dirty || checkoutForm.controls.phoneNumber.touched) && checkoutForm.controls.phoneNumber.errors?.required\">\n <span class=\"text-danger\">\n\n {{'phone-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.phoneNumber.dirty || checkoutForm.controls.phoneNumber.touched) && checkoutForm.controls.phoneNumber.errors?.pattern\">\n <span class=\"text-danger\">\n {{'phone-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.enabled\">\n <label class=\"field-label\">{{'email-address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"email\" name=\"email\"\n [formControl]=\"checkoutForm.controls['email']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.email.dirty || checkoutForm.controls.email.touched) && checkoutForm.controls.email.errors?.required\">\n <span class=\"text-danger\">\n {{'email-address-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.email.dirty || checkoutForm.controls.email.touched) && checkoutForm.controls.email.errors?.email\">\n <span class=\"text-danger\">\n {{'email-address-help2'|translate}}\n </span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 3-->\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(countries$ | async) as countries\">\n <label class=\"field-label\">{{'country'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"countryCode\"\n [formControl]=\"checkoutForm.controls['countryCode']\"\n (change)=\"onCountrySelected($event.target.value)\">\n <!-- <option selected [value]=\"countries[0].code\">{{ 'choose-country' | translate }}</option> -->\n <option *ngFor=\"let country of countries\" [value]=\"country.code\">{{ country.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutForm.controls.countryCode.dirty || checkoutForm.controls.countryCode.touched) && checkoutForm.controls.countryCode.errors?.required\"\n class=\"text text-danger\">\n {{'country-help'|translate}}\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(provinces$ | async) as provinces\">\n <label class=\"field-label\">{{'state'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"provinceCode\"\n (change)=\"onProvincesSelected($event.target.value)\"\n [formControl]=\"checkoutForm.controls['provinceCode']\">\n <!-- <option selected [value]=\"null\">{{ 'choose-province' | translate }}</option>\n -->\n <option *ngFor=\"let province of provinces\" [value]=\"province.code\">{{ province.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutForm.controls.provinceCode.dirty || checkoutForm.controls.provinceCode.touched) && checkoutForm.controls.provinceCode.errors?.required\"\n class=\"text text-danger\">\n {{'state-help'|translate}}\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.enabled\">\n <label class=\"field-label\">{{'town-city'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"city\"\n [formControl]=\"checkoutForm.controls['city']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.city.dirty || checkoutForm.controls.city.touched) && checkoutForm.controls.city.errors?.required\">\n <span class=\"text-danger\">{{'town-city-help'|translate}}</span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 4-->\n <div class=\"form-group col-12 col-md-8\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.enabled\">\n <label class=\"field-label\">{{'address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.required\"\n class=\"required\">*</span>\n <span class=\"char-count\">\n {{ 50 - (checkoutForm.controls['street'].value?.length || 0) }}\n {{'remainingCharacters'|translate}}\n </span>\n </label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"street\"\n [formControl]=\"checkoutForm.controls['street']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.street.dirty || checkoutForm.controls.street.touched) && checkoutForm.controls.street.errors?.required\">\n <span class=\"text-danger\">{{'address-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.street.dirty || checkoutForm.controls.street.touched) && checkoutForm.controls.street.errors?.maxlength\">\n <span class=\"text-danger\">{{'address-help2'|translate}}</span>\n </div>\n </div>\n\n <!-- form direcci\u00F3n -->\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.postcode.enabled\">\n <label class=\"field-label\">{{'postal-code'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.postcode.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"postcode\"\n [formControl]=\"checkoutForm.controls['postcode']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.postcode.dirty || checkoutForm.controls.postcode.touched) && checkoutForm.controls.postcode.errors?.required\">\n <span class=\"text-danger\">{{'postal-code-help'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.postcode.dirty || checkoutForm.controls.postcode.touched) && checkoutForm.controls.postcode.errors?.pattern\">\n <span class=\"text-danger\"> {{postalCodeErrorMessage | translate}} </span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 5-->\n <ng-container *ngIf=\"compactAddressView; else documentRowFull\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled; else documentNumberOnly\">\n <div class=\"form-group col-12\" *ngIf=\"(documentTypes$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <div class=\"input-group document-input-group\">\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\"\n (click)=\"toggleDocumentTypeDropdown($event)\"\n [attr.aria-expanded]=\"documentTypeDropdownOpen\"\n [disabled]=\"checkoutForm.controls['documentType']?.disabled || formReadonly\">\n {{ getSelectedDocumentTypeLabel(documentTypes) || ('document-type' | translate) }}\n </button>\n <div class=\"dropdown-menu\" [class.show]=\"documentTypeDropdownOpen\">\n <button class=\"dropdown-item\" type=\"button\"\n *ngFor=\"let item of documentTypes\"\n (click)=\"selectDocumentType(item.code)\">\n {{ item.name }}\n </button>\n </div>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentType.dirty || checkoutForm.controls.documentType.touched) && checkoutForm.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n <ng-template #documentNumberOnly>\n <div class=\"form-group col-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </ng-container>\n <ng-template #documentRowFull>\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(documentTypes$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.required\"\n class=\"required\">*</span></label>\n <select name=\"documentType\" class=\"form-select\"\n (change)=\"onDocumentTypesSelected($event.target.value)\"\n [formControl]=\"checkoutForm.controls['documentType']\">\n <option *ngFor=\"let item of documentTypes\" [value]=\"item.code\">{{item.name}}</option>\n </select>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentType.dirty || checkoutForm.controls.documentType.touched) && checkoutForm.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\" name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </div>\n\n <div class=\"row mt-df\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a' && !(compactAddressView && !getMode())\"><!--Fila 6-->\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"><span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n\n <!-- <label class=\"field-label\">{{'notes'|translate}}<span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\" class=\"required\">*</span></label> -->\n <textarea (change)=\"onInputChange()\" class=\"form-control notes-textarea\" name=\"notes\"\n [formControl]=\"checkoutForm.controls['notes']\" rows=\"3\" placeholder=\"\"\n autocomplete=\"off\"></textarea>\n </div>\n </div>\n <div class=\"row mt-df address-meta-row\" *ngIf=\"!(compactAddressView && !getMode())\"><!--Fila 7-->\n <div class=\"form-group col-12 col-md-12\">\n <label for=\"formFact\"><b>{{ 'same-billing-address' | translate }}</b> <input type=\"checkbox\"\n class=\"ms-2\" [checked]=\"viewDataFacturacion\" (change)=\"showFormFacturacion()\"\n id=\"formFact\"></label>\n </div>\n </div>\n <div class=\"row mt-df address-required-row\" *ngIf=\"!(compactAddressView && !getMode())\">\n <div class=\"col-12\">\n <span class=\"required-hint-text\">\n <span class=\"required-hint-asterisk\">*</span> {{ 'required-fields' | translate }}\n </span>\n </div>\n </div>\n <div class=\"row mt-df address-terms-row\" *ngIf=\"!(compactAddressView && !getMode())\">\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.terms.enabled\">\n <label class=\"terms-label\" for=\"\">\n <input class=\"me-2\" name=\"terms\" [formControl]=\"checkoutForm.controls['terms']\"\n type=\"checkbox\" required (change)=\"onInputChange()\" />\n <span>{{ 'accept-terms-prefix' | translate }}</span>\n <button type=\"button\" class=\"terms-link\" (click)=\"openModal(template)\">\n {{ 'terms-and-conditions' | translate }}\n </button>\n <span *ngIf=\"this.addressingService.getTypeForm().viewForms.terms.required\"\n class=\"required\">*</span>\n </label>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.terms.dirty || checkoutForm.controls.terms.touched) && !checkoutForm.controls.terms.value\">\n <span class=\"text-danger\">{{ 'must-accept-terms' | translate }}</span>\n </div>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"viewDataFacturacion ; else datosFormFacturacion\"> </div>\n <div class=\"checkout-btn-unique text-end\" *ngIf=\"!formReadonly\">\n <button type=\"submit\" [disabled]=\"!validado\" class=\"btn valid-btn mt-2\">\n {{ getPrimaryActionLabel() | translate }}</button>\n\n\n </div>\n <div *ngIf=\"loading && !compactAddressView\" class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </form>\n <ng-container *ngIf=\"compactAddressView && !getMode()\">\n <div class=\"w-100\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <div class=\"row mt-df\">\n <div class=\"form-group col-12 col-md-12\">\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"></label>\n <textarea (change)=\"onSelectionNotesChange()\" class=\"form-control notes-textarea\"\n name=\"notes\" [(ngModel)]=\"this.addressBookSelected.notes\" #ctrl=\"ngModel\" rows=\"3\"\n placeholder=\"\" autocomplete=\"off\" [disabled]=\"selectedAddress?.isTemporary\"></textarea>\n <div class=\"invalid-feedback d-block\" *ngIf=\"\n addressingService.getTypeForm().viewForms.notes.required\n && (!addressBookSelected.notes || !addressBookSelected.notes.trim())\n \">\n {{ 'required-field' | translate }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n\n <ng-template #addressSelection>\n\n <ng-container *ngIf=\"this.addressingService.modeSelectAddress == 'ONLY_ADDRESS_SELECTION'\">\n <div class=\"checkout-title my-2\">\n <h3>{{'address-selection'|translate}}</h3>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"this.addressBook; else addressBookNotResult\">\n\n <ng-container *ngIf=\"this.addressBook?.length ;else addressBookLoading\">\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-sm-6 col-12 my-3\" *ngFor=\"let item of addressBook; let i = index\">\n <ng-container *ngIf=\"compactAddressView; else addressCardFull\">\n <div class=\"address-card-compact\" [class.is-selected]=\"item.selected\"\n (click)=\"setSelectAddress(item); onInputChange()\">\n <label class=\"address-card-radio\">\n <input class=\"form-check-input input-size-lg\" type=\"radio\" [name]=\"'n-'+i\"\n [id]=\"i\" [checked]=\"item.selected\" (click)=\"setSelectAddress(item)\"\n (change)=\"onInputChange()\">\n </label>\n <div class=\"address-card-content\">\n <div class=\"address-card-main\">\n <div class=\"address-card-title\">{{ item.street }}</div>\n <div class=\"address-card-sub\">\n {{ item.city }} - {{ getProvince(item.provinceCode) }} - {{ getCountry(item.countryCode) }}\n </div>\n <div class=\"address-card-sub\">\n {{ 'postal-code' | translate }} {{ item.postcode }}\n </div>\n </div>\n <details class=\"address-card-details\" (click)=\"$event.stopPropagation()\">\n <summary>{{ 'details' | translate }}</summary>\n <div class=\"address-card-details-body\">\n <div class=\"address-card-detail-title\">{{ 'address-contact' | translate }}</div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'first-name' | translate }}</strong> {{ item.addressContact.firstName }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'last-name' | translate }}</strong> {{ item.addressContact.lastName }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'document-type' | translate }}</strong> {{ getDocumentType(item.addressContact.documentType) }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'document-number' | translate }}</strong> {{ item.addressContact.documentNumber }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'email-address' | translate }}</strong> {{ item.addressContact.email }}\n </div>\n </div>\n </details>\n </div>\n </div>\n </ng-container>\n <ng-template #addressCardFull>\n <div class=\"card p-3\">\n <input class=\"ms-1 mt-3 form-check-input input-size-lg\" type=\"radio\" [name]=\"'n-'+i\"\n [id]=\"i\" [checked]=\"item.selected\" (click)=\"setSelectAddress(item)\"\n (change)=\"onInputChange()\">\n <div class=\"ms-5\">\n <h4 class=\"card-title\">\n <strong>{{'address'|translate}}</strong><br>\n <span class=\"text-uppercase h3\">{{item.street}}</span>\n </h4>\n <div class=\"row\">\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'country'|translate}}</strong> {{getCountry(item.countryCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'state'|translate}}</strong> {{getProvince(item.provinceCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'town-city'|translate}}</strong> {{item.city}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'postal-code'|translate}}</strong> {{item.postcode}}\n </h5>\n </div>\n <div class=\"row px-3\">\n <div class=\"card p-2 bg-light w-100\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">{{'address-contact'|translate}}</h5>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'first-name'|translate}}</strong>\n {{item.addressContact.firstName}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'last-name'|translate}}</strong>\n {{item.addressContact.lastName}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'document-type'|translate}}</strong>\n {{getDocumentType(item.addressContact.documentType)}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'document-number'|translate}}</strong>\n {{item.addressContact.documentNumber}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'email-address'|translate}}</strong>\n {{item.addressContact.email}}\n </h6>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n\n </div>\n <!-- Se hardcodea el canal de mundo del juguete empresa A ya que se necesita con urgencia, se sustituira por un campo que llegara de backend. -->\n <div class=\"w-100\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <div class=\"row mt-df\">\n <div class=\"form-group col-12 col-md-12\">\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"notes\"\n [(ngModel)]=\"this.addressBookSelected.notes\" #ctrl=\"ngModel\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"invalid-feedback d-block\" *ngIf=\"\n addressingService.getTypeForm().viewForms.notes.required\n && (!addressBookSelected.notes || !addressBookSelected.notes.trim())\n \">\n {{ 'required-field' | translate }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n <div class=\"checkout-btn-unique text-end\">\n <button (click)=\"selectAddress(this.cartService.items)\" class=\"btn valid-btn mt-2\">\n {{ getPrimaryActionLabel() | translate }}\n </button>\n </div>\n <div *ngIf=\"loading\" class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n </ng-template>\n\n\n <ng-template #requireLoginView>\n <div id=\"loginCheckout\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\" *ngIf=\"require_login\">\n <div class=\"col-12\">\n <app-login-form-ec (ready)=\"verifyValidate($event)\" [redirect]=\"false\" [title]=\"'need-login'\">\n </app-login-form-ec>\n </div>\n </div>\n </div>\n </ng-template>\n\n\n\n <ng-template #datosFormFacturacion>\n <div class=\"container-fluid px-0 px-md-2\">\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card \">\n <div class=\"card-header text-dark text-center\">\n <h3>{{'billing-data'|translate}}</h3>\n </div>\n <div class=\"card-body\">\n <form (submit)=\"verifyValidate()\">\n <div class=\"row mt-df\">\n <!--Fila 1-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.enabled\">\n <label class=\"field-label\">{{'first-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"firstName\"\n [formControl]=\"checkoutFormFacturacion.controls['firstName']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.firstName.dirty || checkoutFormFacturacion.controls.firstName.touched) && checkoutFormFacturacion.controls.firstName.errors?.required\">\n <span class=\"text-danger\">{{'first-name-help1'|translate}}</span>\n\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.firstName.dirty || checkoutFormFacturacion.controls.firstName.touched) && checkoutFormFacturacion.controls.firstName.errors?.pattern\">\n <span class=\"text-danger\">\n {{'first-name-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.enabled\">\n <label class=\"field-label\">{{'last-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"lastName\"\n [formControl]=\"checkoutFormFacturacion.controls['lastName']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.lastName.dirty || checkoutFormFacturacion.controls.lastName.touched) && checkoutFormFacturacion.controls.lastName.errors?.required\">\n <span class=\"text-danger\">{{'last-name-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.lastName.dirty || checkoutFormFacturacion.controls.lastName.touched) && checkoutFormFacturacion.controls.lastName.errors?.pattern\">\n <span class=\"text-danger\">{{'last-name-help2'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 2-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.enabled\">\n <label class=\"field-label\">{{'phone'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"tel\"\n name=\"phoneNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['phoneNumber']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.phoneNumber.dirty || checkoutFormFacturacion.controls.phoneNumber.touched) && checkoutFormFacturacion.controls.phoneNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'phone-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.phoneNumber.dirty || checkoutFormFacturacion.controls.phoneNumber.touched) && checkoutFormFacturacion.controls.phoneNumber.errors?.pattern\">\n <span class=\"text-danger\">\n {{'phone-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.enabled\">\n <label class=\"field-label\">{{'email-address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"email\" name=\"email\"\n [formControl]=\"checkoutFormFacturacion.controls['email']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.email.dirty || checkoutFormFacturacion.controls.email.touched) && checkoutFormFacturacion.controls.email.errors?.required\">\n <span class=\"text-danger\">\n {{'email-address-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.email.dirty || checkoutFormFacturacion.controls.email.touched) && checkoutFormFacturacion.controls.email.errors?.email\">\n <span class=\"text-danger\">\n {{'email-address-help2'|translate}}\n </span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 3-->\n\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.enabled\">\n\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(countriesFacturacion$ | async) as countries\">\n <label class=\"field-label\">{{'country'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"countryCode\"\n [formControl]=\"checkoutFormFacturacion.controls['countryCode']\"\n (change)=\"onCountrySelectedFacturacion($event.target.value)\">\n <!-- <option selected [value]=\"null\">{{ 'choose-country' | translate }}</option> -->\n <option *ngFor=\"let country of countries\" [value]=\"country.code\">\n {{ country.name }}</option>\n </select>\n <div *ngIf=\"(checkoutFormFacturacion.controls.countryCode.dirty || checkoutFormFacturacion.controls.countryCode.touched) && checkoutFormFacturacion.controls.countryCode.errors?.required\"\n class=\"text text-danger\">\n {{'country-help'|translate}}\n </div>\n </div>\n </ng-container>\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.enabled\">\n\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(provincesFacturacion$ | async) as provinces\">\n <label class=\"field-label\">{{'state'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"provinceCode\"\n (change)=\"onProvincesSelectedFacturacion($event.target.value)\"\n [formControl]=\"checkoutFormFacturacion.controls['provinceCode']\">\n <!-- <option selected [value]=\"null\">{{ 'choose-province' | translate }}</option> -->\n <option *ngFor=\"let province of provinces\" [value]=\"province.code\">\n {{ province.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutFormFacturacion.controls.provinceCode.dirty || checkoutFormFacturacion.controls.provinceCode.touched) && checkoutFormFacturacion.controls.provinceCode.errors?.required\"\n class=\"text text-danger\">\n {{'state-help'|translate}}\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.enabled\">\n <label class=\"field-label\">{{'town-city'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"city\"\n [formControl]=\"checkoutFormFacturacion.controls['city']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.city.dirty || checkoutFormFacturacion.controls.city.touched) && checkoutFormFacturacion.controls.city.errors?.required\">\n <span class=\"text-danger\">{{'town-city-help'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 4-->\n <div class=\"form-group col-12 col-md-8\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.enabled\">\n <label class=\"field-label\">{{'address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"street\"\n [formControl]=\"checkoutFormFacturacion.controls['street']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.street.dirty || checkoutFormFacturacion.controls.street.touched) && checkoutFormFacturacion.controls.street.errors?.required\">\n <span class=\"text-danger\">{{'address-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.street.dirty || checkoutFormFacturacion.controls.street.touched) && checkoutFormFacturacion.controls.street.errors?.maxlength\">\n <span class=\"text-danger\">{{'address-help2'|translate}}</span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.postcode.enabled\">\n <label class=\"field-label\">{{'postal-code'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.postcode.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\"\n name=\"postcode\" [formControl]=\"checkoutFormFacturacion.controls['postcode']\"\n value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.postcode.dirty || checkoutFormFacturacion.controls.postcode.touched) && checkoutFormFacturacion.controls.postcode.errors?.required\">\n <span class=\"text-danger\">{{'postal-code-help'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.postcode.dirty || checkoutFormFacturacion.controls.postcode.touched) && checkoutFormFacturacion.controls.postcode.errors?.pattern\">\n <span class=\"text-danger\">{{postalCodeErrorMessage |translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 5-->\n <ng-container *ngIf=\"compactAddressView; else documentRowFullFacturacion\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled; else documentNumberOnlyFacturacion\">\n <div class=\"form-group col-12\"\n *ngIf=\"(documentTypesFacturacion$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <div class=\"input-group document-input-group\">\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\"\n (click)=\"toggleDocumentTypeDropdownFacturacion($event)\"\n [attr.aria-expanded]=\"documentTypeFactDropdownOpen\"\n [disabled]=\"checkoutFormFacturacion.controls['documentType']?.disabled || formReadonly\">\n {{ getSelectedDocumentTypeLabelFacturacion(documentTypes) || ('document-type' | translate) }}\n </button>\n <div class=\"dropdown-menu\" [class.show]=\"documentTypeFactDropdownOpen\">\n <button class=\"dropdown-item\" type=\"button\"\n *ngFor=\"let item of documentTypes\"\n (click)=\"selectDocumentTypeFacturacion(item.code)\">\n {{ item.name }}\n </button>\n </div>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentType.dirty || checkoutFormFacturacion.controls.documentType.touched) && checkoutFormFacturacion.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n <ng-template #documentNumberOnlyFacturacion>\n <div class=\"form-group col-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </ng-container>\n <ng-template #documentRowFullFacturacion>\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled\">\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(documentTypesFacturacion$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.required\"\n class=\"required\">*</span></label>\n <select name=\"documentType\" class=\"form-select\"\n [formControl]=\"checkoutFormFacturacion.controls['documentType']\"\n (change)=\"onDocumentTypesSelectedFacturacion($event.target.value)\">\n <option *ngFor=\"let item of documentTypes\" [value]=\"item.code\">\n {{item.name}}</option>\n </select>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentType.dirty || checkoutFormFacturacion.controls.documentType.touched) && checkoutFormFacturacion.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n </ng-template>\n </div>\n <div class=\"row mt-df\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <label class=\"field-label\"\n *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}} <span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelNotesHtml\">\n <div [innerHTML]=\"labelNotesHtml.value\"></div> \n <span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span>\n </label>\n\n <!-- <label class=\"field-label\">{{'notes'|translate}}<span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\" class=\"required\">*</span></label> -->\n <textarea (change)=\"onInputChange()\" class=\"form-control notes-textarea\"\n name=\"notes\" [formControl]=\"checkoutFormFacturacion.controls['notes']\"\n rows=\"3\" placeholder=\"\" autocomplete=\"off\"></textarea>\n </div>\n </div>\n </form>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n\n\n\n <ng-template #template>\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"btn-close float-end\" aria-label=\"Close\" (click)=\"modalRef.hide()\">\n </button>\n </div>\n </div>\n\n <div class=\"modal-body scrol-if\">\n <app-section-container-ec [name]=\"'terminos-y-condiciones'\"> </app-section-container-ec>\n </div>\n\n </ng-template>\n\n\n <ng-template #addressBookNotResult>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12 text-center my-2\">\n <h4> {{'address-book-not-result' | translate }} </h4>\n </div>\n </div>\n </div>\n </ng-template>\n\n <ng-template #addressBookLoading>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12 text-center my-2\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-template #pleaseLogin>\n <div class=\"container\">\n <p>Por favor <a [routerLink]=\"['/auth/login']\"> Inicie Sesi\u00F3n</a></p>\n </div>\n</ng-template>\n",
10233
+ template: "<ng-container\n *ngIf=\"this.channelConfig.channelType != 'b2b' || (this.channelConfig.channelType == 'b2b' && authService.isAuthenticated()); else pleaseLogin\">\n <ng-container\n *ngIf=\"this.addressingService.modeSelectAddress == 'LOAD_ADDRESS_AND_SELECTION' && this.authService.isAuthenticated() && this.addressBook != null && !compactAddressView\">\n <div class=\"container card p-4 mb-3\">\n <div class=\"row justify-content-center\">\n <div class=\"col-12 col-md-10 col-lg-8 text-center\">\n <div class=\"btn-group btn-group-toggle\" data-bs-toggle=\"buttons\">\n <label [class]=\"'btn btn-outline-secondary ' + (!getMode() ? 'active' : '')\">\n <input type=\"radio\" name=\"options\" id=\"option1\" autocomplete=\"off\" checked\n (change)=\"setMode('seleccion')\"> {{'select-address' | translate | titlecase}}\n </label>\n\n <label [class]=\"'btn btn-outline-secondary ' + (getMode() ? 'active' : '')\"\n *ngIf=\"!getParamByChannelAndLanguage('btn_new_address_') && !customerHasCustomerTaxRate\">\n <input type=\"radio\" name=\"options\" id=\"option2\" autocomplete=\"off\"\n (change)=\"setMode('carga')\">\n {{ 'new-address' | translate | titlecase}}\n </label>\n\n <label [class]=\"'btn btn-outline-secondary ' + (selectAddress ? 'active' : '')\"\n *ngIf=\"getParamByChannelAndLanguage('btn_new_address_') as param\">\n <input type=\"radio\" name=\"options\" id=\"option2\" autocomplete=\"off\"\n (change)=\"setMode('carga')\">\n {{ param.value}}\n </label>\n\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"compactAddressView || getMode(); else addressSelection\">\n <div *ngIf=\"!require_login; else requireLoginView\">\n <div class=\"single-step-surface\">\n <div class=\"single-step-overlay\" *ngIf=\"compactAddressView && loading\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n\n <ng-container *ngIf=\"this.addressingService.modeSelectAddress == 'ONLY_LOAD_ADDRESS'\">\n <div class=\"checkout-title my-2\">\n <h3>{{'billing-details'|translate}}</h3>\n </div>\n </ng-container>\n\n <app-dataform-ec-single\n *ngIf=\"compactAddressView\"\n [showToggle]=\"this.addressingService.modeSelectAddress == 'LOAD_ADDRESS_AND_SELECTION' && this.authService.isAuthenticated() && this.addressBook != null\"\n [isNewAddressMode]=\"getMode()\"\n [showDefaultNewAddressButton]=\"!getParamByChannelAndLanguage('btn_new_address_') && !customerHasCustomerTaxRate\"\n [customNewAddressLabel]=\"getParamByChannelAndLanguage('btn_new_address_')?.value\"\n [isTemporarySelected]=\"selectedAddress?.isTemporary\"\n [selectedAddressLabel]=\"getSelectedAddressLabel()\"\n [addressDropdownOpen]=\"addressDropdownOpen\"\n [addressSearch]=\"addressSearch\"\n [addressOptions]=\"getFilteredAddressOptions()\"\n [showSelectBlock]=\"!getMode()\"\n [hasSelectedAddress]=\"hasSelectedAddress()\"\n (modeChange)=\"setMode($event)\"\n (toggleDropdown)=\"toggleAddressDropdown()\"\n (closeDropdown)=\"addressDropdownOpen = false\"\n (selectAddress)=\"selectAddressFromDropdown($event)\"\n (addressSearchChange)=\"addressSearch = $event\">\n </app-dataform-ec-single>\n\n <form (submit)=\"verifyValidate(false,this.cartService.items)\"\n [class.compact-address-form]=\"compactAddressView\"\n *ngIf=\"!compactAddressView || getMode() || hasSelectedAddress()\">\n <div class=\"row mt-df\"><!--Fila 1-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.enabled\">\n <label class=\"field-label\">{{'first-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"firstName\"\n [formControl]=\"checkoutForm.controls['firstName']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.firstName.dirty || checkoutForm.controls.firstName.touched) && checkoutForm.controls.firstName.errors?.required\">\n <span class=\"text-danger\">{{'first-name-help1'|translate}}</span>\n\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.firstName.dirty || checkoutForm.controls.firstName.touched) && checkoutForm.controls.firstName.errors?.pattern\">\n <span class=\"text-danger\">\n {{'first-name-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.enabled\">\n <label class=\"field-label\">{{'last-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"lastName\"\n [formControl]=\"checkoutForm.controls['lastName']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.lastName.dirty || checkoutForm.controls.lastName.touched) && checkoutForm.controls.lastName.errors?.required\">\n <span class=\"text-danger\">{{'last-name-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.lastName.dirty || checkoutForm.controls.lastName.touched) && checkoutForm.controls.lastName.errors?.pattern\">\n <span class=\"text-danger\">{{'last-name-help2'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\"><!--Fila 2-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.enabled\">\n <label class=\"field-label\">{{'phone'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"tel\" name=\"phoneNumber\"\n [formControl]=\"checkoutForm.controls['phoneNumber']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.phoneNumber.dirty || checkoutForm.controls.phoneNumber.touched) && checkoutForm.controls.phoneNumber.errors?.required\">\n <span class=\"text-danger\">\n\n {{'phone-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.phoneNumber.dirty || checkoutForm.controls.phoneNumber.touched) && checkoutForm.controls.phoneNumber.errors?.pattern\">\n <span class=\"text-danger\">\n {{'phone-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.enabled\">\n <label class=\"field-label\">{{'email-address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"email\" name=\"email\"\n [formControl]=\"checkoutForm.controls['email']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.email.dirty || checkoutForm.controls.email.touched) && checkoutForm.controls.email.errors?.required\">\n <span class=\"text-danger\">\n {{'email-address-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.email.dirty || checkoutForm.controls.email.touched) && checkoutForm.controls.email.errors?.email\">\n <span class=\"text-danger\">\n {{'email-address-help2'|translate}}\n </span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 3-->\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(countries$ | async) as countries\">\n <label class=\"field-label\">{{'country'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"countryCode\"\n [formControl]=\"checkoutForm.controls['countryCode']\"\n (change)=\"onCountrySelected($event.target.value)\">\n <!-- <option selected [value]=\"countries[0].code\">{{ 'choose-country' | translate }}</option> -->\n <option *ngFor=\"let country of countries\" [value]=\"country.code\">{{ country.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutForm.controls.countryCode.dirty || checkoutForm.controls.countryCode.touched) && checkoutForm.controls.countryCode.errors?.required\"\n class=\"text text-danger\">\n {{'country-help'|translate}}\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(provinces$ | async) as provinces\">\n <label class=\"field-label\">{{'state'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"provinceCode\"\n (change)=\"onProvincesSelected($event.target.value)\"\n [formControl]=\"checkoutForm.controls['provinceCode']\">\n <!-- <option selected [value]=\"null\">{{ 'choose-province' | translate }}</option>\n -->\n <option *ngFor=\"let province of provinces\" [value]=\"province.code\">{{ province.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutForm.controls.provinceCode.dirty || checkoutForm.controls.provinceCode.touched) && checkoutForm.controls.provinceCode.errors?.required\"\n class=\"text text-danger\">\n {{'state-help'|translate}}\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.enabled\">\n <label class=\"field-label\">{{'town-city'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"city\"\n [formControl]=\"checkoutForm.controls['city']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.city.dirty || checkoutForm.controls.city.touched) && checkoutForm.controls.city.errors?.required\">\n <span class=\"text-danger\">{{'town-city-help'|translate}}</span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 4-->\n <div class=\"form-group col-12 col-md-8\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.enabled\">\n <label class=\"field-label\">{{'address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.required\"\n class=\"required\">*</span>\n <span class=\"char-count\">\n {{ 50 - (checkoutForm.controls['street'].value?.length || 0) }}\n {{'remainingCharacters'|translate}}\n </span>\n </label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"street\"\n [formControl]=\"checkoutForm.controls['street']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.street.dirty || checkoutForm.controls.street.touched) && checkoutForm.controls.street.errors?.required\">\n <span class=\"text-danger\">{{'address-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.street.dirty || checkoutForm.controls.street.touched) && checkoutForm.controls.street.errors?.maxlength\">\n <span class=\"text-danger\">{{'address-help2'|translate}}</span>\n </div>\n </div>\n\n <!-- form direcci\u00F3n -->\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"isPostalCodeFieldVisible()\">\n <label class=\"field-label\">{{'postal-code'|translate}}<span\n *ngIf=\"isPostalCodeFieldRequired()\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"postcode\"\n [formControl]=\"checkoutForm.controls['postcode']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.postcode.dirty || checkoutForm.controls.postcode.touched) && checkoutForm.controls.postcode.errors?.required\">\n <span class=\"text-danger\">{{'postal-code-help'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.postcode.dirty || checkoutForm.controls.postcode.touched) && checkoutForm.controls.postcode.errors?.pattern\">\n <span class=\"text-danger\"> {{postalCodeErrorMessage | translate}} </span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 5-->\n <ng-container *ngIf=\"compactAddressView; else documentRowFull\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled; else documentNumberOnly\">\n <div class=\"form-group col-12\" *ngIf=\"(documentTypes$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <div class=\"input-group document-input-group\">\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\"\n (click)=\"toggleDocumentTypeDropdown($event)\"\n [attr.aria-expanded]=\"documentTypeDropdownOpen\"\n [disabled]=\"checkoutForm.controls['documentType']?.disabled || formReadonly\">\n {{ getSelectedDocumentTypeLabel(documentTypes) || ('document-type' | translate) }}\n </button>\n <div class=\"dropdown-menu\" [class.show]=\"documentTypeDropdownOpen\">\n <button class=\"dropdown-item\" type=\"button\"\n *ngFor=\"let item of documentTypes\"\n (click)=\"selectDocumentType(item.code)\">\n {{ item.name }}\n </button>\n </div>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentType.dirty || checkoutForm.controls.documentType.touched) && checkoutForm.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n <ng-template #documentNumberOnly>\n <div class=\"form-group col-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </ng-container>\n <ng-template #documentRowFull>\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(documentTypes$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.required\"\n class=\"required\">*</span></label>\n <select name=\"documentType\" class=\"form-select\"\n (change)=\"onDocumentTypesSelected($event.target.value)\"\n [formControl]=\"checkoutForm.controls['documentType']\">\n <option *ngFor=\"let item of documentTypes\" [value]=\"item.code\">{{item.name}}</option>\n </select>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentType.dirty || checkoutForm.controls.documentType.touched) && checkoutForm.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\" name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </div>\n\n <div class=\"row mt-df\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a' && !(compactAddressView && !getMode())\"><!--Fila 6-->\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"><span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n\n <!-- <label class=\"field-label\">{{'notes'|translate}}<span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\" class=\"required\">*</span></label> -->\n <textarea (change)=\"onInputChange()\" class=\"form-control notes-textarea\" name=\"notes\"\n [formControl]=\"checkoutForm.controls['notes']\" rows=\"3\" placeholder=\"\"\n autocomplete=\"off\"></textarea>\n </div>\n </div>\n <div class=\"row mt-df address-meta-row\" *ngIf=\"!(compactAddressView && !getMode())\"><!--Fila 7-->\n <div class=\"form-group col-12 col-md-12\">\n <label for=\"formFact\"><b>{{ 'same-billing-address' | translate }}</b> <input type=\"checkbox\"\n class=\"ms-2\" [checked]=\"viewDataFacturacion\" (change)=\"showFormFacturacion()\"\n id=\"formFact\"></label>\n </div>\n </div>\n <div class=\"row mt-df address-required-row\" *ngIf=\"!(compactAddressView && !getMode())\">\n <div class=\"col-12\">\n <span class=\"required-hint-text\">\n <span class=\"required-hint-asterisk\">*</span> {{ 'required-fields' | translate }}\n </span>\n </div>\n </div>\n <div class=\"row mt-df address-terms-row\" *ngIf=\"!(compactAddressView && !getMode())\">\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.terms.enabled\">\n <label class=\"terms-label\" for=\"\">\n <input class=\"me-2\" name=\"terms\" [formControl]=\"checkoutForm.controls['terms']\"\n type=\"checkbox\" required (change)=\"onInputChange()\" />\n <span>{{ 'accept-terms-prefix' | translate }}</span>\n <button type=\"button\" class=\"terms-link\" (click)=\"openModal(template)\">\n {{ 'terms-and-conditions' | translate }}\n </button>\n <span *ngIf=\"this.addressingService.getTypeForm().viewForms.terms.required\"\n class=\"required\">*</span>\n </label>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.terms.dirty || checkoutForm.controls.terms.touched) && !checkoutForm.controls.terms.value\">\n <span class=\"text-danger\">{{ 'must-accept-terms' | translate }}</span>\n </div>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"viewDataFacturacion ; else datosFormFacturacion\"> </div>\n <div class=\"checkout-btn-unique text-end\" *ngIf=\"!formReadonly\">\n <button type=\"submit\" [disabled]=\"!validado\" class=\"btn valid-btn mt-2\">\n {{ getPrimaryActionLabel() | translate }}</button>\n\n\n </div>\n <div *ngIf=\"loading && !compactAddressView\" class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </form>\n <ng-container *ngIf=\"compactAddressView && !getMode()\">\n <div class=\"w-100\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <div class=\"row mt-df\">\n <div class=\"form-group col-12 col-md-12\">\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"></label>\n <textarea (change)=\"onSelectionNotesChange()\" class=\"form-control notes-textarea\"\n name=\"notes\" [(ngModel)]=\"this.addressBookSelected.notes\" #ctrl=\"ngModel\" rows=\"3\"\n placeholder=\"\" autocomplete=\"off\" [disabled]=\"selectedAddress?.isTemporary\"></textarea>\n <div class=\"invalid-feedback d-block\" *ngIf=\"\n addressingService.getTypeForm().viewForms.notes.required\n && (!addressBookSelected.notes || !addressBookSelected.notes.trim())\n \">\n {{ 'required-field' | translate }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n\n <ng-template #addressSelection>\n\n <ng-container *ngIf=\"this.addressingService.modeSelectAddress == 'ONLY_ADDRESS_SELECTION'\">\n <div class=\"checkout-title my-2\">\n <h3>{{'address-selection'|translate}}</h3>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"this.addressBook; else addressBookNotResult\">\n\n <ng-container *ngIf=\"this.addressBook?.length ;else addressBookLoading\">\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-sm-6 col-12 my-3\" *ngFor=\"let item of addressBook; let i = index\">\n <ng-container *ngIf=\"compactAddressView; else addressCardFull\">\n <div class=\"address-card-compact\" [class.is-selected]=\"item.selected\"\n (click)=\"setSelectAddress(item); onInputChange()\">\n <label class=\"address-card-radio\">\n <input class=\"form-check-input input-size-lg\" type=\"radio\" [name]=\"'n-'+i\"\n [id]=\"i\" [checked]=\"item.selected\" (click)=\"setSelectAddress(item)\"\n (change)=\"onInputChange()\">\n </label>\n <div class=\"address-card-content\">\n <div class=\"address-card-main\">\n <div class=\"address-card-title\">{{ item.street }}</div>\n <div class=\"address-card-sub\">\n {{ item.city }} - {{ getProvince(item.provinceCode) }} - {{ getCountry(item.countryCode) }}\n </div>\n <div class=\"address-card-sub\"\n *ngIf=\"shouldShowPostalCodeByCountryCode(item.countryCode)\">\n {{ 'postal-code' | translate }} {{ item.postcode }}\n </div>\n </div>\n <details class=\"address-card-details\" (click)=\"$event.stopPropagation()\">\n <summary>{{ 'details' | translate }}</summary>\n <div class=\"address-card-details-body\">\n <div class=\"address-card-detail-title\">{{ 'address-contact' | translate }}</div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'first-name' | translate }}</strong> {{ item.addressContact.firstName }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'last-name' | translate }}</strong> {{ item.addressContact.lastName }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'document-type' | translate }}</strong> {{ getDocumentType(item.addressContact.documentType) }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'document-number' | translate }}</strong> {{ item.addressContact.documentNumber }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'email-address' | translate }}</strong> {{ item.addressContact.email }}\n </div>\n </div>\n </details>\n </div>\n </div>\n </ng-container>\n <ng-template #addressCardFull>\n <div class=\"card p-3\">\n <input class=\"ms-1 mt-3 form-check-input input-size-lg\" type=\"radio\" [name]=\"'n-'+i\"\n [id]=\"i\" [checked]=\"item.selected\" (click)=\"setSelectAddress(item)\"\n (change)=\"onInputChange()\">\n <div class=\"ms-5\">\n <h4 class=\"card-title\">\n <strong>{{'address'|translate}}</strong><br>\n <span class=\"text-uppercase h3\">{{item.street}}</span>\n </h4>\n <div class=\"row\">\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'country'|translate}}</strong> {{getCountry(item.countryCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'state'|translate}}</strong> {{getProvince(item.provinceCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'town-city'|translate}}</strong> {{item.city}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\"\n *ngIf=\"shouldShowPostalCodeByCountryCode(item.countryCode)\">\n <strong>{{'postal-code'|translate}}</strong> {{item.postcode}}\n </h5>\n </div>\n <div class=\"row px-3\">\n <div class=\"card p-2 bg-light w-100\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">{{'address-contact'|translate}}</h5>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'first-name'|translate}}</strong>\n {{item.addressContact.firstName}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'last-name'|translate}}</strong>\n {{item.addressContact.lastName}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'document-type'|translate}}</strong>\n {{getDocumentType(item.addressContact.documentType)}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'document-number'|translate}}</strong>\n {{item.addressContact.documentNumber}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'email-address'|translate}}</strong>\n {{item.addressContact.email}}\n </h6>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n\n </div>\n <!-- Se hardcodea el canal de mundo del juguete empresa A ya que se necesita con urgencia, se sustituira por un campo que llegara de backend. -->\n <div class=\"w-100\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <div class=\"row mt-df\">\n <div class=\"form-group col-12 col-md-12\">\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"notes\"\n [(ngModel)]=\"this.addressBookSelected.notes\" #ctrl=\"ngModel\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"invalid-feedback d-block\" *ngIf=\"\n addressingService.getTypeForm().viewForms.notes.required\n && (!addressBookSelected.notes || !addressBookSelected.notes.trim())\n \">\n {{ 'required-field' | translate }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n <div class=\"row mt-df\"><!--Direcci\u00F3n de facturaci\u00F3n-->\n <div class=\"form-group col-12 col-md-12\">\n <label for=\"formFactSelection\"><b>{{ 'same-billing-address' | translate }}</b> <input type=\"checkbox\"\n class=\"ms-2\" [checked]=\"viewDataFacturacion\" (change)=\"showFormFacturacion()\"\n id=\"formFactSelection\"></label>\n </div>\n </div>\n <ng-container *ngIf=\"!viewDataFacturacion\">\n <!-- Selector de modo para direcci\u00F3n de facturaci\u00F3n -->\n <div class=\"container card p-4 mb-3\">\n <div class=\"row justify-content-center\">\n <div class=\"col-12 col-md-10 col-lg-8 text-center\">\n <div class=\"btn-group btn-group-toggle\" data-bs-toggle=\"buttons\">\n <label [class]=\"'btn btn-outline-secondary ' + (!getModeFacturacion() ? 'active' : '')\">\n <input type=\"radio\" name=\"billingOptions\" id=\"billingOption1\" autocomplete=\"off\"\n [checked]=\"!getModeFacturacion()\" (change)=\"setModeFacturacion('seleccion')\">\n {{'select-address' | translate | titlecase}}\n </label>\n <label [class]=\"'btn btn-outline-secondary ' + (getModeFacturacion() ? 'active' : '')\">\n <input type=\"radio\" name=\"billingOptions\" id=\"billingOption2\" autocomplete=\"off\"\n [checked]=\"getModeFacturacion()\" (change)=\"setModeFacturacion('carga')\">\n {{ 'new-address' | translate | titlecase}}\n </label>\n </div>\n </div>\n </div>\n </div>\n <!-- Formulario de nueva direcci\u00F3n de facturaci\u00F3n -->\n <ng-container *ngIf=\"getModeFacturacion()\">\n <ng-container *ngTemplateOutlet=\"datosFormFacturacion\"></ng-container>\n </ng-container>\n <!-- Selecci\u00F3n de direcci\u00F3n de facturaci\u00F3n del address book -->\n <ng-container *ngIf=\"!getModeFacturacion()\">\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-sm-6 col-12 my-3\" *ngFor=\"let item of addressBook; let i = index\">\n <div class=\"card p-3\">\n <input class=\"ms-1 mt-3 form-check-input input-size-lg\" type=\"radio\" [name]=\"'billing-'+i\"\n [id]=\"'billing-'+i\" [checked]=\"item.selectedFacturacion\"\n (click)=\"setSelectAddressFacturacion(item)\" (change)=\"onInputChange()\">\n <div class=\"ms-5\">\n <h4 class=\"card-title\">\n <strong>{{'address'|translate}}</strong><br>\n <span class=\"text-uppercase h3\">{{item.street}}</span>\n </h4>\n <div class=\"row\">\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'country'|translate}}</strong> {{getCountry(item.countryCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'state'|translate}}</strong> {{getProvince(item.provinceCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'town-city'|translate}}</strong> {{item.city}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\"\n *ngIf=\"shouldShowPostalCodeByCountryCode(item.countryCode)\">\n <strong>{{'postal-code'|translate}}</strong> {{item.postcode}}\n </h5>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <div class=\"checkout-btn-unique text-end\">\n <button *ngIf=\"!viewDataFacturacion && !getModeFacturacion()\"\n (click)=\"onSelectAddressFacturacion(this.cartService.items)\" class=\"btn valid-btn mt-2\"\n [disabled]=\"!addressBookSelectedFacturacion.id\">\n {{ getPrimaryActionLabel() | translate }}\n </button>\n <button *ngIf=\"!viewDataFacturacion && getModeFacturacion()\"\n (click)=\"onSubmitNewBillingAddress(this.cartService.items)\" class=\"btn valid-btn mt-2\"\n [disabled]=\"checkoutFormFacturacion.invalid\">\n {{ getPrimaryActionLabel() | translate }}\n </button>\n <button *ngIf=\"viewDataFacturacion\"\n (click)=\"onSelectAddress(this.cartService.items)\" class=\"btn valid-btn mt-2\">\n {{ getPrimaryActionLabel() | translate }}\n </button>\n </div>\n <div *ngIf=\"loading\" class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n </ng-template>\n\n\n <ng-template #requireLoginView>\n <div id=\"loginCheckout\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\" *ngIf=\"require_login\">\n <div class=\"col-12\">\n <app-login-form-ec (ready)=\"verifyValidate($event)\" [redirect]=\"false\" [title]=\"'need-login'\">\n </app-login-form-ec>\n </div>\n </div>\n </div>\n </ng-template>\n\n\n\n <ng-template #datosFormFacturacion>\n <div class=\"container-fluid px-0 px-md-2\">\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card \">\n <div class=\"card-header text-dark text-center\">\n <h3>{{'billing-data'|translate}}</h3>\n </div>\n <div class=\"card-body\">\n <form (submit)=\"handleBillingFormSubmit($event)\">\n <div class=\"row mt-df\">\n <!--Fila 1-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.enabled\">\n <label class=\"field-label\">{{'first-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"firstName\"\n [formControl]=\"checkoutFormFacturacion.controls['firstName']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.firstName.dirty || checkoutFormFacturacion.controls.firstName.touched) && checkoutFormFacturacion.controls.firstName.errors?.required\">\n <span class=\"text-danger\">{{'first-name-help1'|translate}}</span>\n\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.firstName.dirty || checkoutFormFacturacion.controls.firstName.touched) && checkoutFormFacturacion.controls.firstName.errors?.pattern\">\n <span class=\"text-danger\">\n {{'first-name-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.enabled\">\n <label class=\"field-label\">{{'last-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"lastName\"\n [formControl]=\"checkoutFormFacturacion.controls['lastName']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.lastName.dirty || checkoutFormFacturacion.controls.lastName.touched) && checkoutFormFacturacion.controls.lastName.errors?.required\">\n <span class=\"text-danger\">{{'last-name-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.lastName.dirty || checkoutFormFacturacion.controls.lastName.touched) && checkoutFormFacturacion.controls.lastName.errors?.pattern\">\n <span class=\"text-danger\">{{'last-name-help2'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 2-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.enabled\">\n <label class=\"field-label\">{{'phone'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"tel\"\n name=\"phoneNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['phoneNumber']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.phoneNumber.dirty || checkoutFormFacturacion.controls.phoneNumber.touched) && checkoutFormFacturacion.controls.phoneNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'phone-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.phoneNumber.dirty || checkoutFormFacturacion.controls.phoneNumber.touched) && checkoutFormFacturacion.controls.phoneNumber.errors?.pattern\">\n <span class=\"text-danger\">\n {{'phone-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.enabled\">\n <label class=\"field-label\">{{'email-address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"email\" name=\"email\"\n [formControl]=\"checkoutFormFacturacion.controls['email']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.email.dirty || checkoutFormFacturacion.controls.email.touched) && checkoutFormFacturacion.controls.email.errors?.required\">\n <span class=\"text-danger\">\n {{'email-address-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.email.dirty || checkoutFormFacturacion.controls.email.touched) && checkoutFormFacturacion.controls.email.errors?.email\">\n <span class=\"text-danger\">\n {{'email-address-help2'|translate}}\n </span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 3-->\n\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.enabled\">\n\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(countriesFacturacion$ | async) as countries\">\n <label class=\"field-label\">{{'country'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"countryCode\"\n [formControl]=\"checkoutFormFacturacion.controls['countryCode']\"\n (change)=\"onCountrySelectedFacturacion($event.target.value)\">\n <!-- <option selected [value]=\"null\">{{ 'choose-country' | translate }}</option> -->\n <option *ngFor=\"let country of countries\" [value]=\"country.code\">\n {{ country.name }}</option>\n </select>\n <div *ngIf=\"(checkoutFormFacturacion.controls.countryCode.dirty || checkoutFormFacturacion.controls.countryCode.touched) && checkoutFormFacturacion.controls.countryCode.errors?.required\"\n class=\"text text-danger\">\n {{'country-help'|translate}}\n </div>\n </div>\n </ng-container>\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.enabled\">\n\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(provincesFacturacion$ | async) as provinces\">\n <label class=\"field-label\">{{'state'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"provinceCode\"\n (change)=\"onProvincesSelectedFacturacion($event.target.value)\"\n [formControl]=\"checkoutFormFacturacion.controls['provinceCode']\">\n <!-- <option selected [value]=\"null\">{{ 'choose-province' | translate }}</option> -->\n <option *ngFor=\"let province of provinces\" [value]=\"province.code\">\n {{ province.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutFormFacturacion.controls.provinceCode.dirty || checkoutFormFacturacion.controls.provinceCode.touched) && checkoutFormFacturacion.controls.provinceCode.errors?.required\"\n class=\"text text-danger\">\n {{'state-help'|translate}}\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.enabled\">\n <label class=\"field-label\">{{'town-city'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"city\"\n [formControl]=\"checkoutFormFacturacion.controls['city']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.city.dirty || checkoutFormFacturacion.controls.city.touched) && checkoutFormFacturacion.controls.city.errors?.required\">\n <span class=\"text-danger\">{{'town-city-help'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 4-->\n <div class=\"form-group col-12 col-md-8\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.enabled\">\n <label class=\"field-label\">{{'address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"street\"\n [formControl]=\"checkoutFormFacturacion.controls['street']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.street.dirty || checkoutFormFacturacion.controls.street.touched) && checkoutFormFacturacion.controls.street.errors?.required\">\n <span class=\"text-danger\">{{'address-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.street.dirty || checkoutFormFacturacion.controls.street.touched) && checkoutFormFacturacion.controls.street.errors?.maxlength\">\n <span class=\"text-danger\">{{'address-help2'|translate}}</span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"isPostalCodeFieldVisible(true)\">\n <label class=\"field-label\">{{'postal-code'|translate}}<span\n *ngIf=\"isPostalCodeFieldRequired(true)\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\"\n name=\"postcode\" [formControl]=\"checkoutFormFacturacion.controls['postcode']\"\n value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.postcode.dirty || checkoutFormFacturacion.controls.postcode.touched) && checkoutFormFacturacion.controls.postcode.errors?.required\">\n <span class=\"text-danger\">{{'postal-code-help'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.postcode.dirty || checkoutFormFacturacion.controls.postcode.touched) && checkoutFormFacturacion.controls.postcode.errors?.pattern\">\n <span class=\"text-danger\">{{postalCodeErrorMessageFacturacion |translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 5-->\n <ng-container *ngIf=\"compactAddressView; else documentRowFullFacturacion\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled; else documentNumberOnlyFacturacion\">\n <div class=\"form-group col-12\"\n *ngIf=\"(documentTypesFacturacion$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <div class=\"input-group document-input-group\">\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\"\n (click)=\"toggleDocumentTypeDropdownFacturacion($event)\"\n [attr.aria-expanded]=\"documentTypeFactDropdownOpen\"\n [disabled]=\"checkoutFormFacturacion.controls['documentType']?.disabled || formReadonly\">\n {{ getSelectedDocumentTypeLabelFacturacion(documentTypes) || ('document-type' | translate) }}\n </button>\n <div class=\"dropdown-menu\" [class.show]=\"documentTypeFactDropdownOpen\">\n <button class=\"dropdown-item\" type=\"button\"\n *ngFor=\"let item of documentTypes\"\n (click)=\"selectDocumentTypeFacturacion(item.code)\">\n {{ item.name }}\n </button>\n </div>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentType.dirty || checkoutFormFacturacion.controls.documentType.touched) && checkoutFormFacturacion.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n <ng-template #documentNumberOnlyFacturacion>\n <div class=\"form-group col-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </ng-container>\n <ng-template #documentRowFullFacturacion>\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled\">\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(documentTypesFacturacion$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.required\"\n class=\"required\">*</span></label>\n <select name=\"documentType\" class=\"form-select\"\n [formControl]=\"checkoutFormFacturacion.controls['documentType']\"\n (change)=\"onDocumentTypesSelectedFacturacion($event.target.value)\">\n <option *ngFor=\"let item of documentTypes\" [value]=\"item.code\">\n {{item.name}}</option>\n </select>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentType.dirty || checkoutFormFacturacion.controls.documentType.touched) && checkoutFormFacturacion.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n </ng-template>\n </div>\n <div class=\"row mt-df\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <label class=\"field-label\"\n *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}} <span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelNotesHtml\">\n <div [innerHTML]=\"labelNotesHtml.value\"></div> \n <span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span>\n </label>\n\n <!-- <label class=\"field-label\">{{'notes'|translate}}<span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\" class=\"required\">*</span></label> -->\n <textarea (change)=\"onInputChange()\" class=\"form-control notes-textarea\"\n name=\"notes\" [formControl]=\"checkoutFormFacturacion.controls['notes']\"\n rows=\"3\" placeholder=\"\" autocomplete=\"off\"></textarea>\n </div>\n </div>\n </form>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n\n\n\n <ng-template #template>\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"btn-close float-end\" aria-label=\"Close\" (click)=\"modalRef.hide()\">\n </button>\n </div>\n </div>\n\n <div class=\"modal-body scrol-if\">\n <app-section-container-ec [name]=\"'terminos-y-condiciones'\"> </app-section-container-ec>\n </div>\n\n </ng-template>\n\n\n <ng-template #addressBookNotResult>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12 text-center my-2\">\n <h4> {{'address-book-not-result' | translate }} </h4>\n </div>\n </div>\n </div>\n </ng-template>\n\n <ng-template #addressBookLoading>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12 text-center my-2\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-template #pleaseLogin>\n <div class=\"container\">\n <p>Por favor <a [routerLink]=\"['/auth/login']\"> Inicie Sesi\u00F3n</a></p>\n </div>\n</ng-template>\n",
9862
10234
  providers: [BsModalService],
9863
10235
  styles: ["@charset \"UTF-8\";.btn.valid-btn{background-color:var(--ec-primary,#000);border-color:var(--ec-primary,#000);color:var(--ec-primary-contrast,#fff);margin-right:-3px;margin-bottom:10px}.btn.valid-btn:disabled,.btn.valid-btn[disabled]{background-color:var(--ec-primary-muted,#6c757d);border-color:var(--ec-primary-muted,#6c757d);color:var(--ec-primary-contrast,#fff);opacity:.8}.mt-df{margin:10px auto 0}.btn.btn-outline-secondary.active,.btn.btn-outline-secondary:hover{color:#fff!important}.required{color:red}.address-required-row .required-hint-text{color:#6b6b6b;font-size:.85rem;font-weight:500;letter-spacing:.01em}.address-required-row .required-hint-asterisk{color:#6b6b6b;font-weight:700}.field-label{color:#000}:host-context(#appCheckoutEc) .field-label{font-weight:700}:host-context(#appCheckoutEc) .address-meta-row b,:host-context(#appCheckoutEc) .address-terms-row label{font-weight:400}.terms-label{display:inline-flex;flex-wrap:wrap;align-items:center;gap:.35rem}.terms-link{background:0 0;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer}.form-control.ng-dirty.ng-invalid,.form-control.ng-touched.ng-invalid{border-color:#dc3545;box-shadow:0 0 0 .15rem rgba(220,53,69,.18)}.form-control.ng-dirty.ng-valid,.form-control.ng-touched.ng-valid{border-color:#16a34a;box-shadow:0 0 0 .15rem rgba(22,163,74,.15)}.char-count{margin-left:.35rem;font-size:.78rem;font-weight:400;color:#888;white-space:nowrap}.notes-textarea{min-height:120px;max-height:240px;resize:vertical;max-width:100%}.compact-address-form .valid-btn{font-size:1rem;padding:.7rem 1.1rem;letter-spacing:.02em}.document-input-group{position:relative;align-items:stretch}.document-input-group .dropdown-menu{max-height:240px;overflow-y:auto}.document-input-group .dropdown-toggle{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;min-height:100%;border-color:#ced4da;color:#495057}.document-input-group .form-control{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}:host-context(#appCheckoutEc) .checkout-btn-unique{display:flex;justify-content:flex-end}:host-context(#appCheckoutEc) .checkout-btn-unique .valid-btn{display:block;margin-left:auto;width:56%;max-width:360px;min-width:220px}@media screen and (max-width:992px){:host-context(#appCheckoutEc) .checkout-btn-unique{justify-content:stretch}:host-context(#appCheckoutEc) .checkout-btn-unique .valid-btn{width:100%;min-width:0}.address-required-row .required-hint-text{font-size:.82rem}}:host-context(#appCheckoutEc) .valid-btn{text-transform:uppercase}label{color:#000}#appCheckoutEc .checkout-single .btn-group-toggle{border:1px solid #e3e3e3;border-radius:6px;overflow:hidden}#appCheckoutEc .checkout-single .btn-group-toggle .btn{border-radius:0!important;font-weight:600;padding:.55rem 1rem;border-left:1px solid #e3e3e3}#appCheckoutEc .checkout-single .btn-group-toggle .btn:first-child{border-left:0}.input-size-lg{width:1.8rem;height:1.8rem}.address-card-compact{display:flex;gap:.75rem;border:1px solid #e3e3e3;border-radius:6px;padding:.75rem;background:#fff;align-items:flex-start;cursor:pointer;transition:border-color .2s,box-shadow .2s}.address-card-compact.is-selected{border-color:#000;box-shadow:0 0 0 1px #000 inset}.address-card-compact:hover{border-color:#444}.address-card-radio{margin-top:.25rem}.address-card-content{flex:1;display:flex;flex-direction:column;gap:.35rem}.address-card-title{font-weight:600;font-size:1rem}.address-card-sub{color:#666;font-size:.9rem}.address-card-details{margin-top:.5rem}.address-card-details summary{cursor:pointer;color:#000;font-weight:600;font-size:.9rem;list-style:none;display:inline-flex;align-items:center;gap:.35rem}.address-card-details summary::-webkit-details-marker{display:none}.address-card-details summary::before{content:\"\u25B8\";font-size:.85rem}.address-card-details[open] summary::before{content:\"\u25BE\"}.address-card-details-body{margin-top:.5rem;padding:.5rem;background:#f8f8f8;border-radius:6px}.address-card-detail-title{font-weight:600;margin-bottom:.25rem}.address-card-detail-line{font-size:.9rem;color:#555}.single-step-surface{position:relative}.single-step-overlay{position:absolute;inset:0;background:rgba(255,255,255,.6);display:flex;align-items:center;justify-content:center;z-index:5}.compact-address-form .address-meta-row,.compact-address-form .address-required-row,.compact-address-form .address-terms-row{margin-top:.4rem}.compact-address-form .address-meta-row label,.compact-address-form .address-terms-row label{display:inline-flex;align-items:center;gap:.4rem;margin-bottom:0;font-weight:600}.compact-address-form .address-terms-row a{margin-left:0!important;display:inline-block;font-size:.85rem}.compact-address-form .address-terms-row .text-danger-container{margin-top:.35rem}"]
9864
10236
  })
@@ -10172,7 +10544,7 @@ var PaymentEcComponent = /** @class */ (function (_super) {
10172
10544
  };
10173
10545
  _this.verifyValidate = function () {
10174
10546
  _this.setLoading();
10175
- setTimeout(function (r) { return _this.emitResult(); }, 1000);
10547
+ _this.emitResult();
10176
10548
  };
10177
10549
  _this.setMethod = function (method) { return __awaiter$b(_this, void 0, void 0, function () {
10178
10550
  var result, balanceCustomer, totals, isBalanceMethod, allowAny;
@@ -16443,14 +16815,13 @@ var __decorate$1m = (this && this.__decorate) || function (decorators, target, k
16443
16815
  };
16444
16816
  var RedSysRedirectEcComponent = /** @class */ (function (_super) {
16445
16817
  __extends$J(RedSysRedirectEcComponent, _super);
16446
- function RedSysRedirectEcComponent(renderer, connection, toastrService, consts, cartService, toastr, activedRoute, modalService) {
16818
+ function RedSysRedirectEcComponent(renderer, connection, toastrService, consts, cartService, activedRoute, modalService) {
16447
16819
  var _this = _super.call(this) || this;
16448
16820
  _this.renderer = renderer;
16449
16821
  _this.connection = connection;
16450
16822
  _this.toastrService = toastrService;
16451
16823
  _this.consts = consts;
16452
16824
  _this.cartService = cartService;
16453
- _this.toastr = toastr;
16454
16825
  _this.activedRoute = activedRoute;
16455
16826
  _this.modalService = modalService;
16456
16827
  _this.method = null;
@@ -16460,41 +16831,44 @@ var RedSysRedirectEcComponent = /** @class */ (function (_super) {
16460
16831
  _this.loading = true;
16461
16832
  _this.isDobleAuth = false;
16462
16833
  _this.urls = [];
16463
- _this.closeModal = '';
16834
+ _this.closeModalReason = ''; // Renombrado para evitar confusión
16464
16835
  _this.dataRedirect = function () { return _this.consts.getUrlBase() + 'shop-api/' + _this.consts.getChannel() + '/redsys/redirect/' + _this.cartService.cart_token + '/process-payment'; };
16465
16836
  _this.clearStorageState = function () {
16466
16837
  sessionStorage.removeItem('state');
16467
16838
  localStorage.removeItem('state');
16468
16839
  };
16840
+ // Método que se llama desde la X de la cabecera del modal en el HTML
16469
16841
  _this.clickClose = function () {
16470
- _this.closeModal = 'cancel';
16471
- _this.modalRef.hide();
16472
- _this.processError('Se cancelo el pago con tarjeta');
16842
+ _this.closeModalReason = 'cancel';
16843
+ if (_this.modalRef) {
16844
+ _this.modalRef.hide();
16845
+ }
16846
+ _this.processError('Se canceló el pago con tarjeta');
16473
16847
  };
16474
16848
  _this.callState = function () {
16475
- var state = _this.closeModal != '' ? _this.closeModal : sessionStorage.getItem('state');
16476
- console.log(state);
16849
+ var _a, _b, _c;
16850
+ var state = _this.closeModalReason != '' ? _this.closeModalReason : sessionStorage.getItem('state');
16477
16851
  if (state) {
16478
- sessionStorage.removeItem('state');
16479
- localStorage.removeItem('state');
16852
+ _this.clearStorageState();
16480
16853
  if (state == 'ok') {
16481
- _this.modalRef.hide();
16854
+ (_a = _this.modalRef) === null || _a === void 0 ? void 0 : _a.hide();
16482
16855
  _this.ready.emit(true);
16483
16856
  return;
16484
16857
  }
16485
16858
  if (state == 'menosuno') {
16486
- _this.modalRef.hide();
16487
- _this.processError('');
16859
+ (_b = _this.modalRef) === null || _b === void 0 ? void 0 : _b.hide();
16860
+ _this.processError('Error en el pago');
16488
16861
  return;
16489
16862
  }
16490
16863
  if (state == 'cancel') {
16491
- return;
16864
+ return; // El modal ya se escondió dentro de clickClose()
16492
16865
  }
16493
- _this.modalRef.hide();
16494
- _this.processError('');
16866
+ (_c = _this.modalRef) === null || _c === void 0 ? void 0 : _c.hide();
16867
+ _this.processError('Error desconocido en la transacción');
16495
16868
  return;
16496
16869
  }
16497
- setTimeout(function () {
16870
+ // Guardamos el timeout en una variable de clase
16871
+ _this.stateTimeout = setTimeout(function () {
16498
16872
  _this.callState();
16499
16873
  }, 6000);
16500
16874
  };
@@ -16510,6 +16884,10 @@ var RedSysRedirectEcComponent = /** @class */ (function (_super) {
16510
16884
  };
16511
16885
  RedSysRedirectEcComponent.prototype.ngOnDestroy = function () {
16512
16886
  console.log("SE DESTROZA");
16887
+ // Limpiar el setTimeout al salir del componente
16888
+ if (this.stateTimeout) {
16889
+ clearTimeout(this.stateTimeout);
16890
+ }
16513
16891
  };
16514
16892
  RedSysRedirectEcComponent.prototype.ngOnChanges = function () {
16515
16893
  console.log("SE CAMBIO");
@@ -16517,17 +16895,26 @@ var RedSysRedirectEcComponent = /** @class */ (function (_super) {
16517
16895
  RedSysRedirectEcComponent.prototype.openModal = function (template) {
16518
16896
  this.clearStorageState();
16519
16897
  sessionStorage.setItem('dataRedirect', this.dataRedirect());
16520
- this.modalRef = this.modalService.show(template, { class: 'modal-lg modal-dialog-centered ', keyboard: false, backdrop: 'static', animated: true });
16521
- this.closeModal = '';
16898
+ // Abrimos el modal y guardamos la referencia en this.modalRef
16899
+ this.modalRef = this.modalService.show(template, { class: 'modal-lg modal-dialog-centered', keyboard: false, backdrop: 'static', animated: true });
16900
+ this.closeModalReason = '';
16522
16901
  this.callState();
16523
16902
  };
16903
+ // Opcional pero recomendado: Capturar mensajes enviados desde el Iframe de Redsys
16904
+ RedSysRedirectEcComponent.prototype.onMessage = function (event) {
16905
+ if (event.data === 'pago_completado' || event.data === 'ok') {
16906
+ sessionStorage.setItem('state', 'ok');
16907
+ }
16908
+ else if (event.data === 'pago_error' || event.data === 'menosuno') {
16909
+ sessionStorage.setItem('state', 'menosuno');
16910
+ }
16911
+ };
16524
16912
  RedSysRedirectEcComponent.ctorParameters = function () { return [
16525
16913
  { type: Renderer2 },
16526
16914
  { type: ConnectionService },
16527
16915
  { type: ToastService },
16528
16916
  { type: Constants },
16529
16917
  { type: CartService },
16530
- { type: ToastService },
16531
16918
  { type: ActivatedRoute },
16532
16919
  { type: BsModalService }
16533
16920
  ]; };
@@ -16546,11 +16933,13 @@ var RedSysRedirectEcComponent = /** @class */ (function (_super) {
16546
16933
  __decorate$1m([
16547
16934
  ViewChild('template')
16548
16935
  ], RedSysRedirectEcComponent.prototype, "template", void 0);
16936
+ __decorate$1m([
16937
+ HostListener('window:message', ['$event'])
16938
+ ], RedSysRedirectEcComponent.prototype, "onMessage", null);
16549
16939
  RedSysRedirectEcComponent = __decorate$1m([
16550
16940
  Component({
16551
16941
  selector: 'app-redsys-redirect-ec',
16552
- template: "<div class=\"text-center\">\n <h3>Continuar con el pago</h3>\n <p *ngIf=\"method\" class=\"px-5\">{{ method?.description }}</p>\n <p *ngIf=\"method\" class=\"px-5\">{{ method?.instructions }}</p>\n <button class=\"btn btn-outline-secondary comprar\" (click)=\"openModal(template)\">Pagar con tarjeta</button>\n</div>\n\n<ng-template #template>\n <div class=\"modal-content\">\n </div>\n <div class=\"modal-body\">\n <iframe src=\"../../../assets/redsysFrameRedirectBase.html\" frameborder=\"0\" class=\"iframeStyle\"></iframe>\n </div>\n \n</ng-template>",
16553
- providers: [BsModalService],
16942
+ template: "<div class=\"text-center\">\n <h3>Continuar con el pago</h3>\n <p *ngIf=\"method\" class=\"px-5\">{{ method?.description }}</p>\n <p *ngIf=\"method\" class=\"px-5\">{{ method?.instructions }}</p>\n <button class=\"btn btn-outline-secondary comprar\" (click)=\"openModal(template)\">\n Pagar con tarjeta\n </button>\n</div>\n\n<ng-template #template>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Pasarela de pago</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"clickClose()\">\n </button>\n </div>\n \n <div class=\"modal-body p-0\">\n <iframe src=\"../../../assets/redsysFrameRedirectBase.html\" \n frameborder=\"0\" \n class=\"iframeStyle\"\n style=\"width: 100%; height: 600px; min-height: 60vh;\">\n </iframe>\n </div>\n</ng-template>",
16554
16943
  styles: [".half-width{width:49%!important}.ml-1{margin-left:1%}#card-form{height:450px}.iframeStyle{height:800px;width:100%;max-height:800px}"]
16555
16944
  })
16556
16945
  ], RedSysRedirectEcComponent);