ng-easycommerce 0.0.518 → 0.0.519

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.
package/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ # version 0.0.519
2
+ - Se modifica funcionamiento lotes para que espere un tiempo en cargar el endpoint de carrito.
3
+ - Se añade loading en boton lotes para que cargue al darle a guardar
1
4
  # version 0.0.515
2
5
  - Se modifica funcionamiento del checkout solucionando bug 0.0.513
3
6
  # version 0.0.514
@@ -156,6 +156,7 @@
156
156
  "lookbook": "lookbook",
157
157
  "lots": "Lots",
158
158
  "lot-saved": "Lot saved",
159
+ "lot-saving": "Saving lots...",
159
160
  "lot-title": "Manage Lots",
160
161
  "lot-subtitle": "Manage shipping dates and locations",
161
162
  "lot-new": "+ Add Lot",
@@ -156,6 +156,7 @@
156
156
  "lookbook": "lookbook",
157
157
  "lots": "Lotes",
158
158
  "lot-saved": "Se ha guardado el lote",
159
+ "lot-saving": "Guardando lotes...",
159
160
  "lot-title": "Administrar Lotes",
160
161
  "lot-subtitle": "Gestionar fechas y sedes de envío",
161
162
  "lot-new": "+ Nuevo Lote",
@@ -2172,14 +2172,23 @@
2172
2172
  var subtotal = { type: 'subtotal', name: 'subtotal', amount: cart.totals.items };
2173
2173
  var total = { type: 'total', name: 'total', amount: cart.totals.total };
2174
2174
  !forCart && new_state.push(subtotal);
2175
- cart.cartDiscounts.forEach(function (cartDiscount) {
2176
- cartDiscount.type = _this.formatType(cartDiscount.type);
2175
+ // console.log(cart.cartDiscounts);
2176
+ for (var index = 0; index < cart.cartDiscounts.length; index++) {
2177
+ cart.cartDiscounts[index].type = _this.formatType(cart.cartDiscounts[index].type);
2177
2178
  new_state.push({
2178
- type: cartDiscount.type,
2179
- name: (cartDiscount.type != 'coupon') ? cartDiscount.name : 'coupon',
2180
- amount: _this.getAmount(cartDiscount, cart)
2179
+ type: cart.cartDiscounts[index].type,
2180
+ name: (cart.cartDiscounts[index].type != 'coupon') ? cart.cartDiscounts[index].name : 'coupon',
2181
+ amount: _this.getAmount(cart.cartDiscounts[index], cart)
2181
2182
  });
2182
- });
2183
+ }
2184
+ // cart.cartDiscounts.forEach(cartDiscount => {
2185
+ // cartDiscount.type = this.formatType(cartDiscount.type);
2186
+ // new_state.push({
2187
+ // type: cartDiscount.type,
2188
+ // name: (cartDiscount.type != 'coupon') ? cartDiscount.name : 'coupon',
2189
+ // amount: this.getAmount(cartDiscount, cart)
2190
+ // });
2191
+ // });
2183
2192
  !forCart && new_state.push(total);
2184
2193
  return new_state;
2185
2194
  };
@@ -7012,6 +7021,7 @@
7012
7021
  _this.isLoggedIn = false;
7013
7022
  _this.mediaUrl = '';
7014
7023
  _this.promotions = [];
7024
+ _this.cargando = false;
7015
7025
  _this.toDecimal = function (amount) { return _this.consts.toDecimal(amount); };
