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.product_photo,"
.$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."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, "
@ -3795,6 +3796,17 @@ class Bdd {
}
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){
$defunt = $this->getDefuntById($defuntId);
if($defunt == null){
@ -3803,10 +3815,16 @@ class Bdd {
if($defunt["devis_id"] == 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);
if($product == null){
return null;
}
$coverProductList = $this->getProductsByProductTypeKey(ProductConstant::PRODUCT_COVER_TYPE_KEY);
$coverProductList = json_decode($coverProductList);

View File

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

View File

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

View File

@ -123,16 +123,17 @@ $coverProducts = $_['coverProducts'];
<?php foreach ($coverProducts as $currentCoverProduct): ?>
<div class="row">
<div class="d-flex align-items-center mb-2">
<input type="radio"
name="coverProductsRadioButton"
<input type="checkbox"
name="coverProductsCheckbox"
class="coverProductsExclusive"
value="<?= $currentCoverProduct->id; ?>"
<?= $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>
<?php endforeach; ?>
<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>