This commit is contained in:
Juan Ferrer Toribio 2017-04-05 16:06:07 +02:00
parent efdde01e19
commit 944a955068
68 changed files with 566 additions and 814 deletions

View File

@ -11,7 +11,7 @@ Hedera.AddressList = new Class
,onAddAddressClick: function ()
{
this.hash.set ({
this.hash.setAll ({
'form': 'account/address',
'address': 0
});

View File

@ -32,33 +32,33 @@
<div class="card list">
<htk-radio-group
id="default-address"
column="default_address"
form="user-form"/>
lot="user-form"
name="default_address"/>
<htk-repeater model="addresses" form-id="iter" renderer="repeaterFunc">
<custom>
<a id="link" class="list-row" title="_EditAddress">
<div class="actions">
<htk-radio
form="iter"
column="id"
lot="iter"
name="id"
radio-group="default-address"
tip="_SetAsDefault"/>
<htk-button
form="iter"
column="id"
lot="iter"
name="id"
tip="_RemoveAddress"
icon="delete"
on-click="onRemoveAddressClick"/>
</div>
<p class="important">
<htk-text form="iter" column="consignee"/>
<htk-text lot="iter" name="consignee"/>
</p>
<p>
<htk-text form="iter" column="name"/>
<htk-text lot="iter" name="name"/>
</p>
<p>
<htk-text form="iter" column="zip_code"/>,
<htk-text form="iter" column="city"/>
<htk-text lot="iter" name="zip_code"/>,
<htk-text lot="iter" name="city"/>
</p>
</a>
</custom>

View File

@ -12,9 +12,9 @@
<custom>
SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id
FROM address_view a
LEFT JOIN vn2008.province p ON p.province_id = a.province_id
JOIN vn2008.Paises c ON c.Id = p.Paises_Id
WHERE active != FALSE AND a.id = #address
LEFT JOIN vn2008.province p ON p.province_id = a.province_id
JOIN vn2008.Paises c ON c.Id = p.Paises_Id
WHERE active != FALSE AND a.id = #address
</custom>
<sql-batch property="batch">
<custom>
@ -41,28 +41,28 @@
<div class="card form">
<div>
<label><t>Name</t></label>
<htk-entry form="iter" column="consignee"/>
<htk-entry lot="iter" name="consignee"/>
</div>
<div>
<label><t>Address</t></label>
<htk-entry form="iter" column="name"/>
<htk-entry lot="iter" name="name"/>
</div>
<div>
<label><t>City</t></label>
<htk-entry form="iter" column="city"/>
<htk-entry lot="iter" name="city"/>
</div>
<div>
<label><t>ZipCode</t></label>
<htk-entry form="iter" column="zip_code"/>
<htk-entry lot="iter" name="zip_code"/>
</div>
<div>
<label><t>Country</t></label>
<htk-combo>
<db-param
<vn-param
id="country"
property="param"
form="iter"
column="country_id"
lot="iter"
name="country_id"
one-way="true"/>
<db-model property="model">
<custom>
@ -74,7 +74,7 @@
</div>
<div>
<label><t>Province</t></label>
<htk-combo form="iter" column="province_id">
<htk-combo lot="iter" name="province_id">
<db-model property="model">
<custom>
SELECT province_id, name FROM vn2008.province

View File

@ -72,7 +72,7 @@ Hedera.Conf = new Class
,onAddressesClick: function ()
{
this.hash.set ({'form': 'account/address-list'});
this.hash.setAll ({'form': 'account/address-list'});
}
});

View File

@ -47,15 +47,15 @@
<div class="card form">
<div>
<label for="user-name"><t>Username</t></label>
<htk-text form="user" column="name"/>
<htk-text lot="user" name="name"/>
</div>
<div>
<label for="email"><t>Email</t></label>
<htk-entry form="user" column="email"></htk-entry>
<htk-entry lot="user" name="email"></htk-entry>
</div>
<div>
<label for="mail"><t>Receive invoices by email</t></label>
<htk-check form="user" column="mail"/>
<htk-check lot="user" name="mail"/>
</div>
</div>
</div>
@ -97,23 +97,23 @@
</h3>
<ul>
<li>
<htk-text form="password-form" column="length"/>
<htk-text lot="password-form" name="length"/>
<t>characters long</t>
</li>
<li>
<htk-text form="password-form" column="nAlpha"/>
<htk-text lot="password-form" name="nAlpha"/>
<t>alphabetic characters</t>
</li>
<li>
<htk-text form="password-form" column="nUpper"/>
<htk-text lot="password-form" name="nUpper"/>
<t>capital letters</t>
</li>
<li>
<htk-text form="password-form" column="nDigits"/>
<htk-text lot="password-form" name="nDigits"/>
<t>digits</t>
</li>
<li>
<htk-text form="password-form" column="nPunct"/>
<htk-text lot="password-form" name="nPunct"/>
<t>symbols</t>
</li>
</ul>

View File

@ -22,16 +22,16 @@
<div id="main" class="access-log">
<div class="card form">
<p>
<htk-text form="user-form" column="Id_Cliente"/>
<htk-text lot="user-form" name="Id_Cliente"/>
</p>
<p>
<htk-text form="user-form" column="Cliente"/>
<htk-text lot="user-form" name="Cliente"/>
</p>
<p>
<htk-text form="user-form" column="Telefono"/>
<htk-text lot="user-form" name="Telefono"/>
</p>
<p>
<htk-text form="user-form" column="movil"/>
<htk-text lot="user-form" name="movil"/>
</p>
</div>
<div class="card">
@ -56,12 +56,12 @@
<custom>
<div class="list-row">
<p>
<htk-text form="iter" column="stamp" format="_%a, %e %b %Y at %T"/>
<htk-text lot="iter" name="stamp" format="_%a, %e %b %Y at %T"/>
</p>
<p>
<htk-text form="iter" column="platform"/> -
<htk-text form="iter" column="browser"/>
<htk-text form="iter" column="version"/>
<htk-text lot="iter" name="platform"/> -
<htk-text lot="iter" name="browser"/>
<htk-text lot="iter" name="version"/>
</p>
</div>
</custom>

View File

@ -5,7 +5,7 @@ Hedera.Connections = new Class
,_timeoutId: null
,onModelStatusChange: function (model, status)
,onModelStatusChange: function (model)
{
if (!model.ready)
return;
@ -40,9 +40,9 @@ Hedera.Connections = new Class
this._onUserSupplant.bind (this));
}
,_onUserSupplant: function (userName)
,_onUserSupplant: function ()
{
this.hash.set ({'form': 'ecomerce/orders'});
this.hash.setAll ({'form': 'ecomerce/orders'});
}
,sessionsFunc: function ()

View File

@ -38,23 +38,23 @@
<a id="link" class="list-row" title="_Access log">
<div class="actions">
<htk-button
form="iter"
column="id"
lot="iter"
name="id"
tip="_Supplant user"
icon="incognito"
on-click="onChangeUserClick"/>
</div>
<p class="important">
<htk-text form="iter" column="Cliente"/>
<htk-text lot="iter" name="Cliente"/>
</p>
<p>
<htk-text form="iter" column="stamp" format="%a, %T"/> -
<htk-text form="iter" column="lastUpdate" format="%T"/>
<htk-text lot="iter" name="stamp" format="%a, %T"/> -
<htk-text lot="iter" name="lastUpdate" format="%T"/>
</p>
<p>
<htk-text form="iter" column="platform"/> -
<htk-text form="iter" column="browser"/>
<htk-text form="iter" column="version"/>
<htk-text lot="iter" name="platform"/> -
<htk-text lot="iter" name="browser"/>
<htk-text lot="iter" name="version"/>
</p>
</a>
</custom>

View File

@ -13,7 +13,7 @@
<div class="card form">
<div>
<label><t>Store</t></label>
<htk-combo form="set" column="warehouse">
<htk-combo lot="set" name="warehouse">
<db-model property="model">
<custom>
SELECT id, name FROM vn2008.warehouse
@ -24,7 +24,7 @@
</div>
<div>
<label><t>Realm</t></label>
<htk-combo form="set" column="realm" not-null="false">
<htk-combo lot="set" name="realm" not-null="false">
<db-model property="model">
<custom>
SELECT id, reino FROM vn2008.reinos

View File

