test into master #42
|
@ -6,19 +6,35 @@ export default new Class({
|
||||||
|
|
||||||
async open() {
|
async open() {
|
||||||
await Hedera.Form.prototype.open.call(this);
|
await Hedera.Form.prototype.open.call(this);
|
||||||
this.basket = new Hedera.Basket(this.app);
|
const basket = new Hedera.Basket(this.app);
|
||||||
|
|
||||||
this.orderId = this.$.params.$.id || this.basket.orderId;
|
if (this.$.params.$.id) {
|
||||||
if (!this.orderId)
|
this.orderId = this.$.params.$.id;
|
||||||
return this.hash.setAll({form: 'ecomerce/checkout'});
|
} else if (await basket.check()) {
|
||||||
|
this.orderId = basket.orderId;
|
||||||
|
}
|
||||||
|
|
||||||
this.$.lot.assign({id: this.orderId});
|
if (this.orderId)
|
||||||
|
this.$.lot.assign({id: this.orderId});
|
||||||
},
|
},
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
this.$.items.setInfo('bi', 'myOrderRow', 'hedera');
|
this.$.items.setInfo('bi', 'myOrderRow', 'hedera');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onOrderReady(form) {
|
||||||
|
if (form.row < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (form.$.method != 'PICKUP') {
|
||||||
|
Vn.Node.show(this.$.address);
|
||||||
|
Vn.Node.setText(this.$.method, _('Agency'));
|
||||||
|
} else {
|
||||||
|
Vn.Node.hide(this.$.address);
|
||||||
|
Vn.Node.setText(this.$.method, _('Warehouse'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onConfigureClick() {
|
onConfigureClick() {
|
||||||
Htk.Toast.showWarning(_('RememberReconfiguringImpact'));
|
Htk.Toast.showWarning(_('RememberReconfiguringImpact'));
|
||||||
this.hash.setAll({
|
this.hash.setAll({
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
ShoppingBasket: Cistella de la compra
|
ShoppingBasket: Cistella de la compra
|
||||||
Order: Encàrrec
|
Order: Encàrrec
|
||||||
ShippingInformation: Dades d'enviament
|
ShippingInformation: Dades d'enviament
|
||||||
|
DeliveryAddress: Adreça de lliurament
|
||||||
|
Delivery at: Lliurament el
|
||||||
|
Agency: Agència
|
||||||
|
Warehouse: Magatzem
|
||||||
Delete: Borrar encàrrec
|
Delete: Borrar encàrrec
|
||||||
GoToCatalog: Anar al catàleg
|
GoToCatalog: Anar al catàleg
|
||||||
ConfigureOrder: Configurar encàrrec
|
ConfigureOrder: Configurar encàrrec
|
||||||
Checkout: Tramitar encàrrec
|
Checkout: Tramitar encàrrec
|
||||||
OrderNumber: N encàrec
|
OrderNumber: N encàrec
|
||||||
DateExit: Data d'eixida
|
DateExit: Data d'eixida
|
||||||
Warehouse: Magatzem
|
|
||||||
OrderTotal: Total encàrrec
|
OrderTotal: Total encàrrec
|
||||||
Amount: Quant
|
Amount: Quant
|
||||||
Pack: Pack
|
Pack: Pack
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
ShoppingBasket: Shopping basket
|
ShoppingBasket: Shopping basket
|
||||||
Order: Order
|
Order: Order
|
||||||
ShippingInformation: Shipping information
|
ShippingInformation: Shipping information
|
||||||
|
DeliveryAddress: Delivery address
|
||||||
|
Delivery at: Delivery at
|
||||||
|
Agency: Agency
|
||||||
|
Warehouse: Store
|
||||||
Delete: Delete order
|
Delete: Delete order
|
||||||
GoToCatalog: Go to catalog
|
GoToCatalog: Go to catalog
|
||||||
ConfigureOrder: Configure order
|
ConfigureOrder: Configure order
|
||||||
Checkout: Checkout
|
Checkout: Checkout
|
||||||
OrderNumber: Order number
|
OrderNumber: Order number
|
||||||
DateExit: Shipping date
|
DateExit: Shipping date
|
||||||
Warehouse: Store
|
|
||||||
OrderTotal: Total
|
OrderTotal: Total
|
||||||
Amount: Amount
|
Amount: Amount
|
||||||
Pack: Pack
|
Pack: Pack
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
ShoppingBasket: Cesta de la compra
|
ShoppingBasket: Cesta de la compra
|
||||||
Order: Pedido
|
Order: Pedido
|
||||||
ShippingInformation: Datos de envío
|
ShippingInformation: Datos de envío
|
||||||
|
DeliveryAddress: Dirección de entrega
|
||||||
|
Delivery at: Entrega el
|
||||||
|
Agency: Agencia
|
||||||
|
Warehouse: Almacén
|
||||||
Delete: Borrar pedido
|
Delete: Borrar pedido
|
||||||
GoToCatalog: Ir al catálogo
|
GoToCatalog: Ir al catálogo
|
||||||
ConfigureOrder: Configurar pedido
|
ConfigureOrder: Configurar pedido
|
||||||
Checkout: Finalizar pedido
|
Checkout: Finalizar pedido
|
||||||
OrderNumber: Nº pedido
|
OrderNumber: Nº pedido
|
||||||
DateExit: Fecha de salida
|
DateExit: Fecha de salida
|
||||||
Warehouse: Almacén
|
|
||||||
OrderTotal: Total
|
OrderTotal: Total
|
||||||
Amount: Cantidad
|
Amount: Cantidad
|
||||||
Pack: Pack
|
Pack: Pack
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
ShoppingBasket: Panier
|
ShoppingBasket: Panier
|
||||||
Order: Commande
|
Order: Commande
|
||||||
ShippingInformation: Informations sur la livraison
|
ShippingInformation: Informations sur la livraison
|
||||||
|
DeliveryAddress: Addresse de livraison
|
||||||
|
Delivery at: Livraison à
|
||||||
|
Agency: Agence
|
||||||
|
Warehouse: Entrepôt
|
||||||
Delete: Effacer
|
Delete: Effacer
|
||||||
GoToCatalog: Aller au catalogue
|
GoToCatalog: Aller au catalogue
|
||||||
ConfigureOrder: Définissez l'ordre
|
ConfigureOrder: Définissez l'ordre
|
||||||
Checkout: Caisse
|
Checkout: Caisse
|
||||||
OrderNumber: Numéro de commande
|
OrderNumber: Numéro de commande
|
||||||
DateExit: Date de sortie
|
DateExit: Date de sortie
|
||||||
Warehouse: Magasin
|
|
||||||
OrderTotal: Total commande
|
OrderTotal: Total commande
|
||||||
Amount: Quant
|
Amount: Quant
|
||||||
Pack: Pack
|
Pack: Pack
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
ShoppingBasket: Cesta da compra
|
ShoppingBasket: Cesta da compra
|
||||||
Order: Encomenda
|
Order: Encomenda
|
||||||
ShippingInformation: Dados de envio
|
ShippingInformation: Dados de envio
|
||||||
|
DeliveryAddress: Endereço de entrega
|
||||||
|
Delivery at: Entrega na
|
||||||
|
Agency: Agência
|
||||||
|
Warehouse: Armazém
|
||||||
Delete: Eliminar encomenda
|
Delete: Eliminar encomenda
|
||||||
GoToCatalog: Ir ao catálogo
|
GoToCatalog: Ir ao catálogo
|
||||||
ConfigureOrder: Configurar encomenda
|
ConfigureOrder: Configurar encomenda
|
||||||
Checkout: Finalizar encomenda
|
Checkout: Finalizar encomenda
|
||||||
OrderNumber: Nº encomenda
|
OrderNumber: Nº encomenda
|
||||||
DateExit: Data de saída
|
DateExit: Data de saída
|
||||||
Warehouse: Armazém
|
|
||||||
OrderTotal: Total
|
OrderTotal: Total
|
||||||
Amount: Quantidade
|
Amount: Quantidade
|
||||||
Pack: Pack
|
Pack: Pack
|
||||||
|
|
|
@ -21,13 +21,14 @@
|
||||||
</div>
|
</div>
|
||||||
<vn-group>
|
<vn-group>
|
||||||
<vn-lot id="lot"/>
|
<vn-lot id="lot"/>
|
||||||
<db-form v-model="order">
|
<db-form v-model="order" on-ready="onOrderReady">
|
||||||
<db-model property="model" lot="lot">
|
<db-model property="model" lot="lot">
|
||||||
SELECT o.id, o.sent,
|
SELECT o.id, o.sent,
|
||||||
ag.description agency, v.code method, ad.nickname
|
ag.description agency, v.code method,
|
||||||
|
ad.nickname, ad.postalCode, ad.city, ad.street
|
||||||
FROM myOrder o
|
FROM myOrder o
|
||||||
JOIN vn.agencyMode ag ON ag.id = o.agencyModeFk
|
JOIN vn.agencyMode ag ON ag.id = o.agencyModeFk
|
||||||
LEFT JOIN myAddress ad ON ad.id = o.addressFk
|
LEFT JOIN myAddress ad ON ad.id = o.addressFk
|
||||||
JOIN vn.deliveryMethod v ON v.id = o.deliveryMethodFk
|
JOIN vn.deliveryMethod v ON v.id = o.deliveryMethodFk
|
||||||
WHERE o.id = #id;
|
WHERE o.id = #id;
|
||||||
</db-model>
|
</db-model>
|
||||||
|
@ -37,12 +38,21 @@
|
||||||
<div class="box vn-w-sm vn-pa-lg">
|
<div class="box vn-w-sm vn-pa-lg">
|
||||||
<div class="head vn-pb-lg">
|
<div class="head vn-pb-lg">
|
||||||
<h5>#{{order.id}}</h5>
|
<h5>#{{order.id}}</h5>
|
||||||
<div class="vn-mt-md">
|
<div class="delivery">
|
||||||
<h6><t>ShippingInformation</t></h6>
|
<h6><t>ShippingInformation</t></h6>
|
||||||
<p></p>
|
<p>{{order.nickname}}</p>
|
||||||
<p><t>Delivery at</t> {{Vn.Value.format(order.sent, _('%D'))}}</p>
|
<p>
|
||||||
<p><span id="method"><t>Agency</t></span> {{order.agency}}</p>
|
<t>Delivery at</t> {{Vn.Value.format(order.sent, _('%D'))}}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span id="method"><t>Agency</t></span> {{order.agency}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div id="address" class="address vn-mt-md">
|
||||||
|
<h6><t>DeliveryAddress</t></h6>
|
||||||
<p>{{order.nickname}}</p>
|
<p>{{order.nickname}}</p>
|
||||||
|
<p>{{order.street}}</p>
|
||||||
|
<p>{{order.postalCode}}, {{order.city}}</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="total">
|
<p class="total">
|
||||||
<t>Total</t>
|
<t>Total</t>
|
||||||
|
|
|
@ -7,15 +7,11 @@ const Catalog = new Class({
|
||||||
,_menuShown: false
|
,_menuShown: false
|
||||||
|
|
||||||
,async open() {
|
,async open() {
|
||||||
let isOk = true;
|
|
||||||
const basket = new Hedera.Basket(this.app);
|
const basket = new Hedera.Basket(this.app);
|
||||||
this.orderId = basket.orderId;
|
|
||||||
|
|
||||||
if (!localStorage.getItem('hederaGuest')) {
|
if (!localStorage.getItem('hederaGuest')) {
|
||||||
if (!this.orderId)
|
if (await basket.check())
|
||||||
return this.hash.setAll({form: 'ecomerce/checkout'});
|
this.orderId = basket.orderId;
|
||||||
else
|
|
||||||
isOk = await basket.checkRedirect(this.orderId);
|
|
||||||
} else {
|
} else {
|
||||||
const resultSet = await this.conn.execQuery(
|
const resultSet = await this.conn.execQuery(
|
||||||
'CALL myOrder_configureForGuest(@orderId); SELECT @orderId;');
|
'CALL myOrder_configureForGuest(@orderId); SELECT @orderId;');
|
||||||
|
@ -24,7 +20,8 @@ const Catalog = new Class({
|
||||||
this.orderId = resultSet.fetchValue();
|
this.orderId = resultSet.fetchValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOk) await Hedera.Form.prototype.open.call(this);
|
if (this.orderId)
|
||||||
|
await Hedera.Form.prototype.open.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
,activate() {
|
,activate() {
|
||||||
|
|
|
@ -94,10 +94,9 @@
|
||||||
<vn-lot id="order-lot"/>
|
<vn-lot id="order-lot"/>
|
||||||
<db-form v-model="basket">
|
<db-form v-model="basket">
|
||||||
<db-model property="model" lot="order-lot">
|
<db-model property="model" lot="order-lot">
|
||||||
SELECT o.id, o.sent, a.description agency, m.code method
|
SELECT o.id, o.sent, ad.nickname
|
||||||
FROM myOrder o
|
FROM myOrder o
|
||||||
JOIN vn.agencyMode a ON a.id = o.agencyModeFk
|
LEFT JOIN myAddress ad ON ad.id = o.addressFk
|
||||||
JOIN vn.deliveryMethod m ON m.id = o.deliveryMethodFk
|
|
||||||
WHERE o.id = #orderId
|
WHERE o.id = #orderId
|
||||||
</db-model>
|
</db-model>
|
||||||
</db-form>
|
</db-form>
|
||||||
|
@ -207,11 +206,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="right-panel" class="catalog-panel right-panel side-panel" on-click="onRightPanelClick">
|
<div id="right-panel" class="catalog-panel right-panel side-panel" on-click="onRightPanelClick">
|
||||||
<div class="basket-info">
|
<div class="basket-info">
|
||||||
|
<p>{{basket.nickname}}</p>
|
||||||
<p>{{Vn.Value.format(basket.sent, '%D')}}</p>
|
<p>{{Vn.Value.format(basket.sent, '%D')}}</p>
|
||||||
<p>
|
|
||||||
{{_(basket.method != 'PICKUP' ? 'Agency' : 'Warehouse')}}
|
|
||||||
{{basket.agency}}
|
|
||||||
</p>
|
|
||||||
<button class="thin" on-click="this.onConfigureClick()">
|
<button class="thin" on-click="this.onConfigureClick()">
|
||||||
<t>Modify</t>
|
<t>Modify</t>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default new Class({
|
||||||
async open() {
|
async open() {
|
||||||
const basket = new Hedera.Basket(this.app);
|
const basket = new Hedera.Basket(this.app);
|
||||||
try {
|
try {
|
||||||
await basket.check(this.hash.$.id);
|
await basket.checkOrder(this.hash.$.id);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Htk.Toast.showError(err.message);
|
Htk.Toast.showError(err.message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
<db-form v-model="order" on-ready="onOrderReady">
|
<db-form v-model="order" on-ready="onOrderReady">
|
||||||
<db-model property="model" result-index="1" lot="params">
|
<db-model property="model" result-index="1" lot="params">
|
||||||
CALL myOrder_getTax(#id);
|
CALL myOrder_getTax(#id);
|
||||||
SELECT o.id, o.sent, o.notes, o.companyFk,
|
SELECT o.id, o.sent, o.notes, o.companyFk,
|
||||||
ag.description agency, v.code method,
|
ag.description agency, v.code method,
|
||||||
ad.nickname, ad.postalCode, ad.city, ad.street,
|
ad.nickname, ad.postalCode, ad.city, ad.street,
|
||||||
t.*, c.credit, myClient_getDebt(NULL) debt
|
t.*, c.credit, myClient_getDebt(NULL) debt
|
||||||
FROM myOrder o
|
FROM myOrder o
|
||||||
JOIN vn.agencyMode ag ON ag.id = o.agencyModeFk
|
JOIN vn.agencyMode ag ON ag.id = o.agencyModeFk
|
||||||
|
@ -35,8 +35,10 @@
|
||||||
<div class="vn-w-sm">
|
<div class="vn-w-sm">
|
||||||
<div class="box vn-pa-lg summary">
|
<div class="box vn-pa-lg summary">
|
||||||
<div>
|
<div>
|
||||||
|
<h5>#{{order.id}}</h5>
|
||||||
<div class="delivery">
|
<div class="delivery">
|
||||||
<h6><t>ShippingInformation</t></h6>
|
<h6><t>ShippingInformation</t></h6>
|
||||||
|
<p>{{order.nickname}}</p>
|
||||||
<p>
|
<p>
|
||||||
<t>Delivery at</t> {{Vn.Value.format(order.sent, _('%D'))}}
|
<t>Delivery at</t> {{Vn.Value.format(order.sent, _('%D'))}}
|
||||||
</p>
|
</p>
|
||||||
|
@ -46,7 +48,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="address" class="address vn-mt-md">
|
<div id="address" class="address vn-mt-md">
|
||||||
<h6><t>DeliveryAddress</t></h6>
|
<h6><t>DeliveryAddress</t></h6>
|
||||||
<p>{{order.nickname}}</p>
|
|
||||||
<p>{{order.street}}</p>
|
<p>{{order.street}}</p>
|
||||||
<p>{{order.postalCode}}, {{order.city}}</p>
|
<p>{{order.postalCode}}, {{order.city}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,33 +6,51 @@ module.exports = class {
|
||||||
if (orderId) orderId = parseInt(orderId);
|
if (orderId) orderId = parseInt(orderId);
|
||||||
this.orderId = orderId;
|
this.orderId = orderId;
|
||||||
}
|
}
|
||||||
async check(orderId) {
|
async checkOrder(orderId) {
|
||||||
const resultSet = await this.app.conn.execQuery(
|
const resultSet = await this.app.conn.execQuery(
|
||||||
'CALL myOrder_checkConfig(#id)',
|
'CALL myOrder_checkConfig(#id)',
|
||||||
{id: orderId}
|
{id: orderId}
|
||||||
);
|
);
|
||||||
resultSet.fetchValue();
|
resultSet.fetchValue();
|
||||||
}
|
}
|
||||||
async checkRedirect(orderId) {
|
async check() {
|
||||||
|
if (this.orderId) {
|
||||||
|
return await this.checkRedirect();
|
||||||
|
} else {
|
||||||
|
this.app.hash.setAll({form: 'ecomerce/checkout'});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async checkRedirect() {
|
||||||
try {
|
try {
|
||||||
await this.check(orderId);
|
await this.checkOrder(this.orderId);
|
||||||
return true;
|
return true;
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
Htk.Toast.showError(err.message);
|
if (err.exception == 'Vn.Lib.UserError') {
|
||||||
this.app.hash.setAll({
|
const dst = {
|
||||||
form: 'ecomerce/checkout',
|
form: 'ecomerce/checkout',
|
||||||
id: orderId,
|
continue: 'catalog'
|
||||||
continue: 'catalog'
|
};
|
||||||
});
|
|
||||||
return false;
|
if (err.code == 'orderNotOwnedByUser') {
|
||||||
|
this.constructor.unload();
|
||||||
|
} else {
|
||||||
|
dst.id = this.orderId;
|
||||||
|
Htk.Toast.showError(err.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.app.hash.setAll(dst);
|
||||||
|
return false;
|
||||||
|
} else
|
||||||
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async load(orderId) {
|
async load(orderId) {
|
||||||
this.loadIntoBasket(orderId);
|
this.loadIntoBasket(orderId);
|
||||||
if (!await this.checkRedirect(orderId)) return;
|
if (await this.checkRedirect())
|
||||||
this.app.hash.setAll({
|
this.app.hash.setAll({
|
||||||
form: 'ecomerce/catalog'
|
form: 'ecomerce/catalog'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
loadIntoBasket(orderId) {
|
loadIntoBasket(orderId) {
|
||||||
if (this.orderId != orderId) {
|
if (this.orderId != orderId) {
|
||||||
|
|
Loading…
Reference in New Issue