[fix]: fix and input when confirm send email the defunt aatachment
This commit is contained in:
parent
13279e86db
commit
892ba5b6d4
File diff suppressed because one or more lines are too long
@ -1580,11 +1580,11 @@ class PageController extends Controller {
|
||||
|
||||
}
|
||||
|
||||
public function sendAttachmentToClientByDefunt($defuntId, $ff_pdf, $subject, $body, $addName = false){
|
||||
public function sendAttachmentToClientByDefunt($defuntId, $ff_pdf, $to,$subject, $body, $addName = false){
|
||||
$devis = $this->myDb->getDevisOfDefunt($defuntId);
|
||||
if($devis != null){
|
||||
// try {
|
||||
$client_email = $devis['client_group_mail'] ?? $devis['client_mail'];
|
||||
$client_email = $to;
|
||||
$client_nom = $devis['client_nom'];
|
||||
$data = $this->storage->get($ff_pdf)->getContent();
|
||||
$message = $this->mailer->createMessage();
|
||||
@ -2028,7 +2028,7 @@ class PageController extends Controller {
|
||||
* @NoCSRFRequired
|
||||
* @param string $numdefunt
|
||||
*/
|
||||
public function saveRapportSoin($numdefunt, $isSendEmail = false){
|
||||
public function saveRapportSoin($numdefunt, $email = ''){
|
||||
$defaultConfig = json_decode($this->myDb->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD));
|
||||
$defunt = json_decode($this->myDb->getOneDefunt($numdefunt, $this->idNextcloud))[0];
|
||||
$observations = json_decode($this->myDb->getListObservations($numdefunt, $this->idNextcloud));
|
||||
@ -2275,9 +2275,9 @@ class PageController extends Controller {
|
||||
$file_pdf = $this->storage->get($ff_pdf);
|
||||
$file_pdf->putContent($pdfContent);
|
||||
|
||||
if($ff_pdf != null && $isSendEmail){
|
||||
if($ff_pdf != null && trim($email) != ''){
|
||||
//send email
|
||||
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, "Rapport soins", "Veuillez trouver ci-joint le rapport de soins de ".$nomDefunt.".");
|
||||
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, $email,"Rapport soins", "Veuillez trouver ci-joint le rapport de soins de ".$nomDefunt.".");
|
||||
}
|
||||
|
||||
$res = array();
|
||||
@ -2319,7 +2319,7 @@ class PageController extends Controller {
|
||||
* @NoCSRFRequired
|
||||
* @param string $numdefunt
|
||||
*/
|
||||
public function saveRapportBijoux($numdefunt,$withPhotos = false, $isSendEmail = false){
|
||||
public function saveRapportBijoux($numdefunt,$withPhotos = false, $email = ''){
|
||||
if($withPhotos != null && $withPhotos == 1){
|
||||
$withPhotos = true;
|
||||
}
|
||||
@ -2456,9 +2456,9 @@ class PageController extends Controller {
|
||||
$file_pdf = $this->storage->get($ff_pdf);
|
||||
$file_pdf->putContent($pdfContent);
|
||||
|
||||
if($ff_pdf != null && $isSendEmail){
|
||||
if($ff_pdf != null && trim($email) != ''){
|
||||
//send email
|
||||
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, "Rapport des bijoux", "Veuillez trouver ci-joint le rapport des bijoux de ".$nomDefunt.".");
|
||||
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, $email,"Rapport des bijoux", "Veuillez trouver ci-joint le rapport des bijoux de ".$nomDefunt.".");
|
||||
}
|
||||
|
||||
$res = array();
|
||||
@ -2669,12 +2669,12 @@ class PageController extends Controller {
|
||||
* @param int $defuntId
|
||||
*/
|
||||
|
||||
public function exportCareCertificate($defuntId, $isSendEmail = false){
|
||||
public function exportCareCertificate($defuntId, $email = ''){
|
||||
try{
|
||||
$careCertificateFilename = $this->certificateService->generateCareCertificate($defuntId,$this->idNextcloud);
|
||||
if($careCertificateFilename != null && $isSendEmail){
|
||||
if($careCertificateFilename != null && trim($email) != '' ){
|
||||
//send email
|
||||
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, "Attestation de soins", " Veuillez trouver ci-joint l'attestation de soins ", true);
|
||||
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, $email,"Attestation de soins", " Veuillez trouver ci-joint l'attestation de soins ", true);
|
||||
}
|
||||
return $careCertificateFilename;
|
||||
}
|
||||
@ -2818,12 +2818,12 @@ class PageController extends Controller {
|
||||
* @param int $defuntId
|
||||
*/
|
||||
|
||||
public function saveAttestationPacemaker($defuntId, $isSendEmail = false){
|
||||
public function saveAttestationPacemaker($defuntId, $email = ''){
|
||||
try{
|
||||
$careCertificateFilename = $this->certificateService->generatePacemakerCertificate($defuntId,$this->idNextcloud);
|
||||
if($careCertificateFilename != null && $isSendEmail){
|
||||
if($careCertificateFilename != null && trim($email) != ''){
|
||||
//send email
|
||||
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, "Attestation pacemaker", "Veuillez trouver ci-joint l'attestation de pacemaker ", true);
|
||||
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, $email,"Attestation pacemaker", "Veuillez trouver ci-joint l'attestation de pacemaker ", true);
|
||||
|
||||
}
|
||||
return $careCertificateFilename;
|
||||
|
||||
@ -130,36 +130,42 @@ window.addEventListener("DOMContentLoaded", function () {
|
||||
const _ = new Modal(modalElement[0],{
|
||||
backdrop: false
|
||||
})
|
||||
$('#valdateSendEmailModal').on('click', function(){
|
||||
$('#validateSendEmailModal').on('click', function(){
|
||||
const type = modalElement.data('export-type')
|
||||
const isSendEmail = $('#valueSendEmailModal').is(':checked')
|
||||
const isSendEmail = $('#checkSendEmailModal').is(':checked')
|
||||
const email = $('#valueSendEmailModal').val()
|
||||
const initEmail = $('#valueSendEmailModal').data('init-value')
|
||||
switch(type){
|
||||
case 'care-certificate':
|
||||
exportCareCertificate({defuntId : defuntid, isSendEmail})
|
||||
exportCareCertificate({defuntId : defuntid, email: isSendEmail ? email: ''})
|
||||
break;
|
||||
case 'pacemaker':
|
||||
saveAttestationPacemaker({ defuntId: defuntid ,isSendEmail});
|
||||
saveAttestationPacemaker({ defuntId: defuntid ,email: isSendEmail ? email: ''});
|
||||
break;
|
||||
case 'rapport-soin':
|
||||
saveRapportSoin({ numdefunt: defuntid ,isSendEmail});
|
||||
saveRapportSoin({ numdefunt: defuntid ,email: isSendEmail ? email: ''});
|
||||
break;
|
||||
case 'rapport-bijoux':
|
||||
const selectedValue = modalElement.data('export-with-photos')
|
||||
saveRapportBijoux({
|
||||
numdefunt: defuntid,
|
||||
withPhotos: selectedValue ,
|
||||
isSendEmail
|
||||
email: isSendEmail ? email: ''
|
||||
});
|
||||
default:
|
||||
break;
|
||||
}
|
||||
modalElement.modal('hide')
|
||||
$('#valueSendEmailModal').prop('checked', false);
|
||||
$('#checkSendEmailModal').prop('checked', false);
|
||||
$('#checkSendEmailModal').prop('checked', false);
|
||||
$('#valueSendEmailModal').val(initEmail);
|
||||
})
|
||||
$('#closeSendEmailModal').on('click', function(){
|
||||
modalElement.data('export-type', null)
|
||||
const initEmail = $('#valueSendEmailModal').data('init-value')
|
||||
modalElement.modal('hide')
|
||||
$('#valueSendEmailModal').prop('checked', false);
|
||||
$('#checkSendEmailModal').prop('checked', false);
|
||||
$('#valueSendEmailModal').val(initEmail);
|
||||
})
|
||||
|
||||
exportCareCertificateButton.addEventListener("click",function(){
|
||||
|
||||
@ -530,14 +530,25 @@ $coverProducts = $_['coverProducts'];
|
||||
<h5 class="modal-title">Confirmation de l'envoi par email</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-check d-flex align-items-center">
|
||||
<input type="checkbox" style="cursor:pointer;margin-right:8px;" id="valueSendEmailModal">
|
||||
<label class="form-check-label" for="valueSendEmailModal">Voulez-vous envoyer par email le fichier à <?= $_['defunt'][0]->client_group_mail ?? $_['defunt'][0]->client_mail;?> ?</label>
|
||||
<div class="form-group form-check d-flex justify-items-start align-items-center ">
|
||||
<input type="checkbox" style="cursor:pointer;margin-right:8px;" id="checkSendEmailModal">
|
||||
<label class="form-check-label" for="checkSendEmailModal">Voulez-vous envoyer par email le fichier ? </label>
|
||||
</div>
|
||||
<div class="form-group px-4">
|
||||
<input
|
||||
class="form-control rounded-sm"
|
||||
placeholder="adresse email"
|
||||
type="text"
|
||||
value="<?= $_['defunt'][0]->client_group_mail ?? $_['defunt'][0]->client_mail; ?>"
|
||||
style="cursor:pointer;margin-right:8px;"
|
||||
id="valueSendEmailModal"
|
||||
data-init-value="<?= $_['defunt'][0]->client_group_mail ?? $_['defunt'][0]->client_mail; ?>"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="closeSendEmailModal" type="button" class="btn btn-secondary">Annuler</button>
|
||||
<button id="valdateSendEmailModal" type="button" class="btn btn-primary">Valider</button>
|
||||
<button id="closeSendEmailModal" type="button" class="btn btn-secondary">Fermer</button>
|
||||
<button id="validateSendEmailModal" type="button" class="btn btn-primary">Valider</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user