add loader

This commit is contained in:
Tiavina 2025-02-11 10:20:00 +03:00
parent be1f39b58c
commit 0a4c1ee319
51 changed files with 143 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

View File

@ -98,4 +98,32 @@ table.dataTable.display tbody tr.even > [class*="sorting_"] {
align-items: center;
gap: 5px;
cursor: pointer;
}
.loader-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
display: none;
}
.loader-center {
width: 50px;
height: 50px;
border: 5px solid #fff;
border-top-color: #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

View File

@ -1,5 +1,5 @@
import {showError, showSuccess } from "@nextcloud/dialogs";
import {baseUrl} from "../modules/mainFunction.mjs";
import {baseUrl, hideLoader, showLoader} from "../modules/mainFunction.mjs";
import { Devis } from "../objects/devis.mjs";
import DataTable from "datatables.net";
window.addEventListener("DOMContentLoaded", function () {
@ -52,6 +52,8 @@ $('body').on('click', '#invoiceQuote', function () {
paymentDate: dateValue
}
showLoader();
$.ajax({
url: baseUrl + '/exportDevisToFacture',
type: 'POST',
@ -65,5 +67,7 @@ $('body').on('click', '#invoiceQuote', function () {
}).fail(function (response, code) {
$('#devisFacturationModal').hide();
showError(t('gestion', "Erreur dans la facturation du devis"));
}).always(function () {
hideLoader();
});
});

View File

@ -1,5 +1,5 @@
import {showError, showSuccess } from "@nextcloud/dialogs";
import {baseUrl} from "../modules/mainFunction.mjs";
import {baseUrl, hideLoader, showLoader} from "../modules/mainFunction.mjs";
import { Facture } from "../objects/facture.mjs";
import DataTable from "datatables.net";
window.addEventListener("DOMContentLoaded", function () {
@ -56,6 +56,8 @@ $('body').on('click', '#payInvoice', function () {
paymentDate: paymentDate
}
showLoader();
$.ajax({
url: baseUrl + '/facture/payInvoices',
type: 'POST',
@ -73,6 +75,8 @@ $('body').on('click', '#payInvoice', function () {
}).fail(function (response, code) {
$('#facturePaymentModal').hide();
showError(t('gestion', "Erreur dans le paiement des factures"));
}).always(function () {
hideLoader();
});
});
@ -90,6 +94,8 @@ $('body').on('click', '#exportMultipleFactureToPdf', function () {
filterType : filterType
};
showLoader();
$.ajax({
url: baseUrl + '/facture/exportFactureByClientAndMonthYearToPdf',
type: 'POST',
@ -104,8 +110,9 @@ $('body').on('click', '#exportMultipleFactureToPdf', function () {
showError(t('gestion', "Les données pour sauvegarde sont vides"));
}).fail(function (response, code) {
showError(t('gestion', "Erreur dans la génération de facture multiple"));
}).always(function () {
hideLoader();
});
});
document.onchange = function(event) {

View File

@ -1,6 +1,6 @@
import { FilePicker, showError, showSuccess } from "@nextcloud/dialogs";
import { updateDB, configuration, updateEditable, deleteDB, getProduitsById, listProduit, getStatArticleAnnuel, getStatSoinsThanatoAnnuel, getStatSoinsThanatoWeekend, getArticlesById, listArticle, getObservationsById, getBijouxById, getHypodermiquesyId } from "../modules/ajaxRequest.mjs";
import { path, baseUrl, updateNumerical } from "../modules/mainFunction.mjs";
import { path, baseUrl, updateNumerical, showLoader, hideLoader } from "../modules/mainFunction.mjs";
import DataTable from 'datatables.net';
import { Client } from '../objects/client.mjs';
import { Lieu } from '../objects/lieu.mjs';
@ -445,6 +445,8 @@ $('body').on('click', '#exportClientStat', function () {
clientIdsToExport: clientIdsToExport
}
showLoader();
$.ajax({
url: baseUrl + '/client/exportClientStatistic',
type: 'POST',
@ -456,6 +458,8 @@ $('body').on('click', '#exportClientStat', function () {
showSuccess(t('gestion', "Sauvegardé dans : " + response));
}).fail(function (response, code) {
showError(t('gestion', "Erreur dans l'export de statistique client"));
}).always(function () {
hideLoader();
});
@ -467,6 +471,8 @@ $('body').on('click', '#exportFactureToPdf', function () {
factureId: factureIdentifier
};
showLoader();
$.ajax({
url: baseUrl + '/facture/exportFactureToPdf',
type: 'POST',
@ -479,6 +485,8 @@ $('body').on('click', '#exportFactureToPdf', function () {
});
}).fail(function (response, code) {
showError(t('gestion', "Erreur dans la facturation des devis"));
}).always(function () {
hideLoader();
});

View File

@ -1,5 +1,5 @@
import {showError, showSuccess } from "@nextcloud/dialogs";
import {baseUrl} from "../modules/mainFunction.mjs";
import {baseUrl,showLoader,hideLoader} from "../modules/mainFunction.mjs";
import { Devis } from "../objects/devis.mjs";
import DataTable from "datatables.net";
import { Thanatopracteur } from "../objects/thanatopracteur.mjs";
@ -56,6 +56,8 @@ $('body').on('click', '#exportThanatosStat', function () {
year: yearValue
}
showLoader();
$.ajax({
url: baseUrl + '/thanatopracteur/exportThanatoStatistic',
type: 'POST',
@ -68,7 +70,7 @@ $('body').on('click', '#exportThanatosStat', function () {
response.forEach(fileName => {
showSuccess('Sauvegardé dans' + fileName);
});
}).fail(function (response, code) {
showError(t('gestion', "Erreur dans l'export de statistique thanato"));
}).always(function () {
hideLoader();
});
});

View File

@ -1,6 +1,6 @@
import { showMessage, showSuccess, showError } from "@nextcloud/dialogs";
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
import { baseUrl, cur, getGlobal, insertCell, insertRow, insertRowWeekendRow, modifyCell } from "./mainFunction.mjs";
import { baseUrl, cur, getGlobal, hideLoader, insertCell, insertRow, insertRowWeekendRow, modifyCell, showLoader } from "./mainFunction.mjs";
/**
* Update data
@ -556,6 +556,7 @@ export function saveNextcloud(myData) {
* @param {*} myData
*/
export function saveDocumentRecap(myData) {
showLoader();
$.ajax({
url: baseUrl + '/saveDocumentRecap',
type: 'POST',
@ -565,8 +566,9 @@ export function saveDocumentRecap(myData) {
showMessage('Sauvegarde reussie.');
}).fail(function (response, code) {
showMessage(t('gestion', 'There is an error'));
error(response);
});
}).always(function () {
hideLoader();
});
}
/**
@ -656,6 +658,7 @@ export function refreshFEC() {
* @param {*} myData
*/
export function saveAttestationPacemaker(myData) {
showLoader();
$.ajax({
url: baseUrl + '/saveAttestationPacemaker',
type: 'POST',
@ -669,7 +672,8 @@ export function saveAttestationPacemaker(myData) {
}
}).fail(function (response, code) {
showMessage(t('gestion', 'Erreur dans la génération d\'attestation pacemaker'));
error(response);
}).always(function () {
hideLoader();
});
};
@ -678,6 +682,7 @@ export function saveAttestationPacemaker(myData) {
* @param {*} myData
*/
export function saveRapportSoin(myData) {
showLoader();
$.ajax({
url: baseUrl + '/saveRapportSoin',
type: 'POST',
@ -691,7 +696,9 @@ export function saveRapportSoin(myData) {
}
}).fail(function (response, code) {
showMessage(t('gestion', 'There is an error'));
error(response);
})
.always(function () {
hideLoader();
});
};
@ -700,6 +707,7 @@ export function saveRapportSoin(myData) {
* @param {*} myData
*/
export function saveRapportBijoux(myData) {
showLoader();
$.ajax({
url: baseUrl + '/saveRapportBijoux',
type: 'POST',
@ -713,7 +721,8 @@ export function saveRapportBijoux(myData) {
}
}).fail(function (response, code) {
showMessage(t('gestion', 'There is an error'));
error(response);
}).always(function () {
hideLoader();
});
};
@ -739,6 +748,7 @@ export function getproduits(callback) {
* @param {*} defuntIdPayload
*/
export function exportCareCertificate(defuntIdPayload) {
showLoader();
$.ajax({
url: baseUrl + '/defunt/exportCareCertificate',
type: 'POST',
@ -752,7 +762,8 @@ export function exportCareCertificate(defuntIdPayload) {
}
}).fail(function (response, code) {
showMessage(t('gestion', 'There is an error'));
error(response);
}).always(function () {
hideLoader();
});
};
@ -794,6 +805,8 @@ export function exportDevisToPdf(devisId) {
let payload = {
devisId : devisId
}
showLoader();
$.ajax({
url: baseUrl + '/devis/exportDevisToPdf',
type: 'POST',
@ -810,7 +823,8 @@ export function exportDevisToPdf(devisId) {
});
}).fail(function (response, code) {
showMessage(t('gestion', 'Erreur dans l\'export du devis en PDF'));
error(response);
}).always(function () {
hideLoader();
});
};
@ -824,6 +838,8 @@ export function exportClientDevisByMonthAndYearToPdf(clientId,year,month) {
month : month,
year : year
};
showLoader();
$.ajax({
url: baseUrl + '/devis/exportDevisByClientAndMonthYearToPdf',
type: 'POST',
@ -837,6 +853,8 @@ export function exportClientDevisByMonthAndYearToPdf(clientId,year,month) {
showError(t('gestion', "Les données pour sauvegarde sont vides"));
}).fail(function (response, code) {
showError(t('gestion', "Erreur dans la génération de devis multiple"));
}).always(function () {
hideLoader();
});
};
@ -850,6 +868,8 @@ export function setBijouxPhoto(bijouxId,file) {
let formData = new FormData();
formData.append("bijouxId", bijouxId);
formData.append("photo", file);
showLoader();
$.ajax({
url: baseUrl + '/defunt/uploadFileToBijoux',
type: 'POST',
@ -865,6 +885,8 @@ export function setBijouxPhoto(bijouxId,file) {
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"));
}).always(function () {
hideLoader();
});
}
else{
@ -882,6 +904,7 @@ export function setDefuntPacemakerPhoto(defuntId,file) {
let formData = new FormData();
formData.append("defuntId", defuntId);
formData.append("photo", file);
showLoader();
$.ajax({
url: baseUrl + '/defunt/uploadPacemakerPhotoToDefunts',
type: 'POST',
@ -898,6 +921,8 @@ export function setDefuntPacemakerPhoto(defuntId,file) {
showError(t('gestion', "Le défunt n'appartient à aucun devis"));
}).fail(function (response, code) {
showError(t('gestion', "Le défunt n'appartient à aucun devis"));
}).always(function () {
hideLoader();
});
}
else{

View File

@ -266,4 +266,12 @@ export function removeOptions(selectElement) {
for(i = L; i >= 0; i--) {
selectElement.remove(i);
}
}
export function showLoader(){
$('#loader-center').css('display', 'flex');
}
export function hideLoader(){
$('#loader-center').hide();
}

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/apercustousdevis')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/apercustoutesfactures')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/article')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/bibliotheque')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/clientGroup')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/clientGroupDiscount')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/clientGroupFacturation')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/configuration')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/defunt')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/defuntshow')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/devis')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/devisshow')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/facture')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/factureshow')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/index')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/lieu')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
<div id="loader-center" class="loader-container">
<div class="loader-center"></div>
</div>

View File

@ -12,6 +12,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/produit')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/statistique')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/thanatopracteur')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/trajet')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -13,6 +13,7 @@
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/trajetdetails')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>