Htk.Repater beta, errores solucionados

This commit is contained in:
Juan Ferrer Toribio 2015-03-15 13:44:57 +01:00
parent 92293086a1
commit d64160d891
20 changed files with 282 additions and 184 deletions

View File

@ -2,7 +2,5 @@
Vn.Provinces = new Class
({
Extends: Vn.Module
,activate: function () {}
});

View File

@ -3,7 +3,6 @@
<vn-param id="agency">
<vn-hash-link key="agency"/>
</vn-param>
<vn-param id="agency-id"/>
</vn-group>
<div id="form" class="provinces">
<div class="box">

View File

@ -1,97 +1,97 @@
<vn>
<div id="form" class="about">
<div class="box">
<div>
<div class="header">
<h1><t>QualityAndVariety</t></h1>
<div>
<div class="header">
<h1><t>QualityAndVariety</t></h1>
</div>
<p><t>MaximumFreshness</t></p>
<h3><t>SquareMeters</t></h3>
<img src="forms/cms/about/image/store.png" alt="store"/>
<h3><t>AboutRealms</t></h3>
<p><t>AboutLocation</t></p>
<img src="forms/cms/about/image/trailer.png" alt="trailer"/>
<p>
<img src="forms/cms/about/image/dealer.png" alt="dealer"/>
<t>PurchaseThroughWeb</t>
</p>
<img src="forms/cms/about/image/palletizing.png" alt="palletizing"/>
</div>
<p><t>MaximumFreshness</t></p>
<h3><t>SquareMeters</t></h3>
<img src="forms/cms/about/image/store.png" alt="store"/>
<h3><t>AboutRealms</t></h3>
<p><t>AboutLocation</t></p>
<img src="forms/cms/about/image/trailer.png" alt="trailer"/>
<p>
<img src="forms/cms/about/image/dealer.png" alt="dealer"/>
<t>PurchaseThroughWeb</t>
</p>
<img src="forms/cms/about/image/palletizing.png" alt="palletizing"/>
</div>
<div>
<div class="header">
<h1><t>WhatMakeUsDifferent</t></h1>
<div>
<div class="header">
<h1><t>WhatMakeUsDifferent</t></h1>
</div>
<p><t>DesignVariety</t></p>
<img src="forms/cms/about/image/differentiates_us.png" alt="differentiates_us"/>
<p><t>AdaptToYourNeeds</t></p>
<h3><t>TheBestQuality</t></h3>
</div>
<p><t>DesignVariety</t></p>
<img src="forms/cms/about/image/differentiates_us.png" alt="differentiates_us"/>
<p><t>AdaptToYourNeeds</t></p>
<h3><t>TheBestQuality</t></h3>
</div>
<div>
<div class="header">
<h1><t>AtYourService</t></h1>
<div>
<div class="header">
<h1><t>AtYourService</t></h1>
</div>
<h2><t>BuyersAndTraders</t></h2>
<img src="forms/cms/about/image/commercial.png" alt="commercial"/>
</div>
<h2><t>BuyersAndTraders</t></h2>
<img src="forms/cms/about/image/commercial.png" alt="commercial"/>
</div>
<div>
<div class="header">
<h1><t>Training</t></h1>
<div>
<div class="header">
<h1><t>Training</t></h1>
</div>
<p><t>GoodTraining</t></p>
<img src="forms/cms/about/image/training.png" alt="training"/>
<p><t>SpecialTrainingPrices</t></p>
<img src="forms/cms/about/image/courses.png" alt="courses"/>
<h2><t>YoutubeChannel</t></h2>
<img src="forms/cms/about/image/youtube.png" alt="youtube"/>
</div>
<p><t>GoodTraining</t></p>
<img src="forms/cms/about/image/training.png" alt="training"/>
<p><t>SpecialTrainingPrices</t></p>
<img src="forms/cms/about/image/courses.png" alt="courses"/>
<h2><t>YoutubeChannel</t></h2>
<img src="forms/cms/about/image/youtube.png" alt="youtube"/>
</div>
<div>
<div class="header">
<h1><t>HowWeWork</t></h1>
<div>
<div class="header">
<h1><t>HowWeWork</t></h1>
</div>
<p><t>AalsmeerAuction</t></p>
<img src="forms/cms/about/image/auction.png" alt="auction"/>
<p><t>BeforeAuction</t></p>
<img src="forms/cms/about/image/producers.png" alt="producers"/>
<p><t>DirectlyFromProviders</t></p>
<p><t>GoodsDischarge</t></p>
<img src="forms/cms/about/image/goods_transport.png" alt="goods_transport"/>
<h2>
<t>FirstQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<img src="forms/cms/about/image/goods_receive.png" alt="goods_receive"/>
<p><t>GoodsTravel</t></p>
<img src="forms/cms/about/image/2_control.png" alt="2_control"/>
<p><t>GoodsReception</t></p>
<h2>
<t>SecondQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<p><t>CustomerOrders</t></p>
<img src="forms/cms/about/image/web.png" alt="web"/>
<p><t>AfterOrder</t></p>
<img src="forms/cms/about/image/4_control.png" alt="4_control"/>
<h2>
<t>ThirdQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<p><t>BuyerControl</t></p>
<h2>
<t>FourthQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<p><t>EmbeddedSection</t></p>
<img src="forms/cms/about/image/fit.png" alt="fit"/>
<p><t>AfterEmbedAgency</t></p>
<img src="forms/cms/about/image/agencies.png" alt="agencies"/>
<p><t>FreshnessGuaranteed</t></p>
</div>
<div class="summary">
<p>
<t>AboutSummary</t>
<img src="image/logo.svg" alt="Verdnatura"/>
</p>
</div>
<p><t>AalsmeerAuction</t></p>
<img src="forms/cms/about/image/auction.png" alt="auction"/>
<p><t>BeforeAuction</t></p>
<img src="forms/cms/about/image/producers.png" alt="producers"/>
<p><t>DirectlyFromProviders</t></p>
<p><t>GoodsDischarge</t></p>
<img src="forms/cms/about/image/goods_transport.png" alt="goods_transport"/>
<h2>
<t>FirstQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<img src="forms/cms/about/image/goods_receive.png" alt="goods_receive"/>
<p><t>GoodsTravel</t></p>
<img src="forms/cms/about/image/2_control.png" alt="2_control"/>
<p><t>GoodsReception</t></p>
<h2>
<t>SecondQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<p><t>CustomerOrders</t></p>
<img src="forms/cms/about/image/web.png" alt="web"/>
<p><t>AfterOrder</t></p>
<img src="forms/cms/about/image/4_control.png" alt="4_control"/>
<h2>
<t>ThirdQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<p><t>BuyerControl</t></p>
<h2>
<t>FourthQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<p><t>EmbeddedSection</t></p>
<img src="forms/cms/about/image/fit.png" alt="fit"/>
<p><t>AfterEmbedAgency</t></p>
<img src="forms/cms/about/image/agencies.png" alt="agencies"/>
<p><t>FreshnessGuaranteed</t></p>
</div>
<div class="summary">
<p>
<t>AboutSummary</t>
<img src="image/logo.svg" alt="Verdnatura"/>
</p>
</div>
</div>
</div>
</vn>

