Version beta 1 del bionic
This commit is contained in:
parent
434e8e46c1
commit
c7f171a71c
|
@ -13,14 +13,12 @@ Vn.Basket = new Class
|
|||
{
|
||||
var res = resultSet.fetchResult ();
|
||||
|
||||
if (!res.next ())
|
||||
return;
|
||||
|
||||
if (res.next ())
|
||||
switch (res.get ('stat'))
|
||||
{
|
||||
case 'BAD_CONFIG':
|
||||
case 'NOT_EXISTS':
|
||||
this.onConfigureClick ();
|
||||
this.hash.set ({'form': 'ecomerce/checkout'});
|
||||
break;
|
||||
case 'UPDATED':
|
||||
(new Htk.Toast ()).showWarning (_('OrderItemsUpdated'));
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
<vn-param id="order"/>
|
||||
<db-form id="order-form">
|
||||
<db-model updatable="true">
|
||||
SELECT id, date_send, agency_id, wh_id
|
||||
FROM order_view WHERE id = #id
|
||||
SELECT id, date_send, agency_id
|
||||
FROM basket
|
||||
<sql-batch property="batch">
|
||||
<item name="id" param="order"/>
|
||||
</sql-batch>
|
||||
</db-model>
|
||||
<db-param column="date_send" id="date"/>
|
||||
<db-param column="wh_id" id="warehouse"/>
|
||||
<db-param column="address_id" id="address"/>
|
||||
</db-form>
|
||||
</vn-group>
|
||||
|
@ -33,14 +32,13 @@
|
|||
<div>
|
||||
<htk-grid show-header="false">
|
||||
<db-model result-index="1" id="order-rows" updatable="true">
|
||||
CALL bionic_by_order (@calc);
|
||||
CALL bionic_from_basket (@calc);
|
||||
SELECT m.id, m.amount, t.available, a.Article, a.Categoria,
|
||||
a.Medida, a.Tallos, a.Color, o.Abreviatura, m.price2 price, a.Foto
|
||||
FROM order_row_view m
|
||||
a.Medida, a.Tallos, a.Color, o.Abreviatura, m.price price, a.Foto
|
||||
FROM basket_item m
|
||||
INNER JOIN vn2008.Articles a ON a.Id_Article = m.item_id
|
||||
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
|
||||
LEFT JOIN cache.bionic t ON m.warehouse_id = t.warehouse_id AND m.item_id = t.item_id AND t.calc_id = @calc
|
||||
WHERE m.order_id = #order;
|
||||
LEFT JOIN cache.bionic t ON m.warehouse_id = t.warehouse_id AND m.item_id = t.item_id AND t.calc_id = @calc;
|
||||
<sql-batch property="batch">
|
||||
<item name="order" param="order"/>
|
||||
</sql-batch>
|
||||
|
|
|
@ -182,59 +182,56 @@ Vn.Catalog = new Class
|
|||
,onAddLotClick: function (column, value, row, button)
|
||||
{
|
||||
var model = this.$('item-lots');
|
||||
|
||||
var grouping = model.get (row, 'grouping');
|
||||
var warehouse = model.get (row, 'warehouse_id');
|
||||
var rate = model.get (row, 'rate');
|
||||
|
||||
for (var i = 0; i < this.items.length; i++)
|
||||
var lotAmount = this.items[warehouse];
|
||||
|
||||
if (lotAmount === undefined)
|
||||
lotAmount = 0;
|
||||
|
||||
lotAmount += grouping;
|
||||
|
||||
if (lotAmount <= model.get (row, 'available'))
|
||||
{
|
||||
var t = this.items[i];
|
||||
if (t.warehouse == warehouse && t.rate == rate)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= this.items.length)
|
||||
this.items.push ({
|
||||
warehouse: warehouse,
|
||||
rate: rate,
|
||||
amount: grouping
|
||||
});
|
||||
else
|
||||
t.amount += grouping;
|
||||
|
||||
this.items[warehouse] = lotAmount;
|
||||
this.$('amount').value += grouping;
|
||||
}
|
||||
else
|
||||
(new Htk.Toast ()).showError (_('NoMoreAmountAvailable'));
|
||||
}
|
||||
|
||||
,onEraseClick: function ()
|
||||
{
|
||||
this.$('amount').value = 0;
|
||||
this.items = [];
|
||||
this.items = {};
|
||||
}
|
||||
|
||||
,onConfirmClick: function ()
|
||||
{
|
||||
if (this.items.length > 0)
|
||||
{
|
||||
var sql = '';
|
||||
var batch = new Sql.Batch ();
|
||||
var query = new Sql.String ({query: 'CALL order_row_new (#warehouse, #item, #rate, #amount);'});
|
||||
var query = new Sql.String ({query: 'CALL basket_item_add (#warehouse, #item, #amount);'});
|
||||
|
||||
for (var i = 0; i < this.items.length; i++)
|
||||
for (var warehouse in this.items)
|
||||
{
|
||||
var t = this.items[i];
|
||||
batch.addValue ('warehouse', t.warehouse);
|
||||
batch.addValue ('warehouse', warehouse);
|
||||
batch.addValue ('item', this.itemId);
|
||||
batch.addValue ('rate', t.rate);
|
||||
batch.addValue ('amount', t.amount);
|
||||
batch.addValue ('amount', this.items[warehouse]);
|
||||
sql += query.render (batch);
|
||||
}
|
||||
|
||||
if (sql != '')
|
||||
this.conn.execQuery (sql);
|
||||
}
|
||||
|
||||
this.popup.hide ();
|
||||
}
|
||||
|
||||
,onStatusChange: function (model)
|
||||
{
|
||||
if (this.popup)
|
||||
this.popup.reset ();
|
||||
}
|
||||
});
|
||||
|
||||
Htk.Realm = new Class
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</sql-filter-item>
|
||||
</sql-filter>
|
||||
<db-model result-index="1" id="items-model">
|
||||
CALL bionic_by_type (@calc, #type);
|
||||
CALL bionic_from_type (@calc, #type);
|
||||
SELECT t.item_id, SUM(t.available) available, MIN(t.price) price,
|
||||
a.Foto, a.Article, a.Categoria, a.Medida, a.Tallos, a.Color, o.Abreviatura
|
||||
FROM cache.bionic t
|
||||
|
@ -33,12 +33,16 @@
|
|||
<item name="type" param="type"/>
|
||||
</sql-batch>
|
||||
</db-model>
|
||||
<db-model id="item-lots" result-index="1">
|
||||
CALL bionic_by_type (@calc, #type);
|
||||
SELECT warehouse_id, items, grouping, price, rate
|
||||
FROM cache.bionic_lot
|
||||
WHERE calc_id = @calc
|
||||
AND item_id = #item
|
||||
<db-model id="item-lots" result-index="1" on-status-changed-after="onStatusChange">
|
||||
CALL bionic_from_type (@calc, #type);
|
||||
SELECT l.warehouse_id, l.items, l.grouping, l.price, l.rate, b.available
|
||||
FROM cache.bionic b
|
||||
JOIN cache.bionic_lot l
|
||||
ON l.warehouse_id = b.warehouse_id
|
||||
AND l.item_id = b.item_id
|
||||
AND l.calc_id = @calc
|
||||
WHERE b.calc_id = @calc
|
||||
AND b.item_id = #item
|
||||
ORDER BY warehouse_id, grouping;
|
||||
<sql-batch property="batch" id="lots-batch" blocked="true">
|
||||
<item name="type" param="type"/>
|
||||
|
|
|
@ -10,19 +10,18 @@
|
|||
<db-form id="defaults" on-ready="onValuesReady">
|
||||
<db-model>
|
||||
SELECT delivery_method, agency_id, address_id
|
||||
FROM order_defaults_view
|
||||
FROM basket_defaults
|
||||
</db-model>
|
||||
</db-form>
|
||||
<db-form id="order-form" on-ready="onValuesReady">
|
||||
<db-model>
|
||||
SELECT v.code delivery_method, o.date_send, o.agency_id, o.address_id
|
||||
FROM order_view o
|
||||
FROM basket o
|
||||
JOIN vn2008.Vistas v ON o.delivery_method_id = v.vista_id
|
||||
LIMIT 1
|
||||
</db-model>
|
||||
</db-form>
|
||||
<db-model property="model" id="agencies" auto-load="false" result-index="1">
|
||||
CALL agency_list_by_date (#date, #address);
|
||||
CALL agency_list_from_date (#date, #address);
|
||||
SELECT a.Id_Agencia, a.description
|
||||
FROM t_agency t
|
||||
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agency_id
|
||||
|
@ -37,7 +36,7 @@
|
|||
</sql-batch>
|
||||
</db-model>
|
||||
<db-model property="model" id="warehouses" auto-load="false" result-index="1">
|
||||
CALL agency_list_by_date (#date, NULL);
|
||||
CALL agency_list_from_date (#date, NULL);
|
||||
SELECT a.Id_Agencia, SUBSTR(a.description, 5) description
|
||||
FROM t_agency t
|
||||
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agency_id
|
||||
|
|
|
@ -5,15 +5,14 @@
|
|||
</vn-param>
|
||||
<db-form id="order-form" on-ready="onOrderReady">
|
||||
<db-model>
|
||||
SELECT o.id, o.date_send, o.note, o.company_id,
|
||||
SELECT o.id, o.date_send, o.note,
|
||||
ag.description agency, v.code method, c.credit,
|
||||
ad.consignee, ad.zip_code, ad.city, ad.name address
|
||||
FROM order_view o
|
||||
FROM basket o
|
||||
JOIN vn2008.Agencias ag ON ag.Id_Agencia = o.agency_id
|
||||
LEFT JOIN address_view ad ON ad.id = o.address_id
|
||||
JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id
|
||||
JOIN customer_view c
|
||||
WHERE o.id = #order
|
||||
<sql-batch property="batch">
|
||||
<item name="order" param="order-id"/>
|
||||
</sql-batch>
|
||||
|
@ -21,7 +20,7 @@
|
|||
</db-form>
|
||||
<db-form id="total-form" on-ready="onImportReady">
|
||||
<db-model result-index="1">
|
||||
CALL order_get_vat (#order);
|
||||
CALL basket_get_vat ();
|
||||
SELECT
|
||||
IFNULL(SUM(tax_base), 0) tax_base,
|
||||
IFNULL(SUM(vat + surcharge), 0) vat
|
||||
|
@ -33,8 +32,8 @@
|
|||
</db-model>
|
||||
</db-form>
|
||||
<db-query id="confirm-query" on-ready="onConfirm">
|
||||
CALL order_confirm_bionic (#order);
|
||||
SELECT customer_get_debt() debt;
|
||||
CALL basket_confirm ();
|
||||
SELECT customer_get_debt();
|
||||
<sql-batch property="batch">
|
||||
<item name="order" param="order-id"/>
|
||||
</sql-batch>
|
||||
|
|
|
@ -573,8 +573,8 @@ img.icon
|
|||
.htk-calendar div.enabled:hover
|
||||
{
|
||||
cursor: pointer;
|
||||
background-color: #DDD;
|
||||
color: #555;
|
||||
background-color: #008678;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Date chooser */
|
||||
|
|
|
@ -1091,6 +1091,7 @@ Db.Model.implement
|
|||
{
|
||||
this._status = status;
|
||||
this.signalEmit ('status-changed', status);
|
||||
this.signalEmit ('status-changed-after', status);
|
||||
}
|
||||
|
||||
,_createTarget: function (tableIndex)
|
||||
|
|
|
@ -45,7 +45,6 @@ Htk.Image = new Class
|
|||
|
||||
,render: function (force)
|
||||
{
|
||||
console.log (this._value);
|
||||
if (this._value)
|
||||
{
|
||||
var url = '';
|
||||
|
|
|
@ -36,11 +36,14 @@ Htk.Popup = new Class
|
|||
document.addEventListener ('mousedown', this.hideHandler);
|
||||
|
||||
this.parent = parent;
|
||||
this.setPosition ();
|
||||
this.reset ();
|
||||
}
|
||||
|
||||
,setPosition: function ()
|
||||
,reset: function ()
|
||||
{
|
||||
if (!this.parent)
|
||||
return;
|
||||
|
||||
var spacing = 5;
|
||||
var rect = this.parent.getBoundingClientRect ();
|
||||
var left = rect.left;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
,"SelectSubtype": "Por favor, seleccione el subtipo en el menú de la derecha"
|
||||
,"ArticleNotFound": "Artículo no encontrado"
|
||||
,"ArticleNotAvailable": "Artículo no disponible"
|
||||
,"NoMoreAmountAvailable": "No hay mas cantidad disponible"
|
||||
|
||||
,"StartOrder": "Empezar pedido"
|
||||
,"ShoppingBasket": "Cesta de la compra"
|
||||
|
|
|
@ -53,9 +53,21 @@ class Service
|
|||
self::sendReply ();
|
||||
}
|
||||
|
||||
static function errorHandler ($code, $message, $file, $line, $context)
|
||||
static function errorHandler ($errno, $message, $file, $line, $context)
|
||||
{
|
||||
self::setError ('PHP', 'error', "$file:$line:$message");
|
||||
switch ($errno)
|
||||
{
|
||||
case E_ERROR:
|
||||
case E_PARSE:
|
||||
case E_CORE_ERROR:
|
||||
case E_USER_ERROR:
|
||||
case E_COMPILE_ERROR:
|
||||
self::setError ('PHP', $errno, "$file:$line:$message");
|
||||
break;
|
||||
default:
|
||||
self::addWarning ('PHP', $errno, "$file:$line:$message");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue