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
@@ -4020,6 +4020,26 @@
4020
4020
  return new Promise(function (resolve, reject) { return reject(new Error(err.error)); });
4021
4021
  }).catch(function (err) { return console.error(err); });
4022
4022
  };
4023
+ _this.setHeadquarterByIds = function (data) {
4024
+ return _this.connection.put(_this.headquarterApi(), data)
4025
+ .pipe(operators.map(function (order) {
4026
+ var _a;
4027
+ if (order && order.error) {
4028
+ _this.cartService.changeHaveToUpdate(false);
4029
+ return false;
4030
+ }
4031
+ _this.checkoutService.updateAsociatedData(order);
4032
+ _this.checkoutService.setCheckoutNotes(((_a = data) === null || _a === void 0 ? void 0 : _a.notes) || '');
4033
+ _this.setStepReady(data, order);
4034
+ if (_this.consts.getCheckoutView() === 'single') {
4035
+ _this.checkoutService.prefetchPaymentMethods();
4036
+ }
4037
+ _this.analyticsService.callEvent('payment_info', order);
4038
+ return order;
4039
+ })).toPromise().then(function (res) { return res; }, function (err) {
4040
+ return new Promise(function (resolve, reject) { return reject(new Error(err.error)); });
4041
+ }).catch(function (err) { return console.error(err); });
4042
+ };
4023
4043
  _this.setAddress = function (user_data) {
4024
4044
  user_data.locale = _this.consts.getLocale();
4025
4045
  // se modifica el código postal para castearlo a String antes de enviarlo
@@ -6012,29 +6032,30 @@
6012
6032
  };
