Merge branch 'staging' into features/feature-facture-generated-state-and-sent-state

This commit is contained in:
Tiavina 2025-03-07 17:23:37 +03:00
commit b400430cbb
30 changed files with 464 additions and 201 deletions

View File

@ -1,3 +1,75 @@
/*!
* Bootstrap backdrop.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap base-component.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap component-functions.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap config.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap data.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap event-handler.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap focustrap.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap index.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap manipulator.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap modal.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap scrollbar.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap selector-engine.js v5.2.3 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*! /*!
* Sizzle CSS Selector Engine v2.3.9 * Sizzle CSS Selector Engine v2.3.9
* https://sizzlejs.com/ * https://sizzlejs.com/

View File

@ -36,7 +36,7 @@ date_default_timezone_set('Europe/Paris');
class PageController extends Controller { class PageController extends Controller {
private $idNextcloud; private $idNextcloud;
private $myDb; private Bdd $myDb;
// private $src_path = "/var/www/html/apps/gestion/img/"; // private $src_path = "/var/www/html/apps/gestion/img/";
private $src_path = "/var/www/html/custom_apps/gestion/img/"; private $src_path = "/var/www/html/custom_apps/gestion/img/";
@ -1129,7 +1129,7 @@ class PageController extends Controller {
* @NoCSRFRequired * @NoCSRFRequired
*/ */
public function getFacturesWithProduits() { public function getFacturesWithProduits() {
$result = $this->myDb->getFacturesWithProduits($this->idNextcloud); $result = $this->myDb->getFacturesWithProduits();
$this->refreshFEC(); $this->refreshFEC();
return $result; return $result;
} }
@ -1580,6 +1580,28 @@ class PageController extends Controller {
} }
public function sendAttachmentToClientByDefunt($defuntId, $ff_pdf, $subject, $body, $addName = false){
$devis = $this->myDb->getDevisOfDefunt($defuntId);
if($devis != null){
try {
$client_email = $devis['client_mail'];
$client_nom = $devis['client_nom'];
$data = file_get_contents($ff_pdf);
$message = $this->mailer->createMessage();
$message->setTo(recipients: [$client_email => $client_nom]);
// $message->setFrom([$client_email => $client_nom]);
$content = $this->mailer->createAttachment($data,$ff_pdf,"x-pdf");
$message->attach($content);
$message->setSubject($subject);
$message->setPlainBody($addName ? $body." de ".$devis['defunt_nom']: $body);
$this->mailer->send($message);
return new DataResponse("", 200, ['Content-Type' => 'application/json']);
} catch (Exception $e) {
return new DataResponse("Is your global mail server configured in Nextcloud ?", 500, ['Content-Type' => 'application/json']);
}
}
}
/** /**
* @NoAdminRequired * @NoAdminRequired
* @NoCSRFRequired * @NoCSRFRequired
@ -2005,7 +2027,7 @@ class PageController extends Controller {
* @NoCSRFRequired * @NoCSRFRequired
* @param string $numdefunt * @param string $numdefunt
*/ */
public function saveRapportSoin($numdefunt){ public function saveRapportSoin($numdefunt, $isSendEmail = false){
$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));
@ -2252,6 +2274,11 @@ 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){
//send email
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, "Rapport soins", " Veuiller trouver ci-joint le rapport de soins de ".$nomDefunt.".");
}
$res = array(); $res = array();
$res['path'] = $folderDestination; $res['path'] = $folderDestination;
return json_encode($res); return json_encode($res);
@ -2291,7 +2318,7 @@ class PageController extends Controller {
* @NoCSRFRequired * @NoCSRFRequired
* @param string $numdefunt * @param string $numdefunt
*/ */
public function saveRapportBijoux($numdefunt,$withPhotos = false){ public function saveRapportBijoux($numdefunt,$withPhotos = false, $isSendEmail = false){
if($withPhotos != null && $withPhotos == 1){ if($withPhotos != null && $withPhotos == 1){
$withPhotos = true; $withPhotos = true;
} }
@ -2428,6 +2455,11 @@ 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){
//send email
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, "Rapport des bijoux", " Veuiller trouver ci-joint le rapport des bijoux de ".$nomDefunt.".");
}
$res = array(); $res = array();
$res['path'] = $folderDestination; $res['path'] = $folderDestination;
return json_encode($res); return json_encode($res);
@ -2636,9 +2668,13 @@ class PageController extends Controller {
* @param int $defuntId * @param int $defuntId
*/ */
public function exportCareCertificate($defuntId){ public function exportCareCertificate($defuntId, $isSendEmail = false){
try{ try{
$careCertificateFilename = $this->certificateService->generateCareCertificate($defuntId,$this->idNextcloud); $careCertificateFilename = $this->certificateService->generateCareCertificate($defuntId,$this->idNextcloud);
if($careCertificateFilename != null && $isSendEmail){
//send email
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, "Attestation de soins", " Veuiller trouver ci-joint l'attestation de soins ", true);
}
return $careCertificateFilename; return $careCertificateFilename;
} }
catch(\OCP\Files\NotFoundException $e) { } catch(\OCP\Files\NotFoundException $e) { }
@ -2781,9 +2817,14 @@ class PageController extends Controller {
* @param int $defuntId * @param int $defuntId
*/ */
public function saveAttestationPacemaker($defuntId){ public function saveAttestationPacemaker($defuntId, $isSendEmail = false){
try{ try{
$careCertificateFilename = $this->certificateService->generatePacemakerCertificate($defuntId,$this->idNextcloud); $careCertificateFilename = $this->certificateService->generatePacemakerCertificate($defuntId,$this->idNextcloud);
if($careCertificateFilename != null && $isSendEmail){
//send email
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, "Attestation pacemaker", " Veuiller trouver ci-joint l'attestation de pacemaker ", true);
}
return $careCertificateFilename; return $careCertificateFilename;
} }
catch(\OCP\Files\NotFoundException $e) { } catch(\OCP\Files\NotFoundException $e) { }

View File

@ -264,6 +264,7 @@ class Bdd {
.$this->tableprefix."client.fk_client_group_facturation_id as fk_client_group_facturation_id," .$this->tableprefix."client.fk_client_group_facturation_id as fk_client_group_facturation_id,"
.$this->tableprefix."thanato.nom as nom_thanato, ".$this->tableprefix."thanato.prenom as prenom_thanato, ".$this->tableprefix."thanato.id as tid, " .$this->tableprefix."thanato.nom as nom_thanato, ".$this->tableprefix."thanato.prenom as prenom_thanato, ".$this->tableprefix."thanato.id as tid, "
.$this->tableprefix."devis.num, ".$this->tableprefix."devis.date, ".$this->tableprefix."devis.version, ".$this->tableprefix."devis.mentions, " .$this->tableprefix."devis.num, ".$this->tableprefix."devis.date, ".$this->tableprefix."devis.version, ".$this->tableprefix."devis.mentions, "
.$this->tableprefix."devis.order_number, ".$this->tableprefix."devis.case_number, "
.$this->tableprefix."lieu.id as lid, ".$this->tableprefix."lieu.nom as lieu,".$this->tableprefix."lieu.adresse as adresse_soin,".$this->tableprefix."devis.id_lieu, " .$this->tableprefix."lieu.id as lid, ".$this->tableprefix."lieu.nom as lieu,".$this->tableprefix."lieu.adresse as adresse_soin,".$this->tableprefix."devis.id_lieu, "
.$this->tableprefix."defunt.id as id_defunt, ".$this->tableprefix."defunt.nom as nom_defunt, " .$this->tableprefix."defunt.id as id_defunt, ".$this->tableprefix."defunt.nom as nom_defunt, "
.$this->tableprefix."devis.devis_full_number as devis_full_number .$this->tableprefix."devis.devis_full_number as devis_full_number
@ -348,6 +349,57 @@ class Bdd {
return json_encode($result); return json_encode($result);
} }
public function getFacturesListWithDependencies(){
$sql = "SELECT
facture.id,
facture.user_id,
facture.num,
facture.date,
facture.fk_facture_status_key,
facture.fk_facture_payment_type_id,
facture.payment_date,
facture_payment_type.facture_payment_type_label,
facture_status.facture_status_label,
facture.facture_type,
facture.fk_client_id as facture_client_id,
facture.fk_client_group_facturation_id as facture_client_group_facturation_id,
facture.date_paiement,
facture.type_paiement,
facture.id_devis,
facture.version,
facture.status_paiement,
facture_client.nom as facture_client_name,
facture_client_group_facturation.group_facturation_name as facture_group_name,
devis.num as dnum,
devis.comment as dcomment,
client.entreprise,
client.nom,
client.prenom,
client.id as id_cli,
client.entreprise as client_entreprise,
client.fk_client_group_facturation_id as fk_client_group_facturation_id,
client.adresse as adresse_cli,client.mail as mail_cli,
client.telephone as telephone_cli,client.legal_one as legalone_cli,
client.fk_client_group_id as fk_client_group_id,
defunt.id as id_defunt,
defunt.nom as nom_defunt,
lieu.id as lid,
lieu.nom as lieu,
lieu.adresse as adresse_soin,devis.id_lieu
FROM ".$this->tableprefix."facture as facture
LEFT JOIN ".$this->tableprefix."devis as devis on facture.id_devis = devis.id
LEFT JOIN ".$this->tableprefix."lieu as lieu on devis.id_lieu = lieu.id
LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.id
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
LEFT JOIN ".$this->tableprefix."facture_payment_type as facture_payment_type on facture.fk_facture_payment_type_id = facture_payment_type.id
LEFT JOIN ".$this->tableprefix."facture_status as facture_status on facture.fk_facture_status_key = facture_status.facture_status_key
LEFT JOIN ".$this->tableprefix."client as facture_client on facture.fk_client_id = facture_client.id
LEFT JOIN ".$this->tableprefix."client_group_facturation as facture_client_group_facturation on facture.fk_client_group_facturation_id = facture_client_group_facturation.id
ORDER BY facture.id DESC, facture.date_paiement DESC";
$result = $this->execSQL($sql, array());
return $result;
}
public function getFactures($idNextcloud){ public function getFactures($idNextcloud){
$sql = "SELECT ".$this->tableprefix."facture.id, ".$this->tableprefix."facture.user_id, ".$this->tableprefix."facture.num, ".$this->tableprefix."facture.date, " $sql = "SELECT ".$this->tableprefix."facture.id, ".$this->tableprefix."facture.user_id, ".$this->tableprefix."facture.num, ".$this->tableprefix."facture.date, "
.$this->tableprefix."facture.fk_facture_status_key, ".$this->tableprefix."facture.fk_facture_payment_type_id, ".$this->tableprefix."facture.payment_date, " .$this->tableprefix."facture.fk_facture_status_key, ".$this->tableprefix."facture.fk_facture_payment_type_id, ".$this->tableprefix."facture.payment_date, "
@ -379,8 +431,8 @@ class Bdd {
return $result; return $result;
} }
public function getFacturesWithProduits($idNextCloud){ public function getFacturesWithProduits(){
$factures = $this->getFactures($idNextCloud); $factures = $this->getFacturesListWithDependencies();
$facturesList = json_decode($factures); $facturesList = json_decode($factures);
foreach($facturesList as $currentFacture){ foreach($facturesList as $currentFacture){
$produits = $this->getProduitsDevisByDevisId($currentFacture->id_devis); $produits = $this->getProduitsDevisByDevisId($currentFacture->id_devis);
@ -3450,6 +3502,7 @@ class Bdd {
defunt.product_reference as defunt_product_reference, defunt.product_reference as defunt_product_reference,
client.nom as client_nom, client.nom as client_nom,
client.prenom as client_prenom, client.prenom as client_prenom,
client.mail as client_mail,
client.entreprise as client_entreprise, client.entreprise as client_entreprise,
client.adresse as client_adresse, client.adresse as client_adresse,
thanato.nom as thanato_nom, thanato.nom as thanato_nom,
@ -4424,7 +4477,9 @@ class Bdd {
facture.fk_client_id, facture.fk_client_id,
facture.fk_client_group_facturation_id, facture.fk_client_group_facturation_id,
facture.month, facture.month,
facture.year facture.year,
facture.facture_case_number,
facture.facture_order_number
FROM ".$this->tableprefix."facture as facture FROM ".$this->tableprefix."facture as facture
WHERE facture.id = ? AND WHERE facture.id = ? AND
facture.facture_type = ? facture.facture_type = ?

View File

@ -1,10 +1,11 @@
import "@nextcloud/dialogs/dist/index.css"; import "@nextcloud/dialogs/dist/index.css";
import Modal from 'bootstrap/js/dist/modal';
import "datatables.net-dt/css/jquery.dataTables.css"; import "datatables.net-dt/css/jquery.dataTables.css";
import "../css/mycss.css"; import "../css/mycss.css";
import { globalConfiguration } from "./modules/mainFunction.mjs";
import "./listener/main_listener"; import "./listener/main_listener";
import { setDefuntCover, setDefuntPacemakerPhoto,setBijouxPhoto,getBibliotheques, getBijouxById, getHypodermiquesyId, getObservationsById, getproduits, saveAttestationPacemaker,exportCareCertificate, saveRapportBijoux, saveRapportSoin, updateDB } from "./modules/ajaxRequest.mjs"; import { getBibliotheques, exportCareCertificate,getBijouxById, getHypodermiquesyId, getObservationsById, getproduits, saveAttestationPacemaker, saveRapportBijoux, saveRapportSoin, setBijouxPhoto, setDefuntCover, setDefuntPacemakerPhoto, updateDB } from "./modules/ajaxRequest.mjs";
import { globalConfiguration } from "./modules/mainFunction.mjs";
let bibliotheques = []; let bibliotheques = [];
let sortedBibliotheques = []; let sortedBibliotheques = [];
@ -99,15 +100,17 @@ window.addEventListener("DOMContentLoaded", function () {
break; break;
} }
} }
saveRapportBijoux({
numdefunt: defuntid,
withPhotos: selectedValue
});
$('#saveRapportBijouxModal').hide(); $('#saveRapportBijouxModal').hide();
modalElement.data('export-type', 'rapport-bijoux')
modalElement.data('export-with-photos', selectedValue)
modalElement.modal('show')
// saveRapportBijoux({
// numdefunt: defuntid,
// withPhotos: selectedValue
// });
}); });
setDefuntCoverButton.addEventListener("click",function(){ setDefuntCoverButton.addEventListener("click",function(){
const productCoverRadios = document.getElementsByName('coverProductsRadioButton'); const productCoverRadios = document.getElementsByName('coverProductsRadioButton');
let selectedValue = null; let selectedValue = null;
@ -123,15 +126,57 @@ window.addEventListener("DOMContentLoaded", function () {
}); });
}) })
const modalElement = $('#confirmSendEmailModal')
const _ = new Modal(modalElement[0],{
backdrop: false
})
$('#valdateSendEmailModal').on('click', function(){
const type = modalElement.data('export-type')
const isSendEmail = $('#valueSendEmailModal').is(':checked')
switch(type){
case 'care-certificate':
exportCareCertificate({defuntId : defuntid, isSendEmail})
break;
case 'pacemaker':
saveAttestationPacemaker({ defuntId: defuntid ,isSendEmail});
break;
case 'rapport-soin':
saveRapportSoin({ numdefunt: defuntid ,isSendEmail});
break;
case 'rapport-bijoux':
const selectedValue = modalElement.data('export-with-photos')
saveRapportBijoux({
numdefunt: defuntid,
withPhotos: selectedValue ,
isSendEmail
});
default:
break;
}
modalElement.modal('hide')
$('#valueSendEmailModal').prop('checked', false);
})
$('#closeSendEmailModal').on('click', function(){
modalElement.data('export-type', null)
modalElement.modal('hide')
$('#valueSendEmailModal').prop('checked', false);
})
exportCareCertificateButton.addEventListener("click",function(){ exportCareCertificateButton.addEventListener("click",function(){
exportCareCertificate({defuntId : defuntid}); modalElement.data('export-type', 'care-certificate')
modalElement.modal('show')
// exportCareCertificate({defuntId : defuntid});
}) })
pacemakerBtn.addEventListener("click", function(){ pacemakerBtn.addEventListener("click", function(){
saveAttestationPacemaker({ defuntId: defuntid }); modalElement.data('export-type', 'pacemaker')
modalElement.modal('show')
// saveAttestationPacemaker({ defuntId: defuntid });
}); });
rapportSoinBtn.addEventListener("click", function(){ rapportSoinBtn.addEventListener("click", function(){
saveRapportSoin({ numdefunt: defuntid }); modalElement.data('export-type', 'rapport-soin')
modalElement.modal('show')
// saveRapportSoin({ numdefunt: defuntid });
}); });
$(document).on("change", ".photoBijouUpload", function () { $(document).on("change", ".photoBijouUpload", function () {

View File

@ -34,7 +34,8 @@ export class Facture {
} }
this.payment_date = paymentDate; this.payment_date = paymentDate;
this.factureType = myresp.facture_type; this.factureType = myresp.facture_type;
if(this.factureType == FactureTypeSingle){ const isFactureSingle = this.factureType == FactureTypeSingle;
if(isFactureSingle){
this.baseUrl = generateUrl(`/apps/gestion/facture/${this.id}/show`); this.baseUrl = generateUrl(`/apps/gestion/facture/${this.id}/show`);
} }
else{ else{
@ -46,6 +47,17 @@ export class Facture {
this.isDocumentAlreadySentLabel = this.getDocumentStateLabel(isDocumentAlreadySent); this.isDocumentAlreadySentLabel = this.getDocumentStateLabel(isDocumentAlreadySent);
this.isDocumentAlreadyGeneratedClass = this.getDocumentStateClass(isDocumentAlreadyGenerated); this.isDocumentAlreadyGeneratedClass = this.getDocumentStateClass(isDocumentAlreadyGenerated);
this.isDocumentAlreadySentClass = this.getDocumentStateClass(isDocumentAlreadySent); this.isDocumentAlreadySentClass = this.getDocumentStateClass(isDocumentAlreadySent);
this.clientName = this.nom;
if(isFactureSingle == false){
const isFactureClientWithoutGroup = myresp.facture_client_id != null && myresp.facture_client_id != 0;
if(isFactureClientWithoutGroup){
this.clientName = ((myresp.facture_client_name == null || myresp.facture_client_name.length == 0) ? '-' : myresp.facture_client_name);
}
else{
this.clientName = ((myresp.facture_group_name == null || myresp.facture_group_name.length == 0) ? '-' : myresp.facture_group_name);
}
}
} }
getDocumentStateLabel(documentState){ getDocumentStateLabel(documentState){
@ -68,7 +80,7 @@ export class Facture {
'<input style="margin:0;padding:0;" class="inputDate devisOrFactureInputDate" type="date" value=' + this.date_paiement + ' data-table="facture" data-column="date_paiement" data-id="' + this.id + '"/>', '<input style="margin:0;padding:0;" class="inputDate devisOrFactureInputDate" type="date" value=' + this.date_paiement + ' data-table="facture" data-column="date_paiement" data-id="' + this.id + '"/>',
'<div>' + this.type_paiement + '</div>', '<div>' + this.type_paiement + '</div>',
'<div class="selectAvailableDevis" data-table="facture" data-column="id_devis" data-id="' + this.id + '" data-current="' + this.id_devis + '">' + this.nom_defunt + ' | <span style="font-size: 0.7rem">' + this.prenom + ' ' + this.nom + '</span></div>', '<div class="selectAvailableDevis" data-table="facture" data-column="id_devis" data-id="' + this.id + '" data-current="' + this.id_devis + '">' + this.nom_defunt + ' | <span style="font-size: 0.7rem">' + this.prenom + ' ' + this.nom + '</span></div>',
'<div>' + this.nom + '</div>', '<div>' + this.clientName + '</div>',
'<div>' + this.factureProduits + '</div>', '<div>' + this.factureProduits + '</div>',
'<div>' + this.status_paiement + '</div>', '<div>' + this.status_paiement + '</div>',
'<div>' + this.payment_date + '</div>', '<div>' + this.payment_date + '</div>',

View File

@ -115,16 +115,16 @@
} }
; ;
foreach ($devis as $key => $d) { foreach ($devis as $key => $currentDevis) {
?> ?>
<div class="bootstrap-iso d-flex flex-column justify-content-between"> <div class="bootstrap-iso d-flex flex-column justify-content-between">
<div class="d-flex flex-column w-100"> <div class="d-flex flex-column w-100">
<h2 class="mt-3 mb-3 text-center"> <?php p($l->t('Quote')); ?> <h2 class="mt-3 mb-3 text-center"> <?php p($l->t('Quote')); ?>
<div id="devisid" style="display:inline" data-table="devis" data-column="num" <div id="devisid" style="display:inline" data-table="devis" data-column="num"
data-id="<?php echo $d->id; ?>">sur le defunt <?php echo $d->nom_defunt; ?></div> data-id="<?php echo $currentDevis->id; ?>">sur le defunt <?php echo $currentDevis->nom_defunt; ?></div>
<span data-html2canvas-ignore>(</span> <span data-html2canvas-ignore>(</span>
<div data-html2canvas-ignore id="devisversion" style="display:inline" data-table="devis" <div data-html2canvas-ignore id="devisversion" style="display:inline" data-table="devis"
data-column="version" data-id="<?php echo $d->id; ?>"><?php echo $d->lieu; ?>)</div> data-column="version" data-id="<?php echo $currentDevis->id; ?>"><?php echo $currentDevis->lieu; ?>)</div>
</h2> </h2>
<hr /> <hr />
<div class="row"> <div class="row">
@ -152,21 +152,21 @@
</div> </div>
<div class="col-5 h-100 m-0" style="min-height:250px;"> <div class="col-5 h-100 m-0" style="min-height:250px;">
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('TO')); ?> <h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('TO')); ?>
<span id="entreprise"><?php echo $d->entreprise ?></span></h6> <span id="entreprise"><?php echo $currentDevis->entreprise ?></span></h6>
<p <p
class="p-3 m-0 h-auto text-center text-dark text-center border border-top-0 border-2 border-dark"> class="p-3 m-0 h-auto text-center text-dark text-center border border-top-0 border-2 border-dark">
<span id="nomprenom" data-id="0" data-table="devis" <span id="nomprenom" data-id="0" data-table="devis"
data-column="id_client"><?php echo $d->prenom . ' ' . $d->nom ?></span><br /> data-column="id_client"><?php echo $currentDevis->prenom . ' ' . $currentDevis->nom ?></span><br />
<span id="adresse"><?php echo $d->adresse_cli ?></span><br /> <span id="adresse"><?php echo $currentDevis->adresse_cli ?></span><br />
<span id="mail"><?php echo $d->mail_cli ?></span><br /> <span id="mail"><?php echo $currentDevis->mail_cli ?></span><br />
<span id="telephone"><?php echo $d->telephone_cli ?></span><br /> <span id="telephone"><?php echo $currentDevis->telephone_cli ?></span><br />
<span id="legal_one"><?php echo $d->legalone_cli ?></span><br /> <span id="legal_one"><?php echo $currentDevis->legalone_cli ?></span><br />
<span id="dateContext" style="display: none"><?php echo $facture->date ?></span> <span id="dateContext" style="display: none"><?php echo $facture->date ?></span>
<span id="nomcli" style="display: none"><?php echo $d->prenom . ' ' . $d->nom ?></span> <span id="nomcli" style="display: none"><?php echo $currentDevis->prenom . ' ' . $currentDevis->nom ?></span>
<span id="idcli" style="display: none"><?php echo $d->id_cli ?></span> <span id="idcli" style="display: none"><?php echo $currentDevis->id_cli ?></span>
<span id="etp" style="display: none"><?php echo $d->entreprise ?></span> <span id="etp" style="display: none"><?php echo $currentDevis->entreprise ?></span>
<span class="pdf" <span class="pdf"
style="display: none"><?php echo $d->entreprise . "_" . $d->id . "_v" . $d->version ?></span> style="display: none"><?php echo $currentDevis->entreprise . "_" . $currentDevis->id . "_v" . $currentDevis->version ?></span>
</p> </p>
</div> </div>
</div> </div>
@ -175,7 +175,7 @@
<hr /> <hr />
<div class="col col-xl mb-3 text-center"> <div class="col col-xl mb-3 text-center">
<b><span><?php p($l->t('Offer valid for 1 month from')); ?> : <b><span><?php p($l->t('Offer valid for 1 month from')); ?> :
</span><span><?php echo (new DateTime($d->date))->format('d-m-Y'); ?></span></b></div> </span><span><?php echo (new DateTime($currentDevis->date))->format('d-m-Y'); ?></span></b></div>
<hr /> <hr />
</div> </div>
</div> </div>
@ -183,21 +183,36 @@
<div class="col col-md"> <div class="col col-md">
<div class="col col-xl text-center"> <div class="col col-xl text-center">
<span>Date de soin : <span>Date de soin :
<b><?php echo (new DateTime($d->date))->format('d-m-Y'); ?></b>,</span>&nbsp;<span <b><?php echo (new DateTime($currentDevis->date))->format('d-m-Y'); ?></b>,</span>&nbsp;<span
id="devisid" data-id=<?php echo $d->id; ?>>Defunt associé : id="devisid" data-id=<?php echo $currentDevis->id; ?>>Defunt associé :
<b><?php echo $d->num; ?></b></span><br /> <b><?php echo $currentDevis->nom_defunt; ?></b></span><br />
<span>Lieu : <b><?php echo $d->lieu; ?> (<?php echo $d->adresse_soin; ?>)</b> <span>Lieu : <b><?php echo $currentDevis->lieu; ?> (<?php echo $currentDevis->adresse_soin; ?>)</b>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col col-md"> <div class="col col-md">
<hr /> <label class="fw-bold">Commande :</label>
<div class="col col-xl mb-3 text-center editable" id="deviscomment" style="display:inline" <div class="col col-xl mb-3 text-center editable"
data-table="devis" data-column="comment" data-id="<?php echo $d->id; ?>"> style="display:inline"
<?php echo ($d->comment == "") ? "-" : $d->comment; ?></div> data-table="devis" data-column="order_number"
data-id="<?php echo $currentDevis->id;?>">
<?php echo ($currentDevis->order_number == "" ) ? "-" : $currentDevis->order_number ; ?>
</div>
</div>
<hr /> <hr />
</div> </div>
<div class="row">
<div class="col col-md">
<label class="fw-bold">Numéro de dossier :</label>
<div class="col col-xl mb-3 text-center editable"
style="display:inline"
data-table="devis" data-column="case_number"
data-id="<?php echo $currentDevis->id;?>">
<?php echo ($currentDevis->case_number == "" ) ? "-" : $currentDevis->case_number ; ?>
</div>
</div>
<hr />
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table id="produits" data-type="facture" class="table table-striped"> <table id="produits" data-type="facture" class="table table-striped">
@ -212,7 +227,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($d->dproduits as $key => $produit) { ?> <?php foreach ($currentDevis->dproduits as $key => $produit) { ?>
<tr> <tr>
<td><?php echo $produit->reference ?></td> <td><?php echo $produit->reference ?></td>
<td><?php echo $produit->description ?></td> <td><?php echo $produit->description ?></td>
@ -242,7 +257,7 @@
$tva = json_decode($_['configuration'])[0]->tva_default; $tva = json_decode($_['configuration'])[0]->tva_default;
$totalttc = 0; $totalttc = 0;
$totalprice = 0; $totalprice = 0;
foreach ($d->dproduits as $key => $produit) { foreach ($currentDevis->dproduits as $key => $produit) {
$totalhtc = $totalhtc + ($produit->quantite * $produit->prix_unitaire); $totalhtc = $totalhtc + ($produit->quantite * $produit->prix_unitaire);
} }
$totalttc = ($totalhtc * $tva) / 100; $totalttc = ($totalhtc * $tva) / 100;

View File

@ -454,7 +454,9 @@
</div> </div>
<div class="col-12" style="margin-bottom: 32px"> <div class="col-12" style="margin-bottom: 32px">
<div class="d-flex flex-row justify-content-between"> <div class="d-flex flex-row justify-content-between">
<div><h6>OBSERVATIONS</h6></div> <div>
<h6>OBSERVATIONS</h6>
</div>
<button id="defuntAddObservation" class="btn btn-secondary" type="button">Ajouter une observation</button> <button id="defuntAddObservation" class="btn btn-secondary" type="button">Ajouter une observation</button>
</div> </div>
<hr> <hr>
@ -474,7 +476,9 @@
</div> </div>
<div class="col-12" style="margin-bottom: 32px"> <div class="col-12" style="margin-bottom: 32px">
<div class="d-flex flex-row justify-content-between"> <div class="d-flex flex-row justify-content-between">
<div><h6>BIJOU(X)</h6></div> <div>
<h6>BIJOU(X)</h6>
</div>
<button id="defuntAddBijou" class="btn btn-secondary" type="button">Ajouter un bijou</button> <button id="defuntAddBijou" class="btn btn-secondary" type="button">Ajouter un bijou</button>
</div> </div>
<hr> <hr>
@ -519,4 +523,23 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal" id="confirmSendEmailModal" data-backdrop="false" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Confirmeation 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">Envoyer un email ?</label>
</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>
</div>
</div>
</div>
</div>
</div> </div>