View File

@ -33,10 +33,10 @@ Vn.Contact = new Class
if (response)
{
form.reset ();
alert (_('DataSentSuccess'));
(new Htk.Toast ()).showMessage (_('DataSentSuccess'));
}
else
alert (_('ErrorSendingData'));
(new Htk.Toast ()).showError (_('ErrorSendingData'));
form['captcha'].value = '';
this.refreshCaptcha ();

View File

@ -2,7 +2,5 @@
Vn.Home = new Class
({
Extends: Vn.Module
,activate: function () {}
});

View File

@ -2,6 +2,4 @@
Vn.Training = new Class
({
Extends: Vn.Module
,activate: function () {}
});

View File

@ -12,14 +12,12 @@ Vn.Catalog = new Class
model.setFieldFlags ('id', Db.Conn.Flag.AI);
model.setFieldFlags ('Id_Article', Db.Conn.Flag.PRI_KEY);
this.$('type-column').renderer = this.typeRenderer.bind (this);
this.$('cat').renderer = this.catRenderer;
this.$('basket-button').addEventListener ('click', this.basketClicked.bind (this));
this.$('menu-button').addEventListener ('click', this.showMenu.bind (this));
this.$('menu').addEventListener ('click', this.onMenuClick.bind (this));
this.$('search-entry').addEventListener ('change', this.onSearch.bind (this));
this.$('type-column').renderer = this.typeRenderer.bind (this);
this.$('cat').renderer = this.catRenderer;
this.$('realms-model').on ('status-changed', this.onRealmsReload.bind (this));
this.$('realms').on ('changed', this.onRealmChanged.bind (this));
this.$('types-model').on ('status-changed', this.onTypesReload.bind (this));