@ -14,15 +14,15 @@
<custom>
<a id="link" class="list-row" target="_blank">
<htk-image
form="iter"
column="image"
lot="iter"
name="image"
directory="link"
subdir="full"/>
<p class="important">
<htk-text form="iter" column="name"/>
<htk-text lot="iter" name="name"/>
</p>
<p>
<htk-text form="iter" column="description"/>
<htk-text lot="iter" name="description"/>
</p>
</a>
</custom>

View File

@ -11,6 +11,7 @@
,"Title": "Title"
,"Show packing": "Show packing"
,"Stack different items": "Stack different items"
,"Use ids instead of names": "Use ids instead of names"
,"Show": "Show"

View File

@ -11,6 +11,7 @@
,"Title": "Título"
,"Show packing": "Mostrar unidades por caja"
,"Stack different items": "Apilar artículos distintos"
,"Use ids instead of names": "Usar ids en vez de nombres"
,"Show": "Mostrar"

View File

@ -1 +1,22 @@
{}
{
"Configuration": "Configuration"
,"Select config": "Select config"
,"Reign": "Reign"
,"Family": "Family"
,"Store": "Store"
,"Date": "Date"
,"Shelf": "Shelf"
,"Name prefix": "Name prefix"
,"Limit amount per item": "Limit amount per item"
,"Title": "Title"
,"Show packing": "Show packing"
,"Stack different items": "Stack different items"
,"Use ids instead of names": "Use ids instead of names"
,"Show": "Show"
,"Pallets": "Pallets"
,"No items found, check that all fields are correct":
"No items found, check that all fields are correct"
}

View File

@ -11,6 +11,7 @@
,"Title": "Title"
,"Show packing": "Show packing"
,"Stack different items": "Stack different items"
,"Use ids instead of names": "Use ids instead of names"
,"Show": "Show"

View File

@ -11,6 +11,7 @@
,"Title": "Título"
,"Show packing": "Mostrar unidades por caixa"
,"Stack different items": "Empilhar ítens diferentes"
,"Use ids instead of names": "Usar ids en vez de nombres"
,"Show": "Mostrar"

View File

@ -31,11 +31,11 @@
</div>
<div>
<label><t>Date</t></label>
<htk-date-chooser form="set" column="date"/>
<htk-date-chooser lot="set" name="date"/>
</div>
<div>
<label><t>Reign</t></label>
<htk-combo form="set" column="realm" id="realm">
<htk-combo lot="set" name="realm" id="realm">
<db-model property="model">
<custom>
SELECT id, reino FROM vn2008.reinos
@ -46,7 +46,7 @@
</div>
<div>
<label><t>Family</t></label>
<htk-combo form="set" column="family">
<htk-combo lot="set" name="family">
<db-model property="model">
<custom>
SELECT tipo_id, Tipo FROM vn2008.Tipos
@ -62,7 +62,7 @@
</div>
<div>
<label><t>Store</t></label>
<htk-combo form="set" column="warehouse">
<htk-combo lot="set" name="warehouse">
<db-model property="model">
<custom>
SELECT id, name FROM vn2008.warehouse
@ -73,7 +73,7 @@
</div>
<div>
<label><t>Shelf</t></label>
<htk-combo form="set" column="shelf">
<htk-combo lot="set" name="shelf">
<db-model property="model">
<custom>
SELECT id, name FROM shelf
@ -83,27 +83,27 @@
</div>
<div>
<label><t>Name prefix</t></label>
<htk-entry form="set" column="namePrefix"/>
<htk-entry lot="set" name="namePrefix"/>
</div>
<div>
<label><t>Limit amount per item</t></label>
<htk-entry form="set" column="maxAmount"/>
<htk-entry lot="set" name="maxAmount"/>
</div>
<div>
<label><t>Title</t></label>
<htk-entry form="set" column="reportTitle"/>
<htk-entry lot="set" name="reportTitle"/>
</div>
<div>
<label><t>Show packing</t></label>
<htk-check form="set" column="showPacking"/>
<htk-check lot="set" name="showPacking"/>
</div>
<div>
<label><t>Stack different items</t></label>
<htk-check form="set" column="stack"/>
<htk-check lot="set" name="stack"/>
</div>
<div>
<label><t>Use ids instead of names</t></label>
<htk-check form="set" column="useIds"/>
<htk-check lot="set" name="useIds"/>
</div>
</div>
</div>

View File

@ -33,18 +33,18 @@
<a id="link" class="list-row" title="_AccessLog">
<div class="actions">
<htk-button
form="iter"
column="id"
lot="iter"
name="id"
tip="_AccessAsUser"
icon="incognito"
on-click="onChangeUserClick"/>
</div>
<p class="important">
<htk-text form="iter" column="Cliente"/>
<htk-text lot="iter" name="Cliente"/>
</p>
<p>
<htk-text form="iter" column="id"/> -
<htk-text form="iter" column="name"/>
<htk-text lot="iter" name="id"/> -
<htk-text lot="iter" name="name"/>
</p>
</a>
</custom>

View File

@ -17,9 +17,9 @@ Hedera.Users = new Class
this.onUserSupplant.bind (this));
}
,onUserSupplant: function (userName)
,onUserSupplant: function ()
{
this.hash.set ({'form': 'ecomerce/orders'});
this.hash.setAll ({'form': 'ecomerce/orders'});
}
});

View File

@ -72,18 +72,18 @@
<custom>
<div class="list-row">
<p class="important">
<htk-text form="iter" column="browser"/>
<htk-text form="iter" column="minVersion"/> -
<htk-text form="iter" column="maxVersion"/>
<htk-text lot="iter" name="browser"/>
<htk-text lot="iter" name="minVersion"/> -
<htk-text lot="iter" name="maxVersion"/>
</p>
<p>
<htk-text form="iter" column="visits"/>
<htk-text lot="iter" name="visits"/>
<t>visits</t>,
<htk-text form="iter" column="newVisits"/>
<htk-text lot="iter" name="newVisits"/>
<t>news</t>
</p>
<p>
<htk-text form="iter" column="lastVisit" format="_%a, %e %b %Y at %T"/>
<htk-text lot="iter" name="lastVisit" format="_%a, %e %b %Y at %T"/>
</p>
</div>
</custom>

View File

@ -16,7 +16,7 @@ Hedera.Visits = new Class
,onSessionsClick: function ()
{
this.hash.set ({'form': 'admin/connections'});
this.hash.setAll ({'form': 'admin/connections'});
}
});

View File

