From 0868d6127109b62ba5ab05454885ee98f18d3dc7 Mon Sep 17 00:00:00 2001 From: iBNu Maksum Date: Thu, 13 Mar 2025 14:57:23 +0700 Subject: [PATCH] Download PDF invoice Customers --- system/autoload/File.php | 2 +- system/controllers/voucher.php | 11 +++++++ system/lan/english.json | 4 ++- ui/ui/admin/footer.tpl | 10 ++++++ ui/ui/customer/invoice-customer.tpl | 50 ++++++++++++++++++++++++++--- 5 files changed, 71 insertions(+), 6 deletions(-) diff --git a/system/autoload/File.php b/system/autoload/File.php index 417447ce..6f47a7c3 100644 --- a/system/autoload/File.php +++ b/system/autoload/File.php @@ -87,7 +87,7 @@ class File $src_img = $image_create($source_file); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nwidth, $nheight, $width, $height); - $image($dst_img, $dst_dir, $quality); + imagepng($dst_img, $dst_dir); if ($dst_img) imagedestroy($dst_img); if ($src_img) imagedestroy($src_img); diff --git a/system/controllers/voucher.php b/system/controllers/voucher.php index c788705d..6e935056 100644 --- a/system/controllers/voucher.php +++ b/system/controllers/voucher.php @@ -64,6 +64,17 @@ switch ($action) { } if ($in) { Package::createInvoice($in); + $UPLOAD_URL_PATH = str_replace($root_path, '', $UPLOAD_PATH); + $logo = ''; + if (file_exists($UPLOAD_PATH . DIRECTORY_SEPARATOR . 'logo.png')) { + $logo = $UPLOAD_URL_PATH . DIRECTORY_SEPARATOR . 'logo.png'; + $imgsize = getimagesize($logo); + $width = $imgsize[0]; + $height = $imgsize[1]; + $ui->assign('wlogo', $width); + $ui->assign('hlogo', $height); + } + $ui->assign('logo', $logo); $ui->display('customer/invoice-customer.tpl'); } else { r2(getUrl('voucher/list-activated'), 'e', Lang::T('Not Found')); diff --git a/system/lan/english.json b/system/lan/english.json index dd2b4eb3..0161425e 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -1145,5 +1145,7 @@ "If_you_Download_manual_the_update_file__sometime_update_change_database__after_uploading__click_this_button_to_update_database_structure_": "If you Download manual the update file, sometime update change database, after uploading, click this button to update database structure.", "Update_Database": "Update Database", "Credits": "Credits", - "Continue_the_process_of_sending_messages": "Continue the process of sending messages" + "Continue_the_process_of_sending_messages": "Continue the process of sending messages", + "Yours_Balances": "Yours Balances", + "Friend_username": "Friend username" } \ No newline at end of file diff --git a/ui/ui/admin/footer.tpl b/ui/ui/admin/footer.tpl index 9f0a21f4..48295aab 100644 --- a/ui/ui/admin/footer.tpl +++ b/ui/ui/admin/footer.tpl @@ -85,22 +85,32 @@ listAtts.forEach(function(el) { if (el.addEventListener) { // all browsers except IE before version 9 el.addEventListener("click", function() { + var txt = $(this).html(); $(this).html( `` ); setTimeout(() => { $(this).prop("disabled", true); }, 100); + setTimeout(() => { + $(this).html(txt); + $(this).prop("disabled", false); + }, 5000); }, false); } else { if (el.attachEvent) { // IE before version 9 el.attachEvent("click", function() { + var txt = $(this).html(); $(this).html( `` ); setTimeout(() => { $(this).prop("disabled", true); }, 100); + setTimeout(() => { + $(this).html(txt); + $(this).prop("disabled", false); + }, 5000); }); } } diff --git a/ui/ui/customer/invoice-customer.tpl b/ui/ui/customer/invoice-customer.tpl index c438ccff..01cdafc1 100644 --- a/ui/ui/customer/invoice-customer.tpl +++ b/ui/ui/customer/invoice-customer.tpl @@ -1,21 +1,63 @@ {include file="customer/header.tpl"} - +
{$in['invoice']}
+ {if !empty($logo)} +
+ {/if}
-
{$invoice}
+
{$invoice}
{Lang::T('Finish')} - + + Download + WhatsApp
+ {include file="customer/footer.tpl"} \ No newline at end of file