thanato type and email features

This commit is contained in:
Tiavina 2025-01-31 14:55:15 +03:00
parent 92e9b46bf0
commit 595c17fd7a
26 changed files with 137 additions and 22 deletions

View File

@ -143,5 +143,8 @@ return [
//devis facturation
['name' => 'page#exportDevisToFacture', 'url' => '/exportDevisToFacture', 'verb' => 'POST'],
//thanato
['name' => 'page#getThanatoTypeList', 'url' => '/thanato/type', 'verb' => 'PROPFIND'],
]
];

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

View File

@ -2778,4 +2778,12 @@ class PageController extends Controller {
$this->refreshFEC();
return true;
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function getThanatoTypeList() {
return $this->myDb->geThanatoTypes();
}
}

View File

@ -31,7 +31,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");
"commentaire", "designation", "hypodermiques_text1", "hypodermiques_text2", "qte", "endroit",
"fk_thanato_type_key","thanato_email");
$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");
$this->tableprefix = '*PREFIX*' ."gestion_";
$this->pdo = $db;
@ -99,7 +100,19 @@ class Bdd {
}
public function getThanatopracteurs($idNextcloud){
$sql = "SELECT * FROM ".$this->tableprefix."thanato;";
$sql = "SELECT
thanato.id,
thanato.nom,
thanato.prenom,
thanato.reference,
thanato.date_habilitation,
thanato.id_nextcloud,
thanato.fk_thanato_type_key,
thanato.thanato_email,
thanato_type.thanato_type_label
FROM ".$this->tableprefix."thanato as thanato
LEFT JOIN ".$this->tableprefix."thanato_type as thanato_type on thanato.fk_thanato_type_key = thanato_type.thanato_type_key
;";
return $this->execSQL($sql, array());
}
@ -2615,4 +2628,9 @@ class Bdd {
return $result;
}
public function geThanatoTypes(){
$sql = "SELECT * FROM ".$this->tableprefix."thanato_type as thanato_type";
return $this->execSQL($sql,[]);
}
}

View File

@ -0,0 +1,15 @@
create table if not exists oc_gestion_thanato_type (
thanato_type_key VARCHAR(255) PRIMARY KEY NOT NULL,
thanato_type_label VARCHAR(255) DEFAULT ''
);
INSERT INTO oc_gestion_thanato_type (thanato_type_key, thanato_type_label)
VALUES
('EMPLOYEE', 'Salarié'),
('SUBCONTRACTOR', 'Sous-traitant');
alter table oc_gestion_thanato
add column fk_thanato_type_key VARCHAR(255) DEFAULT 'EMPLOYEE';
alter table oc_gestion_thanato
add column thanato_email VARCHAR(255) DEFAULT NULL;

View File

@ -65,7 +65,11 @@ document.body.addEventListener('click', e => {
Devis.loadDevisList_dnum(e);
}else if(e.target.className.includes("loadSelect_listalldevis")){
Devis.loadAllDevisList_dnum(e);
}else if(e.target.className.includes("loadSelect_listDelphineDevis")){
}
else if(e.target.className.includes("selectThanatoType")){
Thanatopracteur.loadThanatoTypeIntoSelect(e);
}
else if(e.target.className.includes("loadSelect_listDelphineDevis")){
// Devis.loadDevisThanatoList_dnum(e);
Devis.loadDevisByDateByLieu(e);
// Devis.loadAllDevisList_dnum(e);

View File

@ -13,6 +13,9 @@ export class Thanatopracteur {
this.nom = ((myresp.nom.length === 0) ? '-' : myresp.nom);
this.reference = ((myresp.reference.length === 0) ? '-' : myresp.reference);
this.date = ((myresp.date_habilitation.length === 0) ? '-' : myresp.date_habilitation);
this.thanatoTypeLabel = ((myresp.thanato_type_label != null && myresp.thanato_type_label.length > 0)) ? myresp.thanato_type_label : '-';
this.thanatoTypeKey = ((myresp.fk_thanato_type_key != null && myresp.fk_thanato_type_key.length > 0)) ? myresp.fk_thanato_type_key : '-';
this.thanatoEmail = ((myresp.thanato_email != null && myresp.thanato_email.length > 0)) ? myresp.thanato_email : '';
}
/**undefined
@ -25,6 +28,8 @@ export class Thanatopracteur {
'<div class="editable" data-table="thanato" data-column="nom" data-id="' + this.id + '">' + this.nom + '</div>',
'<div class="editable" data-table="thanato" data-column="reference" data-id="' + this.id + '">' + this.reference + '</div>',
'<input style="margin:0;padding:0;" class="inputDate" type="date" value=' + this.date + ' data-table="thanato" data-column="date_habilitation" data-id="' + this.id + '"/>',
'<div class="editable" data-table="thanato" data-column="thanato_email" data-id="' + this.id + '">' + this.thanatoEmail + '</div>',
'<div class="selectThanatoType" data-table="thanato" data-column="fk_thanato_type_key" data-id="' + this.id + '" data-current="' + this.thanatoTypeKey + '">' + this.thanatoTypeLabel + '</div>',
'<center><div data-modifier="thanato" data-id=' + this.id + ' data-table="thanato" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div></center>'
];
return myrow;
@ -78,6 +83,20 @@ export class Thanatopracteur {
oReq.send();
}
static getThanatoTypes(callback){
var oReq = new XMLHttpRequest();
oReq.open('PROPFIND', baseUrl + '/thanato/type', 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();
}
/**
* @desc populate thanato select list in devis
*/
@ -126,4 +145,50 @@ export class Thanatopracteur {
e.target.appendChild(selectElement);
});
}
static loadThanatoTypeIntoSelect(e){
Thanatopracteur.getThanatoTypes(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 && el.target.value != null){
updateDB(el.target.parentElement.dataset.table,
el.target.parentElement.dataset.column,
el.target.value,
el.target.parentElement.dataset.id
);
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 = null;
option.text = t('gestion', 'Cancel');
selectElement.appendChild(option);
JSON.parse(response).forEach(myresp => {
var txt = document.createElement("textarea");
txt.innerHTML = myresp.thanato_type_label;
var option = document.createElement("option");
option.value = myresp.thanato_type_key;
option.text = txt.value;
selectElement.appendChild(option);
});
checkSelectPurJs(selectElement);
e.target.innerHTML = ''
e.target.appendChild(selectElement);
});
}
}

View File

@ -24,6 +24,8 @@
<th><?php p($l->t('Last name'));?></th>
<th>Référence</th>
<th>Date d'habilitation</th>
<th><?php p($l->t('Email'));?></th>
<th><?php p($l->t('Type'));?></th>
<th><?php p($l->t('Actions'));?></th>
</tr>
</thead>