View File

@ -184,21 +184,44 @@ table.types td.grid-message
padding-top: 1em;
}
/* Box view */
/* Grid view */
.item-box
{
padding: 1em;
border-bottom: 1px solid #DDD;
height: 14em;
min-height: 14em;
}
.item-box img
.item-box > .image
{
width: 8em;
height: 14em;
float: left;
margin-right: 1em;
max-width: 14em;
max-height: 14em;
}
.item-box img
{
max-width: 8em;
max-height: 8em;
display: block;
margin: 0 auto;
}
.item-box p
{
margin: 0;
padding: 0.6em;
}
.item-box h2
{
font-weight: normal;
}
.item-box .amount
{
width: 3em;
}
.amount-p
{
text-align: right;
}
/* List view */

View File

@ -65,15 +65,33 @@
</div>
<!-- <htk-repeater model="items-model" form-id="item">
<div class="item-box">
<htk-image form="item" column="Foto" directory="catalog/200x200"/>
<p>
<div class="image">
<div>
<htk-image form="item" column="Foto" directory="catalog/200x200"/>
</div>
</div>
<h2>
<htk-text form="item" column="Article"/>
</h2>
<p>
<htk-text form="item" column="Medida"/> /
<htk-text form="item" column="Categoria"/> /
<htk-text form="item" column="Color"/> /
<htk-text form="item" column="Tallos"/> /
<htk-text form="item" column="Abreviatura"/>
</p>
<p>
<htk-text form="item" column="Categoria"/> /
<htk-text form="item" column="Medida"/> /
<htk-text form="item" column="Color"/> /
<htk-text form="item" column="Tallos"/>
<t>Available:</t>
<htk-text form="item" column="available"/>
</p>
<p>
<t>Price:</t>
<htk-text form="item" column="price" format="%.2d€"/>
</p>
<p class="amount-p">
<htk-entry id="stems" class="amount"/>
<htk-text form="item" column="grouping" format="x%.0d"/>
<htk-entry form="item" column="amount" class="amount"/>
</p>
<div class="clear"/>
</div>

View File

@ -77,11 +77,11 @@
</tbody>
</table>
<htk-grid model="ticket-data">
<htk-column-spin title="PC" column="zip_code"/>
<htk-column-text title="City" column="city"/>
<htk-column-text title="Province" column="province"/>
<htk-column-text title="Address" column="name"/>
<htk-column-text title="Consignee" column="consignee"/>
<htk-column-spin title="_PC" column="zip_code"/>
<htk-column-text title="_City" column="city"/>
<htk-column-text title="_Province" column="province"/>
<htk-column-text title="_Address" column="name"/>
<htk-column-text title="_Consignee" column="consignee"/>
</htk-grid>
<htk-grid>
<db-model id="movements">
@ -97,17 +97,17 @@
<item name="ticket" param="ticket-id"/>
</sql-batch>
</db-model>
<htk-column-spin title="ItemNumber" column="item_id"/>
<htk-column-spin title="Amount" column="amount"/>
<htk-column-text title="Item" column="concept"/>
<htk-column-text title="Category" column="Categoria"/>
<htk-column-text title="S1" column="Medida"/>
<htk-column-text title="Stems" column="Tallos"/>
<htk-column-text title="Color" column="Color"/>
<htk-column-text title="Origin" column="Abreviatura"/>
<htk-column-spin title="Price" column="price" unit="€" digits="2"/>
<htk-column-spin title="Desc" column="discount" unit="%"/>
<htk-column-spin title="Subtotal" unit="€" digits="2" id="subtotal"/>
<htk-column-spin title="_ItemNumber" column="item_id"/>
<htk-column-spin title="_Amount" column="amount"/>
<htk-column-text title="_Item" column="concept"/>
<htk-column-text title="_Category" column="Categoria"/>
<htk-column-text title="_S1" column="Medida"/>
<htk-column-text title="_Stems" column="Tallos"/>
<htk-column-text title="_Color" column="Color"/>
<htk-column-text title="_Origin" column="Abreviatura"/>
<htk-column-spin title="_Price" column="price" unit="€" digits="2"/>
<htk-column-spin title="_Desc" column="discount" unit="%"/>
<htk-column-spin title="_Subtotal" unit="€" digits="2" id="subtotal"/>
</htk-grid>
</div>
</div>

