finish update client group discount product and client group, wip update ht_amount, wip create client group discount and create group
This commit is contained in:
parent
56a3ba3e2f
commit
16d9430140
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -34,8 +34,8 @@ class Bdd {
|
||||
"injection", "injection_diffusion", "injection_qte", "preinjection", "preinjection_qte", "coinjection", "coinjection_qte",
|
||||
"drainage", "drainage_qte", "drainage_etat", "ponction", "ponction_qte", "cavite", "cavite_qte", "desinfection", "lavage",
|
||||
"rasage", "presentation_cosmetique", "presentation_sur", "hypodermiques", "hypodermiques_sur", "local", "local_sur", "contenu",
|
||||
"commentaire", "designation", "hypodermiques_text1", "hypodermiques_text2", "qte", "endroit","fk_client_group_id");
|
||||
$this->whiteTable = array("client", "lieu", "trajet", "devis", "produit_devis", "facture", "produit", "configuration", "ligne_trajet", "thanato", "article", "defunt", "article_devis", "bibliotheque", "bijou_defunt", "obs_defunt", "hypo_defunt");
|
||||
"commentaire", "designation", "hypodermiques_text1", "hypodermiques_text2", "qte", "endroit","fk_client_group_id","fk_produit_id");
|
||||
$this->whiteTable = array("client", "lieu", "trajet", "devis", "produit_devis", "facture", "produit", "configuration", "ligne_trajet", "thanato", "article", "defunt", "article_devis", "bibliotheque", "bijou_defunt", "obs_defunt", "hypo_defunt","client_group_discount");
|
||||
$this->tableprefix = '*PREFIX*' ."gestion_";
|
||||
$this->pdo = $db;
|
||||
$this->l = $l;
|
||||
|
||||
@ -57,6 +57,9 @@ document.body.addEventListener('click', e => {
|
||||
else if(e.target.className.includes("selectClientGroupList")){
|
||||
ClientGroup.loadClientGroupListToSelect(e);
|
||||
}
|
||||
else if(e.target.className.includes("selectProductsList")){
|
||||
Produit.loadProductListToSelect(e);
|
||||
}
|
||||
else if(e.target.className.includes("loadSelect_listdevis")){
|
||||
Devis.loadDevisList_dnum(e);
|
||||
}else if(e.target.className.includes("loadSelect_listalldevis")){
|
||||
|
||||
@ -5,34 +5,29 @@ export class ClientGroupDiscount {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param myresp instantiate product object
|
||||
* @param myresp instantiate client group discount object
|
||||
*/
|
||||
constructor(myresp) {
|
||||
this.id = myresp.id;
|
||||
this.clientGroupName = ((myresp.client_group_name.length === 0) ? '-' : myresp.client_group_name);
|
||||
this.productReference = ((myresp.produit_reference.length === 0) ? '-' : myresp.produit_reference);
|
||||
this.htAmount = ((myresp.ht_amount.length === 0) ? '-' : myresp.ht_amount);
|
||||
this.clientGroupId = myresp.produit_reference.fk_client_group_id;
|
||||
this.productId = myresp.produit_reference.fk_produit_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get datatable row for a product
|
||||
* Get datatable row for a client group discount
|
||||
*/
|
||||
getDTRow() {
|
||||
let clientGroupDiscountRow = [
|
||||
'<div>' + this.id + '</div>',
|
||||
'<div data-id="' + this.id + '">' + this.clientGroupName + '</div>',
|
||||
'<div data-id="' + this.id + '">' + this.productReference + '</div>',
|
||||
'<div class="selectClientGroupList" data-table="client_group_discount" data-column="fk_client_group_id" data-id="' + this.id + '" data-current="' + this.clientGroupId + '">' + this.clientGroupName + '</div>',
|
||||
'<div class="selectProductsList" data-table="client_group_discount" data-column="fk_produit_id" data-id="' + this.id + '" data-current="' + this.productId + '">' + this.productReference + '</div>',
|
||||
'<div data-id="' + this.id + '">' + this.htAmount + '</div>',
|
||||
'<div data-id=' + this.id + ' data-table="clientGroupDiscount" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
|
||||
];
|
||||
|
||||
// let myrow = [
|
||||
// '<div>' + this.id + '</div>',
|
||||
// '<div class="editable" data-table="produit" data-column="reference" data-id="' + this.id + '">' + this.reference + '</div>',
|
||||
// '<div class="editable" data-table="produit" data-column="description" data-id="' + this.id + '">' + this.description + '</div>',
|
||||
// '<div class="editableNumeric" data-table="produit" data-column="prix_unitaire" data-id="' + this.id + '">' + cur.format(this.prix_unitaire) + '</div>',
|
||||
// '<div data-modifier="produit" data-id=' + this.id + ' data-table="produit" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
|
||||
// ];
|
||||
return clientGroupDiscountRow;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { showError } from "@nextcloud/dialogs";
|
||||
import { baseUrl, cur, LoadDT, showDone } from "../modules/mainFunction.mjs";
|
||||
import { baseUrl, checkSelectPurJs, LoadDT, showDone } from "../modules/mainFunction.mjs";
|
||||
import { updateDB } from "../modules/ajaxRequest.mjs";
|
||||
|
||||
export class Produit {
|
||||
|
||||
@ -63,4 +64,70 @@ export class Produit {
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
static getProductsList(callback){
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('PROPFIND', baseUrl + '/getProduits', true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
callback(JSON.parse(this.response));
|
||||
}else{
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} lid
|
||||
*/
|
||||
static loadProductListToSelect(e){
|
||||
Produit.getProductsList(response => {
|
||||
|
||||
var selectElement = document.createElement("select");
|
||||
selectElement.dataset.current = e.target.dataset.current;
|
||||
selectElement.dataset.id = e.target.dataset.id;
|
||||
selectElement.dataset.old = e.target.innerHTML;
|
||||
|
||||
selectElement.addEventListener("change", el=>{
|
||||
if(el.target.value != 0){
|
||||
updateDB(el.target.parentElement.dataset.table,
|
||||
el.target.parentElement.dataset.column,
|
||||
el.target.value,
|
||||
el.target.parentElement.dataset.id
|
||||
);
|
||||
|
||||
// location.reload();
|
||||
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.dataset.current = el.target.value;
|
||||
}else{
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.dataset.old
|
||||
}
|
||||
});
|
||||
|
||||
var option = document.createElement("option");
|
||||
option.value = 0;
|
||||
option.text = t('gestion', 'Cancel');
|
||||
selectElement.appendChild(option);
|
||||
|
||||
JSON.parse(response).forEach(myresp => {
|
||||
var txt = document.createElement("textarea");
|
||||
txt.innerHTML = myresp.reference;
|
||||
var option = document.createElement("option");
|
||||
option.value = myresp.id;
|
||||
option.text = txt.value;
|
||||
selectElement.appendChild(option);
|
||||
});
|
||||
|
||||
checkSelectPurJs(selectElement);
|
||||
|
||||
e.target.innerHTML = ''
|
||||
e.target.appendChild(selectElement);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user