6013
6033
  _this.setMethod = function (method) { return __awaiter$6(_this, void 0, void 0, function () {
6014
6034
  var res, costs, err_1;
6015
- return __generator$6(this, function (_a) {
6016
- switch (_a.label) {
6035
+ var _a, _b;
6036
+ return __generator$6(this, function (_c) {
6037
+ switch (_c.label) {
6017
6038
  case 0:
6018
6039
  // Deshabilitar todos los botones
6019
6040
  this.buttonsDisabled = true;
6020
6041
  this.errorSubject.next(null);
6021
6042
  this.costsSubject.next([]);
6022
6043
  this.stateSubject.next({ doing: true, ok: false, data: { method: method } });
6023
- _a.label = 1;
6044
+ _c.label = 1;
6024
6045
  case 1:
6025
- _a.trys.push([1, 4, 5, 6]);
6046
+ _c.trys.push([1, 4, 5, 6]);
6026
6047
  return [4 /*yield*/, this.putShipment()];
6027
6048
  case 2:
6028
- res = _a.sent();
6049
+ res = _c.sent();
6029
6050
  this.checkoutService.updateAsociatedData(res);
6030
6051
  this.order = res;
6031
6052
  return [4 /*yield*/, this.getCalculatedCosts()];
6032
6053
  case 3:
6033
- costs = _a.sent();
6034
- this.modifyCostsResponse(costs, this.getUserData().shippingAddress.postcode, method);
6054
+ costs = _c.sent();
6055
+ this.modifyCostsResponse(costs, (_b = (_a = this.getUserData()) === null || _a === void 0 ? void 0 : _a.shippingAddress) === null || _b === void 0 ? void 0 : _b.postcode, method);
6035
6056
  return [3 /*break*/, 6];
6036
6057
  case 4:
6037
- err_1 = _a.sent();
6058
+ err_1 = _c.sent();
6038
6059
  console.error(err_1);
6039
6060
  this.errorSubject.next('operation-error');
6040
6061
  throw new Error(err_1.error);
@@ -8919,11 +8940,13 @@
8919
8940
  _this.allready_data = false;
8920
8941
  _this.addressBook = [];
8921
8942
  _this.addressBookSelected = { id: 0, notes: "" };
8943
+ _this.addressBookSelectedFacturacion = { id: 0, notes: "" };
8922
8944
  _this.finish = false; //Esta variable se usa para mostrar el boton de finalizar.
8923
8945
  _this.validado = false;
8924
8946
  _this.viewDataFacturacion = true;
8925
8947
  _this.params = {};
8926
8948
  _this.selectAddres = false;
8949
+ _this.selectAddressFacturacion = false;
8927
8950
  _this.addressSearch = '';
8928
8951
  _this.addressDropdownOpen = false;
8929
8952
  _this.formReadonly = false;
@@ -8931,6 +8954,10 @@
8931
8954
  _this.tempAddressId = 0;
8932
8955
  _this.postalCodeErrorMessage = "";
8933
8956
  _this.postalCodeErrorMessageFacturacion = "";
8957
+ _this.postalCodeVisible = true;
8958
+ _this.postalCodeVisibleFacturacion = true;
8959
+ _this.postalCodeRequired = true;
8960
+ _this.postalCodeRequiredFacturacion = true;
8934
8961
  _this.documentErrorMessage = "";
8935
8962
  _this.documentErrorMessageFacturacion = "";
8936
8963
  _this.customerHasCustomerTaxRate = false;
@@ -9085,6 +9112,57 @@
9085
9112
  var current = _this.checkoutFormFacturacion.controls['documentType'].value;
9086
9113
  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) || '';
9087
9114
  };
9115
+ _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); };
9116
+ _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); };
9117
+ _this.getDefaultPostalCodeFieldState = function () {
9118
+ var visible = _this.getBasePostalCodeEnabled();
9119
+ return {
9120
+ visible: visible,
9121
+ required: visible && _this.getBasePostalCodeRequired()
9122
+ };
9123
+ };
9124
+ _this.resolveCountryByCode = function (code) {
9125
+ if (!code)
9126
+ return null;
9127
+ var countryFromSubjects = __spread$4((_this.countriesSubject.value || []), (_this.countriesFacturacionSubject.value || [])).find(function (country) { return country.code == code; });
9128
+ return countryFromSubjects
9129
+ || _this.addressingService.countriesList.find(function (country) { return country.code == code; })
9130
+ || null;
9131
+ };
9132
+ _this.resolveCountryForPostalCode = function (selectedCountry) {
9133
+ if (!selectedCountry)
9134
+ return null;
9135
+ if (selectedCountry.checkoutRequiredFields || selectedCountry.isPostalCodeNumeric !== undefined) {
9136
+ return selectedCountry;
9137
+ }
9138
+ return _this.resolveCountryByCode(selectedCountry.code || selectedCountry.countryCode);
9139
+ };
9140
+ _this.resolvePostalCodeFieldState = function (country) {
9141
+ var _a, _b;
9142
+ var checkoutPostalCode = (_b = (_a = country) === null || _a === void 0 ? void 0 : _a.checkoutRequiredFields) === null || _b === void 0 ? void 0 : _b.postalCode;
9143
+ if (checkoutPostalCode === false) {
9144
+ return { visible: false, required: false };
9145
+ }
9146
+ if (checkoutPostalCode === true) {
9147
+ return { visible: true, required: true };
9148
+ }
9149
+ return _this.getDefaultPostalCodeFieldState();
9150
+ };
9151
+ _this.isPostalCodeFieldVisible = function (billing) {
9152
+ if (billing === void 0) { billing = false; }
9153
+ return billing ? _this.postalCodeVisibleFacturacion : _this.postalCodeVisible;
9154
+ };
9155
+ _this.isPostalCodeFieldRequired = function (billing) {
9156
+ if (billing === void 0) { billing = false; }
9157
+ return billing ? _this.postalCodeRequiredFacturacion : _this.postalCodeRequired;
9158
+ };
9159
+ _this.shouldShowPostalCodeByCountryCode = function (code) {
9160
+ var country = _this.resolveCountryByCode(code);
9161
+ if (!country) {
9162
+ return _this.getDefaultPostalCodeFieldState().visible;
9163
+ }
9164
+ return _this.resolvePostalCodeFieldState(country).visible;
9165
+ };
9088
9166
  _this.toggleDocumentTypeDropdown = function (event) {
9089
9167
  var _a;
9090
9168
  event.stopPropagation();
@@ -9341,6 +9419,260 @@
9341
9419
  _this.setCheckoutFormReadonly(_this.compactAddressView && !_this.getMode());
9342
9420
  _this.evaluateDirtyState();
9343
9421
  };
9422
+ _this.getModeFacturacion = function () {
9423
+ switch (_this.addressingService.modeSelectAddress) {
9424
+ case 'ONLY_LOAD_ADDRESS':
9425
+ return true;
9426
+ case 'ONLY_ADDRESS_SELECTION':
9427
+ return !_this.authService.isAuthenticated();
9428
+ case 'LOAD_ADDRESS_AND_SELECTION':
9429
+ return _this.authService.isAuthenticated() ? _this.selectAddressFacturacion : true;
9430
+ }
9431
+ };
9432
+ _this.setModeFacturacion = function (mode) {
9433
+ _this.selectAddressFacturacion = mode === 'carga';
9434
+ _this.onFormChange();
9435
+ _this.evaluateDirtyState();
9436
+ };
9437
+ _this.setSelectAddressFacturacion = function (addressSelect) {
9438
+ var _a;
9439
+ (_this.addressBook || []).forEach(function (address) {
9440
+ var _a;
9441
+ address.selectedFacturacion = String(address.id) === String((_a = addressSelect) === null || _a === void 0 ? void 0 : _a.id);
9442
+ });
9443
+ _this.addressBookSelectedFacturacion.id = ((_a = (_this.addressBook || []).find(function (address) { return address.selectedFacturacion; })) === null || _a === void 0 ? void 0 : _a.id) || 0;
9444
+ };
9445
+ _this.buildAddressFromBook = function (bookAddress) {
9446
+ var _a, _b;
9447
+ var contact = ((_a = bookAddress) === null || _a === void 0 ? void 0 : _a.addressContact) || {};
9448
+ return {
9449
+ firstName: contact.firstName || '',
9450
+ lastName: contact.lastName || '',
9451
+ phoneNumber: contact.phoneNumber || '',
9452
+ email: contact.email || '',
9453
+ documentType: contact.documentType || '',
9454
+ documentNumber: contact.documentNumber || '',
9455
+ countryCode: bookAddress.countryCode,
9456
+ provinceCode: bookAddress.provinceCode,
9457
+ city: bookAddress.city,
9458
+ street: bookAddress.street,
9459
+ postcode: ((_b = bookAddress.postcode) === null || _b === void 0 ? void 0 : _b.toString()) || ''
9460
+ };
9461
+ };
9462
+ _this.handleBillingFormSubmit = function (event) {
9463
+ event.preventDefault();
9464
+ if (_this.getMode()) {
9465
+ _this.verifyValidate(null, null);
9466
+ }
9467
+ };
9468
+ _this.onSelectAddress = function (items) { return __awaiter$9(_this, void 0, void 0, function () {
9469
+ var notesCfg, previousTotals, addressSelected, request, resultSede_2, totalsChanged, e_3;
9470
+ var _this = this;
9471
+ return __generator$9(this, function (_a) {
9472
+ switch (_a.label) {
9473
+ case 0:
9474
+ if (this.canCompleteLegacyAddressOnlyCheckout()) {
9475
+ this.nextStep();
9476
+ return [2 /*return*/];
9477
+ }
9478
+ notesCfg = this.addressingService.getTypeForm().viewForms.notes;
9479
+ if (notesCfg.required && (!this.addressBookSelected.notes || !this.addressBookSelected.notes.trim())) {
9480
+ this.toast.show('required-fields');
9481
+ return [2 /*return*/];
9482
+ }
9483
+ previousTotals = __assign$j({}, this.lastSummaryTotalsSnapshot);
9484
+ this.loading = true;
9485
+ _a.label = 1;
9486
+ case 1:
9487
+ _a.trys.push([1, 3, 4, 5]);
9488
+ addressSelected = this.addressBook.find(function (address) { return address.selected; });
9489
+ if (!addressSelected) {
9490
+ this.showError('invalid-form');
9491
+ return [2 /*return*/];
9492
+ }
9493
+ if (!this.addressBookSelected.id)
9494
+ this.addressBookSelected.id = addressSelected.id || 0;
9495
+ request = {
9496
+ shippingAddressId: addressSelected.id,
9497
+ billingAddressId: addressSelected.id,
9498
+ notes: this.addressBookSelected.notes || ""
9499
+ };
9500
+ return [4 /*yield*/, this.addressingService.setHeadquarterByIds(request)];
9501
+ case 2:
9502
+ resultSede_2 = _a.sent();
9503
+ if (!resultSede_2) {
9504
+ this.toast.show('operation-error');
9505
+ return [2 /*return*/];
9506
+ }
9507
+ if (this.cartService.channelConfig.applyOrderLot) {
9508
+ (items || []).forEach(function (item) {
9509
+ var _a, _b, _c, _d;
9510
+ if (!item.lot[0]) {
9511
+ _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');
9512
+ }
9513
+ });
9514
+ }
9515
+ this.form_ready = true;
9516
+ this.allready_data = true;
9517
+ this.setSavedStateFromCurrent();
9518
+ totalsChanged = this.haveTotalsChanged(previousTotals, resultSede_2);
9519
+ if (this.compactAddressView && this.nextStep) {
9520
+ this.nextStep();
9521
+ }
9522
+ else if (this.isLegacyAddressOnlyCheckout()) {
9523
+ totalsChanged && this.scrollToLegacySummary();
9524
+ return [2 /*return*/];
9525
+ }
9526
+ else {
9527
+ this.nextStep();
9528
+ }
9529
+ return [3 /*break*/, 5];
9530
+ case 3:
9531
+ e_3 = _a.sent();
9532
+ this.toast.show('operation-error');
9533
+ return [3 /*break*/, 5];
9534
+ case 4:
9535
+ this.loading = false;
9536
+ return [7 /*endfinally*/];
9537
+ case 5: return [2 /*return*/];
9538
+ }
9539
+ });
9540
+ }); };
9541
+ _this.onSelectAddressFacturacion = function (items) { return __awaiter$9(_this, void 0, void 0, function () {
9542
+ var addressSelectedFacturacion, addressSelectedEnvio, previousTotals, request, resultSede, totalsChanged, e_4;
9543
+ var _this = this;
9544
+ return __generator$9(this, function (_a) {
9545
+ switch (_a.label) {
9546
+ case 0:
9547
+ addressSelectedFacturacion = this.addressBook.find(function (address) { return address.selectedFacturacion; });
9548
+ addressSelectedEnvio = this.addressBook.find(function (address) { return address.selected; });
9549
+ if (!addressSelectedFacturacion || !addressSelectedEnvio) {
9550
+ this.showError('invalid-form');
9551
+ return [2 /*return*/];
9552
+ }
9553
+ previousTotals = __assign$j({}, this.lastSummaryTotalsSnapshot);
9554
+ this.loading = true;
9555
+ _a.label = 1;
9556
+ case 1:
9557
+ _a.trys.push([1, 3, 4, 5]);
9558
+ this.addressBookSelected.id = addressSelectedEnvio.id || 0;
9559
+ this.addressBookSelectedFacturacion.id = addressSelectedFacturacion.id || 0;
9560
+ request = {
9561
+ shippingAddressId: addressSelectedEnvio.id,
9562
+ billingAddressId: addressSelectedFacturacion.id,
9563
+ notes: this.addressBookSelected.notes || ""
9564
+ };
9565
+ return [4 /*yield*/, this.addressingService.setHeadquarterByIds(request)];
9566
+ case 2:
9567
+ resultSede = _a.sent();
9568
+ if (!resultSede) {
9569
+ this.toast.show('operation-error');
9570
+ return [2 /*return*/];
9571
+ }
9572
+ if (this.cartService.channelConfig.applyOrderLot) {
9573
+ (items || []).forEach(function (item) {
9574
+ if (!item.lot[0]) {
9575
+ _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');
9576
+ }
9577
+ });
9578
+ }
9579
+ this.form_ready = true;
9580
+ this.allready_data = true;
9581
+ this.setSavedStateFromCurrent();
9582
+ totalsChanged = this.haveTotalsChanged(previousTotals, resultSede);
9583
+ if (this.compactAddressView && this.nextStep) {
9584
+ this.nextStep();
9585
+ }
9586
+ else if (this.isLegacyAddressOnlyCheckout()) {
9587
+ totalsChanged && this.scrollToLegacySummary();
9588
+ return [2 /*return*/];
9589
+ }
9590
+ else {
9591
+ this.nextStep();
9592
+ }
9593
+ return [3 /*break*/, 5];
9594
+ case 3:
9595
+ e_4 = _a.sent();
9596
+ this.toast.show('operation-error');
9597
+ return [3 /*break*/, 5];
9598
+ case 4:
9599
+ this.loading = false;
9600
+ return [7 /*endfinally*/];
9601
+ case 5: return [2 /*return*/];
9602
+ }
9603
+ });
9604
+ }); };
9605
+ _this.onSubmitNewBillingAddress = function (items) { return __awaiter$9(_this, void 0, void 0, function () {
9606
+ var addressSelectedEnvio, previousTotals, billingFormData, addressData, result, totalsChanged, e_5;
9607
+ var _this = this;
9608
+ var _a;
9609
+ return __generator$9(this, function (_b) {
9610
+ switch (_b.label) {
9611
+ case 0:
9612
+ if (!this.checkoutFormFacturacion.valid) {
9613
+ this.showError('invalid-form');
9614
+ return [2 /*return*/];
9615
+ }
9616
+ addressSelectedEnvio = this.addressBook.find(function (address) { return address.selected; });
9617
+ if (!addressSelectedEnvio) {
9618
+ this.showError('invalid-form');
9619
+ return [2 /*return*/];
9620
+ }
9621
+ previousTotals = __assign$j({}, this.lastSummaryTotalsSnapshot);
9622
+ this.loading = true;
9623
+ _b.label = 1;
9624
+ case 1:
9625
+ _b.trys.push([1, 3, 4, 5]);
9626
+ billingFormData = __assign$j({}, this.checkoutFormFacturacion.getRawValue());
9627
+ billingFormData.postcode = (_a = billingFormData.postcode) === null || _a === void 0 ? void 0 : _a.toString();
9628
+ addressData = {
9629
+ shippingAddress: this.buildAddressFromBook(addressSelectedEnvio),
9630
+ billingAddress: billingFormData,
9631
+ notes: this.addressBookSelected.notes || ""
9632
+ };
9633
+ return [4 /*yield*/, this.addressingService.setAddress(addressData)];
9634
+ case 2:
9635
+ result = _b.sent();
9636
+ if (result === false) {
9637
+ this.require_login = true;
9638
+ this.toast.show('email_already_registered');
9639
+ return [2 /*return*/];
9640
+ }
9641
+ if (result !== undefined) {
9642
+ if (this.cartService.channelConfig.applyOrderLot) {
9643
+ (items || []).forEach(function (item) {
9644
+ if (!item.lot[0]) {
9645
+ _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');
9646
+ }
9647
+ });
9648
+ }
9649
+ this.form_ready = true;
9650
+ this.allready_data = true;
9651
+ this.setSavedStateFromCurrent();
9652
+ totalsChanged = this.haveTotalsChanged(previousTotals, result);
9653
+ if (this.compactAddressView && this.nextStep) {
9654
+ this.nextStep();
9655
+ }
9656
+ else if (this.isLegacyAddressOnlyCheckout()) {
9657
+ totalsChanged && this.scrollToLegacySummary();
9658
+ return [2 /*return*/];
9659
+ }
9660
+ else {
9661
+ this.nextStep();
9662
+ }
9663
+ }
9664
+ return [3 /*break*/, 5];
9665
+ case 3:
9666
+ e_5 = _b.sent();
9667
+ this.toast.show('operation-error');
9668
+ return [3 /*break*/, 5];
9669
+ case 4:
9670
+ this.loading = false;
9671
+ return [7 /*endfinally*/];
9672
+ case 5: return [2 /*return*/];
9673
+ }
9674
+ });
9675
+ }); };
9344
9676
  _this.toggleAddressDropdown = function () {
9345
9677
  _this.addressDropdownOpen = !_this.addressDropdownOpen;
9346
9678
  };
@@ -9674,24 +10006,26 @@
9674
10006
  _this.updateDocumentValidation(selectedDoc);
9675
10007
  }
9676
10008
  }
10009
+ var selectedBillingCountry = _this.countriesFacturacionSubject.value.find(function (country) { return country.code == _this.checkoutFormFacturacion.controls['countryCode'].value; });
10010
+ _this.updatePostalCodeValidationFacturacion(selectedBillingCountry);
9677
10011
  _this.onFormChange();
9678
10012
  }