@ -5,7 +5,7 @@ Hedera.Packages = new Class
,onShowClick: function (column, agencyId)
{
this.hash.set ({
this.hash.setAll ({
'form': 'agencies/provinces',
'agency': agencyId
});

View File

@ -5,7 +5,7 @@ Hedera.Home = new Class
,onStartOrderClick: function ()
{
this.hash.set ({'form': 'ecomerce/catalog'});
this.hash.setAll ({'form': 'ecomerce/catalog'});
}
});

View File

@ -22,21 +22,21 @@
<div class="masonry-box">
<div class="new">
<div class="top">
<h2><htk-text form="new" column="title"/></h2>
<h2><htk-text lot="new" name="title"/></h2>
<!--
<p class="new-info">
<htk-text format="_%a, %e %b %Y" form="new" column="date_time"/>
<htk-text format="_%a, %e %b %Y" lot="new" name="date_time"/>
</p>
-->
<div class="new-text">
<htk-html form="new" column="text"/>
<htk-html lot="new" name="text"/>
</div>
</div>
<htk-image
directory="news"
subdir="full"
form="new"
column="image"
lot="new"
name="image"
editable="false"
full-dir="full"/>
</div>

View File

@ -16,19 +16,19 @@
<div class="masonry-box">
<div class="new">
<div class="top">
<h2><htk-text form="new" column="title"/></h2>
<h2><htk-text lot="new" name="title"/></h2>
<p class="new-info">
<htk-text format="_%a, %e %b %Y" form="new" column="date_time"/>
<htk-text format="_%a, %e %b %Y" lot="new" name="date_time"/>
</p>
<div class="new-text">
<htk-html form="new" column="text"/>
<htk-html lot="new" name="text"/>
</div>
</div>
<htk-image
directory="news"
subdir="full"
form="new"
column="image"
lot="new"
name="image"
editable="false"
full-dir="full"/>
</div>

View File

@ -8,7 +8,7 @@ Hedera.Basket = new Class
this.close ();
this.isOpen = true;
Hedera.BasketChecker.check (this.conn,
Hedera.BasketChecker.check (this.conn, this.hash,
this.onBasketCheck.bind (this));
}
@ -26,17 +26,17 @@ Hedera.Basket = new Class
,onConfigureClick: function ()
{
Htk.Toast.showWarning (_('RememberReconfiguringImpact'));
this.hash.set ({'form': 'ecomerce/checkout'});
this.hash.setAll ({'form': 'ecomerce/checkout'});
}
,onCatalogClick: function ()
{
this.hash.set ({'form': 'ecomerce/catalog'});
this.hash.setAll ({'form': 'ecomerce/catalog'});
}
,onCheckoutClick: function ()
{
this.hash.set ({'form': 'ecomerce/confirm'});
this.hash.setAll ({'form': 'ecomerce/confirm'});
}
,repeaterFunc: function (res, form)

View File

@ -39,27 +39,27 @@
<custom>
<div class="line">
<htk-button
form="iter"
column="ticket_id"
lot="iter"
name="ticket_id"
class="delete"
tip="_Remove"
icon="delete"
on-click="onDeleteClick"/>
<htk-image
form="iter"
column="Foto"
lot="iter"
name="Foto"
class="photo"
directory="catalog"
subdir="200x200"
full-dir="900x900"/>
<p class="concept">
<htk-text form="iter" column="Article"/>
<htk-text form="iter" column="Medida"/>
<htk-text form="iter" column="Categoria"/>
<htk-text lot="iter" name="Article"/>
<htk-text lot="iter" name="Medida"/>
<htk-text lot="iter" name="Categoria"/>
</p>
<p class="amount">
<htk-text form="iter" column="amount"/> x
<htk-text form="iter" column="price" format="%.2d€"/>
<htk-text lot="iter" name="amount"/> x
<htk-text lot="iter" name="price" format="%.2d€"/>
<span class="subtotal">
<htk-text id="subtotal" format="%.2d€"/>
</span>

View File

@ -12,7 +12,7 @@ Hedera.Catalog = new Class
if (!localStorage.getItem ('hederaGuest'))
{
Hedera.BasketChecker.check (this.conn,
Hedera.BasketChecker.check (this.conn, this.hash,
this.onBasketCheck.bind (this));
}
else
@ -251,7 +251,7 @@ Hedera.Catalog = new Class
if (this.isGuest ())
return;
this.hash.set ({'form': 'ecomerce/basket'});
this.hash.setAll ({'form': 'ecomerce/basket'});
}
,onConfigureClick: function ()
@ -259,7 +259,7 @@ Hedera.Catalog = new Class
if (this.isGuest ())
return;
this.hash.set ({'form': 'ecomerce/checkout'});
this.hash.setAll ({'form': 'ecomerce/checkout'});
}
,onAddItemClick: function (button, form)

View File

@ -151,38 +151,38 @@
<htk-image
directory="catalog"
subdir="200x200"
form="item"
column="Foto"
lot="item"
name="Foto"
full-dir="900x900"/>
<div class="item-info">
<htk-button
form="item"
column="id"
lot="item"
name="id"
tip="_AddToBasket"
icon="add"
on-click="onAddItemClick"
class="add-button"/>
<h2>
<htk-text form="item" column="Article"/>
<htk-text lot="item" name="Article"/>
</h2>
<p class="producer">
<htk-text form="item" column="producer"/>
<htk-text lot="item" name="producer"/>
</p>
<p>
<t>Size</t> <htk-text form="item" column="Medida"/>,
<t>Category</t> <htk-text form="item" column="Categoria"/>
<t>Size</t> <htk-text lot="item" name="Medida"/>,
<t>Category</t> <htk-text lot="item" name="Categoria"/>
</p>
<p class="color">
<t>Color</t> <htk-text form="item" column="color"/>
<htk-text form="item" column="Tallos" format="_, %.0d Units"/>
<t>Color</t> <htk-text lot="item" name="color"/>
<htk-text lot="item" name="Tallos" format="_, %.0d Units"/>
</p>
<div class="aval-price">
<htk-text form="item" column="available"/>
<htk-text lot="item" name="available"/>
<span class="from">
<t>from</t>
</span>
<span class="price">
<htk-text form="item" column="price" format="%.2d€"/>
<htk-text lot="item" name="price" format="%.2d€"/>
</span>
</div>
</div>
@ -194,11 +194,11 @@
<div id="right-panel" class="right-panel" on-click="onRightPanelClick">
<div class="basket-info">
<p>
<htk-text form="basket" column="date_send" format="%D"/>
<htk-text lot="basket" name="date_send" format="%D"/>
</p>
<p>
<span id="method"/>
<htk-text form="basket" column="agency"/>
<htk-text lot="basket" name="agency"/>
</p>
<button class="thin" on-click="onConfigureClick">
<t>Change</t>
@ -415,32 +415,32 @@
<htk-image
directory="catalog"
subdir="200x200"
form="card"
column="Foto"
lot="card"
name="Foto"
full-dir="900x900"
conn="conn"
editable="true"/>
<div class="item-info">
<h2>
<htk-text form="card" column="Article"/>
<htk-text lot="card" name="Article"/>
</h2>
<p class="producer">
<htk-text form="card" column="producer"/>
<htk-text lot="card" name="producer"/>
</p>
<p>
<t>Size</t> <htk-text form="card" column="Medida"/>,
<t>Category</t> <htk-text form="card" column="Categoria"/>
<t>Size</t> <htk-text lot="card" name="Medida"/>,
<t>Category</t> <htk-text lot="card" name="Categoria"/>
</p>
<p class="color">
<t>Color</t> <htk-text form="card" column="color"/>
<htk-text form="card" column="Tallos" format="_, %.0d Units"/>
<t>Color</t> <htk-text lot="card" name="color"/>
<htk-text lot="card" name"Tallos" format="_, %.0d Units"/>
</p>
<p>
<t>Origin</t> <htk-text form="card-extend" column="origin"/>
<t>Origin</t> <htk-text lot="card-extend" name"origin"/>
</p>
</div>
<p class="desc">
<htk-text form="card-extend" column="description" id="desc"/>
<htk-text lot="card-extend" name"description" id="desc"/>
</p>
</div>
<htk-grid class="lots-grid" model="item-lots" show-header="false">

View File

@ -34,7 +34,9 @@ Hedera.Checkout = new Class
date = new Date ();
if (i.get('delivery_method') != 'PICKUP')
date.setTime (date.getTime () + 86400000);
date.setDate (date.getDate () + 1);
date.setHours (0, 0, 0, 0);
}
this.$('date').value = date;
@ -80,7 +82,7 @@ Hedera.Checkout = new Class
else
Htk.Toast.showMessage (_('OrderStarted'));
this.hash.set ({'form': 'ecomerce/catalog'});
this.hash.setAll ({'form': 'ecomerce/catalog'});
}
,onCancelClick: function ()
@ -88,7 +90,7 @@ Hedera.Checkout = new Class
if (this.$('order-form').numRows > 0)
window.history.back();
else
this.hash.set ({'form': 'ecomerce/orders'});
this.hash.setAll ({'form': 'ecomerce/orders'});
}
,agencySteps: ['method', 'date', 'address', 'agency', 'confirm-agency']

View File

@ -114,10 +114,10 @@
<custom>
<div class="address" id="address">
<p class="consignee">
<htk-text form="iter" column="consignee"/>
<htk-text lot="iter" name"consignee"/>
</p>
<p>
<htk-text form="iter" column="name"/>
<htk-text lot="iter" name"name"/>
</p>
</div>
</custom>
@ -152,11 +152,11 @@
<htk-text format="%D" param="date"/>
</p>
<p>
<htk-text form="address-form" column="name"/>
<htk-text lot="address-form" name"name"/>
</p>
<p>
<t>Agency</t>
<htk-text form="agency-combo" column="description"/>
<htk-text lot="agency-combo" name"description"/>
</p>
<button id="confirm-agency" class="thin" on-click="onConfirmClick">
<t>Confirm</t>
@ -172,7 +172,7 @@
<htk-text format="%D" param="date"/>
</p>
<p>
<htk-text form="address-form" column="name"/>
<htk-text lot="address-form" name"name"/>
</p>
<p>
<t>ReceiveThroughtRoute</t>
@ -192,7 +192,7 @@
</p>
<p>
<t>Warehouse</t>
<htk-text form="warehouse-combo" column="description"/>
<htk-text lot="warehouse-combo" name"description"/>
</p>
<button id="confirm-pickup" class="thin" on-click="onConfirmClick">
<t>Confirm</t>

