0
1
Fork 0
This commit is contained in:
Juan Ferrer 2022-07-15 07:55:18 +02:00
parent a43e0522f5
commit 90e9941b4c
10 changed files with 52 additions and 37 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.407.81) stable; urgency=low hedera-web (1.407.82) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -11,20 +11,20 @@ Hedera.Checkout = new Class({
}, },
onValuesReady: function() { onValuesReady: function() {
var orderForm = this.$.orderForm; const orderForm = this.$.orderForm;
var defaultsForm = this.$.defaults; const defaultsForm = this.$.defaults;
if (!(orderForm.ready && defaultsForm.ready)) if (!(orderForm.ready && defaultsForm.ready))
return; return;
var date; let date;
const row = orderForm.$ || defaultsForm.$; const row = orderForm.$ || defaultsForm.$ || {};
if (!date || date.getTime() < (new Date()).getTime()) { if (!date || date.getTime() < (new Date()).getTime()) {
date = new Date(); date = new Date();
date.setHours(0, 0, 0, 0); date.setHours(0, 0, 0, 0);
var addDays = 0; let addDays = 0;
switch(date.getDay()) { switch(date.getDay()) {
case 6: // Saturday case 6: // Saturday
@ -57,7 +57,7 @@ Hedera.Checkout = new Class({
onConfirmClick: function() { onConfirmClick: function() {
this.disableButtons(true); this.disableButtons(true);
var query = 'CALL myBasket_configure(#date, #method, #agency, #address)'; const query = 'CALL myBasket_configure(#date, #method, #agency, #address)';
this.conn.execQuery(query, this.conn.execQuery(query,
this.onBasketConfigured.bind(this), this.$.lot.$); this.onBasketConfigured.bind(this), this.$.lot.$);
}, },
@ -160,10 +160,10 @@ Hedera.Checkout = new Class({
if (this.selectedNode) if (this.selectedNode)
Vn.Node.removeClass(this.selectedNode, 'selected'); Vn.Node.removeClass(this.selectedNode, 'selected');
var row = this.$.addresses.search('id', this.$.lot.$.address); const row = this.$.addresses.search('id', this.$.lot.$.address);
if (row != -1) { if (row != -1) {
var builder = this.$.repeater.getBuilder(row); const builder = this.$.repeater.getBuilder(row);
this.selectedNode = builder.$.address; this.selectedNode = builder.$.address;
Vn.Node.addClass(this.selectedNode, 'selected'); Vn.Node.addClass(this.selectedNode, 'selected');
@ -176,15 +176,21 @@ Hedera.Checkout = new Class({
if (!model.ready) return; if (!model.ready) return;
if (model.numRows > 0) { if (model.numRows > 0) {
var agency; let agency;
var defaults = [ const agencies = [];
this.$.orderForm.$.agencyModeFk,
this.$.defaults.$.agencyModeFk,
this.$.defaults.$.defaultAgencyFk
];
for (var i = 0; i < defaults.length; i++) { if (this.$.orderForm.$)
agency = defaults[i]; agencies.push(this.$.orderForm.$);
const defaults = this.$.defaults.$;
if (defaults)
agencies.push(
defaults.agencyModeFk,
defaults.defaultAgencyFk
);
for (let i = 0; i < agencies.length; i++) {
agency = agencies[i];
if (model.search('id', agency) !== -1) if (model.search('id', agency) !== -1)
break; break;
} }

View File

@ -12,8 +12,7 @@ Hedera.New = new Class({
new Sql.Function({schema: 'account', name: 'myUser_getId'})); new Sql.Function({schema: 'account', name: 'myUser_getId'}));
tinymce.init({ tinymce.init({
mode : 'exact' target: this.$.htmlEditor
,target: this.$.htmlEditor
,plugins: [ ,plugins: [
"advlist autolink lists link image charmap print preview hr" "advlist autolink lists link image charmap print preview hr"
,"anchor pagebreak searchreplace wordcount visualblocks" ,"anchor pagebreak searchreplace wordcount visualblocks"
@ -29,7 +28,7 @@ Hedera.New = new Class({
+" | forecolor backcolor" +" | forecolor backcolor"
,image_advtab: true ,image_advtab: true
,init_instance_callback: this._onEditorInit.bind(this) ,init_instance_callback: this._onEditorInit.bind(this)
}); });
}, },
deactivate: function() { deactivate: function() {
@ -46,16 +45,12 @@ Hedera.New = new Class({
if (!this.editor) if (!this.editor)
return; return;
var newHtml = this.$.iter.$.text; const row = this.$.iter.$;
this.editor.setContent(row ? row.text : '');
if (!newHtml)
newHtml = '';
this.editor.setContent(newHtml);
}, },
onStatusChange: function() { onStatusChange: function() {
if (this.hash.$.new == 0) if (!this.hash.$.new)
this.$.iter.insertRow(); this.$.iter.insertRow();
}, },
@ -71,6 +66,10 @@ Hedera.New = new Class({
onAcceptClick: function() { onAcceptClick: function() {
this.$.iter.set('text', this.editor.getContent()); this.$.iter.set('text', this.editor.getContent());
this.$.iter.performOperations(); this.$.iter.performOperations();
},
onReturnClick: function() {
this.hash.setAll({form: 'news/news'});
} }
}); });
}); });

View File

@ -20,7 +20,7 @@
<htk-bar-button <htk-bar-button
icon="close" icon="close"
tip="_Return" tip="_Return"
on-click="this.hash.setAll({form: 'news/news'});"/> on-click="this.onReturnClick()"/>
<htk-bar-button <htk-bar-button
icon="check" icon="check"
tip="_Accept" tip="_Accept"

View File

@ -2,6 +2,10 @@
Hedera.News = new Class({ Hedera.News = new Class({
Extends: Hedera.Form Extends: Hedera.Form
,activate: function() {
this.$.newsModel.setInfo('n', 'news', 'hedera', ['id'], 'id');
}
,editNew: function(newId) { ,editNew: function(newId) {
this.hash.setAll({ this.hash.setAll({
form: 'news/new', form: 'news/new',

View File

@ -6,7 +6,7 @@
<htk-bar-button <htk-bar-button
icon="add" icon="add"
tip="_AddNew" tip="_AddNew"
on-click="this.onAddClick()"/> on-click="hash.setAll({form: 'news/new', new: null})"/>
</div> </div>
<div id="form" class="news"> <div id="form" class="news">
<htk-repeater form-id="iter" class="box htk-list vn-w-sm"> <htk-repeater form-id="iter" class="box htk-list vn-w-sm">

View File

@ -279,7 +279,6 @@ Model.implement({
,_onLotChange: function() { ,_onLotChange: function() {
const params = this._getHolderValues(); const params = this._getHolderValues();
this._paramsChanged = !Vn.Value.equals(params, this._lastParams); this._paramsChanged = !Vn.Value.equals(params, this._lastParams);
this._lastParams = params;
if (this.autoLoad) if (this.autoLoad)
this.lazyRefresh(); this.lazyRefresh();
@ -316,6 +315,7 @@ Model.implement({
if (this._isReady(params)) { if (this._isReady(params)) {
this._setStatus(Status.LOADING); this._setStatus(Status.LOADING);
this._lastParams = this._getHolderValues();
this._paramsChanged = false; this._paramsChanged = false;
this._conn.execStmt(this._stmt, this._conn.execStmt(this._stmt,
this._selectDone.bind(this), params); this._selectDone.bind(this), params);
@ -490,10 +490,14 @@ Model.implement({
,_checkTableUpdatable: function(tableIndex) { ,_checkTableUpdatable: function(tableIndex) {
var tableUpdatable = tableIndex !== null var tableUpdatable = tableIndex !== null
&& this.tables[tableIndex].pks.length > 0; && this.tables[tableIndex].pks.length > 0;
if (!tableUpdatable) if (!tableUpdatable && !tableIndex) {
console.warn("Db.Model: Table %s is not updatable", if (tableIndex)
this.tables[tableIndex].name); console.warn("Db.Model: Table %s is not updatable",
this.tables[tableIndex].name);
else
console.warn("Db.Model: Model not updatable");
}
return tableUpdatable; return tableUpdatable;
} }
@ -784,7 +788,7 @@ Model.implement({
var dmlQuery = new Sql.Insert(); var dmlQuery = new Sql.Insert();
var table = this.tables[tableIndex]; var table = this.tables[tableIndex];
for (const def of defaults) for (const def of this._defaults)
if (def.table === table.name) { if (def.table === table.name) {
if (def.value) if (def.value)
dmlQuery.addSet(def.field, def.value); dmlQuery.addSet(def.field, def.value);

View File

@ -26,6 +26,7 @@ module.exports = new Class({
this.$ = scope.$; this.$ = scope.$;
scope.link({conn, hash}); scope.link({conn, hash});
this.node = scope.$.form; this.node = scope.$.form;
this.node.$ctrl = this;
const paramsLot = this.$.params; const paramsLot = this.$.params;
if (paramsLot) { if (paramsLot) {

View File

@ -107,6 +107,7 @@ const ComponentClass = {
,createRoot: function(tagName) { ,createRoot: function(tagName) {
const node = this._node = this.createElement(tagName); const node = this._node = this.createElement(tagName);
node.$ctrl = this;
if (this._htmlId) if (this._htmlId)
node.id = this._htmlId; node.id = this._htmlId;
if (this.$constructor.Classes) if (this.$constructor.Classes)

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "1.407.81", "version": "1.407.82",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {
@ -37,7 +37,7 @@
}, },
"scripts": { "scripts": {
"front": "webpack serve --open", "front": "webpack serve --open",
"back": "cd ../salix && NODE_ENV=test gulp backOnly", "back": "cd ../salix && gulp backOnly",
"build": "rm -rf build/ ; webpack", "build": "rm -rf build/ ; webpack",
"clean": "rm -rf build/" "clean": "rm -rf build/"
} }