0
1
Fork 0

Various fixes

This commit is contained in:
Juan Ferrer Toribio 2017-11-02 09:23:55 +01:00
parent 37236b6bb0
commit 3aaf1298ee
17 changed files with 139 additions and 84 deletions

View File

@ -22,12 +22,12 @@ Hedera.AddressList = new Class
window.history.back(); window.history.back();
} }
,onRemoveAddressClick: function (button, form) ,onRemoveAddressClick: function (button)
{ {
if (confirm (_('AreYouSureDeleteAddress'))) if (confirm (_('AreYouSureDeleteAddress')))
{ {
form.set ('active', false); button.lot.set ('active', false);
form.refresh (); button.lot.refresh ();
} }
} }
}); });

View File

@ -30,7 +30,7 @@
id="default-address" id="default-address"
lot="user-form" lot="user-form"
name="default_address"/> name="default_address"/>
<htk-repeater model="addresses" form-id="iter"> <htk-repeater model="addresses">
<custom> <custom>
<a <a
class="list-row" class="list-row"

View File

@ -44,10 +44,10 @@ Hedera.Basket = new Class
res.$.subtotal.value = this.subtotal (form); res.$.subtotal.value = this.subtotal (form);
} }
,onDeleteClick: function (button, form) ,onDeleteClick: function (button)
{ {
if (confirm (_('ReallyDelete'))) if (confirm (_('ReallyDelete')))
form.deleteRow (); button.lot.deleteRow ();
} }
,subtotal: function (form) ,subtotal: function (form)

View File

@ -37,7 +37,7 @@
<custom> <custom>
<div class="line"> <div class="line">
<htk-button <htk-button
value="{{ticket_id}}" lot="iter"
class="delete" class="delete"
tip="_Remove" tip="_Remove"
icon="delete" icon="delete"

View File

@ -234,21 +234,22 @@ Hedera.Catalog = new Class
this.hash.$ = {form: 'ecomerce/checkout'}; this.hash.$ = {form: 'ecomerce/checkout'};
} }
,onAddItemClick: function (button, form) ,onAddItemClick: function (button)
{ {
if (this.isGuest ()) if (this.isGuest ())
return; return;
this.onEraseClick (); this.onEraseClick ();
this.$.card.row = form.row; var lot = button.lot;
this.$.cardLot.assign ({item: form.$.item_id}); this.$.card.row = lot.row;
this.$.cardPopup.show (button.node); this.$.cardLot.assign ({item: lot.$.item_id});
this.$.cardPopup.show ();
} }
,onAddLotClick: function (column, value, rowIndex) ,onAddLotClick: function (column, value, rowIndex)
{ {
var row = this.$.itemLots.getObject (rowIndex); var row = this.$.itemLots.getObject (rowIndex);
var lotAmount = this.items[row.warehouse]; var lotAmount = this.items[row.warehouse_id];
if (lotAmount === undefined) if (lotAmount === undefined)
lotAmount = 0; lotAmount = 0;
@ -260,7 +261,7 @@ Hedera.Catalog = new Class
if (newAmount > row.available) if (newAmount > row.available)
newAmount = row.available; newAmount = row.available;
this.items[row.warehouse] = newAmount; this.items[row.warehouse_id] = newAmount;
this.$.amount.value += newAmount - lotAmount; this.$.amount.value += newAmount - lotAmount;
} }
else else
@ -279,11 +280,11 @@ Hedera.Catalog = new Class
amountSum += amount; amountSum += amount;
var params = { var params = {
item: this.$.cardItem.value, item: this.$.cardLot.$.item,
warehouse: warehouse, warehouse: parseInt (warehouse),
amount: amount amount: amount
}; };
sql += this.conn.render (query, params); sql += this.conn.renderQuery (query, params);
} }
if (amountSum > 0) if (amountSum > 0)
@ -292,7 +293,7 @@ Hedera.Catalog = new Class
var itemName = this.$.card.$.Article; var itemName = this.$.card.$.Article;
Htk.Toast.showMessage ( Htk.Toast.showMessage (
sprintf (_('Added%dOf%s'), amountSum, itemName)); Vn.Value.sprintf (_('Added%dOf%s'), amountSum, itemName));
} }
this.$.cardPopup.hide (); this.$.cardPopup.hide ();
@ -308,12 +309,7 @@ Hedera.Catalog = new Class
{ {
this.onEraseClick (); this.onEraseClick ();
this.$.card.row = -1; this.$.card.row = -1;
this.$.cardItem.value = undefined; this.$.cardLot.assign ({item: undefined});
}
,onStatusChange: function ()
{
this.$.cardPopup.reset ();
} }
}); });

