fiche defunt fixes (marque prothèse, checkbox cover product instead of radio button)

This commit is contained in:
Tiavina 2025-04-10 14:06:59 +03:00
parent 3bb8473068
commit f80fb03af3
27 changed files with 56 additions and 37 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

File diff suppressed because one or more lines are too long

View File

@ -793,6 +793,7 @@ class Bdd {
.$this->tableprefix."defunt.observations_generales," .$this->tableprefix."defunt.observations_generales,"
.$this->tableprefix."defunt.product_photo," .$this->tableprefix."defunt.product_photo,"
.$this->tableprefix."defunt.product_photo_name," .$this->tableprefix."defunt.product_photo_name,"
.$this->tableprefix."defunt.product_brand,"
.$this->tableprefix."client.id as clientid, ".$this->tableprefix."client.nom, ".$this->tableprefix."client.prenom, legal_one, entreprise, telephone, mail, ".$this->tableprefix."client.adresse," .$this->tableprefix."client.id as clientid, ".$this->tableprefix."client.nom, ".$this->tableprefix."client.prenom, legal_one, entreprise, telephone, mail, ".$this->tableprefix."client.adresse,"
.$this->tableprefix."lieu.nom as lieu, ".$this->tableprefix."lieu.adresse as adresse_soin ," .$this->tableprefix."lieu.nom as lieu, ".$this->tableprefix."lieu.adresse as adresse_soin ,"
.$this->tableprefix."thanato.nom as nom_thanato, ".$this->tableprefix."thanato.prenom as prenom_thanato, " .$this->tableprefix."thanato.nom as nom_thanato, ".$this->tableprefix."thanato.prenom as prenom_thanato, "
@ -3795,6 +3796,17 @@ class Bdd {
} }
return null; return null;
} }
private function deleteProductsInDevisByProductType($devisId,$productTypeId){
$sql = "DELETE produit_devis FROM ".$this->tableprefix."produit_devis as produit_devis
LEFT JOIN ".$this->tableprefix."produit as produit ON produit_devis.produit_id = produit.id
WHERE produit_devis.devis_id = ? AND
produit.fk_product_type_id = ?;";
$this->execSQLNoData($sql,[$devisId,$productTypeId]);
}
public function setDefuntCover($defuntId, $productCoverId){ public function setDefuntCover($defuntId, $productCoverId){
$defunt = $this->getDefuntById($defuntId); $defunt = $this->getDefuntById($defuntId);
if($defunt == null){ if($defunt == null){
@ -3803,10 +3815,16 @@ class Bdd {
if($defunt["devis_id"] == null){ if($defunt["devis_id"] == null){
return null; return null;
} }
if($productCoverId == null){
$productTypeCover = $this->getProductTypeByKey(ProductConstant::PRODUCT_COVER_TYPE_KEY);
$this->deleteProductsInDevisByProductType($defunt["devis_id"],$productTypeCover['id']);
return true;
}
$product = $this->getProductAsDefuntCoverProduct($productCoverId); $product = $this->getProductAsDefuntCoverProduct($productCoverId);
if($product == null){ if($product == null){
return null; return null;
} }
$coverProductList = $this->getProductsByProductTypeKey(ProductConstant::PRODUCT_COVER_TYPE_KEY); $coverProductList = $this->getProductsByProductTypeKey(ProductConstant::PRODUCT_COVER_TYPE_KEY);
$coverProductList = json_decode($coverProductList); $coverProductList = json_decode($coverProductList);

View File

@ -79,7 +79,7 @@ window.addEventListener("DOMContentLoaded", function () {
var pacemakerBtn = document.getElementById("pacemakerBtn"); var pacemakerBtn = document.getElementById("pacemakerBtn");
var rapportSoinBtn = document.getElementById("rapportSoinBtn"); var rapportSoinBtn = document.getElementById("rapportSoinBtn");
var exportCareCertificateButton = document.getElementById("exportCareCertificate"); var exportCareCertificateButton = document.getElementById("exportCareCertificate");
var setDefuntCoverButton = this.document.getElementById("coverProductsRadioButton"); var setDefuntCoverButton = this.document.getElementById("coverProductsSetButton");
var showRapportBijouxExportModalButton = this.document.getElementById("showRapportBijouxExportModal"); var showRapportBijouxExportModalButton = this.document.getElementById("showRapportBijouxExportModal");
var closeRapportBijouxModalButton = this.document.getElementById("closeRapportBijouxModal"); var closeRapportBijouxModalButton = this.document.getElementById("closeRapportBijouxModal");
@ -113,11 +113,11 @@ window.addEventListener("DOMContentLoaded", function () {
setDefuntCoverButton.addEventListener("click",function(){ setDefuntCoverButton.addEventListener("click",function(){
const productCoverRadios = document.getElementsByName('coverProductsRadioButton'); const selectedProductCover = document.getElementsByName('coverProductsCheckbox');
let selectedValue = null; let selectedValue = null;
for (const radio of productCoverRadios) { for (const checkbox of selectedProductCover) {
if (radio.checked) { if (checkbox.checked) {
selectedValue = radio.value; selectedValue = checkbox.value;
break; break;
} }
} }
@ -342,4 +342,8 @@ function removeElements() {
items.forEach((item) => { items.forEach((item) => {
item.remove(); item.remove();
}) })
} }
$('.coverProductsExclusive').on('change', function () {
$('.coverProductsExclusive').not(this).prop('checked', false);
});

View File

@ -773,10 +773,6 @@ export function exportCareCertificate(defuntIdPayload) {
* @param {*} setDefuntCoverPayload * @param {*} setDefuntCoverPayload
*/ */
export function setDefuntCover(setDefuntCoverPayload) { export function setDefuntCover(setDefuntCoverPayload) {
if(setDefuntCoverPayload.productId == null){
showError('Veuillez choisir une housse à appliquer');
return;
}
$.ajax({ $.ajax({
url: baseUrl + '/defunt/setDefuntCover', url: baseUrl + '/defunt/setDefuntCover',
type: 'POST', type: 'POST',

View File

@ -123,16 +123,17 @@ $coverProducts = $_['coverProducts'];
<?php foreach ($coverProducts as $currentCoverProduct): ?> <?php foreach ($coverProducts as $currentCoverProduct): ?>
<div class="row"> <div class="row">
<div class="d-flex align-items-center mb-2"> <div class="d-flex align-items-center mb-2">
<input type="radio" <input type="checkbox"
name="coverProductsRadioButton" name="coverProductsCheckbox"
class="coverProductsExclusive"
value="<?= $currentCoverProduct->id; ?>" value="<?= $currentCoverProduct->id; ?>"
<?= $currentCoverProduct->id == $_['defunt'][0]->product_cover_id ? 'checked' : ''; ?>> <?= $currentCoverProduct->id == $_['defunt'][0]->product_cover_id ? 'checked' : ''; ?>>
<label class="form-check-label"><?= $currentCoverProduct->description; ?></label> <label class="form-check-label"><?= $currentCoverProduct->description; ?></label>
</div> </div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<div class="row p-2"> <div class="row p-2">
<button class="btn btn-secondary" id="coverProductsRadioButton"> Valider le choix </button> <button class="btn btn-secondary" id="coverProductsSetButton"> Valider le choix </button>
</div> </div>
</div> </div>
</div> </div>