Merge branch 'features/feature-attestation-fix-and-fiche-defunt' into releases/release-hytha-prod

This commit is contained in:
Tiavina 2025-02-14 11:32:58 +03:00
commit e247c34c05
28 changed files with 91 additions and 60 deletions

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

File diff suppressed because one or more lines are too long

View File

@ -2039,10 +2039,34 @@ class PageController extends Controller {
$pdf->SetFont('ComicSans', '', 10);
$pdf->MultiCell(0, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse.", le ".$today), '', 'R');
$pdf->SetY($pdf->GetY()+15);
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode($nomDefunt."\n".$age."ans\n".(strcmp($defunt->sexe, 'm')==0 ? 'Masculin' : 'Féminin'))), '', 'L');
$pdf->SetY($pdf->GetY()-15);
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Éffectuées le ".$date_devis."\nà ".$defunt->adresse_lieu."\nde ".$defunt->heure_debut." à ".$defunt->heure_fin)), '', 'R');
$rapportInfoHeaderY = $pdf->GetY() + 15;
$rapportDefuntInfoY = $rapportInfoHeaderY;
$rapportDevisInfoY = $rapportInfoHeaderY;
$pdf->SetY(y: $rapportDefuntInfoY);
$pdf->SetFont('ComicSans', '', 10);
$pdf->Cell(0,5,FileExportHelpers::FormatTextForExport($nomDefunt));
$rapportDefuntInfoY += 5;
$pdf->SetY($rapportDefuntInfoY);
$pdf->Cell(0,5,FileExportHelpers::FormatTextForExport($age. " ans"));
$rapportDefuntInfoY += 5;
$pdf->SetY($rapportDefuntInfoY);
$sexeText = strcmp($defunt->sexe, 'm')==0 ? 'Masculin' : 'Féminin';
$pdf->Cell(0,5,FileExportHelpers::FormatTextForExport($sexeText));
//devis info
$rapportDevisInfoX = 115;
$maxWidth = $pdf->GetPageWidth();
$availableWidhtForDevisInfo = $maxWidth - 10 - $rapportDevisInfoX;
$pdf->SetXY($rapportDevisInfoX,$rapportDevisInfoY);
$pdf->MultiCell(0,5,FileExportHelpers::FormatTextForExport("Éffectuées le ".$date_devis));
$rapportDevisInfoY += 5;
$pdf->SetXY($rapportDevisInfoX,$rapportDevisInfoY);
$addressText = "à ".$defunt->adresse_lieu;
$pdf->MultiCell(0,5,FileExportHelpers::FormatTextForExport($addressText),0,'L');
$addressLineCount = FileExportHelpers::GetLineCountForATextInAMaxWidth($pdf,$addressText,$availableWidhtForDevisInfo);
$rapportDevisInfoY += 5 * $addressLineCount;
$pdf->SetXY($rapportDevisInfoX,$rapportDevisInfoY);
$pdf->Cell(0,5,FileExportHelpers::FormatTextForExport("de ".$defunt->heure_debut." à ".$defunt->heure_fin));
$pdf->SetY($pdf->GetY()+10);
$pdf->Line(15, $pdf->GetY(), $pdf->GetPageWidth()-15, $pdf->GetY());
@ -2053,14 +2077,14 @@ class PageController extends Controller {
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Rigidité : ".$defunt->rigidite)), '', 'L');
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Observations du corps : ".$defunt->observations_corps)), '', 'L');
$pdf->SetY($pdf->GetY()+10);
$pdf->SetY($pdf->GetY()+5);
$pdf->SetFont('ComicSans', 'B', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("ACCÈS")), '', 'L');
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Arteriel : ".$defunt->acces)), '', 'L');
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Recherche : ".$defunt->acces_recherche)), '', 'L');
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("État : ".$defunt->acces_etat)), '', 'L');
$pdf->SetY($pdf->GetY()+10);
$pdf->SetY($pdf->GetY()+5);
$pdf->SetFont('ComicSans', 'B', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("INJECTION")), '', 'L');
$pdf->SetY($pdf->GetY()+3);
@ -2098,9 +2122,8 @@ class PageController extends Controller {
$pdf->SetXY(($col_width*2)+15, $pdf->GetY()-8); $pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell($col_width, 8, utf8_decode(html_entity_decode($defunt->drainage_etat)), 'LR', 'C');
$pdf->Line(15, $pdf->GetY(), $pdf->GetPageWidth()-15, $pdf->GetY());
$pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_two), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone), '', 'C');
$pdf->SetY(-20); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse), '', 'C');
$pdf->AddPage();
@ -2165,9 +2188,8 @@ class PageController extends Controller {
$col_width = round(($pdf->GetPageWidth()-30)/2);
foreach ($observations as $key => $obs) {
if($pdf->getY()>=($pdf->GetPageHeight()-45)) {
$pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_two), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone), '', 'C');
$pdf->SetY(-20); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse), '', 'C');
$pdf->AddPage();
}
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell($col_width, 8, utf8_decode(html_entity_decode($obs->designation)), 'LTRB', 'L');
@ -2177,9 +2199,8 @@ class PageController extends Controller {
$pdf->setY($pdf->GetY()+10);
if($pdf->getY()>=($pdf->GetPageHeight()-45)) {
$pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_two), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone), '', 'C');
$pdf->SetY(-20); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse), '', 'C');
$pdf->AddPage();
}
@ -2197,9 +2218,8 @@ class PageController extends Controller {
$pdf->setY($pdf->GetY()-5);
$pdf->SetFont('ComicSans','',11); $pdf->Cell( $pdf->GetPageWidth()-80, 0, "Pour :", 0, 0, 'R');
$pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_two), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone), '', 'C');
$pdf->SetY(-20); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse), '', 'C');
$pdf->AddPage();
$pdf->Image($this->src_path.(($defunt->sexe=='m'?'facehomme.jpg':'facefemme.jpg')), 0, 0, $pdf->GetPageWidth(), $pdf->GetPageHeight());