View File

@ -78,8 +78,7 @@
<db-form id="card-extend"> <db-form id="card-extend">
<db-model <db-model
property="model" property="model"
lot="card-lot" lot="card-lot">
on-status-changed-after="onStatusChange">
SELECT a.description, o.str origin SELECT a.description, o.str origin
FROM vn2008.Articles a FROM vn2008.Articles a
LEFT JOIN vn_locale.origin_view o ON o.origin_id = a.id_origen LEFT JOIN vn_locale.origin_view o ON o.origin_id = a.id_origen
@ -89,8 +88,7 @@
<db-model <db-model
id="item-lots" id="item-lots"
result-index="1" result-index="1"
lot="card-lot" lot="card-lot">
on-status-changed-after="onStatusChange">
CALL bionic_from_item (#item); CALL bionic_from_item (#item);
SELECT p.warehouse_id, w.name warehouse, p.grouping, p.price, p.rate, l.available SELECT p.warehouse_id, w.name warehouse, p.grouping, p.price, p.rate, l.available
FROM tmp.bionic_lot l FROM tmp.bionic_lot l
@ -137,10 +135,11 @@
full-dir="900x900"/> full-dir="900x900"/>
<div class="item-info"> <div class="item-info">
<htk-button <htk-button
lot="item"
value="{{item.item_id}}" value="{{item.item_id}}"
tip="_AddToBasket" tip="_AddToBasket"
icon="add" icon="add"
on-click="onAddItemClick(item.item_id)" on-click="onAddItemClick"
class="add-button"/> class="add-button"/>
<h2>{{item.Article}}</h2> <h2>{{item.Article}}</h2>
<p class="producer"> <p class="producer">

View File

@ -22,9 +22,9 @@ Hedera.Invoices = new Class
return; return;
var params = { var params = {
'srv': 'rest:dms/invoice' srv: 'rest:dms/invoice'
,'invoice': invoiceId ,invoice: invoiceId
,'token': this.conn.token ,token: this.conn.token
}; };
var url = '?'+ Vn.Url.makeUri (params); var url = '?'+ Vn.Url.makeUri (params);

View File

@ -10,7 +10,7 @@ module.exports = new Class
{ {
Object.assign (this, { Object.assign (this, {
data: result.data, data: result.data,
result: result.tables, tables: result.tables,
columns: result.columns, columns: result.columns,
row: -1 row: -1
}); });

View File

@ -45,23 +45,29 @@ module.exports = new Class
var bar = this.createRoot ('div'); var bar = this.createRoot ('div');
bar.className = 'htk-assistant-bar'; bar.className = 'htk-assistant-bar';
var previousButton = this.createElement ('img'); var previousButton = this.createElement ('button');
previousButton.src = 'image/icon/light/go-previous.svg';
previousButton.className = 'previous'; previousButton.className = 'previous';
previousButton.title = _('Previous'); previousButton.title = _('Previous');
previousButton.addEventListener ('click', this.movePrevious.bind (this)); previousButton.addEventListener ('click', this.movePrevious.bind (this));
bar.appendChild (previousButton); bar.appendChild (previousButton);
var icon = this.createElement ('htk-icon');
icon.icon = 'go-previous';
previousButton.appendChild (icon.node);
var steps = this.createElement ('div'); var steps = this.createElement ('div');
bar.appendChild (steps); bar.appendChild (steps);
var nextButton = this.createElement ('img'); var nextButton = this.createElement ('button');
nextButton.src = 'image/icon/light/go-next.svg';
nextButton.className = 'next'; nextButton.className = 'next';
nextButton.title = _('Next'); nextButton.title = _('Next');
nextButton.addEventListener ('click', this.moveNext.bind (this)); nextButton.addEventListener ('click', this.moveNext.bind (this));
bar.appendChild (nextButton); bar.appendChild (nextButton);
var icon = this.createElement ('htk-icon');
icon.icon = 'go-next';
nextButton.appendChild (icon.node);
this._steps = steps; this._steps = steps;
this._previousButton = previousButton; this._previousButton = previousButton;
this._nextButton = nextButton; this._nextButton = nextButton;

View File

@ -48,15 +48,7 @@ module.exports = new Class
{ {
return this._stepFunc; return this._stepFunc;
} }
}, }
node:
{
type: Object
,set: function (x)
{
x.className = 'htk-assistant';
}
},
} }
,_steps: [] ,_steps: []

