forked from verdnatura/hedera-web
Backup
This commit is contained in:
parent
a8b6dd4c1a
commit
125686307f
|
@ -14,14 +14,6 @@
|
|||
ON u.id = c.user_id
|
||||
</db-model>
|
||||
</db-form>
|
||||
<db-model id="addresses" updatable="true">
|
||||
SELECT a.id, a.consignee, p.name province,
|
||||
a.zip_code, a.city, a.name, a.active, c.Pais country
|
||||
FROM address_view a
|
||||
LEFT JOIN vn2008.province p ON a.province_id = p.province_id
|
||||
JOIN vn2008.Paises c ON c.Id = p.Paises_Id
|
||||
WHERE active
|
||||
</db-model>
|
||||
</vn-group>
|
||||
<h1 id="title">
|
||||
<t>Configuration</t>
|
||||
|
|
|
@ -108,29 +108,28 @@ Hedera.Catalog = new Class
|
|||
this.hideMenu ();
|
||||
}
|
||||
|
||||
,shouldRefresh: function ()
|
||||
,onLotChange: function ()
|
||||
{
|
||||
var params = this.params.$;
|
||||
|
||||
if (params.search)
|
||||
return true;
|
||||
|
||||
var refresh = params.realm && (
|
||||
function shouldRefresh (params)
|
||||
{
|
||||
return params.search ||
|
||||
params.realm && (
|
||||
params.type ||
|
||||
params.color ||
|
||||
params.origin ||
|
||||
params.category ||
|
||||
params.producer
|
||||
);
|
||||
|
||||
return refresh;
|
||||
}
|
||||
|
||||
,onLotChange: function ()
|
||||
{
|
||||
if (this.shouldRefresh ())
|
||||
function refreshItems ()
|
||||
{
|
||||
this.$('items').refresh ();
|
||||
}
|
||||
|
||||
if (shouldRefresh (this.params.$))
|
||||
{
|
||||
refreshItems ();
|
||||
this.hideMenu ();
|
||||
this.$('order').style.display = 'block';
|
||||
}
|
||||
|
@ -438,8 +437,14 @@ Vn.Filter = new Class
|
|||
,_onMouseDown: function ()
|
||||
{
|
||||
if (this._model && this._model.status === Db.Model.Status.CLEAN)
|
||||
{
|
||||
var params = {
|
||||
filter: this._filter
|
||||
};
|
||||
|
||||
this._model.refresh ();
|
||||
}
|
||||
}
|
||||
|
||||
,_onUnselectClick: function ()
|
||||
{
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
<db-model
|
||||
id="items"
|
||||
result-index="2"
|
||||
lot="params"
|
||||
filter="filter"
|
||||
lot="lot"
|
||||
auto-load="false">
|
||||
CREATE TEMPORARY TABLE tmp.bionic_calc
|
||||
(INDEX (item_id))
|
||||
|
@ -50,7 +50,7 @@
|
|||
SELECT a.Id_Article item_id
|
||||
FROM vn2008.Articles a
|
||||
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
|
||||
WHERE $filter;
|
||||
WHERE #filter;
|
||||
CALL bionic_calc ();
|
||||
SELECT a.Id_Article item_id, a.description, b.available, b.price,
|
||||
b.producer, a.Foto, a.Article, a.Categoria, a.Medida,
|
||||
|
@ -77,7 +77,6 @@
|
|||
FROM basket_item
|
||||
GROUP BY warehouse_id
|
||||
</db-query>
|
||||
<db-form id="card" model="items"/>
|
||||
<db-form id="card-extend">
|
||||
<db-model
|
||||
property="model"
|
||||
|
@ -212,6 +211,44 @@
|
|||
<div class="clear"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="order" class="order">
|
||||
<h2><t>Order by</t></h2>
|
||||
<select on-change="onOrderChange">
|
||||
<option value="D|relevancy" selected="true">
|
||||
<t>Relevancy</t>
|
||||
</option>
|
||||
<option value="A|Article">
|
||||
<t>Name</t>
|
||||
</option>
|
||||
<option value="A|price">
|
||||
<t>Lower price</t>
|
||||
</option>
|
||||
<option value="D|price">
|
||||
<t>Higher price</t>
|
||||
</option>
|
||||
<option value="A|available">
|
||||
<t>Available</t>
|
||||
</option>
|
||||
<option value="A|Medida">
|
||||
<t>Lower size</t>
|
||||
</option>
|
||||
<option value="D|Medida">
|
||||
<t>Higher size</t>
|
||||
</option>
|
||||
<option value="A|color">
|
||||
<t>Color</t>
|
||||
</option>
|
||||
<option value="A|producer">
|
||||
<t>Producer</t>
|
||||
</option>
|
||||
<option value="A|Abreviatura">
|
||||
<t>Origin</t>
|
||||
</option>
|
||||
<option value="A|Categoria">
|
||||
<t>Category</t>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="realm-msg" class="realm-msg">
|
||||
<h1><t>Choose a realm</t></h1>
|
||||
</div>
|
||||
|
@ -305,44 +342,6 @@
|
|||
</db-model>
|
||||
</vn-filter>
|
||||
</div>
|
||||
<div id="order" class="order">
|
||||
<h2><t>Order by</t></h2>
|
||||
<select on-change="onOrderChange">
|
||||
<option value="D|relevancy" selected="true">
|
||||
<t>Relevancy</t>
|
||||
</option>
|
||||
<option value="A|Article">
|
||||
<t>Name</t>
|
||||
</option>
|
||||
<option value="A|price">
|
||||
<t>Lower price</t>
|
||||
</option>
|
||||
<option value="D|price">
|
||||
<t>Higher price</t>
|
||||
</option>
|
||||
<option value="A|available">
|
||||
<t>Available</t>
|
||||
</option>
|
||||
<option value="A|Medida">
|
||||
<t>Lower size</t>
|
||||
</option>
|
||||
<option value="D|Medida">
|
||||
<t>Higher size</t>
|
||||
</option>
|
||||
<option value="A|color">
|
||||
<t>Color</t>
|
||||
</option>
|
||||
<option value="A|producer">
|
||||
<t>Producer</t>
|
||||
</option>
|
||||
<option value="A|Abreviatura">
|
||||
<t>Origin</t>
|
||||
</option>
|
||||
<option value="A|Categoria">
|
||||
<t>Category</t>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<htk-popup id="desc-popup">
|
||||
|
@ -355,6 +354,7 @@
|
|||
id="card-popup"
|
||||
modal="true"
|
||||
on-closed="onPopupClose">
|
||||
<db-form id="card" model="items"/>
|
||||
<div property="child-node" class="item-card">
|
||||
<div class="top">
|
||||
<htk-image
|
||||
|
|
|
@ -3,6 +3,19 @@ Hedera.Invoices = new Class
|
|||
({
|
||||
Extends: Hedera.Form
|
||||
|
||||
,activate: function ()
|
||||
{
|
||||
var params = this.params;
|
||||
|
||||
if (!params.$.from)
|
||||
{
|
||||
var from = new Date ();
|
||||
from.setDate (from.getDate () - 30);
|
||||
from.setHours (0, 0, 0, 0);
|
||||
params.assign ({from: from});
|
||||
}
|
||||
}
|
||||
|
||||
,onDownloadClick: function (column, invoiceId)
|
||||
{
|
||||
if (!invoiceId)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"Invoices": "Factures"
|
||||
|
||||
,"Show invoices from": "Mostra factures desde"
|
||||
|
||||
,"Serial": "Sèrie"
|
||||
,"Date": "Data"
|
||||
,"Import": "Import"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"Invoices": "Invoices"
|
||||
|
||||
,"Show invoices from": "Show invoices from"
|
||||
|
||||
,"Serial": "Serial"
|
||||
,"Date": "Date"
|
||||
,"Import": "Import"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"Invoices": "Facturas"
|
||||
|
||||
,"Show invoices from": "Mostrar facturas desde"
|
||||
|
||||
,"Serial": "Serie"
|
||||
,"Date": "Fecha"
|
||||
,"Import": "Importe"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"Invoices": "Factures"
|
||||
|
||||
,"Show invoices from": "Afficher les factures de"
|
||||
|
||||
,"Serial": "Série"
|
||||
,"Date": "Date"
|
||||
,"Import": "Montant"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"Invoices": "Invoices"
|
||||
|
||||
,"Show invoices from": "Show invoices from"
|
||||
|
||||
,"Serial": "Serial"
|
||||
,"Date": "Date"
|
||||
,"Import": "Import"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"Invoices": "Factura"
|
||||
|
||||
,"Show invoices from": "Mostrar facturas de"
|
||||
|
||||
,"Serial": "Serie"
|
||||
,"Date": "Data"
|
||||
,"Import": "Importe"
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
<vn>
|
||||
<vn-lot-query id="params">
|
||||
<vn-spec name="from" type="Date"/>
|
||||
</vn-lot-query>
|
||||
<h1 id="title">
|
||||
<t>Invoices</t>
|
||||
</h1>
|
||||
<div id="main" class="invoices">
|
||||
<div class="card">
|
||||
<div class="card form">
|
||||
<div>
|
||||
<label><t>Show invoices from</t></label>
|
||||
<htk-date-chooser lot="params" name="from"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<htk-grid show-header="false">
|
||||
<db-model property="model" id="tickets">
|
||||
<db-model property="model" lot="params">
|
||||
SELECT invoice_id, serial_num, issued, amount
|
||||
FROM invoice_view
|
||||
WHERE issued >= #from
|
||||
ORDER BY issued DESC
|
||||
LIMIT 100
|
||||
</db-model>
|
||||
<htk-column-text title="_Serial" column="serial_num"/>
|
||||
<htk-column-date title="_Date" column="issued" format="_%e %b %Y"/>
|
||||
|
@ -23,5 +31,4 @@
|
|||
</htk-grid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</vn>
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
,"Pending": "Pendent"
|
||||
,"PayOrder": "Pagar encàrrec"
|
||||
|
||||
,"AmountToPay:": "Quantitat a pagar (€):"
|
||||
,"AmountError": "La quantitat ha de ser un nombre positiu i inferior o igual a l'import pendent"
|
||||
,"PayError": "Error al realitzar el pagament"
|
||||
|
||||
,"An error has been in the payment": "Sembla que hi ha hagut un error en el pagament"
|
||||
,"Retry": "Reintenta"
|
||||
,"Accept": "Acceptar"
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
,"Pending": "Pending"
|
||||
,"PayOrder": "Pay order"
|
||||
|
||||
,"AmountToPay:": "Amount to pay (€):"
|
||||
,"AmountError": "The amount must be a positive number less than or equal to the outstanding amount"
|
||||
,"PayError": "Failed to make the payment"
|
||||
|
||||
,"An error has been in the payment": "It seems that there has been an error in the payment"
|
||||
,"Retry": "Retry"
|
||||
,"Accept": "Accept"
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
,"Pending": "Pendiente"
|
||||
,"PayOrder": "Pagar pedido"
|
||||
|
||||
,"AmountToPay:": "Cantidad a pagar (€):"
|
||||
,"AmountError": "La cantidad debe ser un número positivo e inferior o igual al importe pendiente"
|
||||
,"PayError": "Error al realizar el pago"
|
||||
|
||||
,"An error has been in the payment": "Parece que ha habido un error en el pago"
|
||||
,"Retry": "Reintentar"
|
||||
,"Accept": "Aceptar"
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
,"Pending": "En attente"
|
||||
,"PayOrder": "Payer la commande"
|
||||
|
||||
,"AmountToPay:": "Montant à payer (€):"
|
||||
,"AmountError": "La quantité doit être un neméro positif et inférieur ou égal à la somme restant à payer"
|
||||
,"PayError": "Impossible d'effectuer le paiement"
|
||||
|
||||
,"An error has been in the payment": "Il semble qu'il ya eu une erreur dans le paiement"
|
||||
,"Retry": "Réessayez"
|
||||
,"Accept": "Accepter"
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
,"Pending": "Pending"
|
||||
,"PayOrder": "Pay order"
|
||||
|
||||
,"AmountToPay:": "Amount to pay (€):"
|
||||
,"AmountError": "The amount must be a positive number less than or equal to the outstanding amount"
|
||||
,"PayError": "Failed to make the payment"
|
||||
|
||||
,"An error has been in the payment": "It seems that there has been an error in the payment"
|
||||
,"Retry": "Retry"
|
||||
,"Accept": "Accept"
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
,"Pending": "Pendente"
|
||||
,"PayOrder": "Pagar pedido"
|
||||
|
||||
,"AmountToPay:": "Quantidade a pagar (€):"
|
||||
,"AmountError": "A quantidade deve ser um número positivo e inferior ou igual ao importe pendiente"
|
||||
,"PayError": "Erro ao realizar o pagamento"
|
||||
|
||||
,"An error has been in the payment": "Parece que não houve um erro no pagamento"
|
||||
,"Retry": "Tentar novamente"
|
||||
,"Accept": "Aceitar"
|
||||
|
|
|
@ -11,12 +11,14 @@ Hedera.Orders = new Class
|
|||
});
|
||||
this.tpv.check (this._onTpvCheck.bind (this));
|
||||
|
||||
if (!this.hash.get ('from'))
|
||||
var params = this.params;
|
||||
|
||||
if (!params.$.from)
|
||||
{
|
||||
var from = new Date ();
|
||||
from.setDate (from.getDate () - 30);
|
||||
from.setHours (0, 0, 0, 0);
|
||||
this.hash.assign ({from: from});
|
||||
params.assign ({from: from});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,10 +62,14 @@ Hedera.Orders = new Class
|
|||
if (amount !== null)
|
||||
defaultAmountStr = Vn.Value.format (amount, '%.2d');
|
||||
|
||||
amount = parseFloat (prompt (_('AmountToPay:'), defaultAmountStr));
|
||||
amount = prompt (_('AmountToPay:'), defaultAmountStr);
|
||||
|
||||
if (amount != null)
|
||||
{
|
||||
amount = parseFloat (amount.replace (',', '.'));
|
||||
this.tpv.pay (amount, null);
|
||||
}
|
||||
}
|
||||
|
||||
,onDialogResponse: function (dialog, response)
|
||||
{
|
||||
|
|
|
@ -60,15 +60,15 @@
|
|||
<p class="important">
|
||||
<htk-text lot="iter" name="date" format="%D"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="ticket_id"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="consignee"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="type"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="ticket_id"/>
|
||||
</p>
|
||||
</a>
|
||||
</custom>
|
||||
</htk-repeater>
|
||||
|
|
|
@ -87,6 +87,18 @@ Connection.implement
|
|||
return new Sql.String ({query: query}).render (params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an SQL statement object.
|
||||
*
|
||||
* @param {string} stmt The SQL statement
|
||||
* @param {Object} params The statement parameters
|
||||
* @return {string} The rendered statement
|
||||
*/
|
||||
,renderStmt: function (stmt, params)
|
||||
{
|
||||
return stmt.render (params);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parses a value to date.
|
||||
*/
|
||||
|
|
|
@ -278,14 +278,14 @@ Klass.implement
|
|||
this.query = child.textContent;
|
||||
}
|
||||
|
||||
,_getParams: function ()
|
||||
,_getLotParams: function ()
|
||||
{
|
||||
if (!this._stmt)
|
||||
return null;
|
||||
|
||||
var ids = this._stmt.findHolders ();
|
||||
var holders = this._stmt.findHolders ();
|
||||
|
||||
if (!ids)
|
||||
if (!holders)
|
||||
return null;
|
||||
|
||||
var lotParams = this._lot ? this._lot.params : {};
|
||||
|
@ -295,17 +295,17 @@ Klass.implement
|
|||
|
||||
var params = {};
|
||||
|
||||
for (var i = 0; i < ids.length; i++)
|
||||
params[ids[i]] = lotParams[ids[i]];
|
||||
for (var i = 0; i < holders.length; i++)
|
||||
params[holders[i]] = lotParams[holders[i]];
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
,_onLotChange: function ()
|
||||
{
|
||||
var params = this._getParams ();
|
||||
var lotParams = this._getLotParams ();
|
||||
|
||||
if (!Vn.Value.equals (params, this._lastParams))
|
||||
if (!Vn.Value.equals (lotParams, this._lastLotParams))
|
||||
this._autoLoad ();
|
||||
}
|
||||
|
||||
|
@ -321,11 +321,14 @@ Klass.implement
|
|||
{
|
||||
if (!this._stmt || !this._conn)
|
||||
return false;
|
||||
if (!params)
|
||||
|
||||
var holders = this._stmt.findHolders ();
|
||||
|
||||
if (!holders)
|
||||
return true;
|
||||
|
||||
for (var key in params)
|
||||
if (params[key] === undefined)
|
||||
for (var i = 0; i < holders.length; i++)
|
||||
if (params[holders[i]] === undefined)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -334,16 +337,22 @@ Klass.implement
|
|||
/**
|
||||
* Refresh the model data reexecuting the query on the database.
|
||||
*/
|
||||
,refresh: function ()
|
||||
,refresh: function (params)
|
||||
{
|
||||
var params = this._getParams ();
|
||||
var lotParams = this._getLotParams ();
|
||||
|
||||
if (this._isReady (params))
|
||||
var myParams = {};
|
||||
Object.assign (myParams, lotParams);
|
||||
Object.assign (myParams, params);
|
||||
|
||||
if (this._filter && (!params || params.filter === undefined))
|
||||
myParams.filter = this._filter;
|
||||
|
||||
if (this._isReady (myParams))
|
||||
{
|
||||
this._lastParams = params;
|
||||
this._lastLotParams = lotParams;
|
||||
this._setStatus (Status.LOADING);
|
||||
this._conn.execStmt (this._stmt, this._selectDone.bind (this),
|
||||
this._lot ? this._lot.params : null);
|
||||
this._conn.execStmt (this._stmt, this._selectDone.bind (this), myParams);
|
||||
}
|
||||
else
|
||||
this.clean ();
|
||||
|
|
|
@ -60,4 +60,8 @@
|
|||
,"Configuration": "Configuració"
|
||||
,"Account": "Compte"
|
||||
,"Addresses": "Direccions"
|
||||
|
||||
,"AmountToPay:": "Quantitat a pagar (€):"
|
||||
,"AmountError": "La quantitat ha de ser un nombre positiu"
|
||||
,"PayError": "Error al realitzar el pagament"
|
||||
}
|
||||
|
|
|
@ -60,4 +60,8 @@
|
|||
,"Configuration": "Configuration"
|
||||
,"Account": "Account"
|
||||
,"Addresses": "Addresses"
|
||||
|
||||
,"AmountToPay:": "Amount to pay (€):"
|
||||
,"AmountError": "The amount must be a positive number"
|
||||
,"PayError": "Failed to make the payment"
|
||||
}
|
||||
|
|
|
@ -60,4 +60,8 @@
|
|||
,"Configuration": "Configuración"
|
||||
,"Account": "Cuenta"
|
||||
,"Addresses": "Direcciones"
|
||||
|
||||
,"AmountToPay:": "Cantidad a pagar (€):"
|
||||
,"AmountError": "La cantidad debe ser un número positivo"
|
||||
,"PayError": "Error al realizar el pago"
|
||||
}
|
||||
|
|
|
@ -60,4 +60,8 @@
|
|||
,"Configuration": "Configuration"
|
||||
,"Account": "Compte"
|
||||
,"Addresses": "Adresses"
|
||||
|
||||
,"AmountToPay:": "Montant à payer (€):"
|
||||
,"AmountError": "La quantité doit être un neméro positif"
|
||||
,"PayError": "Impossible d'effectuer le paiement"
|
||||
}
|
||||
|
|
|
@ -60,4 +60,8 @@
|
|||
,"Configuration": "Тохиргоо"
|
||||
,"Account": "Дансны"
|
||||
,"Addresses": "хаягууд"
|
||||
|
||||
,"AmountToPay:": "Amount to pay (€):"
|
||||
,"AmountError": "The amount must be a positive number"
|
||||
,"PayError": "Failed to make the payment"
|
||||
}
|
||||
|
|
|
@ -60,4 +60,8 @@
|
|||
,"Configuration": "Configuração"
|
||||
,"Account": "Conta"
|
||||
,"Addresses": "Endereços"
|
||||
|
||||
,"AmountToPay:": "Quantidade a pagar (€):"
|
||||
,"AmountError": "A quantidade deve ser um número positivo"
|
||||
,"PayError": "Erro ao realizar o pagamento"
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = new Class
|
|||
|
||||
,_realPpay: function (amount, company)
|
||||
{
|
||||
if (amount > 0)
|
||||
if (isNumeric (amount) && amount > 0)
|
||||
{
|
||||
var params = {
|
||||
amount: parseInt (amount)
|
||||
|
@ -44,7 +44,7 @@ module.exports = new Class
|
|||
this.conn.send ('tpv/transaction', params,
|
||||
this._onTransactionStart.bind (this));
|
||||
}
|
||||
else if (!isNaN (amount))
|
||||
else
|
||||
Htk.Toast.showError (_('AmountError'));
|
||||
}
|
||||
|
||||
|
@ -52,27 +52,22 @@ module.exports = new Class
|
|||
{
|
||||
if (json)
|
||||
{
|
||||
var postValues = json.postValues;
|
||||
|
||||
var form = document.createElement ('form');
|
||||
form.method = 'post';
|
||||
form.action = json.url;
|
||||
document.body.appendChild (form);
|
||||
|
||||
var fieldsMap =
|
||||
{
|
||||
Ds_SignatureVersion: 'HMAC_SHA256_V1'
|
||||
,Ds_MerchantParameters: json.params
|
||||
,Ds_Signature: json.signature
|
||||
};
|
||||
|
||||
for (var field in fieldsMap)
|
||||
for (var field in postValues)
|
||||
{
|
||||
var input = document.createElement ('input');
|
||||
input.type = 'hidden';
|
||||
input.name = field;
|
||||
form.appendChild (input);
|
||||
|
||||
if (fieldsMap[field])
|
||||
input.value = fieldsMap[field];
|
||||
if (postValues[field])
|
||||
input.value = postValues[field];
|
||||
}
|
||||
|
||||
form.submit ();
|
||||
|
@ -118,3 +113,7 @@ module.exports = new Class
|
|||
}
|
||||
});
|
||||
|
||||
function isNumeric (n)
|
||||
{
|
||||
return !isNaN (parseFloat(n)) && isFinite (n);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
|
||||
var ColumnText = require ('../column/text');
|
||||
|
||||
var nativeEvents = {
|
||||
'click' : 1
|
||||
,'mousedown' : 1
|
||||
,'focusout' : 1
|
||||
};
|
||||
|
||||
module.exports = new Class
|
||||
({
|
||||
Extends: Htk.Field
|
||||
|
@ -150,15 +144,6 @@ module.exports = new Class
|
|||
button.addEventListener ('mousedown', this._onButtonMouseDown.bind (this));
|
||||
}
|
||||
|
||||
,on: function (id, callback, instance)
|
||||
{
|
||||
if (nativeEvents[id] !== undefined)
|
||||
this.node.addEventListener (id,
|
||||
callback.bind (instance, this));
|
||||
else
|
||||
this.parent (id, callback, instance);
|
||||
}
|
||||
|
||||
,_setRow: function (row)
|
||||
{
|
||||
this._row = row;
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
|
||||
var NodeBuilder = require ('./node-builder');
|
||||
|
||||
var nativeEvents = {
|
||||
'click' : 1
|
||||
,'mousedown' : 1
|
||||
,'focusout' : 1
|
||||
};
|
||||
|
||||
module.exports = new Class
|
||||
({
|
||||
Extends: NodeBuilder
|
||||
|
@ -45,6 +51,15 @@ module.exports = new Class
|
|||
this.parent (props);
|
||||
}
|
||||
|
||||
,on: function (id, callback, instance)
|
||||
{
|
||||
if (nativeEvents[id])
|
||||
this.node.addEventListener (id,
|
||||
callback.bind (instance, this));
|
||||
else
|
||||
this.parent (id, callback, instance);
|
||||
}
|
||||
|
||||
,createRoot: function (tagName)
|
||||
{
|
||||
return this._node = this.createElement (tagName);
|
||||
|
|
|
@ -19,18 +19,18 @@ module.exports = new Class
|
|||
|
||||
,regexp: /#\w+/g
|
||||
|
||||
,replaceFunc: function (params, token)
|
||||
{
|
||||
var holder = new Holder ({id: token.substr (1)});
|
||||
return holder.render (params);
|
||||
}
|
||||
|
||||
,render: function (params)
|
||||
{
|
||||
if (!this.query)
|
||||
return null;
|
||||
|
||||
return this.query.replace (this.regexp, this.replaceFunc.bind (this, params));
|
||||
function replaceFunc (token)
|
||||
{
|
||||
var holder = new Holder ({id: token.substr (1)});
|
||||
return holder.render (params);
|
||||
}
|
||||
|
||||
return this.query.replace (this.regexp, replaceFunc);
|
||||
}
|
||||
|
||||
,findHolders: function ()
|
||||
|
|
184
js/vn/value.js
184
js/vn/value.js
|
@ -1,6 +1,103 @@
|
|||
|
||||
var VnDate = require ('./date');
|
||||
|
||||
/**
|
||||
* Clones a simple value. A simple value is any value that is not an array,
|
||||
* object or function. If non-simple value is passed, the same object reference
|
||||
* is returned.
|
||||
*
|
||||
* @param {*} value The value to be copied
|
||||
* @return {*} The value copy
|
||||
*/
|
||||
function simpleClone (value)
|
||||
{
|
||||
if (value instanceof Date)
|
||||
return value.clone ();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if two simple values are equal using the strict equality operator. For
|
||||
* information about simple values see simpleClone() function.
|
||||
*
|
||||
* @param {*} a Value to compare to
|
||||
* @param {*} b Value to compare with
|
||||
* @return {boolean} %true if they are equal, %false otherwise
|
||||
*/
|
||||
function simpleEquals (a, b)
|
||||
{
|
||||
if (a === b)
|
||||
return true;
|
||||
if (a instanceof Date && b instanceof Date)
|
||||
return a.getTime () === b.getTime ();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates differences between two simple key-value objects.
|
||||
*
|
||||
* @param {Object} orgObject Value to compare to
|
||||
* @param {Object} newObject Value to compare with
|
||||
* @return {Object} The differences or %null if there are no differences
|
||||
*/
|
||||
function diff (orgObject, newObject)
|
||||
{
|
||||
var diff = {};
|
||||
|
||||
for (var key in orgObject)
|
||||
if (!simpleEquals (orgObject[key], newObject[key]))
|
||||
diff[key] = simpleClone (newObject[key]);
|
||||
|
||||
for (var key in newObject)
|
||||
if (orgObject[key] === undefined && newObject[key] !== undefined)
|
||||
diff[key] = simpleClone (newObject[key]);
|
||||
|
||||
if (Object.keys (diff).length > 0)
|
||||
return diff;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates new differences between two simple key-value objects.
|
||||
*
|
||||
* @param {Object} orgObject Value to compare to
|
||||
* @param {Object} newObject Value to compare with
|
||||
* @return {Object} The differences or %null if there are no differences
|
||||
*/
|
||||
function partialDiff (orgObject, newObject)
|
||||
{
|
||||
var diff = {};
|
||||
|
||||
for (var key in newObject)
|
||||
if (!simpleEquals (orgObject[key], newObject[key]))
|
||||
diff[key] = simpleClone (newObject[key]);
|
||||
|
||||
if (Object.keys (diff).length > 0)
|
||||
return diff;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones a simple key-value object in wich properties are simple values. For
|
||||
* information about simple values see simpleClone() function.
|
||||
*
|
||||
* @param {*} object The object to be cloned
|
||||
* @return The cloned object
|
||||
*/
|
||||
function kvClone (object)
|
||||
{
|
||||
var copy = {};
|
||||
|
||||
for (var key in object)
|
||||
copy[key] = simpleClone (object[key]);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if two values are equal, it also checks objects. Basic values are
|
||||
* compared using the strict equality operator.
|
||||
|
@ -31,93 +128,6 @@ function equals (a, b)
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates differences between two key-value objects.
|
||||
*
|
||||
* @param {Object} orgObject Value to compare to
|
||||
* @param {Object} newObject Value to compare with
|
||||
* @return {Object} The differences or %null if there are no differences
|
||||
*/
|
||||
function diff (orgObject, newObject)
|
||||
{
|
||||
var diff = {};
|
||||
|
||||
for (var key in orgObject)
|
||||
if (!simpleEquals (orgObject[key], newObject[key]))
|
||||
diff[key] = simpleClone (newObject[key]);
|
||||
|
||||
for (var key in newObject)
|
||||
if (orgObject[key] === undefined && newObject[key] !== undefined)
|
||||
diff[key] = simpleClone (newObject[key]);
|
||||
|
||||
if (Object.keys (diff).length > 0)
|
||||
return diff;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates new differences between two key-value objects.
|
||||
*
|
||||
* @param {Object} orgObject Value to compare to
|
||||
* @param {Object} newObject Value to compare with
|
||||
* @return {Object} The differences or %null if there are no differences
|
||||
*/
|
||||
function partialDiff (orgObject, newObject)
|
||||
{
|
||||
var diff = {};
|
||||
|
||||
for (var key in newObject)
|
||||
if (!simpleEquals (orgObject[key], newObject[key]))
|
||||
diff[key] = simpleClone (newObject[key]);
|
||||
|
||||
if (Object.keys (diff).length > 0)
|
||||
return diff;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function kvClone (object)
|
||||
{
|
||||
var copy = {};
|
||||
|
||||
for (var key in object)
|
||||
copy[key] = simpleClone (object[key]);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a simple value.
|
||||
*
|
||||
* @param {*} value The value to be copied
|
||||
* @return {*} The value copy
|
||||
*/
|
||||
function simpleClone (value)
|
||||
{
|
||||
if (value instanceof Date)
|
||||
return value.clone ();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if two simple values are equal using the strict equality operator.
|
||||
*
|
||||
* @param {*} a Value to compare to
|
||||
* @param {*} b Value to compare with
|
||||
* @return {boolean} %true if they are equal, %false otherwise
|
||||
*/
|
||||
function simpleEquals (a, b)
|
||||
{
|
||||
if (a === b)
|
||||
return true;
|
||||
if (a instanceof Date && b instanceof Date)
|
||||
return a.getTime () === b.getTime ();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formated string.
|
||||
*
|
||||
|
|
10
package.json
10
package.json
|
@ -15,12 +15,12 @@
|
|||
"file-loader": "^0.9.0",
|
||||
"json-loader": "^0.5.4",
|
||||
"raw-loader": "^0.5.1",
|
||||
"style-loader": "^0.13.1",
|
||||
"style-loader": "^0.19.0",
|
||||
"url-loader": "^0.5.7",
|
||||
"webpack": "^3.0.0",
|
||||
"webpack-chunk-hash": "^0.4.0",
|
||||
"webpack-dev-server": "^2.5.0",
|
||||
"webpack-merge": "^3.0.0"
|
||||
"webpack": "^3.6.0",
|
||||
"webpack-chunk-hash": "^0.5.0",
|
||||
"webpack-dev-server": "^2.9.1",
|
||||
"webpack-merge": "^4.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"mootools": "^1.5.2",
|
||||
|
|
|
@ -44,12 +44,17 @@ class Transaction extends Vn\Web\JsonRequest
|
|||
$key = mcrypt_encrypt (MCRYPT_3DES, $key, $transactionId, MCRYPT_MODE_CBC, $iv);
|
||||
|
||||
$signature = base64_encode (hash_hmac ('sha256', $encodedParams, $key, TRUE));
|
||||
|
||||
$url = $row['url'];
|
||||
$postValues = [
|
||||
'Ds_SignatureVersion' => 'HMAC_SHA256_V1'
|
||||
,'Ds_MerchantParameters' => $encodedParams
|
||||
,'Ds_Signature' => $signature
|
||||
];
|
||||
|
||||
return [
|
||||
'url' => $url
|
||||
,'params' => $encodedParams
|
||||
,'signature' => $signature
|
||||
,'postValues' => $postValues
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,10 @@ var baseConfig = {
|
|||
new webpack.optimize.CommonsChunkPlugin ({
|
||||
names: ['vendor', 'manifest']
|
||||
})
|
||||
]
|
||||
],
|
||||
watchOptions: {
|
||||
ignored: /node_modules/
|
||||
}
|
||||
};
|
||||
|
||||
var prodConfig = {
|
||||
|
|
Loading…
Reference in New Issue