9679
10013
  _this.suppressDirty = false;
9680
10014
  _this.setDirtyState(false);
9681
10015
  };
9682
10016
  _this.ecOnConstruct();
9683
- _this.checkoutForm = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formAddres), { postcode: ['', [forms.Validators.required]] // Se agrega para que sólo acepte códigos postales mayores que cero
9684
- }));
10017
+ _this.checkoutForm = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formAddres), { postcode: [''] }));
9685
10018
  _this.checkoutForm.statusChanges
9686
10019
  .pipe(operators.filter(function () { _this.onFormChange(); return _this.checkoutForm.valid; }))
9687
10020
  .subscribe(function () { return _this.onFormValid(); });
9688
10021
  _this.checkoutForm.valueChanges.subscribe(function () { return _this.evaluateDirtyState(); });
9689
- _this.checkoutFormFacturacion = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formBilling), { postcode: ['', [forms.Validators.required]] // Se agrega para que sólo acepte códigos postales mayores que cero
9690
- }));
10022
+ _this.checkoutFormFacturacion = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formBilling), { postcode: [''] }));
9691
10023
  _this.checkoutFormFacturacion.statusChanges
9692
10024
  .pipe(operators.filter(function () { _this.onFormChange(); return _this.checkoutFormFacturacion.valid; }))
