Htk.Repater beta, errores solucionados
This commit is contained in:
parent
92293086a1
commit
d64160d891
|
@ -2,7 +2,5 @@
|
|||
Vn.Provinces = new Class
|
||||
({
|
||||
Extends: Vn.Module
|
||||
|
||||
,activate: function () {}
|
||||
});
|
||||
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<vn>
|
||||
<div id="form" class="about">
|
||||
<div class="box">
|
||||
<div>
|
||||
<div>
|
||||
<div class="header">
|
||||
<h1><t>QualityAndVariety</t></h1>
|
||||
</div>
|
||||
|
@ -16,8 +16,8 @@
|
|||
<t>PurchaseThroughWeb</t>
|
||||
</p>
|
||||
<img src="forms/cms/about/image/palletizing.png" alt="palletizing"/>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="header">
|
||||
<h1><t>WhatMakeUsDifferent</t></h1>
|
||||
</div>
|
||||
|
@ -25,15 +25,15 @@
|
|||
<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>
|
||||
<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>
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="header">
|
||||
<h1><t>Training</t></h1>
|
||||
</div>
|
||||
|
@ -43,8 +43,8 @@
|
|||
<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>
|
||||
<div>
|
||||
<div class="header">
|
||||
<h1><t>HowWeWork</t></h1>
|
||||
</div>
|
||||
|
@ -85,13 +85,13 @@
|
|||
<p><t>AfterEmbedAgency</t></p>
|
||||
<img src="forms/cms/about/image/agencies.png" alt="agencies"/>
|
||||
<p><t>FreshnessGuaranteed</t></p>
|
||||
</div>
|
||||
<div class="summary">
|
||||
</div>
|
||||
<div class="summary">
|
||||
<p>
|
||||
<t>AboutSummary</t>
|
||||
<img src="image/logo.svg" alt="Verdnatura"/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</vn>
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
Vn.Home = new Class
|
||||
({
|
||||
Extends: Vn.Module
|
||||
|
||||
,activate: function () {}
|
||||
});
|
||||
|
||||
|
|
|
@ -2,6 +2,4 @@
|
|||
Vn.Training = new Class
|
||||
({
|
||||
Extends: Vn.Module
|
||||
|
||||
,activate: function () {}
|
||||
});
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -65,15 +65,33 @@
|
|||
</div>
|
||||
<!-- <htk-repeater model="items-model" form-id="item">
|
||||
<div class="item-box">
|
||||
<div class="image">
|
||||
<div>
|
||||
<htk-image form="item" column="Foto" directory="catalog/200x200"/>
|
||||
<p>
|
||||
</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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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']))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
@ -55,6 +60,19 @@ Htk.Repeater = new Class
|
|||
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 ()
|
||||
{
|
||||
if (!this._model || !this.xml)
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
@ -49,6 +51,8 @@ Htk.Toast = new Class
|
|||
}
|
||||
|
||||
,hide: function ()
|
||||
{
|
||||
if (this.timerId)
|
||||
{
|
||||
clearTimeout (this.timerId);
|
||||
this.timerId = null;
|
||||
|
@ -56,6 +60,7 @@ Htk.Toast = new Class
|
|||
document.body.removeChild (this.node);
|
||||
this.signalEmit ('closed');
|
||||
}
|
||||
}
|
||||
|
||||
,stopEvent: function (event)
|
||||
{
|
||||
|
|
|
@ -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 |
|
@ -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;
|
||||
|
|
|
@ -22,6 +22,9 @@ class Web
|
|||
**/
|
||||
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.
|
||||
**/
|
||||
|
|
Loading…
Reference in New Issue