finish export thanato stat in frontend
This commit is contained in:
parent
b575057341
commit
73e2a63faa
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
@ -423,41 +423,6 @@ $('body').on('click', '#about', function () {
|
||||
modal.style.display = "block";
|
||||
});
|
||||
|
||||
$('body').on('click', '#exportThanatoData', function () {
|
||||
var oTable = $('.tabledt').dataTable();
|
||||
var rowcollection = oTable.$(".thanatoToExport:checked", {"page": "all"});
|
||||
let thanatoIdsToExport = [];
|
||||
rowcollection.each(function(index,elem){
|
||||
var checkbox_value = $(elem).val();
|
||||
thanatoIdsToExport.push(checkbox_value);
|
||||
});
|
||||
|
||||
if(thanatoIdsToExport.length == 0){
|
||||
showError(t('gestion', "Veuillez choisir au moins une ligne de client"));
|
||||
return;
|
||||
}
|
||||
|
||||
let exportThanatoPayload = {
|
||||
thanatoIdsToExport: thanatoIdsToExport
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + '/thanatopracteur/exportThanatoStatistic',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(exportThanatoPayload)
|
||||
}).done(function (response) {
|
||||
let datatable = new DataTable('.tabledt');
|
||||
Thanatopracteur.loadThanatoDT(datatable);
|
||||
showSuccess(t('gestion', "Sauvegardé dans : " + response));
|
||||
}).fail(function (response, code) {
|
||||
showError(t('gestion', "Erreur dans l'export de statistique thanato"));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '#exportClientStat', function () {
|
||||
var oTable = $('.tabledt').dataTable();
|
||||
var rowcollection = oTable.$(".clientToExport:checked", {"page": "all"});
|
||||
@ -509,7 +474,7 @@ $('body').on('click', '#exportFactureToPdf', function () {
|
||||
showSuccess('Sauvegardé dans' + fileName);
|
||||
});
|
||||
}).fail(function (response, code) {
|
||||
showError(t('gestion', "Please create a new hypodermique"));
|
||||
showError(t('gestion', "Erreur dans la facturation des devis"));
|
||||
});
|
||||
|
||||
|
||||
|
||||
74
gestion/src/js/listener/thanatoListener.js
Normal file
74
gestion/src/js/listener/thanatoListener.js
Normal file
@ -0,0 +1,74 @@
|
||||
import {showError, showSuccess } from "@nextcloud/dialogs";
|
||||
import {baseUrl} from "../modules/mainFunction.mjs";
|
||||
import { Devis } from "../objects/devis.mjs";
|
||||
import DataTable from "datatables.net";
|
||||
import { Thanatopracteur } from "../objects/thanatopracteur.mjs";
|
||||
window.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
const today = new Date();
|
||||
const currentMonth = today.getMonth() + 1;
|
||||
const currentYear = today.getFullYear();
|
||||
this.document.getElementById("monthSelect").value = currentMonth;
|
||||
this.document.getElementById("yearSelect").value = currentYear;
|
||||
});
|
||||
|
||||
$('body').on('click', '#showExportThanatoModal', function () {
|
||||
var oTable = $('.tabledt').dataTable();
|
||||
var rowcollection = oTable.$(".thanatoToExport:checked", {"page": "all"});
|
||||
let thanatoIdsToExport = [];
|
||||
rowcollection.each(function(index,elem){
|
||||
var checkbox_value = $(elem).val();
|
||||
thanatoIdsToExport.push(checkbox_value);
|
||||
});
|
||||
|
||||
if(thanatoIdsToExport.length == 0){
|
||||
showError(t('gestion', "Veuillez choisir au moins une ligne de thanato"));
|
||||
return;
|
||||
}
|
||||
$('#exportThanatoModal').show();
|
||||
});
|
||||
|
||||
$('body').on('click', '#closeExportThanatoModal', function () {
|
||||
$('#exportThanatoModal').hide();
|
||||
});
|
||||
|
||||
$('body').on('click', '#exportThanatosStat', function () {
|
||||
var oTable = $('.tabledt').dataTable();
|
||||
var rowcollection = oTable.$(".thanatoToExport:checked", {"page": "all"});
|
||||
let thanatoIdsToExport = [];
|
||||
rowcollection.each(function(index,elem){
|
||||
var checkbox_value = $(elem).val();
|
||||
thanatoIdsToExport.push(checkbox_value);
|
||||
});
|
||||
|
||||
if(thanatoIdsToExport.length == 0){
|
||||
$('#exportThanatoModal').hide();
|
||||
showError(t('gestion', "Veuillez choisir au moins une ligne de thanato"));
|
||||
return;
|
||||
}
|
||||
|
||||
var today = new Date();
|
||||
var monthValue = document.getElementById("monthSelect").value ?? today.getMonth() + 1;
|
||||
var yearValue = document.getElementById("yearSelect").value ?? today.getFullYear();
|
||||
let exportThanatoPayload = {
|
||||
thanatoIdsToExport: thanatoIdsToExport,
|
||||
month: monthValue,
|
||||
year: yearValue
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + '/thanatopracteur/exportThanatoStatistic',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(exportThanatoPayload)
|
||||
}).done(function (response) {
|
||||
$('#exportThanatoModal').hide();
|
||||
let datatable = new DataTable('.tabledt');
|
||||
Thanatopracteur.loadThanatoDT(datatable);
|
||||
response.forEach(fileName => {
|
||||
showSuccess('Sauvegardé dans' + fileName);
|
||||
});
|
||||
}).fail(function (response, code) {
|
||||
showError(t('gestion', "Erreur dans l'export de statistique thanato"));
|
||||
});
|
||||
});
|
||||
@ -6,6 +6,7 @@ import "./listener/main_listener";
|
||||
import DataTable from "datatables.net";
|
||||
import { globalConfiguration, optionDatatable } from "./modules/mainFunction.mjs";
|
||||
import { Thanatopracteur } from "./objects/thanatopracteur.mjs";
|
||||
import "./listener/thanatoListener";
|
||||
|
||||
window.addEventListener("DOMContentLoaded", function () {
|
||||
globalConfiguration();
|
||||
|
||||
@ -14,7 +14,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end">
|
||||
<button class="btn btn-secondary" id="exportThanatoData">Export thanato stat</button>
|
||||
<button id="showExportThanatoModal" class="btn btn-secondary" data-toggle="modal" data-target="#exportThanatoModal">
|
||||
Export stat
|
||||
</button>
|
||||
</div>
|
||||
<hr>
|
||||
<table id="client" class="display tabledt" style="font-size:11px;">
|
||||
@ -31,4 +33,44 @@
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="modal" id="exportThanatoModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Choisir le mois et l'année pour l'export</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<select class="form-select w-auto" name="month" id="monthSelect">
|
||||
<option value="1">Janvier</option>
|
||||
<option value="2">Février</option>
|
||||
<option value="3">Mars</option>
|
||||
<option value="4">Avril</option>
|
||||
<option value="5">Mai</option>
|
||||
<option value="6">Juin</option>
|
||||
<option value="7">Juillet</option>
|
||||
<option value="8">Août</option>
|
||||
<option value="9">Septembre</option>
|
||||
<option value="10">Octobre</option>
|
||||
<option value="11">Novembre</option>
|
||||
<option value="12">Décembre</option>
|
||||
</select>
|
||||
<select class="form-select w-auto" name="year" id="yearSelect">
|
||||
<?php
|
||||
$currentYear = date('Y');
|
||||
for ($year = $currentYear; $year >= $currentYear - 10; $year--) {
|
||||
echo '<option value="' . $year . '"';
|
||||
echo '>' . $year . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="closeExportThanatoModal" type="button" class="btn btn-secondary">Annuler</button>
|
||||
<button id="exportThanatosStat" type="button" class="btn btn-primary">Exporter</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
x
Reference in New Issue
Block a user