Implement dark mode, bug report page, and schema dump
This commit is contained in:
@@ -79,19 +79,30 @@ class PaymentOrderController extends Controller
|
||||
/**
|
||||
* Store a newly created payment order (accountant creates)
|
||||
*/
|
||||
public function store(Request $request, FinanceDocument $financeDocument)
|
||||
public function store(Request $request)
|
||||
{
|
||||
// Check authorization
|
||||
$this->authorize('create_payment_order');
|
||||
|
||||
$financeDocument = FinanceDocument::findOrFail($request->input('finance_document_id'));
|
||||
|
||||
// Check if document is ready
|
||||
if (!$financeDocument->canCreatePaymentOrder()) {
|
||||
if (app()->environment('testing')) {
|
||||
\Log::info('payment_order.store.blocked', [
|
||||
'finance_document_id' => $financeDocument->id,
|
||||
'status' => $financeDocument->status,
|
||||
'amount_tier' => $financeDocument->amount_tier,
|
||||
'payment_order_created_at' => $financeDocument->payment_order_created_at,
|
||||
]);
|
||||
}
|
||||
return redirect()
|
||||
->route('admin.finance.show', $financeDocument)
|
||||
->with('error', '此財務申請單尚未完成審核流程,無法製作付款單。');
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'finance_document_id' => ['required', 'exists:finance_documents,id'],
|
||||
'payee_name' => ['required', 'string', 'max:100'],
|
||||
'payee_bank_code' => ['nullable', 'string', 'max:10'],
|
||||
'payee_account_number' => ['nullable', 'string', 'max:30'],
|
||||
@@ -142,6 +153,12 @@ class PaymentOrderController extends Controller
|
||||
->with('status', "付款單 {$paymentOrderNumber} 已建立,等待出納覆核。");
|
||||
|
||||
} catch (\Exception $e) {
|
||||
if (app()->environment('testing')) {
|
||||
\Log::error('payment_order.store.failed', [
|
||||
'finance_document_id' => $financeDocument->id ?? null,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
DB::rollBack();
|
||||
return redirect()
|
||||
->back()
|
||||
|
||||
Reference in New Issue
Block a user