[PROMOTE] 晉升捐贈發票列印修正至 demo
1. 捐贈發票排除列印按鈕並補上不可列印提示,後端加守衛防偽造 POST。
This commit is contained in:
commit
372f2fc55d
@ -1155,6 +1155,10 @@ class SalesController extends Controller
|
|||||||
if ($invoice->status !== Invoice::STATUS_ISSUED || empty($invoice->invoice_no)) {
|
if ($invoice->status !== Invoice::STATUS_ISSUED || empty($invoice->invoice_no)) {
|
||||||
return back()->with('error', __('Only issued invoices can be printed'));
|
return back()->with('error', __('Only issued invoices can be printed'));
|
||||||
}
|
}
|
||||||
|
// 捐贈發票依法無紙本、不可列印(綠界 InvoicePrint 會回查無資料)
|
||||||
|
if (!empty($invoice->love_code)) {
|
||||||
|
return back()->with('error', __('Donation invoices cannot be printed'));
|
||||||
|
}
|
||||||
$machine = $invoice->machine;
|
$machine = $invoice->machine;
|
||||||
if (!$machine || !$ecpay->configForMachine($machine)) {
|
if (!$machine || !$ecpay->configForMachine($machine)) {
|
||||||
return back()->with('error', __('This machine has no ECPay invoice settings'));
|
return back()->with('error', __('This machine has no ECPay invoice settings'));
|
||||||
|
|||||||
@ -587,6 +587,7 @@
|
|||||||
"Displayed below Logo on the left (defaults to customer name).": "Displayed below Logo on the left (defaults to customer name).",
|
"Displayed below Logo on the left (defaults to customer name).": "Displayed below Logo on the left (defaults to customer name).",
|
||||||
"Displayed below main title on the left.": "Displayed below main title on the left.",
|
"Displayed below main title on the left.": "Displayed below main title on the left.",
|
||||||
"Displaying": "Displaying",
|
"Displaying": "Displaying",
|
||||||
|
"Donation invoices cannot be printed": "Donation invoices cannot be printed",
|
||||||
"Done": "Done",
|
"Done": "Done",
|
||||||
"Door Closed": "Door Closed",
|
"Door Closed": "Door Closed",
|
||||||
"Door Opened": "Door Opened",
|
"Door Opened": "Door Opened",
|
||||||
|
|||||||
@ -587,6 +587,7 @@
|
|||||||
"Displayed below Logo on the left (defaults to customer name).": "左側のロゴの下に表示されるメインタイトル(未設定の場合はデフォルトで顧客名になります)。",
|
"Displayed below Logo on the left (defaults to customer name).": "左側のロゴの下に表示されるメインタイトル(未設定の場合はデフォルトで顧客名になります)。",
|
||||||
"Displayed below main title on the left.": "左側のメインタイトルの下に表示されるサブタイトル。",
|
"Displayed below main title on the left.": "左側のメインタイトルの下に表示されるサブタイトル。",
|
||||||
"Displaying": "表示中",
|
"Displaying": "表示中",
|
||||||
|
"Donation invoices cannot be printed": "寄付の領収書は印刷できません",
|
||||||
"Done": "完了",
|
"Done": "完了",
|
||||||
"Door Closed": "扉が閉まりました",
|
"Door Closed": "扉が閉まりました",
|
||||||
"Door Opened": "扉が開きました",
|
"Door Opened": "扉が開きました",
|
||||||
|
|||||||
@ -587,6 +587,7 @@
|
|||||||
"Displayed below Logo on the left (defaults to customer name).": "顯示於左側 Logo 下方的主標題(未設定則預設帶入客戶名稱)。",
|
"Displayed below Logo on the left (defaults to customer name).": "顯示於左側 Logo 下方的主標題(未設定則預設帶入客戶名稱)。",
|
||||||
"Displayed below main title on the left.": "顯示於左側主標題下方的副標題/英文名稱。",
|
"Displayed below main title on the left.": "顯示於左側主標題下方的副標題/英文名稱。",
|
||||||
"Displaying": "目前顯示",
|
"Displaying": "目前顯示",
|
||||||
|
"Donation invoices cannot be printed": "捐贈發票無法列印",
|
||||||
"Done": "已完成",
|
"Done": "已完成",
|
||||||
"Door Closed": "機門已關閉",
|
"Door Closed": "機門已關閉",
|
||||||
"Door Opened": "機門已開啟",
|
"Door Opened": "機門已開啟",
|
||||||
|
|||||||
@ -292,6 +292,8 @@
|
|||||||
'void' => ['label' => __('Void'), 'color' => 'slate'],
|
'void' => ['label' => __('Void'), 'color' => 'slate'],
|
||||||
];
|
];
|
||||||
$invBadge = $invStatusMap[$invStatus] ?? ['label' => $invStatus, 'color' => 'slate'];
|
$invBadge = $invStatusMap[$invStatus] ?? ['label' => $invStatus, 'color' => 'slate'];
|
||||||
|
// 捐贈發票依法無紙本、不可列印(綠界 InvoicePrint 會回查無資料)
|
||||||
|
$invPrintable = empty($order->invoice->love_code);
|
||||||
@endphp
|
@endphp
|
||||||
<div class="relative flex flex-col sm:flex-row sm:items-center justify-between gap-6">
|
<div class="relative flex flex-col sm:flex-row sm:items-center justify-between gap-6">
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
@ -309,12 +311,16 @@
|
|||||||
|
|
||||||
@if($invStatus === 'issued')
|
@if($invStatus === 'issued')
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
|
@if($invPrintable)
|
||||||
<form method="POST" action="{{ route('admin.sales.invoices.print', $order->invoice) }}" target="_blank">
|
<form method="POST" action="{{ route('admin.sales.invoices.print', $order->invoice) }}" target="_blank">
|
||||||
@csrf
|
@csrf
|
||||||
<button type="submit" class="flex-1 sm:flex-none px-6 py-3 rounded-xl bg-white dark:bg-slate-800 text-slate-600 dark:text-slate-300 font-bold text-xs border border-slate-200 dark:border-slate-700 hover:bg-indigo-500 hover:text-white hover:border-indigo-500 transition-all duration-300 shadow-sm">
|
<button type="submit" class="flex-1 sm:flex-none px-6 py-3 rounded-xl bg-white dark:bg-slate-800 text-slate-600 dark:text-slate-300 font-bold text-xs border border-slate-200 dark:border-slate-700 hover:bg-indigo-500 hover:text-white hover:border-indigo-500 transition-all duration-300 shadow-sm">
|
||||||
{{ __('Print Invoice') }}
|
{{ __('Print Invoice') }}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
@else
|
||||||
|
<span class="text-[11px] font-bold text-slate-400 dark:text-slate-500 px-2">{{ __('Donation invoices cannot be printed') }}</span>
|
||||||
|
@endif
|
||||||
<form method="POST" action="{{ route('admin.sales.invoices.void', $order->invoice) }}"
|
<form method="POST" action="{{ route('admin.sales.invoices.void', $order->invoice) }}"
|
||||||
onsubmit="return confirm('{{ __('Void this invoice?') }}')">
|
onsubmit="return confirm('{{ __('Void this invoice?') }}')">
|
||||||
@csrf
|
@csrf
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user