Added InvoiceJob
This commit is contained in:
@@ -72,13 +72,11 @@ $pagination_entity_name = "Rechnungen";
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col-6">
|
||||
<button type="submit" class="btn btn-primary">Filter anwenden</button>
|
||||
<a class="btn btn-secondary" href="<?=self::getUrl("Invoice")?>?resetFilter=1">Filter zurücksetzen</a>
|
||||
</div>
|
||||
<div class="col-6 justify-content-end text-right">
|
||||
<button type="submit" name="export_type" value="bmd-credit" class="btn btn-outline-danger"><i class="far fa-fw fa-file-export"></i> Provisionsexport für BMD</button>
|
||||
<button type="submit" name="export_type" value="bmd-invoice" class="btn btn-outline-primary ml-2"><i class="far fa-fw fa-file-export"></i> Rechnungsexport für BMD</button>
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-fw fa-search"></i> Filter anwenden</button>
|
||||
<a class="btn btn-secondary" href="<?=self::getUrl("Invoice")?>?resetFilter=1"><i class="fas fa-fw fa-xmark-large"></i> Filter zurücksetzen</a>
|
||||
<button type="submit" name="export_type" value="bmd-credit" class="btn btn-outline-danger ml-4"><i class="far fa-fw fa-file-export"></i> Provisionsexport für BMD</button>
|
||||
<button type="submit" name="export_type" value="bmd-invoice" class="btn btn-outline-primary ml-1"><i class="far fa-fw fa-file-export"></i> Rechnungsexport für BMD</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -126,13 +124,106 @@ $pagination_entity_name = "Rechnungen";
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4 class="header-title">Rechnungen</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-end">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h4>PDFs erstellen</h4>
|
||||
<form method="post" action="<?=self::getUrl("Invoice", "createJob")?>">
|
||||
<input type="hidden" name="task" value="make-invoice-pdf" />
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label class="form-label" for="from_date">Job Startdatum:</label>
|
||||
<input type="text" class="form-control datepicker" name="from_date" value="" />
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label class="form-label" for="to_date">Job Enddatum:</label>
|
||||
<input type="text" class="form-control datepicker" name="to_date" value="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary mt-1"><i class="fas fa-fw fa-circle-plus"></i> Job erstellen</button>
|
||||
|
||||
<?php if(is_array($pdf_jobs) && count($pdf_jobs)): ?>
|
||||
<h5>Aktuelle PDF Jobs</h5>
|
||||
<table class="table table-sm table-striped">
|
||||
<tr>
|
||||
<th>Von</th>
|
||||
<th>Bis</th>
|
||||
<th>Gestartet</th>
|
||||
<th>Beendet</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
<?php foreach($pdf_jobs as $job): ?>
|
||||
<tr id="job-<?=$job->id?>">
|
||||
<td><?=$job->from_date?></td>
|
||||
<td><?=$job->to_date?></td>
|
||||
<td><?=$job->started?></td>
|
||||
<td class="finished"><?=$job->finished?></td>
|
||||
<td>
|
||||
<strong class="status text-monospace <?=(($job->status == "finished") ? "text-success" : ($job->status == "timeout" ? "text-danger" : "text-info"))?>"><?=($job->status) ? $job->status : "neu"?></strong><br />
|
||||
<span class="status-text"><?=$job->getResult("created") ? $job->getResult("created")." Rechungs-PDFs erstellt" : ""?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-6 border-left">
|
||||
<h4>Rechungsemails versenden</h4>
|
||||
<form method="post" action="<?=self::getUrl("Invoice", "createJob")?>">
|
||||
<input type="hidden" name="task" value="send-invoice-email" />
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label class="form-label" for="from_date">Job Startdatum:</label>
|
||||
<input type="text" class="form-control datepicker" name="from_date" value="" />
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label class="form-label" for="to_date">Job Enddatum:</label>
|
||||
<input type="text" class="form-control datepicker" name="to_date" value="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary mt-1"><i class="fas fa-fw fa-circle-plus"></i> Job erstellen</button>
|
||||
|
||||
<?php if(is_array($email_jobs) && count($email_jobs)): ?>
|
||||
<h5>Aktuelle Email Jobs</h5>
|
||||
<table class="table table-sm table-striped">
|
||||
<tr>
|
||||
<th>Von</th>
|
||||
<th>Bis</th>
|
||||
<th>Gestartet</th>
|
||||
<th>Beendet</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
<?php foreach($email_jobs as $job): ?>
|
||||
<tr id="job-<?=$job->id?>">
|
||||
<td><?=$job->from_date?></td>
|
||||
<td><?=$job->to_date?></td>
|
||||
<td><?=$job->started?></td>
|
||||
<td class="finished"><?=$job->finished?></td>
|
||||
<td>
|
||||
<strong class="status text-monospace <?=(($job->status == "finished") ? "text-success" : ($job->status == "timeout" ? "text-danger" : "text-info"))?>"><?=($job->status) ? $job->status : "neu"?></strong><br />
|
||||
<span class="status-text"><?=$job->getResult("sent") ? $job->getResult("sent")." Emails versendet" : ""?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div>
|
||||
<table class="table table-sm table-striped table-bordered">
|
||||
@@ -189,6 +280,12 @@ $pagination_entity_name = "Rechnungen";
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h4 class="header-title">Rechnungen</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
|
||||
@@ -291,6 +388,65 @@ $pagination_entity_name = "Rechnungen";
|
||||
todayBtn: 'linked',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').datepicker({
|
||||
orientation: "bottom",
|
||||
language: 'de',
|
||||
format: "dd.mm.yyyy",
|
||||
showWeekDays: true,
|
||||
todayBtn: 'linked',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
var status_update;
|
||||
|
||||
function updateStatus() {
|
||||
$.post(
|
||||
"<?=self::getUrl("InvoiceJob", "api")?>",
|
||||
{
|
||||
do: "getActiveJobs"
|
||||
},
|
||||
function(success) {
|
||||
if(success.status != "OK") return;
|
||||
|
||||
jobs = success.result.jobs;
|
||||
jobs.forEach((job) => {
|
||||
let status = JSON.parse(job.result);
|
||||
if(!status) return;
|
||||
|
||||
if(job.task == "make-invoice-pdf") {
|
||||
$("#job-" + job.id + " .status-text").text(status.created + " Rechungs-PDFs erstellt");
|
||||
} else if(job.task == "send-invoice-email") {
|
||||
$("#job-" + job.id + " .status-text").text(status.sent + " Emails versendet");
|
||||
}
|
||||
|
||||
$("#job-" + job.id + " .status").text(job.status ? job.status : "neu");
|
||||
if(job.status == "timeout") {
|
||||
$("#job-" + job.id + " .status").removeClass("text-info text-success").addClass("text-danger");
|
||||
} else if(job.status == "finished") {
|
||||
$("#job-" + job.id + " .status").removeClass("text-info text-danger").addClass("text-success");
|
||||
} else {
|
||||
$("#job-" + job.id + " .status").removeClass("text-danger text-success").addClass("text-info");
|
||||
}
|
||||
|
||||
if(job.finished) {
|
||||
$("#job-" + job.id + " .finished").text(job.finished);
|
||||
} else {
|
||||
$("#job-" + job.id + " .finished").text("");
|
||||
}
|
||||
});
|
||||
|
||||
status_update = setTimeout(updateStatus, 1000);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
<?php if(is_array($pdf_jobs) && is_array($email_jobs)): ?>
|
||||
status_update = setTimeout(updateStatus, 1000);
|
||||
<?php endif; ?>
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
Reference in New Issue
Block a user