Build mPDF debug input on demand

This commit is contained in:
DevSoftTech Server 2026-08-18 16:36:53 +05:30
parent 53b79b5297
commit 28109df663
2 changed files with 10 additions and 2 deletions

View File

@ -5562,8 +5562,16 @@ class Ipd_discharge extends BaseController
}
$file = WRITEPATH . 'debug' . DIRECTORY_SEPARATOR . 'discharge_mpdf_input_' . $ipdId . '_' . $templateId . '.html';
if (! is_file($file) && (int) ($this->request->getGet('build') ?? 0) === 1) {
$previousGet = $_GET;
$_GET['tpl'] = $templateId;
$_GET['refresh'] = 1;
unset($_GET['build']);
$this->show_discharge($ipdId, 1);
$_GET = $previousGet;
}
if (! is_file($file)) {
return $this->response->setStatusCode(404)->setBody('Generate the PDF first, then reopen this debug view.');
return $this->response->setStatusCode(404)->setBody('Generate the PDF first, then reopen this debug view with ?build=1.');
}
return view('ipd_discharge/mpdf_raw_html', [

View File

@ -271,7 +271,7 @@ $placeholders = [
document.getElementById('btn_mpdf_input').addEventListener('click', function () {
var ipdId = parseInt(val('preview_ipd_id'), 10);
if (!ipdId || !editId) { alert('Save the template and enter IPD ID first.'); return; }
window.open('<?= base_url('Ipd_discharge/debug_mpdf_input') ?>/' + ipdId + '/' + editId, '_blank');
window.open('<?= base_url('Ipd_discharge/debug_mpdf_input') ?>/' + ipdId + '/' + editId + '?build=1', '_blank');
});
/* Placeholder click-to-copy */