Merge remote-tracking branch 'origin/fix/fix-defunt-send-file-by-email-input' into staging
This commit is contained in:
commit
e4ebcbbae2
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);
|
$devis = $this->myDb->getDevisOfDefunt($defuntId);
|
||||||
if($devis != null){
|
if($devis != null){
|
||||||
// try {
|
// try {
|
||||||
$client_email = $devis['client_group_mail'] ?? $devis['client_mail'];
|
$client_email = $to;
|
||||||
$client_nom = $devis['client_nom'];
|
$client_nom = $devis['client_nom'];
|
||||||
$data = $this->storage->get($ff_pdf)->getContent();
|
$data = $this->storage->get($ff_pdf)->getContent();
|
||||||
$message = $this->mailer->createMessage();
|
$message = $this->mailer->createMessage();
|
||||||
@ -2028,7 +2028,7 @@ class PageController extends Controller {
|
|||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
* @param string $numdefunt
|
* @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));
|
$defaultConfig = json_decode($this->myDb->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD));
|
||||||
$defunt = json_decode($this->myDb->getOneDefunt($numdefunt, $this->idNextcloud))[0];
|
$defunt = json_decode($this->myDb->getOneDefunt($numdefunt, $this->idNextcloud))[0];
|
||||||
$observations = json_decode($this->myDb->getListObservations($numdefunt, $this->idNextcloud));
|
$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 = $this->storage->get($ff_pdf);
|
||||||
$file_pdf->putContent($pdfContent);
|
$file_pdf->putContent($pdfContent);
|
||||||
|
|
||||||
if($ff_pdf != null && $isSendEmail){
|
if($ff_pdf != null && trim($email) != ''){
|
||||||
//send 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();
|
$res = array();
|
||||||
@ -2319,7 +2319,7 @@ class PageController extends Controller {
|
|||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
* @param string $numdefunt
|
* @param string $numdefunt
|
||||||
*/
|
*/
|
||||||
public function saveRapportBijoux($numdefunt,$withPhotos = false, $isSendEmail = false){
|
public function saveRapportBijoux($numdefunt,$withPhotos = false, $email = ''){
|
||||||
if($withPhotos != null && $withPhotos == 1){
|
if($withPhotos != null && $withPhotos == 1){
|
||||||
$withPhotos = true;
|
$withPhotos = true;
|
||||||
}
|
}
|
||||||
@ -2456,9 +2456,9 @@ class PageController extends Controller {
|
|||||||
$file_pdf = $this->storage->get($ff_pdf);
|
$file_pdf = $this->storage->get($ff_pdf);
|
||||||
$file_pdf->putContent($pdfContent);
|
$file_pdf->putContent($pdfContent);
|
||||||
|
|
||||||
if($ff_pdf != null && $isSendEmail){
|
if($ff_pdf != null && trim($email) != ''){
|
||||||
//send 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();
|
$res = array();
|
||||||
@ -2669,12 +2669,12 @@ class PageController extends Controller {
|
|||||||
* @param int $defuntId
|
* @param int $defuntId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function exportCareCertificate($defuntId, $isSendEmail = false){
|
public function exportCareCertificate($defuntId, $email = ''){
|
||||||
try{
|
try{
|
||||||
$careCertificateFilename = $this->certificateService->generateCareCertificate($defuntId,$this->idNextcloud);
|
$careCertificateFilename = $this->certificateService->generateCareCertificate($defuntId,$this->idNextcloud);
|
||||||
if($careCertificateFilename != null && $isSendEmail){
|
if($careCertificateFilename != null && trim($email) != '' ){
|
||||||
//send 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;
|
return $careCertificateFilename;
|
||||||
}
|
}
|
||||||
@ -2818,12 +2818,12 @@ class PageController extends Controller {
|
|||||||
* @param int $defuntId
|
* @param int $defuntId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function saveAttestationPacemaker($defuntId, $isSendEmail = false){
|
public function saveAttestationPacemaker($defuntId, $email = ''){
|
||||||
try{
|
try{
|
||||||
$careCertificateFilename = $this->certificateService->generatePacemakerCertificate($defuntId,$this->idNextcloud);
|
$careCertificateFilename = $this->certificateService->generatePacemakerCertificate($defuntId,$this->idNextcloud);
|
||||||
if($careCertificateFilename != null && $isSendEmail){
|
if($careCertificateFilename != null && trim($email) != ''){
|
||||||
//send 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;
|
return $careCertificateFilename;
|
||||||
|
|||||||
@ -101,6 +101,7 @@ window.addEventListener("DOMContentLoaded", function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$('#saveRapportBijouxModal').hide();
|
$('#saveRapportBijouxModal').hide();
|
||||||
|
modalTitle.text('Générer le rapport des bijoux')
|
||||||
modalElement.data('export-type', 'rapport-bijoux')
|
modalElement.data('export-type', 'rapport-bijoux')
|
||||||
modalElement.data('export-with-photos', selectedValue)
|
modalElement.data('export-with-photos', selectedValue)
|
||||||
modalElement.modal('show')
|
modalElement.modal('show')
|
||||||
@ -127,47 +128,56 @@ window.addEventListener("DOMContentLoaded", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const modalElement = $('#confirmSendEmailModal')
|
const modalElement = $('#confirmSendEmailModal')
|
||||||
|
const modalTitle = $('#titleSendEmailModal')
|
||||||
const _ = new Modal(modalElement[0],{
|
const _ = new Modal(modalElement[0],{
|
||||||
backdrop: false
|
backdrop: false
|
||||||
})
|
})
|
||||||
$('#valdateSendEmailModal').on('click', function(){
|
$('#validateSendEmailModal').on('click', function(){
|
||||||
const type = modalElement.data('export-type')
|
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){
|
switch(type){
|
||||||
case 'care-certificate':
|
case 'care-certificate':
|
||||||
exportCareCertificate({defuntId : defuntid, isSendEmail})
|
exportCareCertificate({defuntId : defuntid, email: isSendEmail ? email: ''})
|
||||||
break;
|
break;
|
||||||
case 'pacemaker':
|
case 'pacemaker':
|
||||||
saveAttestationPacemaker({ defuntId: defuntid ,isSendEmail});
|
saveAttestationPacemaker({ defuntId: defuntid ,email: isSendEmail ? email: ''});
|
||||||
break;
|
break;
|
||||||
case 'rapport-soin':
|
case 'rapport-soin':
|
||||||
saveRapportSoin({ numdefunt: defuntid ,isSendEmail});
|
saveRapportSoin({ numdefunt: defuntid ,email: isSendEmail ? email: ''});
|
||||||
break;
|
break;
|
||||||
case 'rapport-bijoux':
|
case 'rapport-bijoux':
|
||||||
const selectedValue = modalElement.data('export-with-photos')
|
const selectedValue = modalElement.data('export-with-photos')
|
||||||
saveRapportBijoux({
|
saveRapportBijoux({
|
||||||
numdefunt: defuntid,
|
numdefunt: defuntid,
|
||||||
withPhotos: selectedValue ,
|
withPhotos: selectedValue ,
|
||||||
isSendEmail
|
email: isSendEmail ? email: ''
|
||||||
});
|
});
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
modalElement.modal('hide')
|
modalElement.modal('hide')
|
||||||
$('#valueSendEmailModal').prop('checked', false);
|
$('#checkSendEmailModal').prop('checked', false);
|
||||||
|
$('#checkSendEmailModal').prop('checked', false);
|
||||||
|
$('#valueSendEmailModal').val(initEmail);
|
||||||
})
|
})
|
||||||
$('#closeSendEmailModal').on('click', function(){
|
$('#closeSendEmailModal').on('click', function(){
|
||||||
modalElement.data('export-type', null)
|
modalElement.data('export-type', null)
|
||||||
|
const initEmail = $('#valueSendEmailModal').data('init-value')
|
||||||
modalElement.modal('hide')
|
modalElement.modal('hide')
|
||||||
$('#valueSendEmailModal').prop('checked', false);
|
$('#checkSendEmailModal').prop('checked', false);
|
||||||
|
$('#valueSendEmailModal').val(initEmail);
|
||||||
})
|
})
|
||||||
|
|
||||||
exportCareCertificateButton.addEventListener("click",function(){
|
exportCareCertificateButton.addEventListener("click",function(){
|
||||||
|
modalTitle.text("Générer l'attestation de soins")
|
||||||
modalElement.data('export-type', 'care-certificate')
|
modalElement.data('export-type', 'care-certificate')
|
||||||
modalElement.modal('show')
|
modalElement.modal('show')
|
||||||
// exportCareCertificate({defuntId : defuntid});
|
// exportCareCertificate({defuntId : defuntid});
|
||||||
})
|
})
|
||||||
pacemakerBtn.addEventListener("click", function(){
|
pacemakerBtn.addEventListener("click", function(){
|
||||||
|
modalTitle.text("Générer l'attestation pacemaker")
|
||||||
modalElement.data('export-type', 'pacemaker')
|
modalElement.data('export-type', 'pacemaker')
|
||||||
modalElement.modal('show')
|
modalElement.modal('show')
|
||||||
// saveAttestationPacemaker({ defuntId: defuntid });
|
// saveAttestationPacemaker({ defuntId: defuntid });
|
||||||
@ -176,6 +186,7 @@ window.addEventListener("DOMContentLoaded", function () {
|
|||||||
rapportSoinBtn.addEventListener("click", function(){
|
rapportSoinBtn.addEventListener("click", function(){
|
||||||
modalElement.data('export-type', 'rapport-soin')
|
modalElement.data('export-type', 'rapport-soin')
|
||||||
modalElement.modal('show')
|
modalElement.modal('show')
|
||||||
|
modalTitle.text('Générer le rapport de soins')
|
||||||
// saveRapportSoin({ numdefunt: defuntid });
|
// saveRapportSoin({ numdefunt: defuntid });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -527,17 +527,28 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">Confirmation de l'envoi par email</h5>
|
<h5 class="modal-title" id="titleSendEmailModal">Confirmation de l'envoi par email</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="form-group form-check d-flex align-items-center">
|
<div class="form-group form-check d-flex justify-items-start align-items-center ">
|
||||||
<input type="checkbox" style="cursor:pointer;margin-right:8px;" id="valueSendEmailModal">
|
<input type="checkbox" style="cursor:pointer;margin-right:8px;" id="checkSendEmailModal">
|
||||||
<label class="form-check-label" for="valueSendEmailModal">Voulez-vous envoyer par email le fichier à <?= $_['defunt'][0]->client_group_mail ?? $_['defunt'][0]->client_mail;?> ?</label>
|
<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>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button id="closeSendEmailModal" type="button" class="btn btn-secondary">Annuler</button>
|
<button id="closeSendEmailModal" type="button" class="btn btn-secondary">Fermer</button>
|
||||||
<button id="valdateSendEmailModal" type="button" class="btn btn-primary">Valider</button>
|
<button id="validateSendEmailModal" type="button" class="btn btn-primary">Valider</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user