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.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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