View File

@ -16,7 +16,8 @@
/* Global */
@font-face {
@font-face
{
font-family: 'Open Sans';
src: url(opensans.ttf) format('truetype');
}
@ -174,7 +175,7 @@ img.editable
/* Date chooser */
.date-chooser button
.htk-date-chooser button
{
border: 1px solid #CCD;
margin: 0.2em;
@ -286,11 +287,8 @@ table.htk-grid
table.htk-grid thead tr,
table.htk-grid tfoot tr
{
/* box-shadow: 0px 0.1em 0.1em #DDD;
background-color: #AD4;
border: 1px solid #CCD;
*/ background-color: #009688;
color: white /* #032 */;
background-color: #009688;
color: white;
vertical-align: middle;
text-align: center;
height: 3em;
@ -303,7 +301,7 @@ table.htk-grid thead th
}
table.htk-grid thead th:hover
{
background-color: #076 /* #DDE */;
background-color: #076;
}
table.htk-grid tr
{
@ -368,6 +366,21 @@ button.cell-button img
height: 1.5em;
}
/* Repater */
.htk-repeater > .message
{
margin: 0 auto;
width: 10em;
padding: 1em;
}
.htk-repeater > .message > img
{
vertical-align: middle;
padding: 0.8em;
height: 1.8em;
}
/* Calendar */
.htk-calendar
@ -451,7 +464,7 @@ button.cell-button img
.htk-toast
{
z-index: 200;
z-index: 210;
display: block;
position: fixed;
background-color: white;
@ -460,7 +473,8 @@ button.cell-button img
padding: 0.5em;
left: 50%;
top: 4em;
max-width: 20em;
width: 20em;
margin-left: -10.5em;
text-align: center;
}

View File

@ -8,7 +8,6 @@ use Vn\Hedera\Web;
use Vn\Lib\Locale;
try {
Web::init ();
Web::sysInit ();
}
catch (Exception $e)
@ -17,13 +16,14 @@ catch (Exception $e)
exit (0);
}
if (!isset ($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')
if (Web::$sysConn->getValue ('SELECT https FROM config'))
if (!Web::isHttps () && Web::$sysConn->getValue ('SELECT https FROM config'))
{
header ("Location: https://${_SERVER['SERVER_NAME']}${_SERVER['REQUEST_URI']}");
exit (0);
}
Web::init ();
// Getting the requested page
if (isset ($_GET['page']) && Vn\Hedera\checkToken ($_GET['page']))

View File

@ -12,7 +12,7 @@ Htk.DateChooser = new Class
{
this.parent (props);
this.createElement ('div');
this.node.className = 'date-chooser';
this.node.className = 'htk-date-chooser';
this.label = document.createElement ('span');
this.node.appendChild (this.label);

View File

@ -12,8 +12,8 @@ Htk.Spin = new Class
,changed: function ()
{
var value = (this.entry.value == '') ? null : parseFloat (this.entry.value);
this.entry.value = value;
var newValue = (this.node.value == '') ? null : parseFloat (this.node.value);
this.node.value = newValue;
this.realValue = value;
this.signalEmit ('changed');
}
@ -22,15 +22,11 @@ Htk.Spin = new Class
{
if (editable)
{
var input;
var obj = this;
input = document.createElement ('input');
var input = document.createElement ('input');
input.style.textAlign = 'right';
input.style.width = '100%';
setInputTypeNumber (input);
input.addEventListener ('change',
function () { obj.changed (); }, false);
input.addEventListener ('change', this.changed.bind (this));
this.node.appendChild (input);
this.entry = input;
}
@ -41,7 +37,7 @@ Htk.Spin = new Class
}
}
,setRealValue: function (value)
,putValue: function (value)
{
var text;

View File

@ -15,7 +15,6 @@ Htk.Repeater = new Class
,'row-deleted': this.onRowDelete
,'row-updated': this.onRowUpdate
,'row-inserted': this.onRowInsert
,'updatable-changed': this.onUpdatableChange
});
this.onModelChange ();
@ -36,6 +35,11 @@ Htk.Repeater = new Class
{
this._alias;
}
},
emptyMessage:
{
type: String
,value: _('NoData')
}
}
@ -46,6 +50,7 @@ Htk.Repeater = new Class
,initialize: function ()
{
this.createElement ('div');
this.node.className = 'htk-repeater';
}
,loadXml: function (builder, node)
@ -54,6 +59,19 @@ Htk.Repeater = new Class
this.parentBuilder = builder;
this.onModelChange ();
}
,buildBox: function (index)
{
var builder = new Vn.Builder ();
var form = new Db.Form ();
form.model = this._model;
form.row = index;
builder.add (this._alias, form);
var mainNode = builder.loadXmlFromNode (this.xml);
this.node.appendChild (mainNode);
}
,onModelChange: function ()
{
@ -62,41 +80,61 @@ Htk.Repeater = new Class
Vn.Node.removeChilds (this.node);
if (!this._model.ready)
return;
for (var i = 0; i < this._model.numRows; i++)
switch (this._model.status)
{
var builder = new Vn.Builder ();
case Db.Model.Status.READY:
{
for (var i = 0; i < this._model.numRows; i++)
this.buildBox (i);
var form = new Db.Form ();
form.model = this._model;
form.row = i;
builder.add (this._alias, form);
var mainNode = builder.loadXmlFromNode (this.xml);
this.node.appendChild (mainNode);
this.showNoRecordsFound ();
break;
}
case Db.Model.Status.LOADING:
this.showMessage (_('Loading'), 'loader-black.gif');
break;
case Db.Model.Status.CLEAN:
this.showMessage (this.emptyMessage, 'refresh.svg');
break;
case Db.Model.Status.ERROR:
this.showMessage (_('ErrorLoadingData'), 'error.svg');
break;
}
}
,showNoRecordsFound: function (count)
{
if (this._model.numRows == 0)
this.showMessage (_('EmptyList'), 'clean.svg');
}
,showMessage: function (message, src)
{
var div = document.createElement ('div');
div.className = 'message';
this.node.appendChild (div);
var img = document.createElement ('img');
img.alt = '';
img.src = 'image/'+ src;
div.appendChild (img);
div.appendChild (document.createTextNode (message));
}
,onRowDelete: function (model, row)
{
var childs = this.node.childNodes;
this.node.removeChild (childs[row]);
Vn.Node.remove (this.node.childNodes[row]);
this.showNoRecordsFound ();
}
,onRowUpdate: function ()
,onRowUpdate: function (model, row, columns)
{
// this.form[row].signalEmit ('iter-changed');
}
,onRowInsert: function ()
,onRowInsert: function (model, row)
{
}
,onUpdatableChange: function ()
{
this.buildBox (row);
}
});