View File

@ -8,7 +8,7 @@ Hedera.Confirm = new Class
this.close ();
this.isOpen = true;
Hedera.BasketChecker.check (this.conn,
Hedera.BasketChecker.check (this.conn, this.hash,
this.onBasketCheck.bind (this));
}
@ -164,11 +164,14 @@ Hedera.Confirm = new Class
else
var payAmount = this.$('total-amount').value;
var tpv = new Hedera.Tpv ({conn: this.conn});
var tpv = new Hedera.Tpv ({
conn: this.conn,
hash: this.hash
});
tpv.pay (payAmount, this.$('order-form').get ('company_id'));
}
else
this.hash.set ({'form': 'ecomerce/orders'});
this.hash.setAll ({'form': 'ecomerce/orders'});
}
});

View File

@ -38,23 +38,23 @@
<div class="delivery">
<p>
<t>Delivery at</t>
<htk-text format="%D" form="order-form" column="date_send"/>
<htk-text format="%D" lot="order-form" name"date_send"/>
</p>
<p>
<span id="method"><t>Agency</t></span>
<htk-text form="order-form" column="agency"/>
<htk-text lot="order-form" name"agency"/>
</p>
</div>
<div id="address" class="address">
<p>
<htk-text form="order-form" column="consignee"/>
<htk-text lot="order-form" name"consignee"/>
</p>
<p>
<htk-text form="order-form" column="address"/>
<htk-text lot="order-form" name"address"/>
</p>
<p>
<htk-text form="order-form" column="zip_code"/>,
<htk-text form="order-form" column="city"/>
<htk-text lot="order-form" name"zip_code"/>,
<htk-text lot="order-form" name"city"/>
</p>
</div>
</div>
@ -76,7 +76,7 @@
<t>Order total</t>
</td>
<td class="currency">
<htk-text format="%.2d€" form="order-form" column="tax_base"/>
<htk-text format="%.2d€" lot="order-form" name"tax_base"/>
</td>
</tr>
<tr>
@ -84,7 +84,7 @@
<t>Order VAT</t>
</td>
<td class="currency">
<htk-text format="%.2d€" form="order-form" column="vat"/>
<htk-text format="%.2d€" lot="order-form" name"vat"/>
</td>
</tr>
<tr class="total-debt sum-total">
@ -100,7 +100,7 @@
<t>Credit</t>
</td>
<td class="currency">
<htk-text format="%.2d€" form="order-form" column="credit"/>
<htk-text format="%.2d€" lot="order-form" name"credit"/>
</td>
</tr>
<tr id="exceeded-info" class="exceeded-info sum-total">
@ -181,14 +181,14 @@
<custom>
<div class="transfer-account">
<p>
<htk-text form="iter" column="description"/>
<htk-text lot="iter" name"description"/>
</p>
<p>
<htk-text form="iter" column="iban"/>
<htk-text form="iter" column="entity_id"/>
<htk-text form="iter" column="office"/>
<htk-text form="iter" column="dc"/>
<htk-text form="iter" column="number"/>
<htk-text lot="iter" name"iban"/>
<htk-text lot="iter" name"entity_id"/>
<htk-text lot="iter" name"office"/>
<htk-text lot="iter" name"dc"/>
<htk-text lot="iter" name"number"/>
</p>
</div>
</custom>

View File

@ -5,13 +5,16 @@ Hedera.Orders = new Class
,activate: function ()
{
this.tpv = new Hedera.Tpv ({conn: this.conn});
this.tpv = new Hedera.Tpv ({
conn: this.conn,
hash: this.hash
});
this.tpv.check (this._onTpvCheck.bind (this));
if (!this.$('from').value)
{
var from = new Date ();
from.setDate (from.getDate () - 25);
from.setDate (from.getDate () - 30);
from.setHours (0, 0, 0, 0);
this.$('from').value = from;
}
@ -25,7 +28,7 @@ Hedera.Orders = new Class
,onBasketClick: function ()
{
this.hash.set ({'form': 'ecomerce/basket'});
this.hash.setAll ({'form': 'ecomerce/basket'});
}
,repeaterFunc: function (res, form)

View File

@ -30,7 +30,7 @@
<t>Balance:</t>
</span>
<span class="amount" id="balance">
<htk-text form="debt" column="debt" format="%.2d€"/>
<htk-text lot="debt" name"debt" format="%.2d€"/>
</span>
<img
src="image/icon/dark/info.svg"
@ -61,19 +61,19 @@
<custom>
<a id="link" class="list-row" title="_SeeOrder">
<p class="important total">
<htk-text form="iter" column="total" format="%.2d€"/>
<htk-text lot="iter" name"total" format="%.2d€"/>
</p>
<p class="important">
<htk-text form="iter" column="date" format="%D"/>
<htk-text lot="iter" name"date" format="%D"/>
</p>
<p>
<htk-text form="iter" column="consignee"/>
<htk-text lot="iter" name"consignee"/>
</p>
<p>
<htk-text form="iter" column="type"/>
<htk-text lot="iter" name"type"/>
</p>
<p>
<htk-text form="iter" column="ticket_id"/>
<htk-text lot="iter" name"ticket_id"/>
</p>
</a>
</custom>

View File

@ -29,36 +29,36 @@
<div class="head">
<div>
<p class="important ticket-id">
<htk-text column="id" form="ticket"/>
<htk-text name"id" lot="ticket"/>
</p>
<p>
<htk-text form="ticket" column="delivery" format="%D"/>
<htk-text lot="ticket" name"delivery" format="%D"/>
</p>
</div>
<div>
<p>
<t>Delivery</t> <htk-text form="ticket" column="Agencia"/>
<t>Delivery</t> <htk-text lot="ticket" name"Agencia"/>
</p>
<p>
<htk-text form="ticket" column="consignee"/>
<htk-text lot="ticket" name"consignee"/>
</p>
<p>
<htk-text form="ticket" column="name"/>
<htk-text lot="ticket" name"name"/>
</p>
<p>
<htk-text form="ticket" column="zip_code"/>
<htk-text form="ticket" column="city"/>
(<htk-text form="ticket" column="province"/>)
<htk-text lot="ticket" name"zip_code"/>
<htk-text lot="ticket" name"city"/>
(<htk-text lot="ticket" name"province"/>)
</p>
</div>
<div>
<p class="important total">
<t>Total</t>
<htk-text form="ticket" column="total" format="%.2d€"/>
<htk-text lot="ticket" name"total" format="%.2d€"/>
</p>
<p class="important total">
<t>Total + VAT</t>
<htk-text form="ticket" column="totalPlusVat" format="%.2d€"/>
<htk-text lot="ticket" name"totalPlusVat" format="%.2d€"/>
</p>
</div>
</div>
@ -76,20 +76,20 @@
<custom>
<div class="line">
<htk-image
form="iter"
column="Foto"
lot="iter"
name"Foto"
class="photo"
directory="catalog"
subdir="200x200"
full-dir="900x900"/>
<p class="concept">
<htk-text form="iter" column="concept"/>
<htk-text form="iter" column="Medida"/>
<htk-text form="iter" column="Categoria"/>
<htk-text lot="iter" name"concept"/>
<htk-text lot="iter" name"Medida"/>
<htk-text lot="iter" name"Categoria"/>
</p>
<p class="amount">
<htk-text form="iter" column="amount"/> x
<htk-text form="iter" column="price" format="%.2d€"/>
<htk-text lot="iter" name"amount"/> x
<htk-text lot="iter" name"price" format="%.2d€"/>
<span class="subtotal">
<htk-text id="subtotal" format="%.2d€"/>
</span>

View File

@ -86,7 +86,7 @@ Hedera.New = new Class
,onReturnClick: function ()
{
this.hash.set ({'form': 'news/news'});
this.hash.setAll ({'form': 'news/news'});
}
});

View File