9693
10025
  .subscribe(function () { return _this.onFormValid(); });
9694
10026
  _this.checkoutFormFacturacion.valueChanges.subscribe(function () { return _this.evaluateDirtyState(); });
10027
+ _this.updatePostalCodeValidation(null);
10028
+ _this.updatePostalCodeValidationFacturacion(null);
9695
10029
  return _this;
9696
10030
  }
9697
10031
  DataFormEcComponent.prototype.ngOnInit = function () {
@@ -9798,10 +10132,48 @@
9798
10132
  form.controls[formControlName].updateValueAndValidity();
9799
10133
  };
9800
10134
  DataFormEcComponent.prototype.updatePostalCodeValidation = function (selectedCountry) {
9801
- this.updateValidation(selectedCountry, 'postcode', this.checkoutForm, 'postalCodeErrorMessage', 'isPostalCodeNumeric', 'postal-code-pattern-error');
10135
+ var _a, _b;
10136
+ var country = this.resolveCountryForPostalCode(selectedCountry);
10137
+ var _c = country
10138
+ ? this.resolvePostalCodeFieldState(country)
10139
+ : this.getDefaultPostalCodeFieldState(), visible = _c.visible, required = _c.required;
10140
+ var isNumeric = (_b = (_a = country) === null || _a === void 0 ? void 0 : _a.isPostalCodeNumeric, (_b !== null && _b !== void 0 ? _b : false));
10141
+ var validators = [];
10142
+ if (required) {
10143
+ validators.push(forms.Validators.required);
10144
+ }
10145
+ if (visible && isNumeric) {
10146
+ validators.push(forms.Validators.pattern(/^\d+$/));
10147
+ }
10148
+ this.postalCodeVisible = visible;
10149
+ this.postalCodeRequired = required;
10150
+ this.postalCodeErrorMessage = isNumeric
10151
+ ? 'postal-code-pattern-error.numeric'
10152
+ : 'postal-code-pattern-error.default';
10153
+ this.checkoutForm.controls['postcode'].setValidators(validators);
10154
+ this.checkoutForm.controls['postcode'].updateValueAndValidity({ emitEvent: false });
9802
10155
  };
