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();
}
,onRemoveAddressClick: function (button, form)
,onRemoveAddressClick: function (button)
{
if (confirm (_('AreYouSureDeleteAddress')))
{
form.set ('active', false);
form.refresh ();
button.lot.set ('active', false);
button.lot.refresh ();
}
}
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,8 @@ var nativeEvents = {
,focusout : 1
};
module.exports = new Class
var Klass = new Class ();
module.exports = Klass.implement
({
Extends: NodeBuilder
,Properties:
@ -27,12 +28,12 @@ module.exports = new Class
/**
* CSS classes to be appendend to the node classes.
*/
class:
className:
{
type: String
,set: function (x)
{
this._cssClass = x;
this._className = x;
this._refreshClass ();
}
,get: function ()
@ -40,6 +41,18 @@ module.exports = new Class
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.
*/
@ -71,6 +84,19 @@ module.exports = new Class
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)
{
if (nativeEvents[id])
@ -101,8 +127,8 @@ module.exports = new Class
,_refreshClass: function ()
{
if (this._node && this._cssClass)
this._node.className = this._cssClass +' '+ this._node.className;
if (this._node && this._className)
this._node.className = this._className +' '+ this._node.className;
}
,remove: function ()

View File

@ -4,6 +4,20 @@ var VnObject = require ('./object');
module.exports = new Class
({
Extends: VnObject
,Properties:
{
/**
* The owner document.
*/
ownerDocument:
{
type: Object
,get: function ()
{
return this.doc;
}
}
}
,doc: null
@ -15,7 +29,12 @@ module.exports = new Class
,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)

View File

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