finish set photo on bijou, wip save bijou rapport with photos or not on frontend

This commit is contained in:
Tiavina 2025-01-29 12:00:24 +03:00
parent 5591a21ac2
commit 1d943f7505
27 changed files with 77 additions and 24 deletions

View File

@ -257,4 +257,8 @@
background-color: rgb(43, 172, 253);
border-radius: 0 0 5px 5px;
color: white
}
.photoBijouUpload{
all: inherit !important;
}

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

@ -2783,7 +2783,7 @@ class PageController extends Controller {
$fileContent = file_get_contents($_FILES["photo"]["tmp_name"]);
$this->storage->newFile($fullPath,$fileContent);
$this->myDb->saveBijouxPhoto($bijouxId,$filename,$photoName);
return true;
return $fullPath;
}
catch(\OCP\Files\NotFoundException $e) { }

View File

@ -4,7 +4,7 @@ import "../css/mycss.css";
import { globalConfiguration } from "./modules/mainFunction.mjs";
import "./listener/main_listener";
import { setDefuntCover,getBibliotheques, getBijouxById, getHypodermiquesyId, getObservationsById, getproduits, saveAttestationPacemaker,exportCareCertificate, saveRapportBijoux, saveRapportSoin, updateDB } from "./modules/ajaxRequest.mjs";
import { setDefuntCover, setBijouxPhoto,getBibliotheques, getBijouxById, getHypodermiquesyId, getObservationsById, getproduits, saveAttestationPacemaker,exportCareCertificate, saveRapportBijoux, saveRapportSoin, updateDB } from "./modules/ajaxRequest.mjs";
let bibliotheques = [];
let sortedBibliotheques = [];
@ -103,6 +103,14 @@ window.addEventListener("DOMContentLoaded", function () {
rapportBijouxBtn.addEventListener("click", function(){
saveRapportBijoux({ numdefunt: defuntid });
});
$(".photoBijouUpload").on("change", function () {
let fileInput = this;
let file = fileInput.files[0];
let bijouxId = $(this).data("id");
setBijouxPhoto(bijouxId,file);
getBijouxById();
})
});
function loadBibliotheques(response) {

View File

@ -512,9 +512,18 @@ export function getBijouxById() {
}).done(function (response, code) {
$('#bijoux tbody').empty();
$.each(JSON.parse(response), function (arrayID, myresp) {
let photo = myresp.photo;
let photoHtml = "";
if(photo != null){
photoHtml = '<td><label style="padding-right:5px;">'+myresp.photo_name+'</label><input type="file" accept="image/png, image/gif, image/jpeg" class="photoBijouUpload" data-id="' + myresp.bdid + '"></td>'
}
else{
photoHtml = '<td><input type="file" accept="image/png, image/gif, image/jpeg" class="photoBijouUpload" data-id="' + myresp.bdid + '"></td>';
}
$('#bijoux tbody').append('<tr>'+
'<td><div class="editable" data-table="bijou_defunt" data-column="designation" data-id="' + myresp.bdid + '">' + ((myresp.designation.length === 0) ? '-' : myresp.designation) + '</div></td>' +
'<td><div class="editable" data-table="bijou_defunt" data-column="commentaire" data-id="' + myresp.bdid + '">' + ((myresp.commentaire.length === 0) ? '-' : myresp.commentaire) + '</div></td>' +
photoHtml +
'<td><div data-html2canvas-ignore data-modifier="getBijouxById" data-id="' + myresp.bdid + '" data-table="bijou_defunt" class="deleteItem icon-delete"></div></td>'+
'</tr>'
);
@ -830,3 +839,34 @@ export function exportClientDevisByMonthAndYearToPdf(clientId,year,month) {
showError(t('gestion', "Erreur dans la génération de devis multiple"));
});
};
/**
* Set bijoux photo
* @param {*} bijouxId
* @param {*} file
*/
export function setBijouxPhoto(bijouxId,file) {
if(file){
let formData = new FormData();
formData.append("bijouxId", bijouxId);
formData.append("photo", file);
$.ajax({
url: baseUrl + '/defunt/uploadFileToBijoux',
type: 'POST',
contentType: false,
processData: false,
data: formData
}).done(function (response) {
if(response != null) {
showSuccess('Sauvegardé dans' + response);
return;
}
showError(t('gestion', "Erreur dans l'assignation de photo sur ce bijou"));
}).fail(function (response, code) {
showError(t('gestion', "Erreur dans la génération de devis multiple"));
});
}
else{
showError(t('gestion', "Veuillez choisir une image"))
}
};

View File

@ -447,6 +447,7 @@
<tr>
<th>Désignation</th>
<th><?php p($l->t('Comment'));?></th>
<th><?php p($l->t('Photo'));?></th>
<th>Actions</th>
</tr>
</thead>