7016
7026
  _this.actualizarCantidad = function (item, cantidad, stock, id) {
7017
7027
  if (id) {
@@ -7151,6 +7161,9 @@
7151
7161
  };
7152
7162
  // Cuando se pulsa el boton para guardar el lote recorre la funcion y el for , recorre linea a linea y lanza el endpoint con una pausa para que no se pierda ninguno y no se quede pillado.
7153
7163
  document.getElementById('botonGuardar').onclick = function () {
7164
+ this_.toastrService.show('lot-saving');
7165
+ this_.cargando = true;
7166
+ var lotID = '';
7154
7167
  var cantidadLotes = 0;
7155
7168
  //Controla que las cantidades de los lotes no sea superior a la del producto en el carrito.
7156
7169
  for (var index = 1; index < id; index++) {
@@ -7162,14 +7175,6 @@
7162
7175
  // console.log(cantidadLotes);
7163
7176
  var y = 0;
7164
7177
  for (var index = 1; index < id; index++) {
7165
- var lotID = '';
7166
- if (document.getElementById("id" + index)) {
7167
- lotID = document.getElementById("id" + index).value;
7168
- var myIndex = allID.indexOf(parseInt(lotID));
7169
- if (myIndex !== -1) {
7170
- allID.splice(myIndex, 1);
7171
- }
7172
- }
7173
7178
  if (document.getElementById("quantity" + index)) {
7174
7179
  var quantity = parseInt(document.getElementById("quantity" + index).value);
7175
7180
  var deliveryDate = document.getElementById("deliveryDate" + index).value;
@@ -7177,13 +7182,20 @@
7177
7182
  var notes = $("#notes" + index).val();
7178
7183
  var shippingAddressName = $('#shippingAddress' + index + ' option:selected').text();
7179
7184
  }
7185
+ if (document.getElementById("id" + index)) {
7186
+ lotID = document.getElementById("id" + index).value;
7187
+ var myIndex = allID.indexOf(parseInt(lotID));
7188
+ if (myIndex !== -1) {
7189
+ allID.splice(myIndex, 1);
7190
+ }
7191
+ }
7180
7192
  if (lotID == 'Pendt.') {
7181
7193
  // console.log('nuevo');
7182
- setTimeout(function () { this_.cartService.addToLot(item.product, 0, item.variant_id, 0, item.item_id, quantity, item.product.price, item.quantity, item.discount, item.product.price * quantity, 'new', deliveryDate, notes, parseInt(shippingAddress), shippingAddressName, 'newlot'); }, 300 * index);
7194
+ this_.cartService.addToLot(item.product, 0, item.variant_id, 0, item.item_id, quantity, item.product.price, item.quantity, item.discount, item.product.price * quantity, 'new', deliveryDate, notes, parseInt(shippingAddress), shippingAddressName, 'newlot');
7183
7195
  }
7184
7196
  else if (lotID != '') {
7185
- // console.log('editar');
7186
- setTimeout(function () { this_.cartService.addToLot(item.product, 0, item.variant_id, parseInt(lotID), item.item_id, quantity, item.product.price, item.quantity, item.discount, item.product.price * quantity, 'edited', deliveryDate, notes, parseInt(shippingAddress), shippingAddressName, 'editlot'); }, 300 * index);
7197
+ console.log(lotID);
7198
+ this_.cartService.addToLot(item.product, 0, item.variant_id, parseInt(lotID), item.item_id, quantity, item.product.price, item.quantity, item.discount, item.product.price * quantity, 'edited', deliveryDate, notes, parseInt(shippingAddress), shippingAddressName, 'editlot');
7187
7199
  }
7188
7200
  y = index;
7189
7201
  }
@@ -7191,8 +7203,9 @@
7191
7203
  // console.log('borrar');
7192
7204
  this_.cartService.addToLot(item.product, 0, item.variant_id, element, 0, 0, 0, 0, 0, 0, 'delete', 0, '', 0, 'delete', 'deletelot');
7193
7205
  });
7194
- setTimeout(function () { this_.cartService.loadCartByToken(this_.cartService.getCartToken()); }, 500 * y);
7195
- this_.toastrService.show('lot-saved');
7206
+ setTimeout(function () { this_.cartService.loadCartByToken(this_.cartService.getCartToken()); }, 300 * y);
7207
+ setTimeout(function () { this_.toastrService.show('lot-saved'); }, 300 * y);
7208
+ setTimeout(function () { this_.cargando = false; }, 300 * y);
7196
7209
  }
7197
7210
  else {
7198
7211
  this_.toastrService.show('La cantidad de los lotes es superior a la cantidad del producto.');
@@ -7569,7 +7582,6 @@
7569
7582
  _this.onDocumentTypesSelected = function (value) { return _this.checkoutForm.controls['documentType'].setValue(value == '' ? '' : value); };
7570
7583
  _this.onDocumentTypesSelectedFacturacion = function (value) { return _this.checkoutForm.controls['documentType'].setValue(value == '' ? '' : value); };
7571
7584
  _this.verifyValidate = function (e, items) { return __awaiter$9(_this, void 0, void 0, function () {
7572
- var _this = this;
7573
7585
  return __generator$9(this, function (_a) {
7574
7586
  //console.log("Verifying: ", e)
7575
7587
  this.require_login = false;
@@ -7578,14 +7590,14 @@
7578
7590
  this.authService.isAuthenticated() && this.checkoutForm.get('email').disable({ onlySelf: true });
7579
7591
  }
7580
7592
  if (this.checkoutForm.valid) {
7581
- if (this.cartService.channelConfig.applyOrderLot) {
7582
- items.forEach(function (item) {
7583
- if (!item.lot[0]) {
7584
- // console.log(this.checkoutForm.controls['city']['value'])
7585
- _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, _this.checkoutForm.controls['city']['value'] + ' - ' + _this.checkoutForm.controls['street']['value'], 'newlot');
7586
- }
7587
- });
7588
- }
7593
+ // if (this.cartService.channelConfig.applyOrderLot){
7594
+ // items.forEach(item => {
7595
+ // if (!item.lot[0]){
7596
+ // // console.log(this.checkoutForm.controls['city']['value'])
7597
+ // 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,this.checkoutForm.controls['city']['value']+ ' - ' + this.checkoutForm.controls['street']['value'], 'newlot');
7598
+ // }
7599
+ // });
7600
+ // }
7589
7601
  this.emitResult();
7590
7602
  }
7591
7603
  else