finish generate care certificate on frontend , wip pdf policy

This commit is contained in:
Tiavina 2025-01-07 16:01:18 +03:00
parent 5fb39fc9a0
commit 3db4200e48
4 changed files with 33 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@ import "../css/mycss.css";
import { globalConfiguration } from "./modules/mainFunction.mjs";
import "./listener/main_listener";
import { getBibliotheques, getBijouxById, getHypodermiquesyId, getObservationsById, getproduits, saveAttestationPacemaker, saveRapportBijoux, saveRapportSoin, updateDB } from "./modules/ajaxRequest.mjs";
import { getBibliotheques, getBijouxById, getHypodermiquesyId, getObservationsById, getproduits, saveAttestationPacemaker,exportCareCertificate, saveRapportBijoux, saveRapportSoin, updateDB } from "./modules/ajaxRequest.mjs";
let bibliotheques = [];
let sortedBibliotheques = [];
@ -71,7 +71,12 @@ window.addEventListener("DOMContentLoaded", function () {
var pacemakerBtn = document.getElementById("pacemakerBtn");
var rapportSoinBtn = document.getElementById("rapportSoinBtn");
var rapportBijouxBtn = document.getElementById("rapportBijouxBtn");
var exportCareCertificateButton = document.getElementById("exportCareCertificate");
exportCareCertificateButton.addEventListener("click",function(){
exportCareCertificate({defuntId : defuntid});
})
pacemakerBtn.addEventListener("click", function(){
saveAttestationPacemaker({ numdefunt: defuntid });
});

View File

@ -723,3 +723,25 @@ export function getproduits(callback) {
showError(response);
});
}
/**
* Export care certificate
* @param {*} defuntIdPayload
*/
export function exportCareCertificate(defuntIdPayload) {
$.ajax({
url: baseUrl + '/defunt/exportCareCertificate',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(defuntIdPayload)
}).done(function (response) {
if(response == null) {
showMessage('Ce defunt n\'appartient à aucun devis.');
} else {
showSuccess('Sauvegardé dans '+ response );
}
}).fail(function (response, code) {
showMessage(t('gestion', 'There is an error'));
error(response);
});
};

View File

@ -22,7 +22,10 @@
<div class="container-fluid">
<div class="d-flex justify-content-between">
<h2>Aperçu du défunt</h2>
<button id="pacemakerBtn" class="btn btn-secondary" type="button">Générer l'attestation pacemaker</button>
<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>
</div>
</div>
<hr>
<div class="col-6" style="margin-bottom: 32px">