9803
10156
  DataFormEcComponent.prototype.updatePostalCodeValidationFacturacion = function (selectedCountry) {
9804
- this.updateValidation(selectedCountry, 'postcode', this.checkoutFormFacturacion, 'postalCodeErrorMessageFacturacion', 'isPostalCodeNumeric', 'postal-code-pattern-error');
10157
+ var _a, _b;
10158
+ var country = this.resolveCountryForPostalCode(selectedCountry);
10159
+ var _c = country
10160
+ ? this.resolvePostalCodeFieldState(country)
10161
+ : this.getDefaultPostalCodeFieldState(), visible = _c.visible, required = _c.required;
10162
+ var isNumeric = (_b = (_a = country) === null || _a === void 0 ? void 0 : _a.isPostalCodeNumeric, (_b !== null && _b !== void 0 ? _b : false));
10163
+ var validators = [];
10164
+ if (required) {
10165
+ validators.push(forms.Validators.required);
10166
+ }
10167
+ if (visible && isNumeric) {
10168
+ validators.push(forms.Validators.pattern(/^\d+$/));
10169
+ }
10170
+ this.postalCodeVisibleFacturacion = visible;
10171
+ this.postalCodeRequiredFacturacion = required;
10172
+ this.postalCodeErrorMessageFacturacion = isNumeric
10173
+ ? 'postal-code-pattern-error.numeric'
10174
+ : 'postal-code-pattern-error.default';
10175
+ this.checkoutFormFacturacion.controls['postcode'].setValidators(validators);
10176
+ this.checkoutFormFacturacion.controls['postcode'].updateValueAndValidity({ emitEvent: false });
9805
10177
  };
