Backup
This commit is contained in:
parent
b8c83df08f
commit
a8b6dd4c1a
|
@ -52,7 +52,7 @@ Hedera.Basket = new Class
|
||||||
|
|
||||||
,subtotal: function (form)
|
,subtotal: function (form)
|
||||||
{
|
{
|
||||||
return form.get ('amount') * form.get ('price');
|
return form.$.amount * form.$.price;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Hedera.Catalog = new Class
|
||||||
|
|
||||||
if (!localStorage.getItem ('hederaGuest'))
|
if (!localStorage.getItem ('hederaGuest'))
|
||||||
{
|
{
|
||||||
Hedera.BasketChecker.check (this.conn, this.hash,
|
Hedera.BasketChecker.check (this.conn, this.params,
|
||||||
this.onBasketCheck.bind (this));
|
this.onBasketCheck.bind (this));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -37,12 +37,6 @@ Hedera.Catalog = new Class
|
||||||
,activate: function ()
|
,activate: function ()
|
||||||
{
|
{
|
||||||
this.$('items').setInfo ('a', 'Articles', 'vn2008', ['item_id']);
|
this.$('items').setInfo ('a', 'Articles', 'vn2008', ['item_id']);
|
||||||
this.$('lot').assign ({filter: this.$('filter')});
|
|
||||||
this.$('lot').setProperties ({
|
|
||||||
type: Vn.LotQuery.Type.EXCLUDE,
|
|
||||||
fields: []
|
|
||||||
});
|
|
||||||
|
|
||||||
document.body.appendChild (this.$('right-panel'));
|
document.body.appendChild (this.$('right-panel'));
|
||||||
|
|
||||||
if (localStorage.getItem ('hederaView'))
|
if (localStorage.getItem ('hederaView'))
|
||||||
|
@ -53,14 +47,14 @@ Hedera.Catalog = new Class
|
||||||
this.onRealmChange ();
|
this.onRealmChange ();
|
||||||
this.refreshTitle ();
|
this.refreshTitle ();
|
||||||
}
|
}
|
||||||
|
|
||||||
,deactivate: function ()
|
,deactivate: function ()
|
||||||
{
|
{
|
||||||
this.hideMenu ();
|
this.hideMenu ();
|
||||||
this.gui.$('top-bar').style.backgroundColor = '';
|
this.gui.$('top-bar').style.backgroundColor = '';
|
||||||
Vn.Node.remove (this.$('right-panel'));
|
Vn.Node.remove (this.$('right-panel'));
|
||||||
}
|
}
|
||||||
|
|
||||||
,setView: function (view)
|
,setView: function (view)
|
||||||
{
|
{
|
||||||
if (view === View.GRID)
|
if (view === View.GRID)
|
||||||
|
@ -116,7 +110,7 @@ Hedera.Catalog = new Class
|
||||||
|
|
||||||
,shouldRefresh: function ()
|
,shouldRefresh: function ()
|
||||||
{
|
{
|
||||||
var params = this.$('lot').params;
|
var params = this.params.$;
|
||||||
|
|
||||||
if (params.search)
|
if (params.search)
|
||||||
return true;
|
return true;
|
||||||
|
@ -151,33 +145,28 @@ Hedera.Catalog = new Class
|
||||||
{
|
{
|
||||||
var link = builder.$('link');
|
var link = builder.$('link');
|
||||||
link.href = this.hash.make ({
|
link.href = this.hash.make ({
|
||||||
form: this.hash.get ('form'),
|
form: this.hash.$.form,
|
||||||
realm: form.get ('id')
|
realm: form.$.id
|
||||||
});
|
});
|
||||||
|
|
||||||
var img = builder.$('image');
|
var img = builder.$('image');
|
||||||
img.src = 'image/family/light/'+ form.get ('id') +'.svg';
|
img.src = 'image/family/light/'+ form.$.id +'.svg';
|
||||||
img.title = form.get ('name');
|
img.title = form.$.name;
|
||||||
img.alt = img.title;
|
img.alt = img.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
,onRealmChange: function ()
|
,onRealmChange: function ()
|
||||||
{
|
{
|
||||||
var newValue = this.hash.get ('realm');
|
var newValue = this.params.$.realm;
|
||||||
this.$('filters').style.display = newValue ? 'block' : 'none';
|
this.$('filters').style.display = newValue ? 'block' : 'none';
|
||||||
this.$('realm-msg').style.display = newValue ? 'none' : 'block';
|
this.$('realm-msg').style.display = newValue ? 'none' : 'block';
|
||||||
|
|
||||||
this.refreshTitleColor ();
|
this.refreshTitleColor ();
|
||||||
this.hash.params = {
|
|
||||||
form: this.hash.get ('form'),
|
|
||||||
realm: newValue,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
,refreshTitleColor: function ()
|
,refreshTitleColor: function ()
|
||||||
{
|
{
|
||||||
var realms = this.$('realms');
|
var realms = this.$('realms');
|
||||||
var realm = this.hash.get ('realm');
|
var realm = this.params.$.realm;
|
||||||
var color = null;
|
var color = null;
|
||||||
|
|
||||||
if (realm)
|
if (realm)
|
||||||
|
@ -194,7 +183,7 @@ Hedera.Catalog = new Class
|
||||||
,refreshTitle: function ()
|
,refreshTitle: function ()
|
||||||
{
|
{
|
||||||
var types = this.$('types');
|
var types = this.$('types');
|
||||||
var type = this.hash.get ('type');
|
var type = this.params.$.type;
|
||||||
var title = _('Catalog');
|
var title = _('Catalog');
|
||||||
|
|
||||||
if (type)
|
if (type)
|
||||||
|
@ -250,7 +239,7 @@ Hedera.Catalog = new Class
|
||||||
if (this.isGuest ())
|
if (this.isGuest ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.hash.params = {form: 'ecomerce/basket'};
|
this.hash.$ = {form: 'ecomerce/basket'};
|
||||||
}
|
}
|
||||||
|
|
||||||
,onConfigureClick: function ()
|
,onConfigureClick: function ()
|
||||||
|
@ -258,7 +247,7 @@ Hedera.Catalog = new Class
|
||||||
if (this.isGuest ())
|
if (this.isGuest ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.hash.params = {form: 'ecomerce/checkout'};
|
this.hash.$ = {form: 'ecomerce/checkout'};
|
||||||
}
|
}
|
||||||
|
|
||||||
,onAddItemClick: function (button, form)
|
,onAddItemClick: function (button, form)
|
||||||
|
@ -268,7 +257,7 @@ Hedera.Catalog = new Class
|
||||||
|
|
||||||
this.onEraseClick ();
|
this.onEraseClick ();
|
||||||
this.$('card').row = form.row;
|
this.$('card').row = form.row;
|
||||||
this.$('card-lot').assign ({item: form.get ('item_id')});
|
this.$('card-lot').assign ({item: form.$.item_id});
|
||||||
this.$('card-popup').show (button.node);
|
this.$('card-popup').show (button.node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +306,7 @@ Hedera.Catalog = new Class
|
||||||
{
|
{
|
||||||
this.conn.execQuery (sql);
|
this.conn.execQuery (sql);
|
||||||
|
|
||||||
var itemName = this.$('card').get ('Article');
|
var itemName = this.$('card').$.Article;
|
||||||
Htk.Toast.showMessage (
|
Htk.Toast.showMessage (
|
||||||
sprintf (_('Added%dOf%s'), amountSum, itemName));
|
sprintf (_('Added%dOf%s'), amountSum, itemName));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,39 +8,41 @@
|
||||||
<vn-spec name="origin" type="Number"/>
|
<vn-spec name="origin" type="Number"/>
|
||||||
<vn-spec name="category" type="String"/>
|
<vn-spec name="category" type="String"/>
|
||||||
<vn-spec name="producer" type="Number"/>
|
<vn-spec name="producer" type="Number"/>
|
||||||
|
<vn-spec name="itemId" type="Number"/>
|
||||||
</vn-lot-query>
|
</vn-lot-query>
|
||||||
<vn-lot id="card-lot"/>
|
|
||||||
<vn-param lot="params" name="realm" on-changed="onRealmChange"/>
|
|
||||||
<vn-param lot="params" name="type" on-changed="refreshTitle"/>
|
|
||||||
<sql-filter type="AND" id="filter">
|
<sql-filter type="AND" id="filter">
|
||||||
<sql-filter-item type="EQUAL"
|
<sql-filter-item type="EQUAL"
|
||||||
field="tipo_id" target="a"
|
target="a" field="tipo_id"
|
||||||
param="type"/>
|
param="type"/>
|
||||||
<sql-filter type="OR">
|
<sql-filter type="OR">
|
||||||
<sql-filter-item type="LIKE"
|
<sql-filter-item type="LIKE"
|
||||||
field="Article" target="a"
|
target="a" field="Article"
|
||||||
param="search"/>
|
param="search"/>
|
||||||
<sql-filter-item type="EQUAL"
|
<sql-filter-item type="EQUAL"
|
||||||
field="Id_Article" target="a"
|
target="a" field="Id_Article"
|
||||||
param="search"/>
|
param="search"/>
|
||||||
|
<sql-filter-item type="EQUAL"
|
||||||
|
target="a" field="Id_Article"
|
||||||
|
param="itemId"/>
|
||||||
</sql-filter>
|
</sql-filter>
|
||||||
<sql-filter-item type="EQUAL"
|
<sql-filter-item type="EQUAL"
|
||||||
field="Color" target="a"
|
target="a" field="Color"
|
||||||
param="color"/>
|
param="color"/>
|
||||||
<sql-filter-item type="EQUAL"
|
<sql-filter-item type="EQUAL"
|
||||||
field="id_origen" target="a"
|
target="a" field="id_origen"
|
||||||
param="origin"/>
|
param="origin"/>
|
||||||
<sql-filter-item type="EQUAL"
|
<sql-filter-item type="EQUAL"
|
||||||
field="Categoria" target="a"
|
target="a" field="Categoria"
|
||||||
param="category"/>
|
param="category"/>
|
||||||
<sql-filter-item type="EQUAL"
|
<sql-filter-item type="EQUAL"
|
||||||
field="producer_id" target="a"
|
target="a" field="producer_id"
|
||||||
param="producer"/>
|
param="producer"/>
|
||||||
</sql-filter>
|
</sql-filter>
|
||||||
<db-model
|
<db-model
|
||||||
id="items"
|
id="items"
|
||||||
result-index="2"
|
result-index="2"
|
||||||
lot="params"
|
lot="params"
|
||||||
|
filter="filter"
|
||||||
auto-load="false">
|
auto-load="false">
|
||||||
CREATE TEMPORARY TABLE tmp.bionic_calc
|
CREATE TEMPORARY TABLE tmp.bionic_calc
|
||||||
(INDEX (item_id))
|
(INDEX (item_id))
|
||||||
|
@ -48,7 +50,7 @@
|
||||||
SELECT a.Id_Article item_id
|
SELECT a.Id_Article item_id
|
||||||
FROM vn2008.Articles a
|
FROM vn2008.Articles a
|
||||||
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
|
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
|
||||||
WHERE #filter;
|
WHERE $filter;
|
||||||
CALL bionic_calc ();
|
CALL bionic_calc ();
|
||||||
SELECT a.Id_Article item_id, a.description, b.available, b.price,
|
SELECT a.Id_Article item_id, a.description, b.available, b.price,
|
||||||
b.producer, a.Foto, a.Article, a.Categoria, a.Medida,
|
b.producer, a.Foto, a.Article, a.Categoria, a.Medida,
|
||||||
|
@ -99,6 +101,9 @@
|
||||||
JOIN vn2008.warehouse w ON w.id = p.warehouse_id
|
JOIN vn2008.warehouse w ON w.id = p.warehouse_id
|
||||||
ORDER BY warehouse_id, grouping;
|
ORDER BY warehouse_id, grouping;
|
||||||
</db-model>
|
</db-model>
|
||||||
|
<vn-lot id="card-lot"/>
|
||||||
|
<vn-param lot="params" name="realm" on-changed="onRealmChange"/>
|
||||||
|
<vn-param lot="params" name="type" on-changed="refreshTitle"/>
|
||||||
</vn-group>
|
</vn-group>
|
||||||
<h1 id="title">
|
<h1 id="title">
|
||||||
<t>Catalog</t>
|
<t>Catalog</t>
|
||||||
|
|
|
@ -101,6 +101,22 @@ Klass.implement
|
||||||
return this._lot;
|
return this._lot;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* The remote filter used for query.
|
||||||
|
*/
|
||||||
|
filter:
|
||||||
|
{
|
||||||
|
type: Sql.Filter
|
||||||
|
,set: function (x)
|
||||||
|
{
|
||||||
|
this._filter = x;
|
||||||
|
this.refresh ();
|
||||||
|
}
|
||||||
|
,get: function ()
|
||||||
|
{
|
||||||
|
return this._filter;
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* The model select statement.
|
* The model select statement.
|
||||||
*/
|
*/
|
||||||
|
@ -309,7 +325,7 @@ Klass.implement
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (var key in params)
|
for (var key in params)
|
||||||
if (params[key] == null)
|
if (params[key] === undefined)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -321,7 +337,7 @@ Klass.implement
|
||||||
,refresh: function ()
|
,refresh: function ()
|
||||||
{
|
{
|
||||||
var params = this._getParams ();
|
var params = this._getParams ();
|
||||||
|
|
||||||
if (this._isReady (params))
|
if (this._isReady (params))
|
||||||
{
|
{
|
||||||
this._lastParams = params;
|
this._lastParams = params;
|
||||||
|
|
|
@ -45,7 +45,10 @@ module.exports = new Class
|
||||||
var paramsLot = res.$('params');
|
var paramsLot = res.$('params');
|
||||||
|
|
||||||
if (paramsLot)
|
if (paramsLot)
|
||||||
|
{
|
||||||
paramsLot.source = this.hash;
|
paramsLot.source = this.hash;
|
||||||
|
this.params = paramsLot;
|
||||||
|
}
|
||||||
|
|
||||||
var models = res.getByTagName ('db-model');
|
var models = res.getByTagName ('db-model');
|
||||||
|
|
||||||
|
@ -81,6 +84,7 @@ module.exports = new Class
|
||||||
this.gui.setForm (null);
|
this.gui.setForm (null);
|
||||||
this.deactivate ();
|
this.deactivate ();
|
||||||
this.node = null;
|
this.node = null;
|
||||||
|
this.params = null;
|
||||||
}
|
}
|
||||||
if (this.builder)
|
if (this.builder)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue