Copia seguridad

This commit is contained in:
Juan Ferrer Toribio 2015-07-03 07:49:45 +02:00
parent b5ab9d7112
commit e81362c549
34 changed files with 921 additions and 696 deletions

View File

@ -17,17 +17,6 @@ Vn.Address = new Class
form.insertRow (); form.insertRow ();
} }
,onIterChange: function (form)
{
// TODO: Implement one way binding in Vn.Param
if (form.get ('country_id') != this.country)
{
this.country = form.get ('country_id');
this.$('country').value = this.country;
}
}
,onOperationsDone: function () ,onOperationsDone: function ()
{ {
(new Htk.Toast ()).showMessage (_('AddressChangedSuccessfully')); (new Htk.Toast ()).showMessage (_('AddressChangedSuccessfully'));

View File

@ -3,7 +3,8 @@
<vn-param id="address"> <vn-param id="address">
<vn-hash-link key="address"/> <vn-hash-link key="address"/>
</vn-param> </vn-param>
<db-form id="iter" on-status-changed="onStatusChange" on-iter-changed="onIterChange"> <db-form id="iter" on-status-changed="onStatusChange">
<db-param id="country" one-way="true" column="country_id"/>
<db-model id="model" updatable="true" on-operations-done="onOperationsDone"> <db-model id="model" updatable="true" on-operations-done="onOperationsDone">
SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id
FROM address_view a FROM address_view a
@ -50,8 +51,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label><t>Country</t></label> <label><t>Country</t></label>
<htk-combo> <htk-combo param="country">
<vn-param id="country"/>
<db-model property="model"> <db-model property="model">
SELECT Id, Pais FROM vn2008.Paises SELECT Id, Pais FROM vn2008.Paises
ORDER BY Pais ORDER BY Pais

View File

@ -85,11 +85,11 @@
<htk-text form="iter" column="name"/> <htk-text form="iter" column="name"/>
</p> </p>
<p> <p>
<htk-text form="iter" column="zip_code"/> - <htk-text form="iter" column="zip_code"/>,
<htk-text form="iter" column="city"/> <htk-text form="iter" column="city"/>
</p> </p>
<p> <p>
<htk-text form="iter" column="province"/> - <htk-text form="iter" column="province"/>,
<htk-text form="iter" column="country"/> <htk-text form="iter" column="country"/>
</p> </p>
<div class="actions"> <div class="actions">

View File

@ -4,14 +4,14 @@
<div class="header"> <div class="header">
<h1><t>ControlPanel</t></h1> <h1><t>ControlPanel</t></h1>
</div> </div>
<htk-grid> <htk-grid show-header="false">
<db-model> <db-model>
SELECT image, name, description, link FROM link SELECT image, name, description, link FROM link
ORDER BY name ORDER BY name
</db-model> </db-model>
<htk-column-image directory="link" subdir="full" column="image"/> <htk-column-image directory="link" subdir="full" column="image"/>
<htk-column-link title="_Module" column="name" target="\_blank" id="column-link"/> <htk-column-link column="name" target="\_blank" id="column-link"/>
<htk-column-text title="_Description" column="description"/> <htk-column-text column="description"/>
</htk-grid> </htk-grid>
</div> </div>
</div> </div>

View File

@ -92,9 +92,9 @@
{ {
position: absolute; position: absolute;
z-index: 20; z-index: 20;
top: 0em; top: 0;
bottom: 0em; bottom: 0;
right: 0em; right: 0;
width: 17em; width: 17em;
background-color: white; background-color: white;
box-shadow: 0 0.2em 0.2em #AAA; box-shadow: 0 0.2em 0.2em #AAA;
@ -127,10 +127,9 @@ button.basket:hover
max-height: 4em; max-height: 4em;
cursor: pointer; cursor: pointer;
} }
.htk-realm img.selected,
.htk-realm img:hover .htk-realm img:hover
{ {
/* height: 4em; */ opacity: 0.85;
} }
/* Types */ /* Types */
@ -139,36 +138,36 @@ button.basket:hover
{ {
position: absolute; position: absolute;
top: 6.8em; top: 6.8em;
bottom: 0em; bottom: 0;
right: 0em; right: 0;
left: 0em; left: 0;
overflow: auto; overflow: auto;
} }
table.types .types
{ {
width: 100%; width: 100%;
} }
table.types > thead .types > thead
{ {
display: none; display: none;
} }
table.types > tbody > tr .types > tbody > tr
{ {
border-top: none; border-top: none;
height: 2.2em; height: 2.2em;
} }
table.types > tbody a .types > tbody a
{ {
display: block; display: block;
padding: 0.3em 7%; padding: 0.3em 7%;
width: 88%; width: 88%;
height: 100%; height: 100%;
} }
table.types tbody a:hover .types tbody a:hover
{ {
background-color: #EEE; background-color: #EEE;
} }
table.types td.grid-message .types td.grid-message
{ {
padding-top: 1em; padding-top: 1em;
} }
@ -215,25 +214,25 @@ table.types td.grid-message
/* List view */ /* List view */
table.items .items
{ {
width: 100%; width: 100%;
} }
.catalog div.header, .catalog div.box div.header,
table.items > thead > tr, .items > thead > tr,
.realms-bar .realms-bar
{ {
background-color: #777; background-color: #777;
} }
table.items > thead th:hover .items > thead th:hover
{ {
background-color: #333; background-color: #333;
} }
table.items > tbody > tr .items > tbody > tr
{ {
height: 6em; height: 6em;
} }
table.items > tbody img .items > tbody img
{ {
max-height: 5em; max-height: 5em;
max-width: 5em; max-width: 5em;

View File

@ -5,64 +5,32 @@ Vn.Checkout = new Class
,activate: function () {} ,activate: function () {}
,onStatusChange: function (form) ,agencySteps: ['delivery', 'date', 'address', 'agency', 'confirm-agency']
{ ,deliverySteps: ['delivery', 'date', 'address', null, 'confirm-delivery']
// if (this.$('address').value == 0)
// form.insertRow ();
}
,onCancelClick: function ()
{
this.hash.set ({'form': 'ecomerce/orders'});
}
,onConfirmClick: function ()
{
var batch = new Sql.Batch ();
batch.addParam ('date', this.$('date'));
batch.addParam ('agency', this.$('agency'));
batch.addValue ('address', this.$('address'));
batch.addValue ('delivery', 1);
var sql = 'CALL order_new_beta (#date, #delivery, #agency, #address);';
this.conn.execQuery (sql, this.onOrderCreate.bind (this), batch);
}
,onOrderCreate: function (resultSet)
{
var orderId = resultSet.fetchValue ();
if (orderId)
{
Vn.Cookie.set ('order', orderId);
this.hash.set ({'form': 'ecomerce/catalog'});
}
else
(new Htk.Toast ()).showMessage (_('ErrorCreatingOrder'));
}
,onFieldChange: function ()
{
setTimeout (this.goNextStep.bind (this), 75);
}
,onAddressClick: function (e)
{
this.onFieldChange ();
}
,goNextStep: function ()
{
this.$('assistant').moveNext ();
}
,deliverySteps: ['delivery', 'date', 'address', 'agency', 'confirm-delivery']
,pickupSteps: ['delivery', 'date', 'pickup', null, 'confirm-pickup'] ,pickupSteps: ['delivery', 'date', 'pickup', null, 'confirm-pickup']
,stepFunc: function (stepIndex) ,stepFunc: function (stepIndex)
{ {
var isDelivery = this.$('rg-delivery').value != 'PICKUP'; var steps;
var steps = isDelivery ? this.deliverySteps : this.pickupSteps; var isDelivery;
switch (this.$('rg-delivery').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]; var stepId = steps[stepIndex];
if (stepId) if (stepId)
@ -80,226 +48,72 @@ Vn.Checkout = new Class
else else
return null; return null;
} }
});
Htk.Assitant = new Class ,onDefaults: function (i)
({
Extends: Vn.Object
,Tag: 'htk-assistant'
,Properties:
{ {
stepCount: if (!i.ready)
{
type: Number
,set: function (x)
{
this._stepCount = x;
if (x > 0)
this.setStep (0);
else
this.setStep (-1);
}
,get: function ()
{
return this._stepCount;
}
},
step:
{
type: Number
,set: function (x)
{
this.setStep (x);
}
,get: function ()
{
return this._stepIndex;
}
},
stepFunc:
{
type: Function
,set: function (x)
{
this._stepFunc = x;
this.setStep (this._stepIndex);
}
,get: function ()
{
return this._stepFunc;
}
},
node:
{
type: Object
,set: function (x)
{
x.className = 'htk-assistant';
}
},
}
,_stepNode: null
,_stepIndex: -1
,_stepCount: 0
,_stepFunc: null
,setStep: function (stepIndex)
{
if (!(stepIndex >= -1 && stepIndex < this.stepCount))
return; return;
if (this._stepFunc && stepIndex != -1) this.lockAssistant = true;
{ this.$('rg-delivery').value = i.get ('delivery_method');
var stepNode = this._stepFunc (stepIndex); this.$('date').value = new Date ();
this.$('agency').value = i.get ('agency_id');
if (stepNode) this.$('address').value = i.get ('address_id');
{ this.lockAssistant = false;
if (this._stepNode)
this._stepNode.style.display = 'none';
this._stepNode = stepNode;
stepNode.style.display = 'block';
this._setStepIndex (stepIndex);
} }
else if (this._stepIndex < stepIndex)
this.setStep (stepIndex + 1); ,onFieldChange: function ()
else {
this.setStep (stepIndex - 1); if (!this.lockAssistant)
setTimeout (this.goNextStep.bind (this), 75);
}
,addressRenderer: function (builder, index)
{
builder.$('address').addEventListener ('click',
this.onAddressClick.bind (this, index));
}
,onAddressClick: function (index)
{
this.$('address-form').row = index;
this.goNextStep ();
}
,goNextStep: function ()
{
this.$('assistant').moveNext ();
}
,onConfirmClick: function ()
{
var batch = new Sql.Batch ();
batch.addParam ('date', this.$('date'));
batch.addParam ('delivery', this.$('rg-delivery'));
batch.addParam ('agency', this.$('agency'));
batch.addParam ('address', this.$('address'));
var sql = 'CALL order_new_beta (#date, #delivery, #agency, #address);';
this.conn.execQuery (sql, this.onOrderCreate.bind (this), batch);
}
,onOrderCreate: function (resultSet)
{
var orderId = resultSet.fetchValue ();
if (orderId)
{
Vn.Cookie.set ('order', orderId);
this.hash.set ({'form': 'ecomerce/catalog'});
(new Htk.Toast ()).showMessage (_('OrderStarted'));
} }
else else
this._setStepIndex (stepIndex); (new Htk.Toast ()).showMessage (_('ErrorCreatingOrder'));
} }
,_setStepIndex: function (stepIndex) ,onCancelClick: function ()
{ {
this._stepIndex = stepIndex; this.hash.set ({'form': 'ecomerce/orders'});
this.signalEmit ('step-change', stepIndex);
}
,movePrevious: function ()
{
this.setStep (this._stepIndex - 1);
}
,moveNext: function ()
{
this.setStep (this._stepIndex + 1);
}
});
Htk.AssitantBar = new Class
({
Extends: Htk.Widget
,Tag: 'htk-assistant-bar'
,Properties:
{
assistant:
{
type: Htk.Assitant
,set: function (x)
{
this.link ({_assistant: x}, {'step-change': this.onStepChange});
var stepCount = x.stepCount;
var steps = this._steps;
Vn.Node.removeChilds (steps);
steps.style.width = (stepCount * 1.3) + 'em';
for (var i = 0; i < stepCount; i++)
{
var img = document.createElement ('img');
img.src = 'image/step.svg';
img.addEventListener ('click', this.setStep.bind (this, i));
steps.appendChild (img);
}
this.onStepChange ();
}
,get: function ()
{
return this._assistant;
}
}
}
,_assistant: null
,_stepIndex: -1
,initialize: function (props)
{
this.parent (props);
var bar = this.createElement ('div');
bar.className = 'htk-assistant-bar';
var previousButton = document.createElement ('img');
previousButton.src = 'image/go-previous.svg';
previousButton.className = 'previous';
previousButton.addEventListener ('click', this.movePrevious.bind (this));
bar.appendChild (previousButton);
var steps = document.createElement ('div');
bar.appendChild (steps);
var nextButton = document.createElement ('img');
nextButton.src = 'image/go-next.svg';
nextButton.className = 'next';
nextButton.addEventListener ('click', this.moveNext.bind (this));
bar.appendChild (nextButton);
this._steps = steps;
this._previousButton = previousButton;
this._nextButton = nextButton;
}
,movePrevious: function ()
{
if (this._assistant)
this._assistant.movePrevious ();
}
,moveNext: function ()
{
if (this._assistant)
this._assistant.moveNext ();
}
,setStep: function (stepIndex)
{
if (this._assistant)
this._assistant.setStep (stepIndex);
}
,onStepChange: function ()
{
if (this._assistant)
{
var stepIndex = this._assistant.step;
var stepCount = this._assistant.stepCount;
}
else
{
var stepIndex = -1;
var stepCount = 0;
}
if (this._stepIndex != -1)
this._steps.childNodes[this._stepIndex].src = 'image/step.svg';
this._stepIndex = stepIndex;
if (stepIndex != -1)
this._steps.childNodes[stepIndex].src = 'image/step-cur.svg';
var visibility = stepIndex <= 0 ? 'hidden' : 'visible';
this._previousButton.style.visibility = visibility;
var visibility = stepIndex >= stepCount - 1 ? 'hidden' : 'visible';
this._nextButton.style.visibility = visibility;
} }
}); });

View File

@ -1,75 +1,58 @@
.checkout .checkout
{ {
padding: 1em; padding: 1em;
}
.checkout
{
max-width: 50em; max-width: 50em;
margin: 0 auto; margin: 0 auto;
} }
table.form td.label
{
width: 30%;
}
/* Checkout */
.checkout .form .checkout .form
{ {
max-width: 40em; max-width: 40em;
padding: 3em; padding: 3em;
} }
/* Delivery method */
ul.delivery
{
list-style-type: none;
margin: 0;
padding-top: 0.8em;
padding-left: 1em;
}
ul.delivery > li
{
margin: 0.2em 0;
}
ul.delivery input
{
margin-right: 0.4em;
}
/* Step */ /* Step */
.answers button, .answers button,
.answers span, .answers span,
.answers select,
.answers p, .answers p,
.radio > div .radio > div
{ {
font-size: 1.3em; font-size: 1.4em;
}
.answers select
{
min-width: 8em;
display: block;
margin: 0 auto;
font-size: 1.6em;
height: 1.8em;
}
.answers p
{
margin: 0.3em 0;
} }
.target .target
{ {
max-width: 24em; max-width: 28em;
margin: 0 auto; margin: 0 auto;
} }
.address .address
{ {
border-radius: 0.1em; border-radius: 0.1em;
padding: 1em; padding: 0.6em 1.4em;
} }
.address:hover .address:hover
{ {
cursor: pointer; cursor: pointer;
background-color: rgba(1, 1, 1, 0.05); background-color: rgba(1, 1, 1, 0.05);
} }
.address > p .address p.consignee
{ {
margin: 0.2em; font-weight: bold;
} }
.radio .radio
{ {
max-width: 15em; max-width: 20em;
margin: 0 auto; margin: 0 auto;
} }
.radio > div .radio > div
@ -86,86 +69,14 @@ ul.delivery input
width: inherit; width: inherit;
max-width: 24em; max-width: 24em;
margin: 0 auto; margin: 0 auto;
box-shadow: 0 0.1em 0.3em #ccc;
} }
.thin-calendar thead > tr, .thin-calendar tr > th
.thin-calendar tfoot > tr
{
background-color: transparent;
color: inherit;
}
.thin-calendar .button:hover
{ {
color: white; color: white;
} }
.thin-calendar td.highlight
{
background-color: #009688;
color: white;
}
.htk-assistant select
{
width: 10em;
float: left;
}
.htk-assistant button .htk-assistant button
{ {
float: right; float: right;
} }
/* Assistant */
.htk-assistant > div
{
display: none;
margin-top: 0;
margin-bottom: 3em;
}
.htk-assistant > div > h2
{
text-align: center;
font-weight: normal;
font-size: 1.6em;
margin: 0.5em;
margin-bottom: 1em;
}
.htk-assistant *
{
color: #555;
}
/* Assistant bar */
.htk-assistant-bar
{
margin: 0.5em auto;
max-width: 30em;
position: relative;
}
.htk-assistant-bar img
{
cursor: pointer;
}
.htk-assistant-bar > img
{
position: absolute;
width: 1.8em;
top: 0;
}
.htk-assistant-bar > img.previous
{
left: 0;
}
.htk-assistant-bar > img.next
{
right: 0;
}
.htk-assistant-bar > div
{
margin: 0 auto;
padding-top: 0.2em;
}
.htk-assistant-bar > div > img
{
width: 1.3em;
}

View File

@ -1,7 +1,6 @@
<vn> <vn>
<vn-group> <vn-group>
<vn-param id="date"/> <vn-param id="date"/>
<vn-param id="address"/>
<vn-param id="agency"/> <vn-param id="agency"/>
<vn-param id="order-id"> <vn-param id="order-id">
<vn-hash-link key="order"/> <vn-hash-link key="order"/>
@ -15,12 +14,14 @@
</sql-batch> </sql-batch>
</db-model> </db-model>
</db-form> </db-form>
<db-form id="defaults"> <db-form id="defaults" on-iter-changed="onDefaults">
<db-model> <db-model>
SELECT address_id, agency_id, delivery_method_id SELECT address_id, agency_id, delivery_method
FROM order_defaults_view FROM order_defaults_view
</db-model> </db-model>
</db-form> </db-form>
<db-form id="address-form">
<db-param column="id" id="address"/>
<db-model id="addresses"> <db-model id="addresses">
SELECT a.id, a.consignee, p.name province, a.zip_code, a.city, a.name, a.active, c.Pais country SELECT a.id, a.consignee, p.name province, a.zip_code, a.city, a.name, a.active, c.Pais country
FROM address_view a FROM address_view a
@ -28,6 +29,7 @@
JOIN vn2008.Paises c ON c.Id = p.Paises_Id JOIN vn2008.Paises c ON c.Id = p.Paises_Id
WHERE active != FALSE WHERE active != FALSE
</db-model> </db-model>
</db-form>
</vn-group> </vn-group>
<div id="form" class="checkout"> <div id="form" class="checkout">
<div class="box"> <div class="box">
@ -47,22 +49,6 @@
step-func="stepFunc" step-func="stepFunc"
node="assistant-node"/> node="assistant-node"/>
<div class="htk-assistant" id="assistant-node"> <div class="htk-assistant" id="assistant-node">
<div id="delivery-step">
<h2><t>DeliveryOrPickupQuestion</t></h2>
<div class="answers radio">
<htk-radio-group
id="rg-delivery"
on-changed="onFieldChange"/>
<div>
<htk-radio radio-group="rg-delivery" value="DELIVERY"/>
<label><t>Receive</t></label>
</div>
<div>
<htk-radio radio-group="rg-delivery" value="PICKUP"/>
<label><t>Pickup</t></label>
</div>
</div>
</div>
<div id="date-step"> <div id="date-step">
<h2 id="date-question"><t>OrderDateDeliveryQuestion</t></h2> <h2 id="date-question"><t>OrderDateDeliveryQuestion</t></h2>
<div class="answers"> <div class="answers">
@ -73,31 +59,43 @@
on-changed="onFieldChange"/> on-changed="onFieldChange"/>
</div> </div>
</div> </div>
<div id="delivery-step">
<h2><t>DeliveryOrPickupQuestion</t></h2>
<div class="answers radio">
<htk-radio-group
id="rg-delivery"
on-changed="onFieldChange"/>
<div>
<htk-radio radio-group="rg-delivery" value="AGENCY"/>
<label><t>ReceiveThroughtAgency</t></label>
</div>
<div>
<htk-radio radio-group="rg-delivery" value="DELIVERY"/>
<label><t>ReceiveThroughtRoute</t></label>
</div>
<div>
<htk-radio radio-group="rg-delivery" value="PICKUP"/>
<label><t>PickupInStore</t></label>
</div>
</div>
</div>
<div id="address-step"> <div id="address-step">
<h2><t>AddressQuestion</t></h2> <h2><t>AddressQuestion</t></h2>
<htk-repeater model="addresses" form-id="iter"> <htk-repeater model="addresses" form-id="iter" renderer="addressRenderer">
<div class="answers target address" on-click="onAddressClick"> <div class="answers target address" id="address">
<h2> <p class="consignee">
<htk-text form="iter" column="consignee"/> <htk-text form="iter" column="consignee"/>
</h2> </p>
<p> <p>
<htk-text form="iter" column="name"/> <htk-text form="iter" column="name"/>
</p> </p>
<p>
<htk-text form="iter" column="zip_code"/> -
<htk-text form="iter" column="city"/>
</p>
<p>
<htk-text form="iter" column="province"/> -
<htk-text form="iter" column="country"/>
</p>
</div> </div>
</htk-repeater> </htk-repeater>
</div> </div>
<div id="agency-step"> <div id="agency-step">
<h2><t>AgencyQuestion</t></h2> <h2><t>AgencyQuestion</t></h2>
<div class="answers target"> <div class="answers target">
<htk-combo param="agency" on-changed="onFieldChange"> <htk-combo id="agency-combo" param="agency" on-changed="onFieldChange">
<db-model property="model" id="agencies"> <db-model property="model" id="agencies">
SELECT a.Id_Agencia, a.description SELECT a.Id_Agencia, a.description
FROM vn2008.Agencias a FROM vn2008.Agencias a
@ -107,18 +105,14 @@
ORDER BY a.description ORDER BY a.description
</db-model> </db-model>
</htk-combo> </htk-combo>
<button class="thin" on-click="onFieldChange">
<t>NEXT</t>
</button>
<div class="clear"/>
</div> </div>
</div> </div>
<div id="pickup-step"> <div id="pickup-step">
<h2><t>PickupWarehouseQuestion</t></h2> <h2><t>PickupWarehouseQuestion</t></h2>
<div class="answers target"> <div class="answers target">
<htk-combo param="agency" on-changed="onFieldChange"> <htk-combo id="warehouse-combo" param="agency" on-changed="onFieldChange">
<db-model property="model" id="warehouses"> <db-model property="model" id="warehouses">
SELECT a.Id_Agencia, SUBSTR(a.description, 5) SELECT a.Id_Agencia, SUBSTR(a.description, 5) description
FROM vn2008.Agencias a FROM vn2008.Agencias a
JOIN vn2008.Vistas v ON a.Vista = v.vista_id JOIN vn2008.Vistas v ON a.Vista = v.vista_id
WHERE a.web != FALSE WHERE a.web != FALSE
@ -126,8 +120,24 @@
ORDER BY a.description ORDER BY a.description
</db-model> </db-model>
</htk-combo> </htk-combo>
<button class="thin" on-click="onFieldChange"> </div>
<t>NEXT</t> </div>
<div id="confirm-agency-step" class="confirm">
<h2><t>ConfirmToAccessCatalog</t></h2>
<div class="answers target">
<p>
<t>Arrival</t>
<htk-text format="_%A, %e of %B" param="date"/>
</p>
<p>
<htk-text form="address-form" column="name"/>
</p>
<p>
<t>Agency</t>
<htk-text form="agency-combo" column="description"/>
</p>
<button class="thin" on-click="onConfirmClick">
<t>CONFIRM</t>
</button> </button>
<div class="clear"/> <div class="clear"/>
</div> </div>
@ -136,13 +146,14 @@
<h2><t>ConfirmToAccessCatalog</t></h2> <h2><t>ConfirmToAccessCatalog</t></h2>
<div class="answers target"> <div class="answers target">
<p> <p>
<t>ArrivalOf</t> <htk-text format="_%A, %e of %B" param="date"/> <t>Arrival</t>
<htk-text format="_%A, %e of %B" param="date"/>
</p> </p>
<p> <p>
<t>Agency</t> <htk-text param="agency"/> <htk-text form="address-form" column="name"/>
</p> </p>
<p> <p>
<htk-text param="address"/> <t>ReceiveThroughtRoute</t>
</p> </p>
<button class="thin" on-click="onConfirmClick"> <button class="thin" on-click="onConfirmClick">
<t>CONFIRM</t> <t>CONFIRM</t>
@ -154,10 +165,12 @@
<h2><t>ConfirmToAccessCatalog</t></h2> <h2><t>ConfirmToAccessCatalog</t></h2>
<div class="answers target"> <div class="answers target">
<p> <p>
<t>PickupOf</t> <htk-text format="_%A, %e of %B" param="date"/> <t>Pickup</t>
<htk-text format="_%A, %e of %B" param="date"/>
</p> </p>
<p> <p>
<t>Warehouse</t> <htk-text param="agency"/> <t>Warehouse</t>
<htk-text form="warehouse-combo" column="description"/>
</p> </p>
<button class="thin" on-click="onConfirmClick"> <button class="thin" on-click="onConfirmClick">
<t>CONFIRM</t> <t>CONFIRM</t>

View File

@ -5,7 +5,6 @@ Vn.Orders = new Class
,activate: function () ,activate: function ()
{ {
this.$('ticket-pay').renderer = this.payRenderer;
this.$('balance-amount').conditionalFunc = this.balanceConditionalFunc; this.$('balance-amount').conditionalFunc = this.balanceConditionalFunc;
this.payPopup = new Htk.Popup (); this.payPopup = new Htk.Popup ();

View File

@ -1,11 +1,15 @@
.orders .orders
{ {
padding: 1em; padding: 1em;
min-width: 55em;
} }
.orders .box .orders .box
{ {
max-width: 70em; max-width: 45em;
}
.orders .box .header,
.balance-grid > thead > tr
{
background-color: #3F51B6;
} }
.orders .htk-grid tbody tr .orders .htk-grid tbody tr
{ {
@ -51,6 +55,11 @@
color: white; color: white;
padding: 0.3em; padding: 0.3em;
} }
.balance-info
{
height: 1em;
cursor: pointer;
}
.positive-balance .positive-balance
{ {
background-color: #EF5350; background-color: #EF5350;

View File

@ -2,35 +2,35 @@
<div id="form" class="orders"> <div id="form" class="orders">
<div class="box"> <div class="box">
<div class="header"> <div class="header">
<h1><t>StartedOrdersDesc</t></h1> <h1><t>OpenOrders</t></h1>
<div class="action-bar"> <div class="action-bar">
<button on-click="onStartClick"> <button on-click="onStartClick">
<img src="image/dark/order.svg" alt=""/> <img src="image/dark/order.svg" alt=""/>
<t>StartOrder</t> <t>StartOrder</t>
</button> </button>
</div> </div>
<div class="clear"/>
</div> </div>
<div> <div>
<htk-grid> <htk-grid show-header="false">
<db-model updatable="true"> <db-model updatable="true">
SELECT o.id, date_send, Agencia SELECT o.id, date_send, Agencia
FROM order_view o FROM order_view o
JOIN vn2008.Agencias a ON o.type_id = a.Id_Agencia LEFT JOIN vn2008.Agencias a ON o.type_id = a.Id_Agencia
</db-model> </db-model>
<htk-column-text column="id"/>
<htk-column-date column="date_send" format="%A, %e of %B"/>
<htk-column-button <htk-column-button
column="id" column="id"
image="image/edit.svg" image="image/edit.svg"
tip="_ContinueOrder" tip="_ContinueOrder"
on-clicked="onContinueClick"/> on-clicked="onContinueClick"/>
<htk-column-spin title="_OrderNumber" column="id"/>
<htk-column-date title="_DateExit" column="date_send"/>
<htk-column-text title="_SendMethod" column="Agencia"/>
</htk-grid> </htk-grid>
</div> </div>
</div> </div>
<div class="box confirmed"> <div class="box confirmed">
<div class="header"> <div class="header">
<h1><t>ConfirmedOrdersDesc</t></h1> <h1><t>ConfirmedOrders</t></h1>
<div class="action-bar"> <div class="action-bar">
<div id="balance"> <div id="balance">
<t>PendingBalance:</t> <t>PendingBalance:</t>
@ -43,27 +43,21 @@
<img src="image/dark/pay.svg" alt="_MakePayment"/> <img src="image/dark/pay.svg" alt="_MakePayment"/>
</button> </button>
</div> </div>
<div class="clear"/>
</div> </div>
<div> <div>
<htk-grid> <htk-grid show-header="false">
<db-model id="tickets"> <db-model id="tickets">
CALL ticket_list (); CALL ticket_list ();
</db-model> </db-model>
<htk-column-date column="date" format="%A, %e of %B"/>
<htk-column-text title="_SendMethod" column="type"/>
<htk-column-spin column="total" unit="€" digits="2"/>
<htk-column-button <htk-column-button
column="ticket_id" column="ticket_id"
image="image/show.svg" image="image/show.svg"
tip="_SeeOrder" tip="_SeeOrder"
on-clicked="onShowClick"/> on-clicked="onShowClick"/>
<htk-column-spin title="_TicketNumber" column="ticket_id"/>
<htk-column-date title="_DateExit" column="date"/>
<htk-column-text title="_SendMethod" column="type"/>
<htk-column-text title="_SentAddress" column="consignee"/>
<htk-column-spin title="_TotalWithVAT" column="total" unit="€" digits="2"/>
<htk-column-button
id="ticket-pay"
image="image/pay.svg"
tip="_PayOrder"
on-clicked="onTicketPayClick"/>
</htk-grid> </htk-grid>
</div> </div>
<form method="post" id="tpv-form"> <form method="post" id="tpv-form">
@ -81,7 +75,7 @@
</div> </div>
</div> </div>
<div id="balance-popup" class="balance-popup"> <div id="balance-popup" class="balance-popup">
<htk-grid class="balance-grid" updatable="false"> <htk-grid class="balance-grid" show-header="false">
<db-model id="balance"> <db-model id="balance">
CALL customer_debt (); CALL customer_debt ();
</db-model> </db-model>

View File

@ -11,7 +11,7 @@
} }
@media screen and (min-device-width: 1850px) @media screen and (min-device-width: 1850px)
{ {
* { font-size: 11pt; } * { font-size: 12pt; }
} }
/* Global */ /* Global */
@ -23,7 +23,7 @@
} }
body body
{ {
margin: 0px; margin: 0;
} }
body, body,
label, label,
@ -88,30 +88,49 @@ h2
} }
p p
{ {
margin: 0; margin: 0.8em 0;
margin-top: 16px;
margin-bottom: 16px;
} }
/* Inputs */ /* Inputs */
input, input[type=text],
input[type=password],
input[type=file],
input[type=number],
textarea, textarea,
select select
{ {
border: 1px solid #CCD; border: 1px solid #CCD;
margin: 0.2em; margin: 0.2em;
padding: 0.3em;
border-radius: 0.1em; border-radius: 0.1em;
box-shadow: 0 0.1em 0.1em #CCC; box-shadow: 0 0.1em 0.1em #CCC;
} }
input[type=text],
input[type=password],
input[type=file],
input[type=number],
textarea
{
padding: 0.3em;
}
select select
{ {
background-color: white; background-color: white;
cursor: pointer;
padding: 0.4em;
padding-top: 0.2em;
font-size: 1.1em; font-size: 1.1em;
height: 1.8em;
}
option
{
padding: 0.3em;
border-width: 0;
font-weight: normal;
font-size: 1em;
}
select,
option
{
cursor: pointer;
} }
input[type=text], input[type=text],
input[type=password] input[type=password]
@ -134,6 +153,8 @@ input[type=checkbox],
input[type=radio] input[type=radio]
{ {
cursor: pointer; cursor: pointer;
margin: 0.2em;
padding: 0.3em;
width: 0.8em; width: 0.8em;
height: 0.8em; height: 0.8em;
} }
@ -220,60 +241,61 @@ img.editable
/* Float */ /* Float */
div.clear .clear
{ {
clear: both; clear: both;
} }
/* Box */ /* Box */
div.box .box
{ {
background-color: white; background-color: white;
margin: 0 auto; margin: 0 auto;
border-radius: 0.1em; border-radius: 0.1em;
box-shadow: 0 0.2em 0.2em #CCC; box-shadow: 0 0.2em 0.2em #CCC;
} }
div.box .header .box .header
{ {
padding: 0.6em 0.8em; padding: 0.6em 0.8em;
margin: 0; margin: 0;
color: white;
background-color: #009688; background-color: #009688;
color: white;
} }
div.box .header h1 .box .header > h1
{ {
color: white;
text-align: left; text-align: left;
font-size: 1.6em; font-size: 1.6em;
line-height: 2em; line-height: 2em;
font-weight: normal; font-weight: normal;
display: inline; display: inline;
} }
div.box .body .box .body
{ {
padding: 2em; padding: 2em;
} }
/* Form */ /* Form */
div.form .form
{ {
margin: 0 auto; margin: 0 auto;
} }
div.form-group .form-group
{ {
padding: 0.4em; padding: 0.4em;
} }
div.form-group > label .form-group > label
{ {
display: block; display: block;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
div.form-group > input[type=text], .form-group > input[type=text],
div.form-group > input[type=password], .form-group > input[type=password],
div.form-group > select, .form-group > select,
div.form-group > textarea .form-group > textarea
{ {
margin: 0; margin: 0;
width: 100%; width: 100%;
@ -281,32 +303,30 @@ div.form-group > textarea
/* Action bar */ /* Action bar */
div.action-bar .action-bar
{ {
float: right; float: right;
padding: 0; padding: 0;
margin-top: 0.3em; margin-top: 0.3em;
background-color: #009688;
} }
div.action-bar > * .action-bar > *
{ {
float: left; float: left;
padding: 0.4em; padding: 0.4em;
} }
div.action-bar > button .action-bar > button
{ {
border-left: 1px solid white; border-left: 1px solid white;
background-color: #009688;
} }
div.action-bar > button:first-child .action-bar > button:first-child
{ {
border-left: none; border-left: none;
} }
div.action-bar > button:hover .action-bar > button:hover
{ {
background-color: #076; background-color: rgba(1, 1, 1, 0.2);
} }
div.action-bar > button > img .action-bar > button > img
{ {
vertical-align: middle; vertical-align: middle;
margin-right: 0.4em; margin-right: 0.4em;
@ -340,90 +360,95 @@ img.icon
/* Grid */ /* Grid */
table.htk-grid .htk-grid
{ {
margin: auto; margin: auto;
border-collapse: collapse; border-collapse: collapse;
text-align: center; text-align: center;
} }
table.htk-grid thead tr, .htk-grid > thead > tr,
table.htk-grid tfoot tr .htk-grid > tfoot > tr
{ {
background-color: #009688; background-color: #009688;
color: white;
vertical-align: middle; vertical-align: middle;
text-align: center; text-align: center;
height: 3em; height: 3em;
} }
table.htk-grid thead th .htk-grid > thead th
{ {
color: white;
cursor: pointer; cursor: pointer;
font-weight: normal; font-weight: normal;
padding: 0 0.4em; padding: 0 0.4em;
} }
table.htk-grid thead th:hover .htk-grid > thead th:hover
{ {
background-color: #076; background-color: rgba(1, 1, 1, 0.2);
} }
table.htk-grid tr .htk-grid tr
{ {
height: 3.5em; height: 3.5em;
} }
table.htk-grid tfoot a, .htk-grid > tfoot a,
table.htk-grid thead a .htk-grid > thead a
{ {
color: black; color: black;
} }
table.htk-grid tr.pair-row .htk-grid tr.pair-row
{ {
background-color: transparent; background-color: transparent;
} }
td.grid-message .htk-grid .message
{ {
height: 5em; height: 5em;
} }
td.grid-message img .htk-grid .message img
{ {
vertical-align: middle; vertical-align: middle;
padding: 0.8em; padding: 0.8em;
height: 1.8em; height: 1.8em;
} }
table.htk-grid tbody tr .htk-grid > tbody tr
{ {
border-top: 1px solid #DDD; border-top: 1px solid #DDD;
} }
table.htk-grid tbody tr:first-child .htk-grid > tbody tr:first-child
{ {
border-top: none; border-top: none;
} }
table.htk-grid tbody td .htk-grid > tbody td
{ {
padding-right: 0.7em; padding-right: 0.7em;
padding-left: 0.3em; padding-left: 0.3em;
} }
table.htk-grid tbody td:first-child, .htk-grid > tbody td:first-child,
table.htk-grid thead th:first-child .htk-grid > thead th:first-child
{ {
padding-left: 1em; padding-left: 1em;
} }
table.htk-grid tbody td:last-child, .htk-grid > tbody td:last-child,
table.htk-grid thead th:last-child .htk-grid > thead th:last-child
{ {
padding-right: 1em; padding-right: 1em;
} }
input.cell-spin .htk-grid .cell-spin
{ {
width: 2.5em; width: 2.5em;
text-align: right; text-align: right;
} }
button.cell-button .htk-grid .cell-button
{ {
margin: 0; margin: 0;
padding: 0; padding: 0.5em;
border: none; border: none;
background-color: transparent; background-color: transparent;
border-radius: 0.1em;
} }
button.cell-button img .htk-grid .cell-button:hover
{
background-color: rgba(1, 1, 1, 0.1);
}
.htk-grid .cell-button img
{ {
height: 1.5em; height: 1.5em;
} }
@ -544,12 +569,10 @@ button.cell-button img
{ {
background-color: #BFB; background-color: #BFB;
} }
.htk-toast.warning .htk-toast.warning
{ {
background-color: #FFB; background-color: #FFB;
} }
.htk-toast.error .htk-toast.error
{ {
background-color: #FBB; background-color: #FBB;
@ -625,3 +648,68 @@ button.cell-button img
margin-right: 0.5em; margin-right: 0.5em;
} }
/* Assistant */
.htk-assistant > div
{
display: none;
margin-top: 1em;
margin-bottom: 4em;
}
.htk-assistant > div > h2
{
text-align: center;
font-style: italic;
font-weight: normal;
font-size: 1.5em;
margin: 0.5em;
margin-bottom: 1em;
}
.htk-assistant *
{
color: #555;
}
/* Assistant bar */
.htk-assistant-bar
{
margin: 0.5em auto;
max-width: 30em;
position: relative;
}
.htk-assistant-bar img
{
cursor: pointer;
}
.htk-assistant-bar > img
{
position: absolute;
width: 1.8em;
top: 0;
padding: 0.3em;
border-radius: 0.1em;
}
.htk-assistant-bar > img:hover
{
background-color: rgba(1,1,1,0.1);
}
.htk-assistant-bar > img.previous
{
left: 0;
}
.htk-assistant-bar > img.next
{
right: 0;
}
.htk-assistant-bar > div
{
margin: 0 auto;
padding-top: 0.2em;
}
.htk-assistant-bar > div > img
{
padding: 0.3em 0.2em;
width: 1.3em;
}

View File

@ -2,6 +2,7 @@
Db.Form = new Class Db.Form = new Class
({ ({
Extends: Vn.Object Extends: Vn.Object
,Implements: Db.Iterator
,Tag: 'db-form' ,Tag: 'db-form'
,Child: 'model' ,Child: 'model'
,Properties: ,Properties:
@ -100,113 +101,5 @@ Db.Form = new Class
if (row == this._row) if (row == this._row)
this.iterChanged (); this.iterChanged ();
} }
,refresh: function ()
{
if (this._model)
this._model.refresh ();
}
/**
* Emits the 'iter-changed' signal on the form.
**/
,iterChanged: function ()
{
this.signalEmit ('iter-changed');
}
/**
* Get the index of the column from its name.
*
* @param {String} columnName The column name
* @return {integer} The column index or -1 if column not exists
**/
,getColumnIndex: function (columnName)
{
if (this._model)
return this._model.getColumnIndex (columnName);
return -1;
}
,insertRow: function ()
{
if (this._model)
this.row = this._model.insertRow ();
}
,performOperations: function ()
{
if (this._model)
this._model.performOperations ();
}
/**
* Removes the current row.
**/
,deleteRow: function ()
{
if (this._row >= 0)
this._model.deleteRow (this._row);
}
/**
* Gets a value from the form.
*
* @param {String} columnName The column name
* @return {Object} The value
**/
,get: function (columnName)
{
return this._model.get (this._row, columnName);
}
/**
* Sets a value on the form.
*
* @param {String} columnName The column name
* @param {Object} value The new value
**/
,set: function (columnName, value)
{
return this._model.set (this._row, columnName, value);
}
/**
* Gets a value from the form using the column index.
*
* @param {String} columnName The column index
* @return {Object} The value
**/
,getByIndex: function (column)
{
return this._model.getByIndex (this._row, column);
}
/**
* Sets a value on the form using the column index.
*
* @param {String} columnName The column index
* @param {Object} value The new value
**/
,setByIndex: function (column, value)
{
return this._model.setByIndex (this._row, column, value);
}
/**
* Gets a param from the form.
*
* @param {String} columnName The column name
* @return {Db.Param} The new parameter
**/
,getParam: function (columnName)
{
return new Db.Param
({
form: this
,column: columnName
});
}
}); });

View File

@ -0,0 +1,147 @@
Db.Iterator = new Class
({
Properties:
{
/**
* The model associated to this form.
**/
model:
{
type: Db.Model
},
/**
* The row where the form positioned, has -1 if the row is unselected.
**/
row:
{
type: Number
},
/**
* The number of rows in the form.
**/
numRows:
{
type: Number
},
/**
* Checks if the form data is ready.
**/
ready:
{
type: Boolean
}
}
,_model: null
,_row: -1
,refresh: function ()
{
if (this._model)
this._model.refresh ();
}
/**
* Emits the 'iter-changed' signal on the form.
**/
,iterChanged: function ()
{
this.signalEmit ('iter-changed');
}
/**
* Get the index of the column from its name.
*
* @param {String} columnName The column name
* @return {integer} The column index or -1 if column not exists
**/
,getColumnIndex: function (columnName)
{
if (this._model)
return this._model.getColumnIndex (columnName);
return -1;
}
,insertRow: function ()
{
if (this._model)
this.row = this._model.insertRow ();
}
,performOperations: function ()
{
if (this._model)
this._model.performOperations ();
}
/**
* Removes the current row.
**/
,deleteRow: function ()
{
if (this._row >= 0)
this._model.deleteRow (this._row);
}
/**
* Gets a value from the form.
*
* @param {String} columnName The column name
* @return {Object} The value
**/
,get: function (columnName)
{
return this._model.get (this._row, columnName);
}
/**
* Sets a value on the form.
*
* @param {String} columnName The column name
* @param {Object} value The new value
**/
,set: function (columnName, value)
{
return this._model.set (this._row, columnName, value);
}
/**
* Gets a value from the form using the column index.
*
* @param {String} columnName The column index
* @return {Object} The value
**/
,getByIndex: function (column)
{
return this._model.getByIndex (this._row, column);
}
/**
* Sets a value on the form using the column index.
*
* @param {String} columnName The column index
* @param {Object} value The new value
**/
,setByIndex: function (column, value)
{
return this._model.setByIndex (this._row, column, value);
}
/**
* Gets a param from the form.
*
* @param {String} columnName The column name
* @return {Db.Param} The new parameter
**/
,getParam: function (columnName)
{
return new Db.Param
({
form: this
,column: columnName
});
}
});

View File

@ -8,6 +8,7 @@ Vn\Hedera\Js::includeLib ('db'
,'result' ,'result'
,'result-set' ,'result-set'
,'model' ,'model'
,'iterator'
,'form' ,'form'
,'param' ,'param'
,'calc' ,'calc'

View File

@ -418,7 +418,7 @@ Db.Model.implement
&& this.tables[tableIndex].pks.length > 0; && this.tables[tableIndex].pks.length > 0;
if (!tableUpdatable) if (!tableUpdatable)
console.warn ("DbModel: Table %s is not updatable", console.warn ("Db.Model: Table %s is not updatable",
this.tables[tableIndex].name); this.tables[tableIndex].name);
return tableUpdatable; return tableUpdatable;

View File

@ -41,13 +41,31 @@ Db.Param = new Class
{ {
return this._form; return this._form;
} }
},
/**
* Determines whether the link to the form is unidirectional, ie, a
* change in the form updates the parameter but not vice versa.
**/
oneWay:
{
type: Boolean
,set: function (x)
{
this._oneWay = x;
}
,get: function ()
{
return this._oneWay;
}
} }
} }
,_columnName: null ,_columnName: null
,_form: null ,_form: null
,formLock: false ,_formLock: false
,columnIndex: -1 ,_columnIndex: -1
,_oneWay: false
,_formValue: null
,initialize: function (props) ,initialize: function (props)
{ {
@ -67,25 +85,33 @@ Db.Param = new Class
,onFormChange: function () ,onFormChange: function ()
{ {
if (this._columnName != null) if (this._columnName != null)
this.columnIndex = this._form.getColumnIndex (this._columnName); this._columnIndex = this._form.getColumnIndex (this._columnName);
} }
,onIterChange: function () ,onIterChange: function ()
{ {
this.formLock = true; this._formLock = true;
if (this.columnIndex != -1) var formValue;
this.value = this._form.getByIndex (this.columnIndex);
if (this._columnIndex != -1)
formValue = this._form.getByIndex (this._columnIndex);
else else
this.value = undefined; formValue = null;
this.formLock = false; if (formValue != this._formValue)
{
this.value = formValue;
this._formValue = formValue;
}
this._formLock = false;
} }
,onChange: function () ,onChange: function ()
{ {
if (!this.formLock && this.columnIndex != -1) if (!this._formLock && this._columnIndex != -1 && !this.oneWay)
this._form.setByIndex (this.columnIndex, this._value); this._form.setByIndex (this._columnIndex, this._value);
} }
}); });

View File

@ -0,0 +1,116 @@
Htk.AssitantBar = new Class
({
Extends: Htk.Widget
,Tag: 'htk-assistant-bar'
,Properties:
{
assistant:
{
type: Htk.Assistant
,set: function (x)
{
this.link ({_assistant: x}, {'step-change': this.onStepChange});
var stepCount = x.stepCount;
var steps = this._steps;
Vn.Node.removeChilds (steps);
steps.style.width = (stepCount * 1.7) + 'em';
for (var i = 0; i < stepCount; i++)
{
var img = document.createElement ('img');
img.src = 'image/step.svg';
img.addEventListener ('click', this.setStep.bind (this, i));
steps.appendChild (img);
}
this.onStepChange ();
}
,get: function ()
{
return this._assistant;
}
}
}
,_assistant: null
,_stepIndex: -1
,initialize: function (props)
{
this.parent (props);
var bar = this.createElement ('div');
bar.className = 'htk-assistant-bar';
var previousButton = document.createElement ('img');
previousButton.src = 'image/go-previous.svg';
previousButton.className = 'previous';
previousButton.title = _('Previous');
previousButton.addEventListener ('click', this.movePrevious.bind (this));
bar.appendChild (previousButton);
var steps = document.createElement ('div');
bar.appendChild (steps);
var nextButton = document.createElement ('img');
nextButton.src = 'image/go-next.svg';
nextButton.className = 'next';
nextButton.title = _('Next');
nextButton.addEventListener ('click', this.moveNext.bind (this));
bar.appendChild (nextButton);
this._steps = steps;
this._previousButton = previousButton;
this._nextButton = nextButton;
}
,movePrevious: function ()
{
if (this._assistant)
this._assistant.movePrevious ();
}
,moveNext: function ()
{
if (this._assistant)
this._assistant.moveNext ();
}
,setStep: function (stepIndex)
{
if (this._assistant)
this._assistant.setStep (stepIndex);
}
,onStepChange: function ()
{
if (this._assistant)
{
var stepIndex = this._assistant.step;
var stepCount = this._assistant.stepCount;
}
else
{
var stepIndex = -1;
var stepCount = 0;
}
if (this._stepIndex != -1)
this._steps.childNodes[this._stepIndex].src = 'image/step.svg';
this._stepIndex = stepIndex;
if (stepIndex != -1)
this._steps.childNodes[stepIndex].src = 'image/step-cur.svg';
var visibility = stepIndex <= 0 ? 'hidden' : 'visible';
this._previousButton.style.visibility = visibility;
var visibility = stepIndex >= stepCount - 1 ? 'hidden' : 'visible';
this._nextButton.style.visibility = visibility;
}
});

