Various fixes
This commit is contained in:
parent
fe68eb5ce0
commit
37236b6bb0
|
@ -6,6 +6,19 @@ Hedera.Conf = new Class
|
||||||
,activate: function ()
|
,activate: function ()
|
||||||
{
|
{
|
||||||
this.$.userModel.setInfo ('c', 'customer_view', 'hedera');
|
this.$.userModel.setInfo ('c', 'customer_view', 'hedera');
|
||||||
|
|
||||||
|
if (this.hash.$.changePass)
|
||||||
|
this.onPassChangeClick ();
|
||||||
|
}
|
||||||
|
|
||||||
|
,onChangePassOpen: function ()
|
||||||
|
{
|
||||||
|
this.hash.assign ({changePass: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
,onChangePassClose: function ()
|
||||||
|
{
|
||||||
|
this.hash.assign ({changePass: undefined});
|
||||||
}
|
}
|
||||||
|
|
||||||
,onPassChangeClick: function ()
|
,onPassChangeClick: function ()
|
||||||
|
@ -17,11 +30,16 @@ Hedera.Conf = new Class
|
||||||
var recoverPass = this.$.user.get ('recoverPass');
|
var recoverPass = this.$.user.get ('recoverPass');
|
||||||
this.$.oldPassword.style.display = recoverPass ? 'none' : 'block';
|
this.$.oldPassword.style.display = recoverPass ? 'none' : 'block';
|
||||||
this.$.changePassword.show ();
|
this.$.changePassword.show ();
|
||||||
|
|
||||||
|
var focusInput;
|
||||||
|
|
||||||
if (recoverPass)
|
if (recoverPass)
|
||||||
this.$.newPassword.focus ();
|
focusInput = this.$.newPassword;
|
||||||
else
|
else
|
||||||
this.$.oldPassword.focus ();
|
focusInput = this.$.oldPassword;
|
||||||
|
|
||||||
|
focusInput.focus ();
|
||||||
|
focusInput.select ();
|
||||||
}
|
}
|
||||||
|
|
||||||
,onPassModifyClick: function ()
|
,onPassModifyClick: function ()
|
||||||
|
|
|
@ -11,9 +11,10 @@
|
||||||
|
|
||||||
.pass-info
|
.pass-info
|
||||||
{
|
{
|
||||||
width: 15em;
|
max-width: 17em;
|
||||||
}
|
}
|
||||||
.pass-info ul
|
.pass-info ul
|
||||||
{
|
{
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
padding-left: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,17 @@
|
||||||
<htk-entry lot="user" name="email"></htk-entry>
|
<htk-entry lot="user" name="email"></htk-entry>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="mail">_Receive invoices by email</label>
|
<span>
|
||||||
<htk-check lot="user" name="mail"/>
|
<htk-check id="mail" lot="user" name="mail"/>
|
||||||
|
<label for="mail">_Receive invoices by email</label>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<htk-popup
|
<htk-popup
|
||||||
id="change-password"
|
id="change-password"
|
||||||
|
on-open="onChangePassOpen"
|
||||||
|
on-closed="onChangePassClose"
|
||||||
modal="true">
|
modal="true">
|
||||||
<div property="child-node" class="htk-dialog pass-change">
|
<div property="child-node" class="htk-dialog pass-change">
|
||||||
<div>
|
<div>
|
||||||
|
@ -82,19 +86,19 @@
|
||||||
</h3>
|
</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<htk-text lot="password-form" name="length"/> _characters long
|
{{passwordForm.length}} <span>_characters long</span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<htk-text lot="password-form" name="nAlpha"/> _alphabetic characters
|
{{passwordForm.nAlpha}} <span>_alphabetic characters</span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<htk-text lot="password-form" name="nUpper"/> _capital letters
|
{{passwordForm.nUpper}} <span>_capital letters</span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<htk-text lot="password-form" name="nDigits"/> _digits
|
{{passwordForm.nDigits}} <span>_digits</span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<htk-text lot="password-form" name="nPunct"/> _symbols
|
{{passwordForm.nPunct}} <span>_symbols</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="main" class="home">
|
<div id="main" class="home">
|
||||||
<div class="column mansonry">
|
<div class="column mansonry">
|
||||||
<htk-repeater>
|
<htk-repeater form-id="new">
|
||||||
<db-model property="model">
|
<db-model property="model">
|
||||||
SELECT title, text, image, id FROM news
|
SELECT title, text, image, id FROM news
|
||||||
WHERE tag != 'course'
|
WHERE tag != 'course'
|
||||||
|
@ -21,15 +21,15 @@
|
||||||
<div class="masonry-box">
|
<div class="masonry-box">
|
||||||
<div class="new">
|
<div class="new">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<h2>{{title}}</h2>
|
<h2>{{new.title}}</h2>
|
||||||
<div class="new-text">
|
<div class="new-text">
|
||||||
<htk-html value="{{text}}"/>
|
<htk-html value="{{new.text}}"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<htk-image
|
<htk-image
|
||||||
directory="news"
|
directory="news"
|
||||||
subdir="full"
|
subdir="full"
|
||||||
value="{{image}}"
|
value="{{new.image}}"
|
||||||
editable="false"
|
editable="false"
|
||||||
full-dir="full"/>
|
full-dir="full"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<div>
|
||||||
|
<h3 class="marker">{{title}}</h3>
|
||||||
|
<p>
|
||||||
|
{{address}}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{postcode}} {{city}}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{province}}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{phone}}
|
||||||
|
</p>
|
||||||
|
</div>
|
|
@ -1,5 +1,8 @@
|
||||||
|
|
||||||
|
var infoTpl = require (__dirname +'/info.xml');
|
||||||
|
|
||||||
var gmapsIsLoaded = false;
|
var gmapsIsLoaded = false;
|
||||||
|
var gmapsLoadedCallback;
|
||||||
|
|
||||||
Hedera.Location = new Class
|
Hedera.Location = new Class
|
||||||
({
|
({
|
||||||
|
@ -10,6 +13,9 @@ Hedera.Location = new Class
|
||||||
,activate: function ()
|
,activate: function ()
|
||||||
{
|
{
|
||||||
this.gui.loaderPush ();
|
this.gui.loaderPush ();
|
||||||
|
|
||||||
|
this.infoBuilder = new Vn.Builder();
|
||||||
|
this.infoBuilder.compileString (infoTpl);
|
||||||
|
|
||||||
var sql = 'SELECT lat, lng, title, address, postcode, city, province, phone, language FROM location';
|
var sql = 'SELECT lat, lng, title, address, postcode, city, province, phone, language FROM location';
|
||||||
this.conn.execQuery (sql, this.onLocationsDone.bind (this));
|
this.conn.execQuery (sql, this.onLocationsDone.bind (this));
|
||||||
|
@ -26,7 +32,7 @@ Hedera.Location = new Class
|
||||||
|
|
||||||
,onLocationsDone: function (resultSet)
|
,onLocationsDone: function (resultSet)
|
||||||
{
|
{
|
||||||
this.locations = resultSet.fetchResult ();
|
this.locations = resultSet.fetchArray ();
|
||||||
this.allLoaded ();
|
this.allLoaded ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,40 +56,20 @@ Hedera.Location = new Class
|
||||||
|
|
||||||
var div = this.$.form;
|
var div = this.$.form;
|
||||||
var gmap = new google.maps.Map (div, options);
|
var gmap = new google.maps.Map (div, options);
|
||||||
var row;
|
|
||||||
|
|
||||||
while (row = this.locations.fetchObject ())
|
locations.forEach (function (location) {
|
||||||
this.createMarker (row, gmap);
|
this.createMarker (location, gmap);
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
,createMarker: function (row, gmap)
|
,createMarker: function (location, gmap)
|
||||||
{
|
{
|
||||||
var div = document.createElement ('div');
|
var scope = this.infoBuilder.load (this.doc, this, null, null, location);
|
||||||
div.className = 'marker';
|
var div = scope.getMain ();
|
||||||
|
|
||||||
var h = document.createElement ('h3');
|
|
||||||
h.appendChild (document.createTextNode (row.title));
|
|
||||||
div.appendChild (h);
|
|
||||||
|
|
||||||
var p = document.createElement ('p');
|
|
||||||
p.appendChild (document.createTextNode (row.address));
|
|
||||||
div.appendChild (p);
|
|
||||||
|
|
||||||
var p = document.createElement ('p');
|
|
||||||
p.appendChild (document.createTextNode (row.postcode +' '+ row.city));
|
|
||||||
div.appendChild (p);
|
|
||||||
|
|
||||||
var p = document.createElement ('p');
|
|
||||||
p.appendChild (document.createTextNode (row.province));
|
|
||||||
div.appendChild (p);
|
|
||||||
|
|
||||||
var p = document.createElement ('p');
|
|
||||||
p.appendChild (document.createTextNode (row.phone));
|
|
||||||
div.appendChild (p);
|
|
||||||
|
|
||||||
var lat = new google.maps.LatLng (
|
var lat = new google.maps.LatLng (
|
||||||
row.lat,
|
location.lat,
|
||||||
row.lng
|
location.lng
|
||||||
);
|
);
|
||||||
|
|
||||||
var marker = new google.maps.Marker ({
|
var marker = new google.maps.Marker ({
|
||||||
|
@ -100,7 +86,7 @@ Hedera.Location = new Class
|
||||||
this.openInfoWindow.bind (this, infoWindow, gmap, marker));
|
this.openInfoWindow.bind (this, infoWindow, gmap, marker));
|
||||||
|
|
||||||
if (Vn.Locale.language
|
if (Vn.Locale.language
|
||||||
&& Vn.Locale.language == row.language)
|
&& Vn.Locale.language == location.language)
|
||||||
this.openInfoWindow (infoWindow, gmap, marker);
|
this.openInfoWindow (infoWindow, gmap, marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,17 +26,17 @@ Hedera.Basket = new Class
|
||||||
,onConfigureClick: function ()
|
,onConfigureClick: function ()
|
||||||
{
|
{
|
||||||
Htk.Toast.showWarning (_('RememberReconfiguringImpact'));
|
Htk.Toast.showWarning (_('RememberReconfiguringImpact'));
|
||||||
this.hash.setAll ({'form': 'ecomerce/checkout'});
|
this.hash.setAll ({form: 'ecomerce/checkout'});
|
||||||
}
|
}
|
||||||
|
|
||||||
,onCatalogClick: function ()
|
,onCatalogClick: function ()
|
||||||
{
|
{
|
||||||
this.hash.setAll ({'form': 'ecomerce/catalog'});
|
this.hash.setAll ({form: 'ecomerce/catalog'});
|
||||||
}
|
}
|
||||||
|
|
||||||
,onCheckoutClick: function ()
|
,onCheckoutClick: function ()
|
||||||
{
|
{
|
||||||
this.hash.setAll ({'form': 'ecomerce/confirm'});
|
this.hash.setAll ({form: 'ecomerce/confirm'});
|
||||||
}
|
}
|
||||||
|
|
||||||
,repeaterFunc: function (res, form)
|
,repeaterFunc: function (res, form)
|
||||||
|
|
|
@ -52,7 +52,7 @@ Hedera.Catalog = new Class
|
||||||
,deactivate: function ()
|
,deactivate: function ()
|
||||||
{
|
{
|
||||||
this.hideMenu ();
|
this.hideMenu ();
|
||||||
this.gui.$.topBar.style.backgroundColor = '';
|
this.gui.$.navbar.style.backgroundColor = '';
|
||||||
Vn.Node.remove (this.$.rightPanel);
|
Vn.Node.remove (this.$.rightPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ Hedera.Catalog = new Class
|
||||||
color = '#'+ realms.get (row, 'color');
|
color = '#'+ realms.get (row, 'color');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.gui.$.topBar.style.backgroundColor = color;
|
this.gui.$.navbar.style.backgroundColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
,refreshTitle: function ()
|
,refreshTitle: function ()
|
||||||
|
|
|
@ -137,29 +137,28 @@
|
||||||
full-dir="900x900"/>
|
full-dir="900x900"/>
|
||||||
<div class="item-info">
|
<div class="item-info">
|
||||||
<htk-button
|
<htk-button
|
||||||
lot="item"
|
value="{{item.item_id}}"
|
||||||
name="id"
|
|
||||||
tip="_AddToBasket"
|
tip="_AddToBasket"
|
||||||
icon="add"
|
icon="add"
|
||||||
on-click="onAddItemClick"
|
on-click="onAddItemClick(item.item_id)"
|
||||||
class="add-button"/>
|
class="add-button"/>
|
||||||
<h2>{{Article}}</h2>
|
<h2>{{item.Article}}</h2>
|
||||||
<p class="producer">
|
<p class="producer">
|
||||||
{{producer}}
|
{{item.producer}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@{{item_id}}
|
@{{item.item_id}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
_Size <htk-text lot="item" name="Medida"/>
|
<span>_Size</span> {{item.Medida}}
|
||||||
_Category <htk-text lot="item" name="Categoria"/>
|
<span>_Category</span> {{item.Categoria}}
|
||||||
</p>
|
</p>
|
||||||
<p class="color">
|
<p class="color">
|
||||||
_Color <htk-text lot="item" name="color"/>
|
<span>_Color</span> {{item.color}}
|
||||||
<htk-text lot="item" name="Tallos" format="_, %.0d Units"/>
|
<htk-text lot="item" name="Tallos" format="_, %.0d Units"/>
|
||||||
</p>
|
</p>
|
||||||
<div class="aval-price">
|
<div class="aval-price">
|
||||||
<htk-text lot="item" name="available"/>
|
{{item.available}}
|
||||||
<span class="from">
|
<span class="from">
|
||||||
_from
|
_from
|
||||||
</span>
|
</span>
|
||||||
|
@ -201,7 +200,7 @@
|
||||||
ORDER BY name
|
ORDER BY name
|
||||||
</db-model>
|
</db-model>
|
||||||
<custom>
|
<custom>
|
||||||
<a class="clickable" href="#!form={{form}}&realm={{id}}">
|
<a class="clickable" href="#!form={{hash.form}}&realm={{id}}">
|
||||||
<img
|
<img
|
||||||
src="image/family/light/{{id}}.svg"
|
src="image/family/light/{{id}}.svg"
|
||||||
title="{{name}}"
|
title="{{name}}"
|
||||||
|
@ -367,25 +366,25 @@
|
||||||
editable="true"/>
|
editable="true"/>
|
||||||
<div class="item-info">
|
<div class="item-info">
|
||||||
<h2>
|
<h2>
|
||||||
<htk-text lot="card" name="Article"/>
|
{{card.Article}}
|
||||||
</h2>
|
</h2>
|
||||||
<p class="producer">
|
<p class="producer">
|
||||||
<htk-text lot="card" name="producer"/>
|
{{card.producer}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
_Size <htk-text lot="card" name="Medida"/>,
|
<span>_Size</span> {{card.Medida}},
|
||||||
_Category <htk-text lot="card" name="Categoria"/>
|
<span>_Category</span> {{card.categoria}}
|
||||||
</p>
|
</p>
|
||||||
<p class="color">
|
<p class="color">
|
||||||
_Color <htk-text lot="card" name="color"/>
|
<span>_Color</span> {{card.color}}
|
||||||
<htk-text lot="card" name="Tallos" format="_, %.0d Units"/>
|
<htk-text lot="card" name="Tallos" format="_, %.0d Units"/>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
_Origin <htk-text lot="card-extend" name="origin"/>
|
<span>_Origin</span> {{card.origin}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="desc">
|
<p class="desc">
|
||||||
<htk-text lot="card-extend" name="description" id="desc"/>
|
{{cardExtend.description}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<htk-grid class="lots-grid" model="item-lots" show-header="false">
|
<htk-grid class="lots-grid" model="item-lots" show-header="false">
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
(function () {
|
||||||
|
|
||||||
|
var methodsData = {
|
||||||
|
AGENCY: {
|
||||||
|
steps: ['method', 'date', 'address', 'agency', 'confirm'],
|
||||||
|
isDelivery: true,
|
||||||
|
textId: 'agencyText'
|
||||||
|
},
|
||||||
|
DELIVERY: {
|
||||||
|
steps: ['method', 'date', 'address', null, 'confirm'],
|
||||||
|
isDelivery: true,
|
||||||
|
textId: 'deliveryText'
|
||||||
|
},
|
||||||
|
PICKUP: {
|
||||||
|
steps: ['method', 'date', 'address', 'pickup', 'confirm'],
|
||||||
|
isDelivery: false,
|
||||||
|
textId: 'pickupText'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Hedera.Checkout = new Class
|
Hedera.Checkout = new Class
|
||||||
({
|
({
|
||||||
|
@ -28,7 +47,7 @@ Hedera.Checkout = new Class
|
||||||
if (orderForm.numRows > 0)
|
if (orderForm.numRows > 0)
|
||||||
{
|
{
|
||||||
var i = orderForm;
|
var i = orderForm;
|
||||||
date = i.get ('date_send');
|
date = i.$.date_send;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
var i = defaultsForm;
|
var i = defaultsForm;
|
||||||
|
@ -37,7 +56,7 @@ Hedera.Checkout = new Class
|
||||||
{
|
{
|
||||||
date = new Date ();
|
date = new Date ();
|
||||||
|
|
||||||
if (i.get('delivery_method') != 'PICKUP')
|
if (i.$.delivery_method != 'PICKUP')
|
||||||
date.setDate (date.getDate () + 1);
|
date.setDate (date.getDate () + 1);
|
||||||
|
|
||||||
date.setHours (0, 0, 0, 0);
|
date.setHours (0, 0, 0, 0);
|
||||||
|
@ -45,18 +64,16 @@ Hedera.Checkout = new Class
|
||||||
|
|
||||||
this.$.lot.assign ({
|
this.$.lot.assign ({
|
||||||
date: date,
|
date: date,
|
||||||
method: i.get ('delivery_method'),
|
method: i.$.delivery_method,
|
||||||
agency: i.get ('agency_id'),
|
agency: i.$.agency_id,
|
||||||
address: i.get ('address_id')
|
address: i.$.address_id
|
||||||
});
|
});
|
||||||
this.autoStepLocked = false;
|
this.autoStepLocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
,disableButtons: function (disable)
|
,disableButtons: function (disable)
|
||||||
{
|
{
|
||||||
this.$.confirmAgency.disabled = disable;
|
this.$.confirmButton.disabled = disable;
|
||||||
this.$.confirmDelivery.disabled = disable;
|
|
||||||
this.$.confirmPickup.disabled = disable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
,onConfirmClick: function ()
|
,onConfirmClick: function ()
|
||||||
|
@ -75,10 +92,8 @@ Hedera.Checkout = new Class
|
||||||
if (!resultSet.fetchResult ())
|
if (!resultSet.fetchResult ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.$.orderForm.numRows > 0)
|
var isUpdated = this.$.orderForm.numRows > 0;
|
||||||
Htk.Toast.showMessage (_('OrderUpdated'));
|
Htk.Toast.showMessage (_(isUpdated ? 'OrderUpdated' : 'OrderStarted'));
|
||||||
else
|
|
||||||
Htk.Toast.showMessage (_('OrderStarted'));
|
|
||||||
|
|
||||||
this.hash.setAll ({form: 'ecomerce/catalog'});
|
this.hash.setAll ({form: 'ecomerce/catalog'});
|
||||||
}
|
}
|
||||||
|
@ -88,55 +103,45 @@ Hedera.Checkout = new Class
|
||||||
if (this.$.orderForm.numRows > 0)
|
if (this.$.orderForm.numRows > 0)
|
||||||
window.history.back();
|
window.history.back();
|
||||||
else
|
else
|
||||||
this.hash.setAll ({'form': 'ecomerce/orders'});
|
this.hash.setAll ({form: 'ecomerce/orders'});
|
||||||
}
|
}
|
||||||
|
|
||||||
,agencySteps: ['method', 'date', 'address', 'agency', 'confirm-agency']
|
|
||||||
,deliverySteps: ['method', 'date', 'address', null, 'confirm-delivery']
|
|
||||||
,pickupSteps: ['method', 'date', 'address', 'pickup', 'confirm-pickup']
|
|
||||||
|
|
||||||
,stepFunc: function (stepIndex)
|
,stepFunc: function (stepIndex)
|
||||||
{
|
{
|
||||||
var steps;
|
var method = this.$.rgMethod.value;
|
||||||
var isDelivery;
|
var methodData = methodsData[method];
|
||||||
|
var stepName;
|
||||||
switch (this.$.rgMethod.value)
|
|
||||||
{
|
|
||||||
case 'AGENCY':
|
|
||||||
steps = this.agencySteps;
|
|
||||||
isDelivery = true;
|
|
||||||
break;
|
|
||||||
case 'DELIVERY':
|
|
||||||
steps = this.deliverySteps;
|
|
||||||
isDelivery = true;
|
|
||||||
break;
|
|
||||||
case 'PICKUP':
|
|
||||||
default:
|
|
||||||
steps = this.pickupSteps;
|
|
||||||
isDelivery = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var stepId = steps[stepIndex];
|
if (methodData !== undefined)
|
||||||
|
stepName = methodData.steps[stepIndex];
|
||||||
if (!stepId)
|
else
|
||||||
|
stepName = 'method';
|
||||||
|
|
||||||
|
if (!stepName)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
switch (stepId)
|
switch (stepName)
|
||||||
{
|
{
|
||||||
case 'date':
|
case 'date':
|
||||||
Vn.Node.setText (this.$.dateQuestion, isDelivery ?
|
var dateQuestion = methodData.isDelivery ?
|
||||||
_('OrderDateDeliveryQuestion'):
|
'OrderDateDeliveryQuestion' : 'OrderDatePickupQuestion';
|
||||||
_('OrderDatePickupQuestion'));
|
Vn.Node.setText (_(dateQuestion));
|
||||||
this.$.calendar.goToSelectedMonth ();
|
this.$.calendar.goToSelectedMonth ();
|
||||||
break;
|
break;
|
||||||
case 'agency':
|
case 'agency':
|
||||||
case 'pickup':
|
case 'pickup':
|
||||||
this.$.agencies.refresh ();
|
this.$.agencies.refresh ();
|
||||||
break;
|
break;
|
||||||
|
case 'confirm':
|
||||||
|
for (var myMethod in methodsData)
|
||||||
|
{
|
||||||
|
var display = myMethod == method ? 'block': 'none';
|
||||||
|
this.$[methodsData[myMethod].textId].style.display = display;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.$[stepId +'Step'];
|
return stepName;
|
||||||
}
|
}
|
||||||
|
|
||||||
,onFieldChange: function ()
|
,onFieldChange: function ()
|
||||||
|
@ -153,7 +158,7 @@ Hedera.Checkout = new Class
|
||||||
,addressRenderer: function (builder, form)
|
,addressRenderer: function (builder, form)
|
||||||
{
|
{
|
||||||
builder.$.address.addEventListener ('click',
|
builder.$.address.addEventListener ('click',
|
||||||
this.onAddressClick.bind (this, form.get ('id')));
|
this.onAddressClick.bind (this, form.$.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
,onAddressClick: function (addressId)
|
,onAddressClick: function (addressId)
|
||||||
|
@ -167,7 +172,7 @@ Hedera.Checkout = new Class
|
||||||
if (this.selectedNode)
|
if (this.selectedNode)
|
||||||
Vn.Node.removeClass (this.selectedNode, 'selected');
|
Vn.Node.removeClass (this.selectedNode, 'selected');
|
||||||
|
|
||||||
var row = this.$.addresses.search ('id', this.$.lot.get ('address'));
|
var row = this.$.addresses.search ('id', this.$.lot.$.address);
|
||||||
|
|
||||||
if (row != -1)
|
if (row != -1)
|
||||||
{
|
{
|
||||||
|
@ -198,3 +203,4 @@ Hedera.Checkout = new Class
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
|
@ -71,15 +71,11 @@
|
||||||
.thin-calendar
|
.thin-calendar
|
||||||
{
|
{
|
||||||
width: inherit;
|
width: inherit;
|
||||||
max-width: 24em;
|
max-width: 22em;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
box-shadow: 0 0.1em 0.3em #ccc;
|
box-shadow: 0 0.1em 0.3em #ccc;
|
||||||
font-size: .7em;
|
font-size: .7em;
|
||||||
}
|
}
|
||||||
.thin-calendar tr > th
|
|
||||||
{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.htk-assistant .thin
|
.htk-assistant .thin
|
||||||
{
|
{
|
||||||
float: right;
|
float: right;
|
||||||
|
|
|
@ -14,6 +14,15 @@
|
||||||
JOIN vn.deliveryMethod d ON d.id = o.delivery_method_id
|
JOIN vn.deliveryMethod d ON d.id = o.delivery_method_id
|
||||||
</db-model>
|
</db-model>
|
||||||
</db-form>
|
</db-form>
|
||||||
|
<db-form id="address-form" model="addresses">
|
||||||
|
<db-model property="model" id="addresses">
|
||||||
|
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 != FALSE
|
||||||
|
</db-model>
|
||||||
|
</db-form>
|
||||||
<db-model
|
<db-model
|
||||||
id="agencies"
|
id="agencies"
|
||||||
lot="lot"
|
lot="lot"
|
||||||
|
@ -36,10 +45,8 @@
|
||||||
<htk-assistant
|
<htk-assistant
|
||||||
id="assistant"
|
id="assistant"
|
||||||
step-count="5"
|
step-count="5"
|
||||||
step-func="stepFunc"
|
step-func="stepFunc">
|
||||||
node="assistant-node"/>
|
<htk-step name="method">
|
||||||
<div id="assistant-node">
|
|
||||||
<div id="method-step">
|
|
||||||
<h2>_DeliveryOrPickupQuestion</h2>
|
<h2>_DeliveryOrPickupQuestion</h2>
|
||||||
<div class="answers radio">
|
<div class="answers radio">
|
||||||
<htk-radio-group
|
<htk-radio-group
|
||||||
|
@ -60,8 +67,8 @@
|
||||||
<label for="r-pickup">_PickupInStore</label>
|
<label for="r-pickup">_PickupInStore</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</htk-step>
|
||||||
<div id="date-step">
|
<htk-step name="date">
|
||||||
<h2 id="date-question">_OrderDateDeliveryQuestion</h2>
|
<h2 id="date-question">_OrderDateDeliveryQuestion</h2>
|
||||||
<div class="answers">
|
<div class="answers">
|
||||||
<htk-calendar
|
<htk-calendar
|
||||||
|
@ -72,110 +79,76 @@
|
||||||
restrict-func="calendarRestrict"
|
restrict-func="calendarRestrict"
|
||||||
on-pick="onFieldChange"/>
|
on-pick="onFieldChange"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</htk-step>
|
||||||
<div id="address-step">
|
<htk-step name="address">
|
||||||
<h2>_AddressQuestion</h2>
|
<h2>_AddressQuestion</h2>
|
||||||
<db-form id="address-form" model="addresses"/>
|
|
||||||
<div class="answers target">
|
<div class="answers target">
|
||||||
<htk-repeater
|
<htk-repeater
|
||||||
id="repeater"
|
id="repeater"
|
||||||
form-id="iter"
|
form-id="iter"
|
||||||
on-change="onAddressChange"
|
on-change="onAddressChange"
|
||||||
renderer="addressRenderer">
|
renderer="addressRenderer"
|
||||||
<db-model property="model" id="addresses">
|
model="addresses">
|
||||||
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 != FALSE
|
|
||||||
</db-model>
|
|
||||||
<custom>
|
<custom>
|
||||||
<div class="address" id="address">
|
<div class="address" id="address">
|
||||||
<p class="consignee">
|
<p class="consignee">
|
||||||
<htk-text lot="iter" name="consignee"/>
|
{{consignee}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<htk-text lot="iter" name="name"/>
|
{{name}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</custom>
|
</custom>
|
||||||
</htk-repeater>
|
</htk-repeater>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</htk-step>
|
||||||
<div id="agency-step">
|
<htk-step name="agency">
|
||||||
<h2>_AgencyQuestion</h2>
|
<h2>_AgencyQuestion</h2>
|
||||||
<div class="answers target">
|
<div class="answers target">
|
||||||
<htk-combo
|
<htk-combo
|
||||||
id="agency-combo"
|
id="agency"
|
||||||
lot="lot"
|
lot="lot"
|
||||||
name="agency"
|
name="agency"
|
||||||
on-changed="onFieldChange"
|
on-changed="onFieldChange"
|
||||||
model="agencies"/>
|
model="agencies"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</htk-step>
|
||||||
<div id="pickup-step">
|
<htk-step name="pickup">
|
||||||
<h2>_PickupWarehouseQuestion</h2>
|
<h2>_PickupWarehouseQuestion</h2>
|
||||||
<div class="answers target">
|
<div class="answers target">
|
||||||
<htk-combo
|
<htk-combo
|
||||||
id="warehouse-combo"
|
id="warehouse"
|
||||||
lot="lot"
|
lot="lot"
|
||||||
name="agency"
|
name="agency"
|
||||||
on-changed="onFieldChange"
|
on-changed="onFieldChange"
|
||||||
model="agencies"/>
|
model="agencies"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</htk-step>
|
||||||
<div id="confirm-agency-step" class="confirm">
|
<htk-step name="confirm" class="confirm">
|
||||||
<h2>_ConfirmToAccessCatalog</h2>
|
<h2>_ConfirmToAccessCatalog</h2>
|
||||||
<div class="answers target">
|
<div class="answers target">
|
||||||
<p>
|
<p>
|
||||||
_Arrival <htk-text format="%D" lot="lot" name="date"/>
|
_Arrival <htk-text format="%D" lot="lot" name="date"/>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<htk-text lot="address-form" name="name"/>
|
{{addressForm.name}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p id="agency-text">
|
||||||
_Agency <htk-text lot="agency-combo" name="description"/>
|
<span>_Agency</span> {{agency.description}}
|
||||||
</p>
|
</p>
|
||||||
<button id="confirm-agency" class="thin" on-click="onConfirmClick">
|
<p id="delivery-text">
|
||||||
_Confirm
|
|
||||||
</button>
|
|
||||||
<div class="clear"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="confirm-delivery-step" class="confirm">
|
|
||||||
<h2>_ConfirmToAccessCatalog</h2>
|
|
||||||
<div class="answers target">
|
|
||||||
<p>
|
|
||||||
_Arrival <htk-text format="%D" lot="lot" name="date"/>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<htk-text lot="address-form" name="name"/>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
_ReceiveThroughtRoute
|
_ReceiveThroughtRoute
|
||||||
</p>
|
</p>
|
||||||
<button id="confirm-delivery" class="thin" on-click="onConfirmClick">
|
<p id="pickup-text">
|
||||||
|
<span>_Warehouse</span> {{warehouse.description}}
|
||||||
|
</p>
|
||||||
|
<button id="confirm-button" class="thin" on-click="onConfirmClick">
|
||||||
_Confirm
|
_Confirm
|
||||||
</button>
|
</button>
|
||||||
<div class="clear"/>
|
<div class="clear"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</htk-step>
|
||||||
<div id="confirm-pickup-step" class="confirm">
|
</htk-assistant>
|
||||||
<h2>_ConfirmToAccessCatalog</h2>
|
|
||||||
<div class="answers target">
|
|
||||||
<p>
|
|
||||||
_Pickup <htk-text format="%D" lot="lot" name="date"/>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
_Warehouse <htk-text lot="warehouse-combo" name="description"/>
|
|
||||||
</p>
|
|
||||||
<button id="confirm-pickup" class="thin" on-click="onConfirmClick">
|
|
||||||
_Confirm
|
|
||||||
</button>
|
|
||||||
<div class="clear"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<htk-assistant-bar assistant="assistant"/>
|
<htk-assistant-bar assistant="assistant"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -38,20 +38,18 @@
|
||||||
<htk-text format="%D" lot="order" name="sendDate"/>
|
<htk-text format="%D" lot="order" name="sendDate"/>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span id="method">_Agency</span>
|
<span id="method">_Agency</span> {{order.agency}}
|
||||||
<htk-text lot="order" name="agency"/>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="address" class="address">
|
<div id="address" class="address">
|
||||||
<p>
|
<p>
|
||||||
<htk-text lot="order" name="consignee"/>
|
{{order.consignee}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<htk-text lot="order" name="address"/>
|
{{order.address}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<htk-text lot="order" name="zipCode"/>,
|
{{order.zipCode}}, {{order.city}}
|
||||||
<htk-text lot="order" name="city"/>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -147,29 +145,29 @@
|
||||||
name="payMethod"
|
name="payMethod"
|
||||||
on-changed="onPayMethodChange"/>
|
on-changed="onPayMethodChange"/>
|
||||||
<div id="balance-method">
|
<div id="balance-method">
|
||||||
<htk-radio radio-group="pay-method" value="BALANCE"/>
|
<htk-radio id="r-balance" radio-group="pay-method" value="BALANCE"/>
|
||||||
<label>_Use my balance</label>
|
<label for="r-balance">_Use my balance</label>
|
||||||
<div class="pay-info">
|
<div class="pay-info">
|
||||||
_You have a favorable balance.
|
_You have a favorable balance.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="credit-method">
|
<div id="credit-method">
|
||||||
<htk-radio radio-group="pay-method" value="CREDIT"/>
|
<htk-radio id="r-credit" radio-group="pay-method" value="CREDIT"/>
|
||||||
<label>_Use my credit</label>
|
<label for="r-credit">_Use my credit</label>
|
||||||
<div class="pay-info">
|
<div class="pay-info">
|
||||||
_You have a favorable credit.
|
_You have a favorable credit.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="card-method">
|
<div id="card-method">
|
||||||
<htk-radio radio-group="pay-method" value="CARD"/>
|
<htk-radio id="r-card" radio-group="pay-method" value="CARD"/>
|
||||||
<label>_Credit card</label>
|
<label for="r-card">_Credit card</label>
|
||||||
<div class="pay-info">
|
<div class="pay-info">
|
||||||
_You will be redirected to the payment.
|
_You will be redirected to the payment.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="transfer-method">
|
<div id="transfer-method">
|
||||||
<htk-radio radio-group="pay-method" value="TRANSFER"/>
|
<htk-radio id="r-transfer" radio-group="pay-method" value="TRANSFER"/>
|
||||||
<label>_Bank Transfer</label>
|
<label for="r-transfer">_Bank Transfer</label>
|
||||||
<div class="pay-info">
|
<div class="pay-info">
|
||||||
_Make a transfer to one account.
|
_Make a transfer to one account.
|
||||||
<htk-repeater form-id="iter">
|
<htk-repeater form-id="iter">
|
||||||
|
@ -195,8 +193,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="later-method">
|
<div id="later-method">
|
||||||
<htk-radio radio-group="pay-method" value="LATER"/>
|
<htk-radio id="r-later" radio-group="pay-method" value="LATER"/>
|
||||||
<label>_Pay later</label>
|
<label for="r-later">_Pay later</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
242
js/db/model.js
242
js/db/model.js
|
@ -334,7 +334,11 @@ Klass.implement
|
||||||
this.result = result;
|
this.result = result;
|
||||||
this.tables = result.tables;
|
this.tables = result.tables;
|
||||||
this.columns = result.columns;
|
this.columns = result.columns;
|
||||||
this.columnMap = result.columnMap;
|
this.columnMap = {};
|
||||||
|
|
||||||
|
for (var i = 0; i < this.columns.length; i++)
|
||||||
|
this.columnMap[this.columns[i].name] = i;
|
||||||
|
|
||||||
this._repairColumns ();
|
this._repairColumns ();
|
||||||
this._refreshMainTable ();
|
this._refreshMainTable ();
|
||||||
|
|
||||||
|
@ -348,19 +352,6 @@ Klass.implement
|
||||||
|
|
||||||
this._setData (result.data);
|
this._setData (result.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
,_refreshRowIndexes: function (start)
|
|
||||||
{
|
|
||||||
this.parent (start);
|
|
||||||
|
|
||||||
if (this._operationsMap)
|
|
||||||
{
|
|
||||||
this._operationsMap = {};
|
|
||||||
|
|
||||||
for (var i = 0; i < this._operations.length; i++)
|
|
||||||
this._operationsMap[i] = this._operations[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
,_cleanData: function ()
|
,_cleanData: function ()
|
||||||
{
|
{
|
||||||
|
@ -402,58 +393,6 @@ Klass.implement
|
||||||
this._refreshUpdatable ();
|
this._refreshUpdatable ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the default value for inserted rows.
|
|
||||||
*
|
|
||||||
* @param {String} column The destination column name
|
|
||||||
* @param {String} table The destination table name
|
|
||||||
* @param {Sql.Expr} expr The default value expression
|
|
||||||
*/
|
|
||||||
,setDefault: function (column, table, expr)
|
|
||||||
{
|
|
||||||
this._defaults.push
|
|
||||||
({
|
|
||||||
column: column
|
|
||||||
,table: table
|
|
||||||
,expr: expr
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the default value for inserted rows.
|
|
||||||
*
|
|
||||||
* @param {String} column The destination column name
|
|
||||||
* @param {String} table The destination table name
|
|
||||||
* @param {*} value The default value
|
|
||||||
*/
|
|
||||||
,setDefaultFromValue: function (column, table, value)
|
|
||||||
{
|
|
||||||
this._defaults.push
|
|
||||||
({
|
|
||||||
column: column
|
|
||||||
,table: table
|
|
||||||
,value: value
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the default value for inserted rows from another column in the
|
|
||||||
* model.
|
|
||||||
*
|
|
||||||
* @param {String} column The destination column name
|
|
||||||
* @param {String} table The destination table name
|
|
||||||
* @param {String} srcColumn The source column
|
|
||||||
*/
|
|
||||||
,setDefaultFromColumn: function (column, table, srcColumn)
|
|
||||||
{
|
|
||||||
this._defaults.push
|
|
||||||
({
|
|
||||||
column: column
|
|
||||||
,table: table
|
|
||||||
,srcColumn: srcColumn
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the column index exists.
|
* Checks if the column index exists.
|
||||||
*
|
*
|
||||||
|
@ -621,6 +560,58 @@ Klass.implement
|
||||||
return this.ready ?
|
return this.ready ?
|
||||||
Object.keys (this._model.columnMap) : null;
|
Object.keys (this._model.columnMap) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default value for inserted rows.
|
||||||
|
*
|
||||||
|
* @param {String} column The destination column name
|
||||||
|
* @param {String} table The destination table name
|
||||||
|
* @param {Sql.Expr} expr The default value expression
|
||||||
|
*/
|
||||||
|
,setDefault: function (column, table, expr)
|
||||||
|
{
|
||||||
|
this._defaults.push
|
||||||
|
({
|
||||||
|
column: column
|
||||||
|
,table: table
|
||||||
|
,expr: expr
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default value for inserted rows.
|
||||||
|
*
|
||||||
|
* @param {String} column The destination column name
|
||||||
|
* @param {String} table The destination table name
|
||||||
|
* @param {*} value The default value
|
||||||
|
*/
|
||||||
|
,setDefaultFromValue: function (column, table, value)
|
||||||
|
{
|
||||||
|
this._defaults.push
|
||||||
|
({
|
||||||
|
column: column
|
||||||
|
,table: table
|
||||||
|
,value: value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default value for inserted rows from another column in the
|
||||||
|
* model.
|
||||||
|
*
|
||||||
|
* @param {String} column The destination column name
|
||||||
|
* @param {String} table The destination table name
|
||||||
|
* @param {String} srcColumn The source column
|
||||||
|
*/
|
||||||
|
,setDefaultFromColumn: function (column, table, srcColumn)
|
||||||
|
{
|
||||||
|
this._defaults.push
|
||||||
|
({
|
||||||
|
column: column
|
||||||
|
,table: table
|
||||||
|
,srcColumn: srcColumn
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a row from the model.
|
* Deletes a row from the model.
|
||||||
|
@ -719,6 +710,22 @@ Klass.implement
|
||||||
this._sort (columnName, way);
|
this._sort (columnName, way);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searchs a value on the model and returns the row index of the first
|
||||||
|
* ocurrence.
|
||||||
|
* If an index have been built on that column, it will be used, for more
|
||||||
|
* information see the indexColumn() method.
|
||||||
|
*
|
||||||
|
* @param {String} columnIndex The column index
|
||||||
|
* @param {Object} value The value to search
|
||||||
|
* @return {Number} The column index
|
||||||
|
*/
|
||||||
|
,searchByIndex: function (columnIndex, value)
|
||||||
|
{
|
||||||
|
var columnName = this.getColumnName (columnIndex);
|
||||||
|
return this.search (columnName, value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs all model changes on the database.
|
* Performs all model changes on the database.
|
||||||
*/
|
*/
|
||||||
|
@ -926,51 +933,6 @@ Klass.implement
|
||||||
this.emit ('operations-done');
|
this.emit ('operations-done');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Undoes all unsaved changes made to the model.
|
|
||||||
*/
|
|
||||||
,reverseOperations: function ()
|
|
||||||
{
|
|
||||||
for (var i = 0; i < this._operations.length; i++)
|
|
||||||
{
|
|
||||||
var op = this._operations[i];
|
|
||||||
var row = op.row;
|
|
||||||
|
|
||||||
if (op.type & Operation.DELETE
|
|
||||||
&& !(op.type & Operation.INSERT))
|
|
||||||
{
|
|
||||||
this._data.splice (row.index, 0, row);
|
|
||||||
this.emit ('row-inserted', row.index);
|
|
||||||
}
|
|
||||||
else if (op.type & Operation.UPDATE)
|
|
||||||
{
|
|
||||||
this.emit ('row-updated-before', row.index);
|
|
||||||
|
|
||||||
var updatedCols = [];
|
|
||||||
var cols = this.columns;
|
|
||||||
|
|
||||||
for (var i = 0; i < cols.length; i++)
|
|
||||||
if (op.oldValues[cols[i].name] !== undefined)
|
|
||||||
{
|
|
||||||
var columnName = cols[i].name;
|
|
||||||
row[columnName] = op.oldValues[columnName];
|
|
||||||
updatedCols.push (columnName);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.emit ('row-updated', row.index, updatedCols);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this._resetOperations ();
|
|
||||||
this._refreshRowIndexes (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
,_resetOperations: function ()
|
|
||||||
{
|
|
||||||
this._operations = [];
|
|
||||||
this._operationsMap = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
,_createTarget: function (tableIndex)
|
,_createTarget: function (tableIndex)
|
||||||
{
|
{
|
||||||
var table = this.tables[tableIndex];
|
var table = this.tables[tableIndex];
|
||||||
|
@ -1033,6 +995,64 @@ Klass.implement
|
||||||
|
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undoes all unsaved changes made to the model.
|
||||||
|
*/
|
||||||
|
,reverseOperations: function ()
|
||||||
|
{
|
||||||
|
for (var i = 0; i < this._operations.length; i++)
|
||||||
|
{
|
||||||
|
var op = this._operations[i];
|
||||||
|
var row = op.row;
|
||||||
|
|
||||||
|
if (op.type & Operation.DELETE
|
||||||
|
&& !(op.type & Operation.INSERT))
|
||||||
|
{
|
||||||
|
this._data.splice (row.index, 0, row);
|
||||||
|
this.emit ('row-inserted', row.index);
|
||||||
|
}
|
||||||
|
else if (op.type & Operation.UPDATE)
|
||||||
|
{
|
||||||
|
this.emit ('row-updated-before', row.index);
|
||||||
|
|
||||||
|
var updatedCols = [];
|
||||||
|
var cols = this.columns;
|
||||||
|
|
||||||
|
for (var i = 0; i < cols.length; i++)
|
||||||
|
if (op.oldValues[cols[i].name] !== undefined)
|
||||||
|
{
|
||||||
|
var columnName = cols[i].name;
|
||||||
|
row[columnName] = op.oldValues[columnName];
|
||||||
|
updatedCols.push (columnName);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.emit ('row-updated', row.index, updatedCols);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._resetOperations ();
|
||||||
|
this._refreshRowIndexes (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
,_resetOperations: function ()
|
||||||
|
{
|
||||||
|
this._operations = [];
|
||||||
|
this._operationsMap = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
,_refreshRowIndexes: function (start)
|
||||||
|
{
|
||||||
|
this.parent (start);
|
||||||
|
|
||||||
|
if (this._operationsMap)
|
||||||
|
{
|
||||||
|
this._operationsMap = {};
|
||||||
|
|
||||||
|
for (var i = 0; i < this._operations.length; i++)
|
||||||
|
this._operationsMap[i] = this._operations[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides information about a table and its columns. If a parameter is
|
* Overrides information about a table and its columns. If a parameter is
|
||||||
|
|
|
@ -43,7 +43,7 @@ module.exports = new Class
|
||||||
/**
|
/**
|
||||||
* Fetchs the next result from the resultset.
|
* Fetchs the next result from the resultset.
|
||||||
*
|
*
|
||||||
* @return {Db.Result} the result or %null if error or there are no more results
|
* @return {Db.Result} The result or %null if error or there are no more results
|
||||||
*/
|
*/
|
||||||
,fetchResult: function ()
|
,fetchResult: function ()
|
||||||
{
|
{
|
||||||
|
@ -59,18 +59,23 @@ module.exports = new Class
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetchs the first row from the next resultset as an object.
|
* Fetchs the next result from the resultset.
|
||||||
*
|
*
|
||||||
* @return {Object} the row if success, %null otherwise
|
* @return {Array} The result or %null if error or there are no more results
|
||||||
*/
|
*/
|
||||||
,fetchObject: function ()
|
,fetchArray: function ()
|
||||||
{
|
{
|
||||||
var result = this.fetchResult ();
|
var result = this.fetch ();
|
||||||
|
|
||||||
if (result instanceof Result)
|
if (result !== null)
|
||||||
return result.fetchObject ();
|
{
|
||||||
|
if (result.data instanceof Array)
|
||||||
|
return result.data;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -82,14 +87,12 @@ module.exports = new Class
|
||||||
*/
|
*/
|
||||||
,fetchRow: function ()
|
,fetchRow: function ()
|
||||||
{
|
{
|
||||||
var result = this.fetch ();
|
var result = this.fetchArray ();
|
||||||
|
|
||||||
if (result !== null
|
if (result === null || result.length === 0)
|
||||||
&& result.data instanceof Array
|
return null;
|
||||||
&& result.data.length > 0)
|
|
||||||
return result.data[0];
|
|
||||||
|
|
||||||
return null;
|
return result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,12 +102,13 @@ module.exports = new Class
|
||||||
*/
|
*/
|
||||||
,fetchValue: function ()
|
,fetchValue: function ()
|
||||||
{
|
{
|
||||||
var row = this.fetchRow ();
|
var result = this.fetchResult ();
|
||||||
|
|
||||||
if (row instanceof Object && row.length > 0)
|
if (result === null
|
||||||
return row[0];
|
|| result.data.length === 0
|
||||||
|
|| result.columns.length === 0)
|
||||||
return null;
|
return undefined;
|
||||||
|
|
||||||
|
return result.data[0][result.columns[0].name];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,31 +10,10 @@ module.exports = new Class
|
||||||
{
|
{
|
||||||
Object.assign (this, {
|
Object.assign (this, {
|
||||||
data: result.data,
|
data: result.data,
|
||||||
tables: result.tables,
|
result: result.tables,
|
||||||
columns: result.columns,
|
columns: result.columns,
|
||||||
row: -1
|
row: -1
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.columns)
|
|
||||||
{
|
|
||||||
this.columnMap = {};
|
|
||||||
|
|
||||||
for (var i = 0; i < this.columns.length; i++)
|
|
||||||
this.columnMap[this.columns[i].name] = i;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
this.columnMap = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a value from de result.
|
|
||||||
*
|
|
||||||
* @param {String} columnName The column name
|
|
||||||
* @return {Object} The cell value
|
|
||||||
*/
|
|
||||||
,get: function (columnName)
|
|
||||||
{
|
|
||||||
return this.data[this.row][columnName];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +21,7 @@ module.exports = new Class
|
||||||
*
|
*
|
||||||
* @return {Object} The row or %null if there are no more rows
|
* @return {Object} The row or %null if there are no more rows
|
||||||
*/
|
*/
|
||||||
,fetchObject: function ()
|
,fetchRow: function ()
|
||||||
{
|
{
|
||||||
if (!this.next ())
|
if (!this.next ())
|
||||||
return null;
|
return null;
|
||||||
|
@ -56,7 +35,7 @@ module.exports = new Class
|
||||||
* @param {number} rowIndex The row index
|
* @param {number} rowIndex The row index
|
||||||
* @return {Object} The row or %null if there are no more rows
|
* @return {Object} The row or %null if there are no more rows
|
||||||
*/
|
*/
|
||||||
,getObject: function (rowIndex)
|
,getRow: function (rowIndex)
|
||||||
{
|
{
|
||||||
return this.data[rowIndex];
|
return this.data[rowIndex];
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ module.exports = new Class
|
||||||
case 'OutdatedVersion':
|
case 'OutdatedVersion':
|
||||||
this._newVersion ();
|
this._newVersion ();
|
||||||
break;
|
break;
|
||||||
case 'User':
|
case 'Vn.Lib.User':
|
||||||
Htk.Toast.showError (error.message);
|
Htk.Toast.showError (error.message);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -139,11 +139,11 @@ module.exports = new Class
|
||||||
{
|
{
|
||||||
// Retrieving configuration parameters
|
// Retrieving configuration parameters
|
||||||
|
|
||||||
Object.assign (Vn.Config, resultSet.fetchObject ());
|
Object.assign (Vn.Config, resultSet.fetchRow ());
|
||||||
|
|
||||||
// Retrieving configuration parameters
|
// Retrieving configuration parameters
|
||||||
|
|
||||||
var row = resultSet.fetchObject ();
|
var row = resultSet.fetchRow ();
|
||||||
|
|
||||||
if (row && row.test_domain)
|
if (row && row.test_domain)
|
||||||
{
|
{
|
||||||
|
@ -181,56 +181,48 @@ module.exports = new Class
|
||||||
{
|
{
|
||||||
// Retrieving menu sections
|
// Retrieving menu sections
|
||||||
|
|
||||||
var row;
|
var sections = resultSet.fetchArray ();
|
||||||
var res = resultSet.fetchResult ();
|
|
||||||
var sectionMap = {};
|
var sectionMap = {};
|
||||||
|
|
||||||
if (res)
|
if (sections)
|
||||||
for (var i = 0; row = res.fetchObject (); i++)
|
sections.forEach (function (section) {
|
||||||
{
|
var parent = section.parent;
|
||||||
var parent = row.parent;
|
|
||||||
|
|
||||||
if (!sectionMap[parent])
|
|
||||||
sectionMap[parent] = [];
|
|
||||||
|
|
||||||
sectionMap[parent].push (i);
|
if (!sectionMap[parent])
|
||||||
}
|
sectionMap[parent] = [];
|
||||||
|
|
||||||
|
sectionMap[parent].push (section);
|
||||||
|
});
|
||||||
|
|
||||||
Vn.Node.removeChilds (this.$.mainMenu);
|
Vn.Node.removeChilds (this.$.mainMenu);
|
||||||
this.createMenu (res, sectionMap, null, this.$.mainMenu);
|
this.createMenu (sectionMap, null, this.$.mainMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Menu
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Menu
|
||||||
|
|
||||||
,createMenu: function (res, sectionMap, parent, ul)
|
,createMenu: function (sectionMap, parent, ul)
|
||||||
{
|
{
|
||||||
var sections = sectionMap[parent];
|
var sections = sectionMap[parent];
|
||||||
|
|
||||||
for (var i = 0; i < sections.length; i++)
|
sections.forEach (function (section) {
|
||||||
{
|
|
||||||
res.row = sections[i];
|
|
||||||
var row = res.getObject (res.row);
|
|
||||||
|
|
||||||
var li = this.createElement ('li');
|
var li = this.createElement ('li');
|
||||||
ul.appendChild (li);
|
ul.appendChild (li);
|
||||||
|
|
||||||
var text = this.createTextNode (_(row.description));
|
var text = this.createTextNode (_(section.description));
|
||||||
|
|
||||||
var a = this.createElement ('a');
|
var a = this.createElement ('a');
|
||||||
a.className = 'clickable';
|
a.className = 'clickable';
|
||||||
|
|
||||||
if (row.path)
|
if (section.path)
|
||||||
{
|
{
|
||||||
a.href = this.hash.make ({'form': row.path});
|
a.href = this.hash.make ({form: section.path});
|
||||||
this._menuOptions[row.path] = a;
|
this._menuOptions[section.path] = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.appendChild (text);
|
a.appendChild (text);
|
||||||
li.appendChild (a);
|
li.appendChild (a);
|
||||||
|
|
||||||
var formId = row.id;
|
if (sectionMap[section.id])
|
||||||
|
|
||||||
if (sectionMap[formId])
|
|
||||||
{
|
{
|
||||||
var submenu = this.createElement ('ul');
|
var submenu = this.createElement ('ul');
|
||||||
submenu.className = 'submenu';
|
submenu.className = 'submenu';
|
||||||
|
@ -241,9 +233,9 @@ module.exports = new Class
|
||||||
li.addEventListener ('mouseout',
|
li.addEventListener ('mouseout',
|
||||||
this._onLiMouseOut.bind (this));
|
this._onLiMouseOut.bind (this));
|
||||||
|
|
||||||
this.createMenu (res, sectionMap, formId, submenu);
|
this.createMenu (sectionMap, section.id, submenu);
|
||||||
}
|
}
|
||||||
}
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
,_onLiMouseHover: function (submenu, parent)
|
,_onLiMouseHover: function (submenu, parent)
|
||||||
|
|
|
@ -55,23 +55,21 @@ module.exports = new Class
|
||||||
,_onQueryDone: function (resultSet)
|
,_onQueryDone: function (resultSet)
|
||||||
{
|
{
|
||||||
Vn.Node.removeChilds (this._node);
|
Vn.Node.removeChilds (this._node);
|
||||||
var res = resultSet.fetchResult ();
|
var socials = resultSet.fetchArray ();
|
||||||
var row;
|
|
||||||
|
|
||||||
while (row = res.fetchObject ())
|
socials.forEach (function (social) {
|
||||||
{
|
|
||||||
var a = this.createElement ('a');
|
var a = this.createElement ('a');
|
||||||
a.href = row.link;
|
a.href = social.link;
|
||||||
a.target = '_blank';
|
a.target = '_blank';
|
||||||
a.className = 'clickable-img';
|
a.className = 'clickable-img';
|
||||||
this._node.appendChild (a);
|
this._node.appendChild (a);
|
||||||
|
|
||||||
var img = this.createElement ('img');
|
var img = this.createElement ('img');
|
||||||
img.src = 'image/social/'+ row.icon;
|
img.src = 'image/social/'+ social.icon;
|
||||||
img.alt = row.title;
|
img.alt = social.title;
|
||||||
img.title = row.title;
|
img.title = social.title;
|
||||||
a.appendChild (img);
|
a.appendChild (img);
|
||||||
}
|
}, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ module.exports = new Class
|
||||||
|
|
||||||
,_onRetryPayDone: function (resultSet)
|
,_onRetryPayDone: function (resultSet)
|
||||||
{
|
{
|
||||||
var row = resultSet.fetchObject ();
|
var row = resultSet.fetchRow ();
|
||||||
|
|
||||||
if (row)
|
if (row)
|
||||||
this._realPpay (row.amount, row.company_id);
|
this._realPpay (row.amount, row.company_id);
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
|
||||||
|
var Step = require ('./step');
|
||||||
|
|
||||||
module.exports = new Class
|
module.exports = new Class
|
||||||
({
|
({
|
||||||
Extends: Vn.Object
|
Extends: Vn.Component
|
||||||
,Tag: 'htk-assistant'
|
,Tag: 'htk-assistant'
|
||||||
,Properties:
|
,Properties:
|
||||||
{
|
{
|
||||||
|
@ -57,11 +59,30 @@ module.exports = new Class
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
,_steps: []
|
||||||
,_stepNode: null
|
,_stepNode: null
|
||||||
,_stepIndex: -1
|
,_stepIndex: -1
|
||||||
|
,_stepName: null
|
||||||
,_stepCount: 0
|
,_stepCount: 0
|
||||||
,_stepFunc: null
|
,_stepFunc: null
|
||||||
|
|
||||||
|
,appendChild: function (step)
|
||||||
|
{
|
||||||
|
if (!(step instanceof Step))
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._node.appendChild (step.node);
|
||||||
|
this._steps[step.name] = step;
|
||||||
|
|
||||||
|
if (step.name === this._stepName)
|
||||||
|
this._showStepNode ();
|
||||||
|
|
||||||
|
}
|
||||||
|
,render: function ()
|
||||||
|
{
|
||||||
|
var node = this.createRoot ('div');
|
||||||
|
node.className = 'htk-assistant';
|
||||||
|
}
|
||||||
,setStep: function (stepIndex)
|
,setStep: function (stepIndex)
|
||||||
{
|
{
|
||||||
if (!(stepIndex >= -1 && stepIndex < this.stepCount))
|
if (!(stepIndex >= -1 && stepIndex < this.stepCount))
|
||||||
|
@ -69,16 +90,15 @@ module.exports = new Class
|
||||||
|
|
||||||
if (this._stepFunc && stepIndex != -1)
|
if (this._stepFunc && stepIndex != -1)
|
||||||
{
|
{
|
||||||
var stepNode = this._stepFunc (stepIndex);
|
var stepName = this._stepFunc (stepIndex);
|
||||||
|
|
||||||
if (stepNode)
|
if (stepName)
|
||||||
{
|
{
|
||||||
if (this._stepNode)
|
if (this._step)
|
||||||
this._stepNode.style.display = 'none';
|
this._step.node.style.display = 'none';
|
||||||
|
|
||||||
this._stepNode = stepNode;
|
|
||||||
stepNode.style.display = 'block';
|
|
||||||
|
|
||||||
|
this._stepName = stepName;
|
||||||
|
this._showStepNode ()
|
||||||
this._setStepIndex (stepIndex);
|
this._setStepIndex (stepIndex);
|
||||||
}
|
}
|
||||||
else if (this._stepIndex < stepIndex)
|
else if (this._stepIndex < stepIndex)
|
||||||
|
@ -87,9 +107,26 @@ module.exports = new Class
|
||||||
this.setStep (stepIndex - 1);
|
this.setStep (stepIndex - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (this._step)
|
||||||
|
this._step.node.style.display = 'none';
|
||||||
|
|
||||||
|
this._stepName = null;
|
||||||
this._setStepIndex (stepIndex);
|
this._setStepIndex (stepIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
,_showStepNode: function ()
|
||||||
|
{
|
||||||
|
var step = this._steps[this._stepName];
|
||||||
|
|
||||||
|
if (step)
|
||||||
|
{
|
||||||
|
this._step = step;
|
||||||
|
step.node.style.display = 'block';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
,_setStepIndex: function (stepIndex)
|
,_setStepIndex: function (stepIndex)
|
||||||
{
|
{
|
||||||
this._stepIndex = stepIndex;
|
this._stepIndex = stepIndex;
|
||||||
|
|
|
@ -141,13 +141,15 @@ module.exports = new Class
|
||||||
var button = this.createRoot ('button');
|
var button = this.createRoot ('button');
|
||||||
button.type = 'button';
|
button.type = 'button';
|
||||||
button.className = 'htk-select input';
|
button.className = 'htk-select input';
|
||||||
button.addEventListener ('mousedown', this._onButtonMouseDown.bind (this));
|
button.addEventListener ('mousedown',
|
||||||
|
this._onButtonMouseDown.bind (this));
|
||||||
}
|
}
|
||||||
|
|
||||||
,_setRow: function (row)
|
,_setRow: function (row)
|
||||||
{
|
{
|
||||||
this._row = row;
|
this._row = row;
|
||||||
this._refreshShowText ();
|
this._refreshShowText ();
|
||||||
|
this.rowChanged ();
|
||||||
this.changed ();
|
this.changed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +170,8 @@ module.exports = new Class
|
||||||
menu.appendChild (grid.node);
|
menu.appendChild (grid.node);
|
||||||
|
|
||||||
var gridNode = grid.node;
|
var gridNode = grid.node;
|
||||||
gridNode.addEventListener ('click', this._onGridClicked.bind (this, grid));
|
gridNode.addEventListener ('click',
|
||||||
|
this._onGridClicked.bind (this, grid));
|
||||||
|
|
||||||
var column = new ColumnText ({columnIndex: this.showColumnIndex});
|
var column = new ColumnText ({columnIndex: this.showColumnIndex});
|
||||||
grid.appendColumn (column);
|
grid.appendColumn (column);
|
||||||
|
|
|
@ -85,7 +85,7 @@ module.exports = new Class
|
||||||
* Shows the popup relative to another element.
|
* Shows the popup relative to another element.
|
||||||
*
|
*
|
||||||
* @param {Node} parent The relative element
|
* @param {Node} parent The relative element
|
||||||
* @param {boolean} fitParent Wether to set the width same to the parent
|
* @param {Boolean} fitParent Wether to set the width same to the parent
|
||||||
* @param {HTMLEvent} ignoreEvent An optional event object to ignore
|
* @param {HTMLEvent} ignoreEvent An optional event object to ignore
|
||||||
*/
|
*/
|
||||||
,show: function (parent, fitParent, ignoreEvent)
|
,show: function (parent, fitParent, ignoreEvent)
|
||||||
|
@ -99,7 +99,7 @@ module.exports = new Class
|
||||||
* Opens the popup.
|
* Opens the popup.
|
||||||
*
|
*
|
||||||
* @param {Node} parent The relative element
|
* @param {Node} parent The relative element
|
||||||
* @param {boolean} fitParent Wether to set the width same to the parent
|
* @param {Boolean} fitParent Wether to set the width same to the parent
|
||||||
*/
|
*/
|
||||||
,open: function (ignoreEvent)
|
,open: function (ignoreEvent)
|
||||||
{
|
{
|
||||||
|
@ -139,13 +139,14 @@ module.exports = new Class
|
||||||
|
|
||||||
setTimeout (this._onOpacityTimeout.bind (this), 10);
|
setTimeout (this._onOpacityTimeout.bind (this), 10);
|
||||||
this._isOpen = true;
|
this._isOpen = true;
|
||||||
|
this.emit ('open');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the popup window shoud be modal based on the modal property
|
* Returns if the popup window shoud be modal based on the modal property
|
||||||
* and if the device is mobile.
|
* and if the device is mobile.
|
||||||
*
|
*
|
||||||
* @return {boolean} %true if it's modal, %false otherwise
|
* @return {Boolean} %true if it's modal, %false otherwise
|
||||||
*/
|
*/
|
||||||
,isModal: function ()
|
,isModal: function ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
module.exports = new Class
|
||||||
|
({
|
||||||
|
Extends: Vn.Component
|
||||||
|
,Tag: 'htk-step'
|
||||||
|
,Properties:
|
||||||
|
{
|
||||||
|
name: {
|
||||||
|
type: String
|
||||||
|
,value: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
,appendChild: function (child)
|
||||||
|
{
|
||||||
|
this._node.appendChild (child);
|
||||||
|
}
|
||||||
|
,render: function ()
|
||||||
|
{
|
||||||
|
var node = this.createRoot ('div');
|
||||||
|
node.className = 'htk-step';
|
||||||
|
}
|
||||||
|
});
|
|
@ -524,6 +524,7 @@ td.cell-image .htk-image
|
||||||
.htk-assistant > div
|
.htk-assistant > div
|
||||||
{
|
{
|
||||||
display: none;
|
display: none;
|
||||||
|
color: #555;
|
||||||
}
|
}
|
||||||
.htk-assistant > div > h2
|
.htk-assistant > div > h2
|
||||||
{
|
{
|
||||||
|
@ -535,10 +536,6 @@ td.cell-image .htk-image
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
.htk-assistant *
|
|
||||||
{
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Assistant bar */
|
/* Assistant bar */
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,11 @@ module.exports = new Class
|
||||||
{
|
{
|
||||||
this._rowLock = true;
|
this._rowLock = true;
|
||||||
|
|
||||||
var row = this._model.getObject (this._row);
|
var row;
|
||||||
|
|
||||||
|
if (this._model)
|
||||||
|
row = this._model.getObject (this._row);
|
||||||
|
|
||||||
this.params = row != null ? row : {};
|
this.params = row != null ? row : {};
|
||||||
|
|
||||||
this._rowLock = false;
|
this._rowLock = false;
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
|
|
||||||
var VnObject = require ('./object');
|
|
||||||
var ModelIface = require ('./model-iface');
|
|
||||||
var ModelProxy = require ('./model-proxy');
|
|
||||||
|
|
||||||
var Mode = ModelProxy.Mode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Model that holds an array of Javascript objects with
|
|
||||||
* the same structure.
|
|
||||||
*/
|
|
||||||
module.exports = new Class
|
|
||||||
({
|
|
||||||
Extends: VnObject
|
|
||||||
,Implements: ModelIface
|
|
||||||
,Tag: 'vn-json-model'
|
|
||||||
,Properties:
|
|
||||||
{
|
|
||||||
numRows:
|
|
||||||
{
|
|
||||||
type: Number
|
|
||||||
},
|
|
||||||
status:
|
|
||||||
{
|
|
||||||
type: Number
|
|
||||||
},
|
|
||||||
mode:
|
|
||||||
{
|
|
||||||
enumType: Mode
|
|
||||||
,value: Mode.ON_CHANGE
|
|
||||||
},
|
|
||||||
data:
|
|
||||||
{
|
|
||||||
type: Array
|
|
||||||
,set: function (x)
|
|
||||||
{
|
|
||||||
this.data = x;
|
|
||||||
}
|
|
||||||
,get: function ()
|
|
||||||
{
|
|
||||||
return this.data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
,checkColExists: function () {}
|
|
||||||
|
|
||||||
,checkRowExists: function () {}
|
|
||||||
|
|
||||||
,getColumnIndex: function () {}
|
|
||||||
|
|
||||||
,get: function (rowIndex, columnName)
|
|
||||||
{
|
|
||||||
return this.data[rowIndex][columnName];
|
|
||||||
}
|
|
||||||
|
|
||||||
,getByIndex: function (rowIndex, column)
|
|
||||||
{
|
|
||||||
var columnName = this.columns[column];
|
|
||||||
return this.data[rowIndex][columnName];
|
|
||||||
}
|
|
||||||
|
|
||||||
,getObject: function (rowIndex)
|
|
||||||
{
|
|
||||||
return this.data[rowIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
,sortByName: function () {}
|
|
||||||
|
|
||||||
,sort: function () {}
|
|
||||||
|
|
||||||
,search: function () {}
|
|
||||||
|
|
||||||
,searchByIndex: function () {}
|
|
||||||
|
|
||||||
,set: function () {}
|
|
||||||
|
|
||||||
,setByIndex: function () {}
|
|
||||||
|
|
||||||
,deleteRow: function () {}
|
|
||||||
|
|
||||||
,insertRow: function () {}
|
|
||||||
|
|
||||||
,clean: function () {}
|
|
||||||
|
|
||||||
,performOperations: function () {}
|
|
||||||
|
|
||||||
,indexColumn: function () {}
|
|
||||||
});
|
|
||||||
|
|
118
js/vn/model.js
118
js/vn/model.js
|
@ -1,8 +1,6 @@
|
||||||
|
|
||||||
var VnObject = require ('./object');
|
var VnObject = require ('./object');
|
||||||
|
var simpleEquals = require ('./value').simpleEquals;
|
||||||
// TODO: Remove this dependency
|
|
||||||
var Type = require ('db/connection').Type;
|
|
||||||
|
|
||||||
var Klass = new Class ();
|
var Klass = new Class ();
|
||||||
module.exports = Klass;
|
module.exports = Klass;
|
||||||
|
@ -298,17 +296,12 @@ Klass.implement
|
||||||
this._buildIndex (column);
|
this._buildIndex (column);
|
||||||
}
|
}
|
||||||
|
|
||||||
,getHashFunc: function (type)
|
,getHashValue: function (value)
|
||||||
{
|
{
|
||||||
switch (type)
|
if (value instanceof Date)
|
||||||
{
|
return value.getTime();
|
||||||
case Type.TIMESTAMP:
|
else
|
||||||
case Type.DATE_TIME:
|
return value;
|
||||||
case Type.DATE:
|
|
||||||
return function (value) { return value.toString (); };
|
|
||||||
default:
|
|
||||||
return function (value) { return value; };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
,_buildIndex: function (columnName)
|
,_buildIndex: function (columnName)
|
||||||
|
@ -316,30 +309,27 @@ Klass.implement
|
||||||
if (this.columnMap[columnName] === undefined)
|
if (this.columnMap[columnName] === undefined)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var index = {};
|
|
||||||
var data = this._data;
|
var data = this._data;
|
||||||
var hashFunc = getHashFunc (this.columns[columnName].type);
|
var values = {};
|
||||||
|
var nulls = [];
|
||||||
|
|
||||||
for (var i = 0; i < data.length; i++)
|
for (var i = 0; i < data.length; i++)
|
||||||
index[hashFunc (data[i][columnName])] = i;
|
{
|
||||||
|
var value = data[i][columnName];
|
||||||
|
|
||||||
this._indexes[columnName] = index;
|
if (value == null)
|
||||||
}
|
{
|
||||||
|
nulls.push (data[i]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
index[this.getHashValue (value)] = data[i];
|
||||||
* Searchs a value on the model and returns the row index of the first
|
}
|
||||||
* ocurrence.
|
|
||||||
* If an index have been built on that column, it will be used, for more
|
this._indexes[columnName] = {
|
||||||
* information see the indexColumn() method.
|
values: values,
|
||||||
*
|
index: index
|
||||||
* @param {String} columnIndex The column index
|
};
|
||||||
* @param {Object} value The value to search
|
|
||||||
* @return {Number} The column index
|
|
||||||
*/
|
|
||||||
,searchByIndex: function (columnIndex, value)
|
|
||||||
{
|
|
||||||
var columnName = this.columns[columnIndex].name;
|
|
||||||
return this.search (columnName, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -352,61 +342,39 @@ Klass.implement
|
||||||
*/
|
*/
|
||||||
,search: function (columnName, value)
|
,search: function (columnName, value)
|
||||||
{
|
{
|
||||||
var columnIndex = this.columnMap[columnName];
|
var data = this._data;
|
||||||
|
|
||||||
if (columnIndex === undefined)
|
if (data == null)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (value)
|
|
||||||
switch (this.columns[columnIndex].type)
|
|
||||||
{
|
|
||||||
case Type.BOOLEAN:
|
|
||||||
value = !!value;
|
|
||||||
break;
|
|
||||||
case Type.INTEGER:
|
|
||||||
value = parseInt (value);
|
|
||||||
break;
|
|
||||||
case Type.DOUBLE:
|
|
||||||
value = parseFloat (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
value = value.toString ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Searchs the value using an internal index.
|
// Searchs the value using an internal index.
|
||||||
|
|
||||||
var index = this._indexes[columnName];
|
var index = this._indexes[columnName];
|
||||||
|
|
||||||
if (index)
|
if (index)
|
||||||
{
|
{
|
||||||
if (index[value] !== undefined)
|
if (value == null)
|
||||||
return index[value];
|
{
|
||||||
|
if (index.nulls[0] !== undefined)
|
||||||
|
return index.nulls[0].index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var row = index.values[this.getHashValue (value)];
|
||||||
|
|
||||||
|
if (rowIndex !== undefined)
|
||||||
|
return row.index;
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Searchs the value using a loop.
|
// Searchs the value using a loop.
|
||||||
|
|
||||||
var data = this._data;
|
for (var i = 0; i < data.length; i++)
|
||||||
|
if (simpleEquals (data[i][columnName], value))
|
||||||
switch (this.columns[columnIndex].type)
|
return i;
|
||||||
{
|
|
||||||
case Type.TIMESTAMP:
|
|
||||||
case Type.DATE_TIME:
|
|
||||||
case Type.DATE:
|
|
||||||
{
|
|
||||||
for (var i = 0; i < data.length; i++)
|
|
||||||
if (value === data[i][columnName].toString ())
|
|
||||||
return i;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
for (var i = 0; i < data.length; i++)
|
|
||||||
if (value === data[i][columnName])
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -61,17 +61,15 @@ module.exports = new Class
|
||||||
,getMethod: function (value, binded)
|
,getMethod: function (value, binded)
|
||||||
{
|
{
|
||||||
if (this.thisArg)
|
if (this.thisArg)
|
||||||
{
|
|
||||||
var method = this.thisArg[value];
|
var method = this.thisArg[value];
|
||||||
|
|
||||||
if (method && binded)
|
|
||||||
method = method.bind (this.thisArg);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
var method = window[value];
|
var method = window[value];
|
||||||
|
|
||||||
|
if (method && binded)
|
||||||
|
method = method.bind (this.thisArg);
|
||||||
|
|
||||||
if (method === undefined)
|
if (method === undefined)
|
||||||
this.builder._showError ('Function \'%s\' not found', value);
|
this.builder.showError ('Function \'%s\' not found', value);
|
||||||
|
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ Vn = module.exports = {
|
||||||
,Spec : require ('./spec')
|
,Spec : require ('./spec')
|
||||||
,ModelIface : require ('./model-iface')
|
,ModelIface : require ('./model-iface')
|
||||||
,ModelProxy : require ('./model-proxy')
|
,ModelProxy : require ('./model-proxy')
|
||||||
,JsonModel : require ('./json-model')
|
|
||||||
,IteratorIface : require ('./iterator-iface')
|
,IteratorIface : require ('./iterator-iface')
|
||||||
,Iterator : require ('./iterator')
|
,Iterator : require ('./iterator')
|
||||||
,Form : require ('./form')
|
,Form : require ('./form')
|
||||||
|
|
|
@ -31,7 +31,7 @@ Hedera.ShelvesReport = new Class
|
||||||
{
|
{
|
||||||
// Fetch query data
|
// Fetch query data
|
||||||
|
|
||||||
var row = resultSet.fetchObject ();
|
var row = resultSet.fetchRow ();
|
||||||
|
|
||||||
// Calculates the scale
|
// Calculates the scale
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@ Hedera.ShelvesReport = new Class
|
||||||
|
|
||||||
var items = this.items = [];
|
var items = this.items = [];
|
||||||
var remainings = this.remainings = [];
|
var remainings = this.remainings = [];
|
||||||
var res = resultSet.fetchResult ();
|
var res = resultSet.fetchArray ();
|
||||||
|
|
||||||
if (res.data.length == 0)
|
if (res.length == 0)
|
||||||
{
|
{
|
||||||
Htk.Toast.showError (_('No items found, check that all fields are correct'));
|
Htk.Toast.showError (_('No items found, check that all fields are correct'));
|
||||||
return;
|
return;
|
||||||
|
@ -71,28 +71,29 @@ Hedera.ShelvesReport = new Class
|
||||||
|
|
||||||
var boxScale = scale * 10;
|
var boxScale = scale * 10;
|
||||||
|
|
||||||
while (row = res.fetchObject ())
|
res.forEach (function (row) {
|
||||||
if (!this.maxAmount || row.etiquetas <= this.maxAmount)
|
if (!this.maxAmount || row.etiquetas <= this.maxAmount)
|
||||||
{
|
{
|
||||||
items.push ({
|
items.push ({
|
||||||
id: row.Id_Article
|
id: row.Id_Article
|
||||||
,name: row.Article
|
,name: row.Article
|
||||||
,packing: row.packing
|
,packing: row.packing
|
||||||
,amount: row.etiquetas
|
,amount: row.etiquetas
|
||||||
,boxHeight: row.z * boxScale
|
,boxHeight: row.z * boxScale
|
||||||
,boxWidth: row.x * boxScale
|
,boxWidth: row.x * boxScale
|
||||||
,boxDepth: row.y * boxScale
|
,boxDepth: row.y * boxScale
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
remainings.push ({
|
remainings.push ({
|
||||||
id: row.Id_Article
|
id: row.Id_Article
|
||||||
,name: row.Article
|
,name: row.Article
|
||||||
,packing: row.packing
|
,packing: row.packing
|
||||||
,amount: row.etiquetas
|
,amount: row.etiquetas
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
// Intializes the allocator
|
// Intializes the allocator
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,9 @@ var baseConfig = {
|
||||||
'/usr/lib/node_modules'
|
'/usr/lib/node_modules'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
node: {
|
||||||
|
__dirname: true
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin ({
|
new webpack.DefinePlugin ({
|
||||||
_DEV_MODE: devMode,
|
_DEV_MODE: devMode,
|
||||||
|
|
Loading…
Reference in New Issue