modal to send facture pdf via mail , wip send mail

This commit is contained in:
Tiavina 2025-03-07 13:35:20 +03:00
parent 5874760348
commit 6e194570f8
4 changed files with 42 additions and 16 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,19 +4,9 @@ import "../css/mycss.css";
import { globalConfiguration } from "./modules/mainFunction.mjs";
import "./listener/main_listener";
import "./listener/invoiceListener";
import "./listener/factureSendMailListener";
import { generateUrl } from "@nextcloud/router";
window.addEventListener("DOMContentLoaded", function () {
globalConfiguration();
});
$('body').on('click', '#showPdfPathPreview', function () {
let pdfPath = $(this).data('path');
if(pdfPath != ""){
let url = generateUrl(pdfPath);
window.open(url, "_blank");
}
});

View File

@ -0,0 +1,21 @@
import {showError, showSuccess } from "@nextcloud/dialogs";
import {baseUrl, hideLoader, showLoader} from "../modules/mainFunction.mjs";
import { Facture } from "../objects/facture.mjs";
import DataTable from "datatables.net";
import { generateUrl } from "@nextcloud/router";
$('body').on('click', '#showSendFacturePdfMailModal', function () {
$('#sendFacturePdfMail').show();
});
$('body').on('click', '#closeSendFacturePdfMail', function () {
$('#sendFacturePdfMail').hide();
});
$('body').on('click', '#showPdfPreview', function () {
let pdfPath = $(this).data('path');
if(pdfPath != ""){
let url = generateUrl(pdfPath);
window.open(url, "_blank");
}
});

View File

@ -10,11 +10,9 @@ $currentConfig = json_decode($_['configuration'])[0];
$facturePdfPath = 'remote.php/dav/files/'.$facture->path_to_file;
?>
<div class="bootstrap-iso">
<canvas id="pdfCanvas"></canvas>
<div id="factureId" data-id="<?php echo $facture->id; ?>"></div>
<div id="factureIdentifier" data-id="<?php echo $facture->id; ?>"></div>
<div id="facturePdfPath" data-path="<?php echo $facturePdfPath; ?>"></div>
<button id="showPdfPathPreview" class="btn btn-secondary" data-path="<?php echo $facturePdfPath; ?>">Show path</button>
<h2 class="mt-3 mb-3 text-center"> <?php echo ('Facture n° '.$facture->num); ?>
</h2>
<hr />
@ -112,7 +110,10 @@ $facturePdfPath = 'remote.php/dav/files/'.$facture->path_to_file;
</div>
<div>
<button id="exportFactureToPdf" type="button" class="mb-2 btn btn-outline-success" data-html2canvas-ignore data-name=""><?php p($l->t('Save in Nextcloud'));?></button>
<button id="mailGestion" type="button" class="mb-2 btn btn-outline-success sendmail" data-html2canvas-ignore data-name=""><?php p($l->t('Send by email'));?></button>
<button id="showSendFacturePdfMailModal"
type="button"
class="mb-2 btn btn-outline-success sendmail"
><?php p($l->t('Send by email'));?></button>
</div>
<div class="mt-0 table-responsive">
<table id="totalFactureGroupPrice" class="table table-striped table-xl">
@ -142,4 +143,18 @@ $facturePdfPath = 'remote.php/dav/files/'.$facture->path_to_file;
<p><?php echo $currentConfig->entreprise; ?><br /><?php echo $currentConfig->adresse; ?><br /><?php echo $currentConfig->legal_one; ?><br /><?php echo $currentConfig->legal_two; ?>
</p>
</div>
<div class="modal" id="sendFacturePdfMail" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Envoyer la facture par email à <?= $facture->mail; ?></h5>
</div>
<div class="modal-footer">
<button id="showPdfPreview" type="button" class="btn btn-secondary" data-path="<?php echo $facturePdfPath; ?>">Voir l'aperçu</button>
<button id="closeSendFacturePdfMail" type="button" class="btn btn-secondary">Annuler</button>
<button id="sendFacturePdf" type="button" class="btn btn-primary">Envoyer</button>
</div>
</div>
</div>
</div>
</div>