View File

@ -10,15 +10,25 @@ module.exports = new Class
type: String type: String
,set: function (x) ,set: function (x)
{ {
this._image = x;
this.img.src = x; this.img.src = x;
} }
,get: function ()
{
return this._image;
}
}, },
icon: icon:
{ {
type: String type: String
,set: function (x) ,set: function (x)
{ {
this.img.src = 'image/icon/light/'+ x +'.svg'; this._icon = x;
this.image = 'image/icon/light/'+ x +'.svg';
}
,get: function ()
{
return this._icon;
} }
}, },
tip: tip:
@ -26,17 +36,15 @@ module.exports = new Class
type: String type: String
,set: function (x) ,set: function (x)
{ {
if (x) this._tip = x;
{ x = x ? x : '';
this.node.title = _(x); this.node.title = x;
this.img.title = _(x); this.img.title = x;
}
this.renderContent (); this.renderContent ();
} }
,get: function () ,get: function ()
{ {
return this.node.title; return this._tip;
} }
}, },
showText: showText:
@ -55,6 +63,9 @@ module.exports = new Class
} }
,_showText: false ,_showText: false
,_tip: null
,_image: null
,_icon: null
,render: function () ,render: function ()
{ {

View File

@ -37,12 +37,16 @@ module.exports = new Class
div.className = 'month'; div.className = 'month';
node.appendChild (div); node.appendChild (div);
var button = this.createElement ('div'); var button = this.createElement ('button');
button.appendChild (this.createTextNode ('<')); button.className = 'previous';
button.className = 'button previous';
button.addEventListener ('click', this.prevMonthClicked.bind (this)); button.addEventListener ('click', this.prevMonthClicked.bind (this));
div.appendChild (button); div.appendChild (button);
var icon = this.createElement ('htk-icon');
icon.icon = 'go-previous',
icon.theme = 'dark';
button.appendChild (icon.node);
var monthNode = this.createElement ('span'); var monthNode = this.createElement ('span');
div.appendChild (monthNode); div.appendChild (monthNode);
@ -52,12 +56,16 @@ module.exports = new Class
var yearNode = this.createElement ('span'); var yearNode = this.createElement ('span');
div.appendChild (yearNode); div.appendChild (yearNode);
var button = this.createElement ('div'); var button = this.createElement ('button');
button.appendChild (this.createTextNode ('>')); button.className = 'next';
button.className = 'button next';
button.addEventListener ('click', this.nextMonthClicked.bind (this)); button.addEventListener ('click', this.nextMonthClicked.bind (this));
div.appendChild (button); div.appendChild (button);
var icon = this.createElement ('htk-icon');
icon.icon = 'go-next',
icon.theme = 'dark';
button.appendChild (icon.node);
var wrapper = this.createElement ('div'); var wrapper = this.createElement ('div');
wrapper.className = 'wrapper'; wrapper.className = 'wrapper';
node.appendChild (wrapper); node.appendChild (wrapper);

View File

@ -50,7 +50,8 @@ module.exports = new Class
,render: function () ,render: function ()
{ {
this.createRoot ('img'); var node = this.createRoot ('img');
node.className = 'htk-icon';
} }
,_setIcon: function () ,_setIcon: function ()

View File

@ -215,23 +215,19 @@ td.cell-image .htk-image
line-height: 2.2em; line-height: 2.2em;
font-size: 1.4em; font-size: 1.4em;
} }
.htk-calendar .month > .button .htk-calendar .month > button
{ {
cursor: pointer;
height: 2.2em; height: 2.2em;
width: 2.2em; width: 2.2em;
text-align: center; text-align: center;
border-radius: 50%; border-radius: 50%;
margin: 0;
} }
.htk-calendar .month > .button:hover .htk-calendar .month > button.previous
{
background-color: rgba(1, 1, 1, 0.2);
}
.htk-calendar .month > .button.previous
{ {
float:left; float:left;
} }
.htk-calendar .month > .button.next .htk-calendar .month > button.next
{ {
float:right; float:right;
} }
@ -548,29 +544,31 @@ td.cell-image .htk-image
{ {
cursor: pointer; cursor: pointer;
} }
.htk-assistant-bar > img .htk-assistant-bar > button
{ {
position: absolute; position: absolute;
width: 1.8em; width: 2.5em;
height: 2.5em;
top: 0; top: 0;
padding: .3em; padding: .3em;
border-radius: 0.1em;
margin: -0.3 0; margin: -0.3 0;
border-radius: 50%;
} }
.htk-assistant-bar > img:hover .htk-assistant-bar > button > .htk-icon
{ {
background-color: rgba(1,1,1,0.1); width: 100%;
height: 100%;
} }
.htk-assistant-bar > img.previous, .htk-assistant-bar > button.previous,
.htk-assistant-bar > img.next .htk-assistant-bar > button.next
{ {
margin: -0.3em; margin: -0.3em;
} }
.htk-assistant-bar > img.previous .htk-assistant-bar > button.previous
{ {
left: 0; left: 0;
} }
.htk-assistant-bar > img.next .htk-assistant-bar > button.next
{ {
right: 0; right: 0;
} }