View File

@ -613,6 +613,7 @@ class Bdd {
$sql = "SELECT ".$this->tableprefix."defunt.id, ".$this->tableprefix."defunt.nom, ".$this->tableprefix."defunt.date_naissance, ".$this->tableprefix."defunt.ref_pacemaker, ".$this->tableprefix."defunt.sexe, "
.$this->tableprefix."client.nom as nom_client, ".$this->tableprefix."client.id as id_client, "
.$this->tableprefix."devis.num as numero_devis, ".$this->tableprefix."devis.id as id_devis, ".$this->tableprefix."devis.user_id as user_id, "
.$this->tableprefix."devis.date as devis_date, "
.$this->tableprefix."lieu.id as lid, ".$this->tableprefix."lieu.nom as lieu
FROM ".$this->tableprefix."defunt
LEFT JOIN ".$this->tableprefix."devis ON ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id

View File

@ -7,7 +7,8 @@ class FileExportHelpers
public static function FormatTextForExport(string $text){
$textFormatted = utf8_decode(html_entity_decode($text));
$textFormatted = str_replace('', "'", $text);
$textFormatted = utf8_decode(html_entity_decode($textFormatted));
return $textFormatted;
}
@ -67,4 +68,21 @@ class FileExportHelpers
return $defuntFolder.'PACEMAKER/';
}
public static function GetLineCountForATextInAMaxWidth($pdf,$text,$maxWidth){
$words = explode(' ', $text);
$lineWidth = 0;
$lineCount = 1;
foreach ($words as $word) {
$wordWidth = $pdf->GetStringWidth($word . ' ');
if ($lineWidth + $wordWidth > $maxWidth) {
$lineCount++;
$lineWidth = $wordWidth;
} else {
$lineWidth += $wordWidth;
}
}
return $lineCount;
}
}

View File