View File

@ -17,6 +17,8 @@ Htk.Toast = new Class
,showText: function (message, className)
{
this.hide ();
var textNode = document.createTextNode (message);
Vn.Node.removeChilds (this.node);
@ -27,8 +29,8 @@ Htk.Toast = new Class
this.hideHandler = this.hide.bind (this);
document.addEventListener ('mousedown', this.hideHandler);
var marginLeft = -parseInt (this.node.offsetWidth / 2);
this.node.style.marginLeft = (marginLeft) +'px';
// var marginLeft = -parseInt (this.node.offsetWidth / 2);
// this.node.style.marginLeft = (marginLeft) +'px';
this.timerId = setTimeout (this.hide.bind (this), 10000);
}
@ -50,11 +52,14 @@ Htk.Toast = new Class
,hide: function ()
{
clearTimeout (this.timerId);
this.timerId = null;
document.removeEventListener ('mousedown', this.hideHandler);
document.body.removeChild (this.node);
this.signalEmit ('closed');
if (this.timerId)
{
clearTimeout (this.timerId);
this.timerId = null;
document.removeEventListener ('mousedown', this.hideHandler);
document.body.removeChild (this.node);
this.signalEmit ('closed');
}
}
,stopEvent: function (event)

View File

@ -46,4 +46,9 @@ Htk.Widget = new Class
return null;
}
,remove: function ()
{
Vn.Node.remove (this.node);
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -13,9 +13,9 @@
div
{
position: absolute;
width: 35em;
width: 36em;
margin-top: -7em;
margin-left: -26em;
margin-left: -18em;
top: 50%;
left: 50%;
text-align: center;

View File

@ -21,7 +21,10 @@ class Web
* Initializes the Hedera web library.
**/
static function init ()
{
{
if (self::isHttps ())
ini_set ('session.cookie_secure', TRUE);
session_start ();
// Setting the locale
@ -92,6 +95,11 @@ class Web
);
}
static function isHttps ()
{
return isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';
}
/**
* Obtains the version of the library.
**/