View File

@ -7,7 +7,8 @@ var nativeEvents = {
,focusout : 1 ,focusout : 1
}; };
module.exports = new Class var Klass = new Class ();
module.exports = Klass.implement
({ ({
Extends: NodeBuilder Extends: NodeBuilder
,Properties: ,Properties:
@ -27,12 +28,12 @@ module.exports = new Class
/** /**
* CSS classes to be appendend to the node classes. * CSS classes to be appendend to the node classes.
*/ */
class: className:
{ {
type: String type: String
,set: function (x) ,set: function (x)
{ {
this._cssClass = x; this._className = x;
this._refreshClass (); this._refreshClass ();
} }
,get: function () ,get: function ()
@ -40,6 +41,18 @@ module.exports = new Class
return this._node.className; return this._node.className;
} }
}, },
/**
* CSS classes to be appendend to the node classes.
*/
class:
{
type: String
,set: function (x)
{
this._className = x;
this._refreshClass ();
}
},
/** /**
* The HTML id of the element. * The HTML id of the element.
*/ */
@ -70,6 +83,19 @@ module.exports = new Class
this.renderBase (); this.renderBase ();
this.parent (props); this.parent (props);
} }
,appendChild: function (child)
{
if (child instanceof Klass)
this._node.appendChild (child.node);
else if (child instanceof Element)
this._node.appendChild (child);
}
,addEventListener: function (eventName, callback)
{
this.node.addEventListener (eventName, callback);
}
,on: function (id, callback, instance) ,on: function (id, callback, instance)
{ {
@ -101,8 +127,8 @@ module.exports = new Class
,_refreshClass: function () ,_refreshClass: function ()
{ {
if (this._node && this._cssClass) if (this._node && this._className)
this._node.className = this._cssClass +' '+ this._node.className; this._node.className = this._className +' '+ this._node.className;
} }
,remove: function () ,remove: function ()

View File

@ -4,6 +4,20 @@ var VnObject = require ('./object');
module.exports = new Class module.exports = new Class
({ ({
Extends: VnObject Extends: VnObject
,Properties:
{
/**
* The owner document.
*/
ownerDocument:
{
type: Object
,get: function ()
{
return this.doc;
}
}
}
,doc: null ,doc: null
@ -15,7 +29,12 @@ module.exports = new Class
,createElement: function (tagName) ,createElement: function (tagName)
{ {
return document.createElement (tagName); var customTag = vnCustomTags[tagName];
if (customTag !== undefined)
return new customTag ({doc: this.doc});
else
return document.createElement (tagName);
} }
,createTextNode: function (text) ,createTextNode: function (text)

View File

@ -29,7 +29,6 @@ function checkTransitions ()
return null; return null;
} }
checkTransitions ();
/** /**
* Slides an element. * Slides an element.