@ -12,15 +12,16 @@ export class Defunt {
constructor(myresp) {
this.id = myresp.id;
this.nom = ((myresp.nom.length === 0) ? '-' : myresp.nom);
this.date_naissance = myresp.date_naissance;
this.age = 0;
this.sexe = ((myresp.sexe.length === 0) ? null : myresp.sexe);
this.ref_pacemaker = ((myresp.ref_pacemaker.lenth == 0) ? '-' : myresp.ref_pacemaker);
this.ref_pacemaker = ((myresp.ref_pacemaker.length == 0) ? '-' : myresp.ref_pacemaker);
this.devisDate = "-";
if(myresp.id_devis != null && myresp.devis_date != null){
const date = new Date(myresp.devis_date);
this.devisDate = date.toLocaleDateString('fr-FR');
}
this.pompe = ((myresp.nom_client == null) ? '-' : myresp.nom_client);
this.lieu = ((myresp.lieu == null) ? '-' : myresp.lieu);
this.numero_devis = ((myresp.user_id == null) ? '-' : myresp.user_id);
this.baseUrl = generateUrl(`/apps/gestion/defunt/${this.id}/show`);
this.age = Defunt.caclulateAge(myresp.date_naissance);
this.productCoverDescription = Defunt.getDefuntProductCoverDescriptionFromApiResponse(myresp);
}
@ -39,17 +40,11 @@ export class Defunt {
let myrow = [
'<div>' + this.id + '</div>', // identifiant
'<div class="editable" data-table="defunt" data-column="nom" data-id="' + this.id + '">' + this.nom + '</div>', // nom
'<div id="ageDefunt-'+this.id+'">'+this.age+'</div>', // age
'<div>'+
'<select class="gestion-select" data-table="defunt" data-column="sexe" data-id="' + this.id + '">'+
'<option value="m" '+((this.sexe=='m')?'selected':'')+'>Masculin</option>'+
'<option value="f" '+((this.sexe=='f')?'selected':'')+'>Féminin</option>'+
'</select>'+
'</div>', // sexe
'<div class="editable" data-table="defunt" data-column="ref_pacemaker" data-id="' + this.id + '">' + this.ref_pacemaker + '</div>', // reference pacemaker
'<div>'+this.numero_devis+'</div>', // numeroDevis
'<div>'+this.pompe+'</div>', // pompe
'<div>'+this.lieu+'</div>', // lieu
'<div>'+this.devisDate+'</div>',
'<div class="selectCoverProductsList" data-id="' + this.id + '" data-current="' + this.productId + '">' +this.productCoverDescription+'</div>', // lieu
'<div style="display:inline-block;margin-right:0px;width:80%;"><a href="' + this.baseUrl + '"><button>' + t('gestion', 'Open') + '</button></a></div><div data-modifier="defunt" data-id=' + this.id + ' data-table="defunt" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
];

View File

@ -16,12 +16,11 @@
<tr>
<th><?php p($l->t('ID'));?></th>
<th>Nom</th>
<th>Âge</th>
<th>Sexe</th>
<th>Référence pacemaker</th>
<th>Numéro de devis</th>
<th>Pompe funèbre</th>
<th>Lieu de soin</th>
<th>Date de soin</th>
<th>Housse</th>
<th><?php p($l->t('Actions'));?></th>
</tr>

View File

@ -21,11 +21,13 @@
</div>
</div>
<div class="container-fluid">
<h2>Aperçu du défunt</h2>
<div class="d-flex justify-content-between">
<h2>Aperçu du défunt</h2>
<div class="div">
<button id="exportCareCertificate" class="btn btn-secondary" type="button">Générer l'attestation de soins</button>
<button id="pacemakerBtn" class="btn btn-secondary" type="button">Générer l'attestation pacemaker</button>
<button id="rapportSoinBtn" class="btn btn-secondary" type="button">Générer le rapport de soins</button>
<button id="showRapportBijouxExportModal" class="btn btn-secondary" type="button" data-toggle="modal" data-target="#saveRapportBijouxModal">Générer le rapport des bijoux</button>
</div>
</div>
<hr>
@ -486,10 +488,6 @@
</div>
</div>
<hr>
<div class="d-flex">
<button id="rapportSoinBtn" class="btn btn-secondary" type="button">Générer le rapport de soins</button>
<button id="showRapportBijouxExportModal" class="btn btn-secondary" type="button" data-toggle="modal" data-target="#saveRapportBijouxModal">Générer le rapport des bijoux</button>
</div>
<div class="modal" id="saveRapportBijouxModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">