@ -19,7 +19,7 @@
</sql-batch>
</db-model>
</db-form>
<db-param form="iter" column="text" on-changed="onBodyChange"/>
<vn-param lot="iter" name"text" on-changed="onBodyChange"/>
</vn-group>
<h1 id="title">
<t>AddEditNew</t>
@ -38,11 +38,11 @@
<div class="card form">
<div>
<label><t>Title</t></label>
<htk-entry form="iter" column="title"/>
<htk-entry lot="iter" name"title"/>
</div>
<div>
<label><t>Tag</t></label>
<htk-combo form="iter" column="tag">
<htk-combo lot="iter" name"tag">
<db-model property="model">
<custom>
SELECT name, description FROM news_tag

View File

@ -19,7 +19,7 @@ Hedera.News = new Class
,onAddClick: function ()
{
this.hash.set ({
this.hash.setAll ({
'form': 'news/new',
'new': 0
});

View File

@ -23,15 +23,15 @@
<a id="link" class="list-row" title="_EditNew">
<div class="actions">
<htk-button
form="iter"
column="id"
lot="iter"
name"id"
tip="_Remove"
icon="delete"
on-click="onDeleteClick"/>
</div>
<htk-image
form="iter"
column="image"
lot="iter"
name"image"
class="photo"
directory="news"
subdir="200x200"
@ -39,14 +39,14 @@
editable="true"
conn="conn"/>
<p class="important">
<htk-text form="iter" column="title"/>
<htk-text lot="iter" name"title"/>
</p>
<p>
<htk-text form="iter" column="Cliente"/>
<htk-text lot="iter" name"Cliente"/>
</p>
<p>
<t>Priority</t>
<htk-text form="iter" column="priority"/>
<htk-text lot="iter" name"priority"/>
</p>
</a>
</custom>

View File

@ -5,7 +5,7 @@ Hedera.Preview = new Class
,activate: function ()
{
var reportName = Vn.Hash.get ('report');
var reportName = this.hash.get ('report');
if (!reportName)
{
@ -34,15 +34,12 @@ Hedera.Preview = new Class
Htk.Toast.showError (_('Error loading report'));
return;
}
var batch = new Sql.Batch ();
batch.addValues (Vn.Hash._hashMap);
this.report = new module.klass ({
info: module,
conn: this.conn
});
this.report.open (batch, this.node);
this.report.open (this.hash, this.node);
}
,onPrintClick: function ()

View File

@ -56,11 +56,11 @@ Connection.implement
*
* @param {Sql.Stmt} stmt The statement
* @param {Function} callback The function to call when operation is done
* @param {Sql.Batch} batch The batch used to set the parameters
* @param {Object} params The statement parameters
*/
,execStmt: function (stmt, callback, batch)
,execStmt: function (stmt, callback, params)
{
this.execSql (stmt.render (batch), callback);
this.execSql (stmt.render (params), callback);
}
/**
@ -68,11 +68,11 @@ Connection.implement
*
* @param {String} query The SQL statement
* @param {Function} callback The function to call when operation is done
* @param {Sql.Batch} batch The batch used to set the parameters
* @param {Object} params The statement parameters
*/
,execQuery: function (query, callback, batch)
,execQuery: function (query, callback, params)
{
this.execStmt (new Sql.String ({query: query}), callback, batch);
this.execStmt (new Sql.String ({query: query}), callback, params);
}
/*

View File

@ -9,7 +9,6 @@ Db = module.exports = {
,Iterator : require ('./iterator')
,SimpleIterator : require ('./simple-iterator')
,Form : require ('./form')
,Param : require ('./param')
,Query : require ('./query')
,Calc : require ('./calc')
,CalcSum : require ('./calc-sum')

View File

@ -101,6 +101,22 @@ Model.implement
return this._batch;
}
},
/**
* The lot used to execute the statement.
*/
lot:
{
type: Vn.Lot
,set: function (x)
{
this.link ({_lot: x}, {'change': this._autoLoad});
this._autoLoad ();
}
,get: function ()
{
return this._lot;
}
},
/**
* The model select statement.
*/

View File

@ -1,97 +0,0 @@
var Form = require ('./form');
module.exports = new Class
({
Extends: Vn.Param
,Tag: 'db-param'
,Parent: 'form'
,Properties:
{
/**
* The form field referenced by this param.
*/
column:
{
type: String
,set: function (x)
{
this._columnName = x;
this.refresh ();
}
,get: function ()
{
this._columnName;
}
},
/**
* The form referenced by this param.
*/
form:
{
type: Form
,set: function (x)
{
this.link ({_set: x},
{
'change': this.onSetChange
});
this.refresh ();
}
,get: function ()
{
return this._set;
}
},
/**
* Determines whether the link to the form is unidirectional, ie, a
* change in the form updates the parameter but not vice versa.
*/
oneWay:
{
type: Boolean
,set: function (x)
{
this._oneWay = x;
}
,get: function ()
{
return this._oneWay;
}
}
}
,_columnName: null
,_set: null
,_setLock: false
,_oneWay: false
,_setValue: null
,initialize: function (props)
{
this.parent (props);
this.on ('changed', this.onChange, this);
}
,refresh: function ()
{
if (this._set)
this.onSetChange ();
}
,onSetChange: function ()
{
this._setLock = true;
var formValue = this._set.get (this._columnName);
this.value = formValue;
this._setLock = false;
}
,onChange: function ()
{
if (!this._setLock && this._columnName && !this.oneWay)
this._set.set (this._columnName, this._value);
}
});

View File

@ -56,19 +56,19 @@ module.exports = new Class
}
},
/**
* The batch used to execute the statement.
* The lot used to execute the statement.
*/
batch:
lot:
{
type: Sql.Batch
type: Vn.Lot
,set: function (x)
{
this.link ({_batch: x}, {'changed': this.onChange});
this.onChange ();
this.link ({_lot: x}, {'change': this.onChange});
this._autoLoad ();
}
,get: function ()
{
return this._batch;
return this._lot;
}
},
/**
@ -81,11 +81,6 @@ module.exports = new Class
}
}
,initialize: function (props)
{
this.parent (props);
}
,loadXml: function (builder, node)
{
this.parent (builder, node);

View File

@ -21,7 +21,7 @@ module.exports = new Class
{
window.onerror = this._onWindowError.bind (this);
window.onunload = this._onWindowUnload.bind (this);
Vn.Hash.initialize ();
this._hash = new Vn.Hash ({window: window});
var conn = new Db.Connection ();
this.link ({_conn: conn}, {'error': this._onConnError});
@ -34,7 +34,10 @@ module.exports = new Class
if (this.tryAutoLogin ())
return;
var login = this._login = new Login ({conn: this._conn});
var login = this._login = new Login ({
conn: this._conn,
hash: this._hash
});
login.on ('login', this._onLogin, this);
login.show ();
}
@ -43,7 +46,10 @@ module.exports = new Class
{
this._freeLogin ();
var gui = this._gui = new Gui ({conn: this._conn});
var gui = this._gui = new Gui ({
conn: this._conn,
hash: this._hash
});
gui.on ('logout', this._onLogout, this);
gui.show ();
}
@ -82,7 +88,7 @@ module.exports = new Class
this._logout ();
break;
case 'OutdatedVersion':
this._newVersion (error);
this._newVersion ();
break;
default:
Htk.Toast.showError (error.message);
@ -100,7 +106,7 @@ module.exports = new Class
this._gui.logout ();
}
,_newVersion: function (error)
,_newVersion: function ()
{
if (this.ignoreVersion)
return;
@ -162,6 +168,7 @@ module.exports = new Class
this._freeGui ();
this.deinitAutoLogin ();
this._conn.unref ();
this._hash.unref ();
}
// Auto login functionality
@ -170,15 +177,17 @@ module.exports = new Class
,initAutoLogin: function ()
{
var isGuest = new Vn.HashParam
var isGuest = new Vn.Param
({
lot: this._hash,
type: Boolean,
key: 'guest'
});
this.link ({_isGuest: isGuest}, {'changed': this._onGuestChange});
var token = new Vn.HashParam
var token = new Vn.Param
({
lot: this._hash,
type: String,
key: 'token'
});

View File

@ -1,8 +1,9 @@
module.exports =
{
check: function (conn, callback)
check: function (conn, hash, callback)
{
this.hash = hash;
conn.execQuery ('CALL basketCheck ()',
this._onBasketCheck.bind (this, callback));
}
@ -10,7 +11,7 @@ module.exports =
,_onBasketCheck: function (callback, resultSet)
{
var status = resultSet.fetchValue ();
if (!status)
return;
@ -21,6 +22,6 @@ module.exports =
if (callback)
callback (isOk);
if (!isOk)
Vn.Hash.set ({'form': 'ecomerce/checkout'});
this.hash.setAll ({'form': 'ecomerce/checkout'});
}
};

View File

@ -23,6 +23,7 @@ module.exports = new Class
var builder = new Vn.Builder ();
builder.signalData = this;
builder.add ('conn', this.conn);
builder.add ('hash', this.hash);
builder.loadXml ('forms/'+ this.formInfo.path +'/ui.xml');
var res = this.builderResultInit (builder);

View File

@ -318,7 +318,7 @@
{
margin-left: 0;
}
.vn-gui .menu-button
.vn-gui .navbar .menu-button
{
display: block;
}

View File

@ -77,10 +77,13 @@ module.exports = new Class
window.addEventListener ('scroll', this._onScrollHandler );
}
this.hash = Vn.Hash;
this.formParam = new Vn.HashParam ({key: 'form'});
this.formParam = new Vn.Param ({
lot: this.hash,
type: String,
key: 'form'
});
this.formParam.on ('changed', this._onFormChange, this);
if (!localStorage.getItem ('hederaCookies'))
{
localStorage.setItem ('hederaCookies', true);
@ -220,7 +223,7 @@ module.exports = new Class
if (res.get ('path'))
{
a.href = Vn.Hash.make ({'form': res.get ('path')});
a.href = this.hash.make ({'form': res.get ('path')});
this.menuOptions[res.get ('path')] = a;
}
@ -374,7 +377,7 @@ module.exports = new Class
,_onFormChange: function ()
{
var formPath = this.formParam.value;
if (!formPath)
formPath = Vn.Config['default_form'];
@ -475,7 +478,7 @@ module.exports = new Class
form: 'preview',
report: reportName
};
Vn.Hash.set (Object.assign (hashParams, params));
this.hash.setAll (Object.assign (hashParams, params));
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Supplant

View File

@ -3,6 +3,11 @@ module.exports = new Class
({
Extends: Htk.Component
,activate: function ()
{
this.renderReport ();
}
,open: function (batch, body)
{
this.batch = batch;
@ -11,11 +16,6 @@ module.exports = new Class
this.activate (batch, body);
}
,activate: function (batch, body)
{
this.renderReport ();
}
,openIframe: function (batch)
{
this.batch = batch;

View File

@ -46,12 +46,10 @@ module.exports = new Class
if (!this._conn || this._priority === null)
return;
var batch = new Sql.Batch ();
batch.addValue ('priority', this._priority);
var params = {priority: this._priority};
var query = 'SELECT title, link, icon FROM social '
+'WHERE priority >= #priority ORDER BY priority';
this._conn.execQuery (query, this._onQueryDone.bind (this), batch);
this._conn.execQuery (query, this._onQueryDone.bind (this), params);
}
,_onQueryDone: function (resultSet)

View File

@ -56,15 +56,15 @@
}
/* Mobile - High DPI */
@media screen and
(max-device-width: 411px) and (min-resolution: 249dpi),
(max-device-width: 411px) and (-webkit-min-device-pixel-ratio: 3)
@media
screen and (max-device-width: 411px) and (min-resolution: 249dpi),
screen and (max-device-width: 411px) and (-webkit-min-device-pixel-ratio: 3)
{
body { font-size: 10pt; }
}
@media screen and
(min-device-width: 412px) and (min-resolution: 249dpi),
(min-device-width: 412px) and (-webkit-min-device-pixel-ratio: 3)
@media
screen and (min-device-width: 412px) and (min-resolution: 249dpi),
screen and (min-device-width: 412px) and (-webkit-min-device-pixel-ratio: 3)
{
body { font-size: 11pt; }
}
@ -160,6 +160,7 @@ button,
.clickable
{
transition: background-color 200ms ease-out;
-webkit-transition: background-color 200ms ease-out;
}
button:hover,
.list-row:hover,
@ -171,6 +172,7 @@ button:hover,
.clickable-img
{
transition: opacity 200ms ease-out;
-webkit-transition: opacity 200ms ease-out;
}
.clickable-img:hover
{

View File

@ -8,17 +8,17 @@ module.exports = new Class
,check: function (callback)
{
this.tpvOrder = Vn.Hash.get ('tpvOrder');
this.tpvStatus = Vn.Hash.get ('tpvStatus');
this.tpvOrder = this.hash.get ('tpvOrder');
this.tpvStatus = this.hash.get ('tpvStatus');
if (this.tpvStatus)
{
var batch = new Sql.Batch ();
batch.addValue ('transaction', this.tpvOrder);
batch.addValue ('status', this.tpvStatus);
var query = 'CALL transactionEnd (#transaction, #status)';
this.conn.execQuery (query, null, batch);
var params = {
transaction: this.tpvOrder,
status: this.tpvStatus
};
this.conn.execQuery (query, null, params);
}
if (callback)
@ -35,10 +35,10 @@ module.exports = new Class
if (amount > 0)
{
var params = {
'amount': parseInt (amount)
,'urlOk': this._makeUrl ('ok')
,'urlKo': this._makeUrl ('ko')
,'company': company
amount: parseInt (amount)
,urlOk: this._makeUrl ('ok')
,urlKo: this._makeUrl ('ko')
,company: company
};
this.conn.send ('tpv/transaction', params,
@ -48,7 +48,7 @@ module.exports = new Class
Htk.Toast.showError (_('AmountError'));
}
,_onTransactionStart: function (json, error)
,_onTransactionStart: function (json)
{
if (json)
{
@ -59,9 +59,9 @@ module.exports = new Class
var fieldsMap =
{
'Ds_SignatureVersion': 'HMAC_SHA256_V1'
,'Ds_MerchantParameters': json.params
,'Ds_Signature': json.signature
Ds_SignatureVersion: 'HMAC_SHA256_V1'
,Ds_MerchantParameters: json.params
,Ds_Signature: json.signature
};
for (var field in fieldsMap)
@ -83,15 +83,13 @@ module.exports = new Class
,retryPay: function ()
{
var batch = new Sql.Batch ();
batch.addValue ('transaction', parseInt (this.tpvOrder));
var query = 'SELECT t.amount, m.company_id '
+'FROM tpv_transaction_view t '
+'JOIN tpv_merchant m ON t.merchant_id = m.id '
+'WHERE t.id = #transaction';
var params = {transaction: parseInt (this.tpvOrder)};
this.conn.execQuery (query,
this._onRetryPayDone.bind (this), batch);
this._onRetryPayDone.bind (this), params);
}
,_onRetryPayDone: function (resultSet)
@ -104,13 +102,13 @@ module.exports = new Class
Htk.Toast.showError (_('AmountError'));
}
,_makeUrl: function (status, order)
,_makeUrl: function (status)
{
var path = location.protocol +'//'+ location.host;
path += location.port ? ':'+ location.port : '';
path += location.pathname;
path += location.search ? location.search : '';
path += Vn.Hash.make ({
path += this.hash.make ({
'form': 'ecomerce/orders',
'tpvStatus': status,
'tpvOrder': '%s'

View File

@ -5,7 +5,6 @@ module.exports = new Class
({
Extends: Widget
,Tag: 'htk-field'
,Child: 'param'
,Properties:
{
value:
@ -22,7 +21,7 @@ module.exports = new Class
this.valueChanged (x);
this.putValue (x);
}
,get: function (x)
,get: function ()
{
return this._value;
}
@ -56,22 +55,22 @@ module.exports = new Class
return this._editable;
}
},
form:
lot:
{
type: Db.Iterator
,set: function (x)
{
this._form = x;
this.bindToForm ();
this._lot = x;
this.bindToLot ();
}
},
column:
name:
{
type: String
,set: function (x)
{
this._paramName = x;
this.bindToForm ();
this.bindToLot ();
}
},
conditionalFunc:
@ -97,13 +96,13 @@ module.exports = new Class
}
}
,bindToForm: function ()
,bindToLot: function ()
{
if (this._form && this._paramName)
this.param = new Db.Param
if (this._lot && this._paramName)
this.param = new Vn.Param
({
form: this._form
,column: this._paramName
lot: this._lot
,name: this._paramName
});
}

View File

@ -1,169 +0,0 @@
var Object = require ('./object');
var Value = require ('./value');
/**
* A map container for many Sql.Object
*/
module.exports = new Class
({
Extends: Object
,Tag: 'sql-batch'
,Properties:
{
blocked:
{
type: Boolean
,set: function (x)
{
this._blocked = x;
}
,get: function ()
{
return this._blocked;
}
}
}
,objects: {}
,_blocked: false
,loadXml: function (builder, node)
{
this.parent (builder, node);
var childs = node.childNodes;
for (var i = 0; i < childs.length; i++)
if (childs[i].tagName && childs[i].tagName.toLowerCase () == 'item')
{
var object;
var id = childs[i].getAttribute ('name');
if (id)
{
if (object = builder.getById (childs[i].getAttribute ('param')))
this.addParam (id, object);
else if (object = builder.getById (childs[i].getAttribute ('object')))
this.addObject (id, object);
}
}
}
,get: function (id)
{
if (this.objects[id])
return this.objects[id];
return null;
}
,add: function (id)
{
if (!this.objects[id])
this.objects[id] = null;
}
,_addObject: function (id, object)
{
this.remove (id);
this.objects[id] = object;
object.on ('changed', this.emitChanged, this);
this.emitChanged ();
}
,addObject: function (id, object)
{
this._addObject (id, object.ref ());
}
,addValue: function (id, value)
{
this._addObject (id,
new Value ({value: value}));
}
,addValues: function (values)
{
for (var id in values)
this.addValue (id, values[id]);
}
,addParam: function (id, param)
{
this._addObject (id,
new Value ({param: param}));
}
,getValue: function (id)
{
var object = this.objects[id];
if (object instanceof Value)
return object.value;
return null;
}
,addParams: function (params)
{
for (var id in params)
this.addParam (id, params[id]);
}
,remove: function (id)
{
if (this.objects[id])
{
this._unrefObject (this.objects[id]);
delete this.objects[id];
}
}
,block: function ()
{
this._blocked = true;
}
,unblock: function ()
{
this._blocked = false;
}
,emitChanged: function ()
{
if (!this._blocked)
this.signalEmit ('changed');
}
,changed: function ()
{
this.signalEmit ('changed');
}
,isReady: function ()
{
for (var id in this.objects)
if (!(this.objects[id] && this.objects[id].isReady ()))
return false;
return true;
}
,_unrefObject: function (object)
{
if (object)
{
object.disconnect ('changed', this.emitChanged, this);
object.unref ();
}
}
,_destroy: function ()
{
for (var id in this.objects)
this._unrefObject (this.objects[id]);
this.parent ();
}
});

View File

@ -1,12 +1,13 @@
var Object = require ('./object');
var SqlObject = require ('./object');
var Value = require ('./value');
/**
* A holder for another object.
*/
module.exports = new Class
({
Extends: Object
Extends: SqlObject
,Properties:
{
id:
@ -16,12 +17,21 @@ module.exports = new Class
}
}
,render: function (batch)
,render: function (params)
{
var object;
if (batch && (object = batch.get (this.id)))
return object.render (batch);
if (params && (object = params[this.id]))
{
if (!(object instanceof SqlObject))
{
var sqlValue = new Value ();
sqlValue.value = object;
return sqlValue.render ();
}
else
return object.render (params);
}
return '#'+ this.id;
}

View File

@ -8,10 +8,10 @@ module.exports = new Class
/**
* Renders the object as an SQL string.
*
* @param {Sql.Batch} batch The batch used to render the object
* @param {Object} params The params used to render the object
* @return {String} The SQL string
*/
,render: function (batch) {}
,render: function () {}
/**
* Gets if the object is ready to be rendered.
@ -26,7 +26,7 @@ module.exports = new Class
/**
* Through the query looking for containers and adds it to the batch.
*
* @return {Sql.Batch} batch The batch
* @return {Object} The found statement parameters
*/
,findHolders: function (batch) {}
,findHolders: function () {}
});

View File

@ -4,7 +4,6 @@ require ('vn/vn');
Sql = module.exports = {
Object : require ('./object')
,Holder : require ('./holder')
,Batch : require ('./batch')
,List : require ('./list')
,Expr : require ('./expr')
,Value : require ('./value')

View File

@ -1,11 +1,11 @@
var Object = require ('./object');
var Set = require ('./set');
var Lot = require ('./lot');
module.exports = new Class
({
Extends: Object
,Implements: Set
,Implements: Lot
,Tag: 'vn-basic-set'
,Properties:
{

View File

@ -1,15 +0,0 @@
var Object = require ('./object');
/**
* Class to handle the URL.
*/
module.exports = new Class
({
Extends: Object
,changed: function ()
{
this.signalEmit ('changed');
}
});

View File

@ -1,138 +0,0 @@
var Object = require ('./object');
var Param = require ('./param');
var Hash = require ('./hash');
var Type = require ('./type');
var VnDate = require ('./date');
module.exports = new Class
({
Extends: Object
,Tag: 'vn-hash-param'
,Child: 'param'
,Properties:
{
param:
{
type: Param
,set: function (x)
{
this.link ({_param: x}, {'changed': this._onParamChange});
this._refreshParam ();
}
,get: function ()
{
return this._param;
}
},
key:
{
type: String
,set: function (x)
{
this._key = x;
this._onHashChange ();
}
,get: function ()
{
return this._key;
}
},
value:
{
type: Object
,set: function (x)
{
this._setValue (x, true);
}
,get: function ()
{
return this._value;
}
},
type:
{
type: Type
,set: function (x)
{
this._type = x;
this._onHashChange ();
}
,get: function ()
{
return this._type;
}
}
}
,_hashLock: false
,_paramLock: false
,_value: undefined
,_key: null
,_type: null
,initialize: function (props)
{
this.parent (props);
var listener = Hash.getListener ();
this.link ({_listener: listener}, {'changed': this._onHashChange});
this._onHashChange ();
}
,_onHashChange: function ()
{
if (this._hashLock || !this._key || !this._listener)
return;
var newValue = Hash.get (this._key, this._type);
this._hashLock = true;
this._setValue (newValue, true);
this._hashLock = false;
}
,_setValue: function (newValue, signal)
{
if (newValue == this._value)
return;
this._value = newValue;
if (this._key && !this._hashLock)
{
this._hashLock = true;
var map = {};
map[this._key] = newValue;
Hash.add (map);
this._hashLock = false;
}
this._refreshParam ();
if (signal)
this.signalEmit ('changed', newValue);
}
,_refreshParam: function ()
{
if (this._param && !this._paramLock)
{
this._paramLock = true;
this._param.value = this._value;
this._paramLock = false;
}
}
,_onParamChange: function ()
{
if (this._paramLock)
return;
this._paramLock = true;
this._setValue (this._param.value);
this._paramLock = false;
}
});

View File

@ -1,58 +1,78 @@
var HashListener = require ('./hash-listener');
var VnObject = require ('./object');
var VnDate = require ('./date');
var Lot = require ('./lot');
/**
* Class to handle the URL.
*/
module.exports =
{
_hash: null
,_hashMap: {}
,_listener: null
module.exports = new Class
({
Extends: VnObject
,Implements: Lot
,Properties: {
window:
{
type: Window
,set: function (x)
{
this._window = x;
x.addEventListener ('hashchange', this._hashChangedHandler);
this._hashChanged ();
}
,get: function ()
{
return this._window;
}
},
params:
{
type: Object
,set: function (x)
{
this.setAll (x);
}
,get: function ()
{
return this._hashMap;
}
}
}
,initialize: function ()
,initialize: function (props)
{
this._listener = new HashListener ();
this._hash = null;
this._hashMap = null;
this._window = null;
this._hashChangedHandler = this._hashChanged.bind (this);
window.addEventListener ('hashchange', this._hashChangedHandler);
this._hashChanged ();
this.parent (props);
}
,destroy: function ()
{
window.removeEventListener ('hashchange', this._hashChangedHandler);
}
,getListener: function ()
{
return this._listener;
}
/**
* Gets the hash part of the URL.
*
* @param {string} key The variable name
*/
,get: function (key, type)
{
return this.parseValue (this._hashMap[key], type);
}
,set: function (key, value)
{
var map = {};
map[key] = value;
this.assign (map);
}
/**
* Sets the hash part of the URL, respecting the current hash variables.
*
* @param {Object} map A key-value map
*/
,add: function (map)
,assign: function (map)
{
var newMap = this._hashMap;
for (var key in map)
newMap[key] = map[key];
this.set (newMap);
this.setAll (newMap);
}
/**
@ -60,7 +80,7 @@ module.exports =
*
* @param {Object} map A key-value map
*/
,set: function (map)
,setAll: function (map)
{
if (map)
for (var key in map)
@ -81,7 +101,7 @@ module.exports =
location.hash = newHash;
this._blockChanged = false;
this._listener.changed ();
this.changed ();
}
}
@ -106,7 +126,7 @@ module.exports =
if (hash.length > 2)
hash += '&';
hash += key +'='+ this.renderValue (map[key]);
hash += encodeURIComponent (key) +'='+ this.renderValue (map[key]);
}
return hash;
@ -127,12 +147,12 @@ module.exports =
var kvPair = kvPairs[i].split ('=', 2);
if (kvPair[0])
newMap[kvPair[0]] = decodeURIComponent (kvPair[1]);
newMap[decodeURIComponent (kvPair[0])] = decodeURIComponent (kvPair[1]);
}
this._hashMap = newMap;
this._hash = newHash;
this._listener.changed ();
this.changed ();
}
,renderValue: function (v)
@ -171,4 +191,11 @@ module.exports =
return v;
}
};
,_destroy: function ()
{
this._window.removeEventListener ('hashchange', this._hashChangedHandler);
this._window = null;
this.parent ();
}
});

View File

@ -1,71 +1,157 @@
var Object = require ('./object');
var Param = require ('./param');
var Value = require ('./value');
var VnObject = require ('./object');
var Lot = require ('./lot');
var Type = require ('./type');
/**
* Simply a linkable value holder.
*/
module.exports = new Class
({
Extends: Object
Extends: VnObject
,Tag: 'vn-param'
,Child: 'param'
,Properties:
{
value:
param:
{
type: Object
,set: function (x)
{
this.link ({_param: x}, {'changed': this._onParamChange});
this._refreshParam ();
}
,get: function ()
{
return this._param;
}
},
key:
{
type: String
,set: function (x)
{
if (Value.compare (x, this._value))
return;
if (x instanceof Date)
x = x.clone ();
this._value = x;
if (this._master && !this.masterLock)
{
this.masterLock = true;
this._master.value = x;
this.masterLock = false;
}
this.signalEmit ('changed', this._value);
this._key = x;
this._onLotChange ();
}
,get: function ()
{
return this._key;
}
},
value:
{
type: Object
,set: function (x)
{
this._setValue (x, true);
}
,get: function ()
{
return this._value;
}
},
master:
type:
{
type: Param
type: Type
,set: function (x)
{
this.link ({_master: x}, {'changed': this._onMasterChange});
this._onMasterChange ();
this._type = x;
this._onLotChange ();
}
,get: function ()
{
return this._master;
return this._type;
}
},
lot:
{
type: Lot
,set: function (x)
{
this.link ({_lot: x}, {'change': this._onLotChange});
this._onLotChange ();
}
,get: function ()
{
return this._lot;
}
},
/**
* Determines whether the link to the form is unidirectional, ie, a
* change in the lot updates the parameter but not vice versa.
*/
oneWay:
{
type: Boolean
,set: function (x)
{
this._oneWay = x;
}
,get: function ()
{
return this._oneWay;
}
}
}
,_lotLock: false
,_paramLock: false
,_value: undefined
,_master: null
,masterLock: false
,_lot: null
,_key: null
,_type: null
,_oneWay: false
,_onMasterChange: function ()
,_onLotChange: function ()
{
if (this.masterLock)
if (this._lotLock || !this._key || !this._lot)
return;
var newValue = this._lot.get (this._key, this._type);
this._lotLock = true;
this._setValue (newValue, true);
this._lotLock = false;
}
,_setValue: function (newValue, signal)
{
if (newValue == this._value)
return;
this.masterLock = true;
this.value = this._master.value;
this.masterLock = false;
if (newValue instanceof Date)
newValue = newValue.clone ();
this._value = newValue;
if (this._lot && this._key && !this._lotLock && !this._oneWay)
{
this._lotLock = true;
this._lot.set (this._key, newValue);
this._lotLock = false;
}
this._refreshParam ();
if (signal)
this.signalEmit ('changed', newValue);
}
,_refreshParam: function ()
{
if (this._param && !this._paramLock)
{
this._paramLock = true;
this._param.value = this._value;
this._paramLock = false;
}
}
,_onParamChange: function ()
{
if (this._paramLock)
return;
this._paramLock = true;
this._setValue (this._param.value);
this._paramLock = false;
}
});

View File

@ -12,12 +12,10 @@ Vn = module.exports = {
,Value : require ('./value')
,Url : require ('./url')
,Mutators : require ('./mutators')
,Set : require ('./set')
,BasicSet : require ('./basic-set')
,Param : require ('./param')
,HashListener : require ('./hash-listener')
,Lot : require ('./lot')
,BasicLot : require ('./basic-lot')
,Hash : require ('./hash')
,HashParam : require ('./hash-param')
,Param : require ('./param')
,Node : require ('./node')
,Builder : require ('./builder')
,JsonException : require ('./json-exception')

View File

@ -10,25 +10,25 @@
</vn-group>
<div id="report" class="sheet">
<h2>
<htk-text column="id" form="ticket"/>
<htk-text name"id" lot="ticket"/>
</h2>
<div class="header">
<p>
<htk-text form="ticket" column="consignee"/>
<htk-text lot="ticket" name"consignee"/>
</p>
<p>
<htk-text form="ticket" column="date" format="%D"/>
<htk-text lot="ticket" name"date" format="%D"/>
</p>
<p>
<htk-text form="ticket" column="name"/>
<htk-text lot="ticket" name"name"/>
</p>
<p>
<htk-text form="ticket" column="zip_code"/>
<htk-text form="ticket" column="city"/>
(<htk-text form="ticket" column="province"/>)
<htk-text lot="ticket" name"zip_code"/>
<htk-text lot="ticket" name"city"/>
(<htk-text lot="ticket" name"province"/>)
</p>
<p>
<t>Delivery</t> <htk-text form="ticket" column="Agencia"/>
<t>Delivery</t> <htk-text lot="ticket" name"Agencia"/>
</p>
</div>
<htk-grid>
@ -37,23 +37,23 @@
CALL clientTicketRowGet(#ticket)
</custom>
</db-model>
<htk-column-spin title="_Ref" column="item"/>
<htk-column-spin title="_Amount" column="amount"/>
<htk-column-text title="_Item" column="concept"/>
<htk-column-text title="_S1" column="Medida"/>
<htk-column-text title="_Cat" column="Categoria"/>
<htk-column-text title="_Color" column="Color"/>
<htk-column-spin title="_Price" column="price" unit="€" digits="2"/>
<htk-column-spin title="_Ref" name"item"/>
<htk-column-spin title="_Amount" name"amount"/>
<htk-column-text title="_Item" name"concept"/>
<htk-column-text title="_S1" name"Medida"/>
<htk-column-text title="_Cat" name"Categoria"/>
<htk-column-text title="_Color" name"Color"/>
<htk-column-spin title="_Price" name"price" unit="€" digits="2"/>
<htk-column-spin title="_Import" unit="€" digits="2" renderer="subtotalRenderer"/>
</htk-grid>
<div class="footer">
<p>
<t>Total</t>
<htk-text form="ticket" column="total" format="%.2d€"/>
<htk-text lot="ticket" name"total" format="%.2d€"/>
</p>
<p>
<t>Total + VAT</t>
<htk-text form="ticket" column="totalPlusVat" format="%.2d€"/>
<htk-text lot="ticket" name"totalPlusVat" format="%.2d€"/>
</p>
</div>
</div>

View File

@ -72,8 +72,8 @@ var devConfig = {
port: wpConfig.devServerPort,
headers: { "Access-Control-Allow-Origin": "*" },
stats: { chunks: false }
},
devtool: 'eval-source-map'
}/*,
devtool: 'eval-source-map'*/
};
var mrgConfig = devMode ? devConfig : prodConfig;