9806
10178
  DataFormEcComponent.prototype.updateDocumentValidation = function (selectedDocumentType) {
9807
10179
  this.updateValidation(selectedDocumentType, 'documentNumber', this.checkoutForm, 'documentErrorMessage', 'isNumeric', 'document-pattern-error', this.addressingService.getTypeForm().viewForms.documentNumber.required);
@@ -9843,7 +10215,7 @@
9843
10215
  DataFormEcComponent = __decorate$P([
9844
10216
  core.Component({
9845
10217
  selector: 'app-dataform-ec',
9846
- 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",
10218
+ 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",
9847
10219
  providers: [modal.BsModalService],
9848
10220
  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}"]
9849
10221
  })
@@ -10157,7 +10529,7 @@
10157
10529
  };
10158
10530
  _this.verifyValidate = function () {
10159
10531
  _this.setLoading();
10160
- setTimeout(function (r) { return _this.emitResult(); }, 1000);
10532
+ _this.emitResult();
10161
10533
  };
10162
10534
  _this.setMethod = function (method) { return __awaiter$b(_this, void 0, void 0, function () {
10163
10535
  var result, balanceCustomer, totals, isBalanceMethod, allowAny;
@@ -16428,14 +16800,13 @@
16428
16800
  };
16429
16801
  var RedSysRedirectEcComponent = /** @class */ (function (_super) {
16430
16802
  __extends$J(RedSysRedirectEcComponent, _super);
16431
- function RedSysRedirectEcComponent(renderer, connection, toastrService, consts, cartService, toastr, activedRoute, modalService) {
16803
+ function RedSysRedirectEcComponent(renderer, connection, toastrService, consts, cartService, activedRoute, modalService) {
16432
16804
  var _this = _super.call(this) || this;
16433
16805
  _this.renderer = renderer;
16434
16806
  _this.connection = connection;
16435
16807
  _this.toastrService = toastrService;
16436
16808
  _this.consts = consts;
16437
16809
  _this.cartService = cartService;
16438
- _this.toastr = toastr;
16439
16810
  _this.activedRoute = activedRoute;
16440
16811
  _this.modalService = modalService;
16441
16812
  _this.method = null;
@@ -16445,41 +16816,44 @@
16445
16816
  _this.loading = true;
16446
16817
  _this.isDobleAuth = false;
16447
16818
  _this.urls = [];
16448
- _this.closeModal = '';
16819
+ _this.closeModalReason = ''; // Renombrado para evitar confusión
16449
16820
  _this.dataRedirect = function () { return _this.consts.getUrlBase() + 'shop-api/' + _this.consts.getChannel() + '/redsys/redirect/' + _this.cartService.cart_token + '/process-payment'; };
16450
16821
  _this.clearStorageState = function () {
16451
16822
  sessionStorage.removeItem('state');
16452
16823
  localStorage.removeItem('state');
16453
16824
  };
16825
+ // Método que se llama desde la X de la cabecera del modal en el HTML
16454
16826
  _this.clickClose = function () {
16455
- _this.closeModal = 'cancel';
16456
- _this.modalRef.hide();
16457
- _this.processError('Se cancelo el pago con tarjeta');
16827
+ _this.closeModalReason = 'cancel';
16828
+ if (_this.modalRef) {
16829
+ _this.modalRef.hide();
16830
+ }
16831
+ _this.processError('Se canceló el pago con tarjeta');
16458
16832
  };
16459
16833
  _this.callState = function () {
16460
- var state = _this.closeModal != '' ? _this.closeModal : sessionStorage.getItem('state');
16461
- console.log(state);
16834
+ var _a, _b, _c;
16835
+ var state = _this.closeModalReason != '' ? _this.closeModalReason : sessionStorage.getItem('state');
16462
16836
  if (state) {
16463
- sessionStorage.removeItem('state');
16464
- localStorage.removeItem('state');
16837
+ _this.clearStorageState();
16465
16838
  if (state == 'ok') {
16466
- _this.modalRef.hide();
16839
+ (_a = _this.modalRef) === null || _a === void 0 ? void 0 : _a.hide();
16467
16840
  _this.ready.emit(true);
16468
16841
  return;
16469
16842
  }
16470
16843
  if (state == 'menosuno') {
16471
- _this.modalRef.hide();
16472
- _this.processError('');
16844
+ (_b = _this.modalRef) === null || _b === void 0 ? void 0 : _b.hide();
16845
+ _this.processError('Error en el pago');
16473
16846
  return;
16474
16847
  }
16475
16848
  if (state == 'cancel') {
16476
- return;
16849
+ return; // El modal ya se escondió dentro de clickClose()
16477
16850
  }
16478
- _this.modalRef.hide();
16479
- _this.processError('');
16851
+ (_c = _this.modalRef) === null || _c === void 0 ? void 0 : _c.hide();
16852
+ _this.processError('Error desconocido en la transacción');
16480
16853
  return;
16481
16854
  }
16482
- setTimeout(function () {
16855
+ // Guardamos el timeout en una variable de clase
16856
+ _this.stateTimeout = setTimeout(function () {
16483
16857
  _this.callState();
16484
16858
  }, 6000);
16485
16859
  };
@@ -16495,6 +16869,10 @@
16495
16869
  };
16496
16870
  RedSysRedirectEcComponent.prototype.ngOnDestroy = function () {
16497
16871
  console.log("SE DESTROZA");
16872
+ // Limpiar el setTimeout al salir del componente
16873
+ if (this.stateTimeout) {
16874
+ clearTimeout(this.stateTimeout);
16875
+ }
16498
16876
  };
16499
16877
  RedSysRedirectEcComponent.prototype.ngOnChanges = function () {
16500
16878
  console.log("SE CAMBIO");
@@ -16502,17 +16880,26 @@
16502
16880
  RedSysRedirectEcComponent.prototype.openModal = function (template) {
16503
16881
  this.clearStorageState();
16504
16882
  sessionStorage.setItem('dataRedirect', this.dataRedirect());
16505
- this.modalRef = this.modalService.show(template, { class: 'modal-lg modal-dialog-centered ', keyboard: false, backdrop: 'static', animated: true });
16506
- this.closeModal = '';
16883
+ // Abrimos el modal y guardamos la referencia en this.modalRef
16884
+ this.modalRef = this.modalService.show(template, { class: 'modal-lg modal-dialog-centered', keyboard: false, backdrop: 'static', animated: true });
16885
+ this.closeModalReason = '';
16507
16886
  this.callState();
16508
16887
  };
16888
+ // Opcional pero recomendado: Capturar mensajes enviados desde el Iframe de Redsys
16889
+ RedSysRedirectEcComponent.prototype.onMessage = function (event) {
16890
+ if (event.data === 'pago_completado' || event.data === 'ok') {
16891
+ sessionStorage.setItem('state', 'ok');
16892
+ }
16893
+ else if (event.data === 'pago_error' || event.data === 'menosuno') {
16894
+ sessionStorage.setItem('state', 'menosuno');
16895
+ }
16896
+ };
16509
16897
  RedSysRedirectEcComponent.ctorParameters = function () { return [
16510
16898
  { type: core.Renderer2 },
16511
16899
  { type: ConnectionService },
16512
16900
  { type: ToastService },
16513
16901
  { type: Constants },
16514
16902
  { type: CartService },
16515
- { type: ToastService },
16516
16903
  { type: router.ActivatedRoute },
16517
16904
  { type: modal.BsModalService }
16518
16905
  ]; };
@@ -16531,11 +16918,13 @@
16531
16918
  __decorate$1m([
16532
16919
  core.ViewChild('template')
16533
16920
  ], RedSysRedirectEcComponent.prototype, "template", void 0);
16921
+ __decorate$1m([
16922
+ core.HostListener('window:message', ['$event'])
16923
+ ], RedSysRedirectEcComponent.prototype, "onMessage", null);
16534
16924
  RedSysRedirectEcComponent = __decorate$1m([
16535
16925
  core.Component({
16536
16926
  selector: 'app-redsys-redirect-ec',
16537
- 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>",
16538
- providers: [modal.BsModalService],
16927
+ 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>",
16539
16928
  styles: [".half-width{width:49%!important}.ml-1{margin-left:1%}#card-form{height:450px}.iframeStyle{height:800px;width:100%;max-height:800px}"]
16540
16929
  })
16541
16930
  ], RedSysRedirectEcComponent);