View File

@ -0,0 +1,109 @@
Htk.Assistant = new Class
({
Extends: Vn.Object
,Tag: 'htk-assistant'
,Properties:
{
stepCount:
{
type: Number
,set: function (x)
{
this._stepCount = x;
if (x > 0)
this.setStep (0);
else
this.setStep (-1);
}
,get: function ()
{
return this._stepCount;
}
},
step:
{
type: Number
,set: function (x)
{
this.setStep (x);
}
,get: function ()
{
return this._stepIndex;
}
},
stepFunc:
{
type: Function
,set: function (x)
{
this._stepFunc = x;
this.setStep (this._stepIndex);
}
,get: function ()
{
return this._stepFunc;
}
},
node:
{
type: Object
,set: function (x)
{
x.className = 'htk-assistant';
}
},
}
,_stepNode: null
,_stepIndex: -1
,_stepCount: 0
,_stepFunc: null
,setStep: function (stepIndex)
{
if (!(stepIndex >= -1 && stepIndex < this.stepCount))
return;
if (this._stepFunc && stepIndex != -1)
{
var stepNode = this._stepFunc (stepIndex);
if (stepNode)
{
if (this._stepNode)
this._stepNode.style.display = 'none';
this._stepNode = stepNode;
stepNode.style.display = 'block';
this._setStepIndex (stepIndex);
}
else if (this._stepIndex < stepIndex)
this.setStep (stepIndex + 1);
else
this.setStep (stepIndex - 1);
}
else
this._setStepIndex (stepIndex);
}
,_setStepIndex: function (stepIndex)
{
this._stepIndex = stepIndex;
this.signalEmit ('step-change', stepIndex);
}
,movePrevious: function ()
{
this.setStep (this._stepIndex - 1);
}
,moveNext: function ()
{
this.setStep (this._stepIndex + 1);
}
});

