2 * Copyright (C) 2025 dany
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20///////////////////////////////////////////////////////////////////////
22// Selection on operation history : payment
23var Operation_Payment = function (range_name, dossier_id, ac) {
24 this.lastcheck = null;
26 this.range_name = range_name;
27 this.dossier_id = dossier_id;
31Operation_Payment.prototype.activate_checkbox_range = function () {
32 let node_lstCheckBox = document.getElementsByClassName(this.range_name);
33 var aCheckBox = Array.from(node_lstCheckBox)
34 if (aCheckBox == undefined) {
35 console.error("activate_checkbox_range_failed")
38 aCheckBox.forEach(elt => elt.addEventListener('click', function (event) {
39 here.checkbox_set_range(event, elt);
43Operation_Payment.prototype.checkbox_set_range = function (event, elt)
46 if (!event.shiftKey) {
51 var aName = document.getElementsByClassName(this.range_name);
55 for (var i = 0; i < aName.length; i++) {
56 if (aName[i] == elt) {
57 this.endcheck = aName[i];
60 if (aName[i] == this.lastcheck) {
69 var check = (aName[from].checked) ? true : false;
70 for (x = from + 1; x < end; x++) {
71 if (aName[x].parentNode.parentNode.visible()) {
72 aName[x].checked=check;
73 this.check_item(aName[x],true)
79Operation_Payment.prototype.check_item = function (dom_elt,flag_waiting_box)
81 console.debug(`element = ${dom_elt.name}`);
82 console.debug(`dossier ${this.dossier_id} ac ${this.ac}`)
85 if ( ! flag_waiting_box ) waiting_box();
86 var queryString = {op:'payment_status',operation_id:dom_elt.name,gDossier:this.dossier_id,ac:this.ac,state:dom_elt.checked};
87 console.debug (`queryString : `)
88 console.debug (queryString)
90 var action = new Ajax.Request(
94 parameters: queryString,
95 onFailure: ajax_misc_failure,
96 onSuccess: function (req) {
97 if ( ! flag_waiting_box )remove_waiting_box();
98 if (req.responseText == 'NOCONX') {
102 if ( req.responseText == 1) { dom_elt.checked=true}
104 if ( req.responseText == 0) { dom_elt.checked=false}
106 console.error(req.responseText)
114 alert_box(e.message);
118//Operation_Payment.prototype.check_all=function()
120// var aName = document.getElementsByClassName(this.range_name);
121// for (x = 0; x < aName.lenght; x++) {
122// if (aName[x].parentNode.parentNode.visible()) {
123// aName[x].checked=true;
124// this.check_item(aName[x]);
129//Operation_Payment.prototype.invert_selection=function()
131// var aName = document.getElementsByClassName(this.range_name);
132// for (x = 0; x < aName.lenght; x++) {
133// if (aName[x].parentNode.parentNode.visible()) {
134// if ( aName[x].checked ) {
135// aName[x].checked=false;
137// aName[x].checked=true;
139// this.check_item(aName[x]);