View File

@ -11,7 +11,7 @@ Htk.Column = new Class
{ {
value: value:
{ {
type: Object type: String
,value: null ,value: null
}, },
column: column:

View File

@ -8,7 +8,7 @@ Htk.Field = new Class
{ {
value: value:
{ {
type: Object type: String
,set: function (x) ,set: function (x)
{ {
if (Vn.Value.compare (x, this._value)) if (Vn.Value.compare (x, this._value))
@ -56,7 +56,7 @@ Htk.Field = new Class
}, },
form: form:
{ {
type: Db.Form type: Vn.Object // Db.Iterator
,set: function (x) ,set: function (x)
{ {
this._form = x; this._form = x;

View File

@ -1,6 +1,7 @@
Htk.Select = new Class Htk.Select = new Class
({ ({
Extends: Htk.Field Extends: Htk.Field
,Implements: Db.Iterator
,Tag: 'htk-combo' ,Tag: 'htk-combo'
,Properties: ,Properties:
{ {
@ -19,9 +20,56 @@ Htk.Select = new Class
{ {
return this._model; return this._model;
} }
},
/**
* The row where the form positioned, has -1 if the row is unselected.
**/
row:
{
type: Number
,set: function (x)
{
if (!this._model || this._model.numRows <= x || x < -1)
x = -1;
if (x == this._row)
return;
this._row = x;
this.iterChanged ();
}
,get: function ()
{
return this._row;
}
},
/**
* The number of rows in the form.
**/
numRows:
{
type: Number
,get: function ()
{
if (this._model)
return this._model.numRows;
return 0;
}
},
/**
* Checks if the form data is ready.
**/
ready:
{
type: Boolean
,get: function ()
{
return this._ready;
}
} }
} }
,_row: -1
,_model: null ,_model: null
,valueColumnIndex: 0 ,valueColumnIndex: 0
,valueColumnName: null ,valueColumnName: null
@ -35,6 +83,12 @@ Htk.Select = new Class
this.node.addEventListener ('change', this.changed.bind (this)); this.node.addEventListener ('change', this.changed.bind (this));
} }
,setRow: function (row)
{
this._row = row;
this.iterChanged ();
}
,changed: function (event) ,changed: function (event)
{ {
var value; var value;
@ -46,6 +100,7 @@ Htk.Select = new Class
value = null; value = null;
this.valueChanged (value); this.valueChanged (value);
this.setRow (row);
} }
,addOption: function (value, text) ,addOption: function (value, text)
@ -59,6 +114,7 @@ Htk.Select = new Class
,onModelChange: function () ,onModelChange: function ()
{ {
var model = this._model; var model = this._model;
this.signalEmit ('status-changed');
if (model.status == Db.Model.Status.LOADING) if (model.status == Db.Model.Status.LOADING)
return; return;
@ -80,7 +136,8 @@ Htk.Select = new Class
} }
case Db.Model.Status.ERROR: case Db.Model.Status.ERROR:
this.addOption (null, _('Error')); this.addOption (null, _('Error'));
break; default:
this.setRow (-1);
} }
} }
@ -91,14 +148,20 @@ Htk.Select = new Class
,selectOption: function () ,selectOption: function ()
{ {
if (!this._model || this._model.status != Db.Model.Status.READY) var row;
return;
var row = this._model.searchByIndex (this.valueColumnIndex, this._value); if (this._model && this._model.status == Db.Model.Status.READY)
{
row = this._model.searchByIndex (this.valueColumnIndex, this._value);
if (row != -1) if (row != -1)
this.node.selectedIndex = row + 1; this.node.selectedIndex = row + 1;
} }
else
row = -1;
this.setRow (row);
}
,putValue: function (value) ,putValue: function (value)
{ {

View File

@ -32,6 +32,19 @@ Htk.Grid = new Class
{ {
type: String type: String
,value: _('NoData') ,value: _('NoData')
},
showHeader:
{
type: Boolean
,set: function (x)
{
this._showHeader = x;
this.thead.style.display = x ? 'table-header-group' : 'none';
}
,get: function ()
{
return this._showHeader;
}
} }
} }
@ -42,10 +55,11 @@ Htk.Grid = new Class
,internalColumns: 0 ,internalColumns: 0
,sortColumn: -1 ,sortColumn: -1
,sortWay: null ,sortWay: null
,_showHeader: true
,initialize: function () ,initialize: function (props)
{ {
this.parent (); this.parent (props);
this.table = this.createElement ('table'); this.table = this.createElement ('table');
this.table.className = 'htk-grid'; this.table.className = 'htk-grid';
@ -206,7 +220,7 @@ Htk.Grid = new Class
this.tbody.appendChild (tr); this.tbody.appendChild (tr);
var td = document.createElement ('td'); var td = document.createElement ('td');
td.className = 'grid-message'; td.className = 'message';
td.colSpan = this.columns.length; td.colSpan = this.columns.length;
tr.appendChild (td); tr.appendChild (td);

View File

@ -11,6 +11,8 @@ Vn\Hedera\Js::includeLib ('htk'
,'grid' ,'grid'
,'full-image' ,'full-image'
,'image-editor' ,'image-editor'
,'assistant'
,'assistant-bar'
,'field' ,'field'
,'field/text' ,'field/text'
,'field/html' ,'field/html'

View File

@ -35,8 +35,20 @@ Htk.Repeater = new Class
{ {
this._alias; this._alias;
} }
}, }
emptyMessage: ,renderer:
{
type: Function
,set: function (x)
{
this._renderer = x;
}
,get: function ()
{
this._renderer;
}
}
,emptyMessage:
{ {
type: String type: String
,value: _('NoData') ,value: _('NoData')
@ -71,6 +83,10 @@ Htk.Repeater = new Class
builder.add (this._alias, form); builder.add (this._alias, form);
var mainNode = builder.loadXmlFromNode (this.xml); var mainNode = builder.loadXmlFromNode (this.xml);
if (this._renderer)
this._renderer (builder, index);
this.node.appendChild (mainNode); this.node.appendChild (mainNode);
} }

View File

@ -29,7 +29,7 @@ Sql.Value = new Class
**/ **/
value: value:
{ {
type: Object type: String
,set: function (x) ,set: function (x)
{ {
if (Vn.Value.compare (x, this._value)) if (Vn.Value.compare (x, this._value))

View File

@ -200,7 +200,7 @@ Vn.Builder = new Class
var method = this.getMethod (nodeValue); var method = this.getMethod (nodeValue);
c.object.on (nodeName.substr (3), method, this.signalData); c.object.on (nodeName.substr (3), method, this.signalData);
} }
else else if (!/^(id|property)$/.test (nodeName))
{ {
var prop = nodeName.replace (/-./g, this.replaceFunc); var prop = nodeName.replace (/-./g, this.replaceFunc);
this.setProperty (c, prop, nodeValue); this.setProperty (c, prop, nodeValue);
@ -229,7 +229,13 @@ Vn.Builder = new Class
{ {
var prop = c.klass.Properties[propName]; var prop = c.klass.Properties[propName];
if (!prop || !value) if (!prop)
{
console.warn ('Htk.Builder: Attribute \'%s\' not valid for tag \'%s\'',
propName, c.node.tagName);
return;
}
if (!value)
return; return;
switch (prop.type) switch (prop.type)
@ -241,7 +247,6 @@ Vn.Builder = new Class
value = 0 + new Number (value); value = 0 + new Number (value);
break; break;
case String: case String:
case Object:
value = this.translateValue (value); value = this.translateValue (value);
break; break;
case Function: case Function:
@ -274,6 +279,11 @@ Vn.Builder = new Class
this.signalData = parentBuilder.signalData; this.signalData = parentBuilder.signalData;
} }
,$: function (objectId)
{
return this.get (objectId);
}
,get: function (objectId) ,get: function (objectId)
{ {
var object = this.objectMap[objectId]; var object = this.objectMap[objectId];

View File

@ -9,7 +9,7 @@ Vn.Param = new Class
{ {
value: value:
{ {
type: Object type: String
,set: function (x) ,set: function (x)
{ {
if (Vn.Value.compare (x, this._value)) if (Vn.Value.compare (x, this._value))

View File

@ -22,4 +22,6 @@ Vn.Locale.add
,"UploadFile": "Putjar arxiu" ,"UploadFile": "Putjar arxiu"
,"ImageAdded": "Imatge afegida correctament" ,"ImageAdded": "Imatge afegida correctament"
,"Close": "Tancar" ,"Close": "Tancar"
,"Previous": "Anterior"
,"Next": "Següent"
}); });

View File

@ -5,22 +5,24 @@
,"NEXT": "SIGUIENTE" ,"NEXT": "SIGUIENTE"
,"DeliveryOrPickupQuestion": "¿Desea recibir o recoger el pedido?" ,"DeliveryOrPickupQuestion": "¿Desea recibir o recoger el pedido?"
,"Receive": "Recibir" ,"ReceiveThroughtAgency": "Recibir por agencia"
,"Pickup": "Recoger" ,"ReceiveThroughtRoute": "Reparto Verdnatura"
,"PickupInStore": "Recoger en almacén"
,"OrderDateDeliveryQuestion": "¿Qué día desea recibir el pedido?" ,"OrderDateDeliveryQuestion": "¿Qué día desea recibir el pedido?"
,"OrderDatePickupQuestion": "¿Qué día desea recoger el pedido?" ,"OrderDatePickupQuestion": "¿Qué día desea recoger el pedido?"
,"AddressQuestion": "¿Dónde desea recibir el pedido?" ,"AddressQuestion": "¿Dónde desea recibir el pedido?"
,"AgencyQuestion": "¿Por qué agencia desea recibir el pedido?" ,"AgencyQuestion": "¿Por qué agencia desea recibir el pedido?"
,"PickupWarehouseQuestion": "¿En qué almacén desea recoger su pedido?" ,"PickupWarehouseQuestion": "¿En qué almacén desea recoger el pedido?"
,"ConfirmToAccessCatalog": "Confirme los datos para acceder al catálogo" ,"ConfirmToAccessCatalog": "Confirme los datos para acceder al catálogo"
,"ArrivalOf": "Llegada el" ,"Arrival": "Llegada"
,"PickupOf": "Recogida el" ,"Pickup": "Recogida"
,"%A, %e of %B": "%A, %e de %B" ,"%A, %e of %B": "%A, %e de %B"
,"Agency": "Agencia" ,"Agency": "Agencia"
,"Warehouse": "Almacén" ,"Warehouse": "Almacén"
,"CONFIRM": "CONFIRMAR" ,"CONFIRM": "CONFIRMAR"
,"ErrorCreatingOrder": "Error al crear el pedido" ,"ErrorCreatingOrder": "Error al crear el pedido"
,"OrderStarted": "Pedido empezado"
} }

View File

@ -1,6 +1,6 @@
{ {
"StartedOrdersDesc": "OpenOrders":
"Pedidos pendientes de confirmar" "Pedidos abiertos"
,"StartOrder": "Empezar pedido" ,"StartOrder": "Empezar pedido"
,"ContinueOrder": "Continuar pedido" ,"ContinueOrder": "Continuar pedido"
@ -9,8 +9,8 @@
,"DateExit": "Fecha de salida" ,"DateExit": "Fecha de salida"
,"SendMethod": "Forma de envío" ,"SendMethod": "Forma de envío"
,"ConfirmedOrdersDesc": ,"ConfirmedOrders":
"Pedidos confirmados más recientes" "Pedidos confirmados"
,"PendingBalance:": "Saldo pendiente:" ,"PendingBalance:": "Saldo pendiente:"
,"PaymentInfo": "Para realizar una entrega a cuenta pulse en el botón de la derecha y haga el pago en la empresa correspondiente. La cantidad que aparece es el saldo pendiente a día de hoy, no tiene en cuenta pedidos del futuro. Puede realizar una entrega a cuenta de la cantidad que desee. Si desea pagar un pedido en concreto puede pulsar directamente en el botón de pago del pedido." ,"PaymentInfo": "Para realizar una entrega a cuenta pulse en el botón de la derecha y haga el pago en la empresa correspondiente. La cantidad que aparece es el saldo pendiente a día de hoy, no tiene en cuenta pedidos del futuro. Puede realizar una entrega a cuenta de la cantidad que desee. Si desea pagar un pedido en concreto puede pulsar directamente en el botón de pago del pedido."
@ -31,4 +31,6 @@
,"AmountToPay:": "Cantidad a pagar (€):" ,"AmountToPay:": "Cantidad a pagar (€):"
,"AmountError": "La cantidad debe ser un número positivo e inferior o igual al importe pendiente" ,"AmountError": "La cantidad debe ser un número positivo e inferior o igual al importe pendiente"
,"PayError": "Error al realizar el pago" ,"PayError": "Error al realizar el pago"
,"%A, %e of %B": "%A, %e de %B"
} }

View File

@ -22,4 +22,6 @@ Vn.Locale.add
,"UploadFile": "Subir archivo" ,"UploadFile": "Subir archivo"
,"ImageAdded": "Imagen añadida correctamente" ,"ImageAdded": "Imagen añadida correctamente"
,"Close": "Cerrar" ,"Close": "Cerrar"
,"Previous": "Anterior"
,"Next": "Siguiente"
}); });

View File

@ -22,4 +22,6 @@ Vn.Locale.add
,"UploadFile": "Télécharger le fichier" ,"UploadFile": "Télécharger le fichier"
,"ImageAdded": "Image ajoutée correctement" ,"ImageAdded": "Image ajoutée correctement"
,"Close": "Croche" ,"Close": "Croche"
,"Previous": "Précédent"
,"Next": "Suivant"
}); });

View File

@ -22,4 +22,6 @@ Vn.Locale.add
,"UploadFile": "Subir archivo" ,"UploadFile": "Subir archivo"
,"ImageAdded": "Imagen añadida correctamente" ,"ImageAdded": "Imagen añadida correctamente"
,"Close": "Cerrar" ,"Close": "Cerrar"
,"Previous": "Anterior"
,"Next": "Següent"
}); });