Initial commit
This commit is contained in:
175
resources/views/admin/budgets/create.blade.php
Normal file
175
resources/views/admin/budgets/create.blade.php
Normal file
@@ -0,0 +1,175 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
|
||||
{{ __('Create Budget') }} (úË—)
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
||||
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800">
|
||||
<div class="px-4 py-5 sm:p-6">
|
||||
<form method="POST" action="{{ route('admin.budgets.store') }}" class="space-y-6" aria-label="{{ __('Create budget form') }}">
|
||||
@csrf
|
||||
|
||||
<!-- Fiscal Year -->
|
||||
<div>
|
||||
<label for="fiscal_year" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{{ __('Fiscal Year') }} <span class="text-red-500" aria-label="{{ __('required') }}">*</span>
|
||||
</label>
|
||||
<input type="number"
|
||||
name="fiscal_year"
|
||||
id="fiscal_year"
|
||||
value="{{ old('fiscal_year', now()->year) }}"
|
||||
min="2000"
|
||||
max="2100"
|
||||
required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100 dark:focus:ring-offset-gray-800 @error('fiscal_year') border-red-300 dark:border-red-500 @enderror"
|
||||
aria-describedby="fiscal_year_help @error('fiscal_year') fiscal_year_error @enderror">
|
||||
<p id="fiscal_year_help" class="mt-1 text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ __('The fiscal year this budget applies to') }}
|
||||
</p>
|
||||
@error('fiscal_year')
|
||||
<p id="fiscal_year_error" class="mt-1 text-sm text-red-600 dark:text-red-400" role="alert">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<!-- Name -->
|
||||
<div>
|
||||
<label for="name" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{{ __('Budget Name') }} <span class="text-red-500" aria-label="{{ __('required') }}">*</span>
|
||||
</label>
|
||||
<input type="text"
|
||||
name="name"
|
||||
id="name"
|
||||
value="{{ old('name') }}"
|
||||
required
|
||||
maxlength="255"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100 dark:focus:ring-offset-gray-800 @error('name') border-red-300 dark:border-red-500 @enderror"
|
||||
placeholder="{{ __('e.g., Annual Budget 2025') }}"
|
||||
aria-describedby="name_help @error('name') name_error @enderror">
|
||||
<p id="name_help" class="mt-1 text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ __('Descriptive name for this budget') }}
|
||||
</p>
|
||||
@error('name')
|
||||
<p id="name_error" class="mt-1 text-sm text-red-600 dark:text-red-400" role="alert">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<!-- Period Type -->
|
||||
<div>
|
||||
<label for="period_type" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{{ __('Period Type') }} <span class="text-red-500" aria-label="{{ __('required') }}">*</span>
|
||||
</label>
|
||||
<select name="period_type"
|
||||
id="period_type"
|
||||
required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100 dark:focus:ring-offset-gray-800 @error('period_type') border-red-300 dark:border-red-500 @enderror"
|
||||
aria-describedby="period_type_help @error('period_type') period_type_error @enderror">
|
||||
<option value="annual" @selected(old('period_type', 'annual') === 'annual')>{{ __('Annual') }} (t¦)</option>
|
||||
<option value="quarterly" @selected(old('period_type') === 'quarterly')>{{ __('Quarterly') }} (c¦)</option>
|
||||
<option value="monthly" @selected(old('period_type') === 'monthly')>{{ __('Monthly') }} (¦)</option>
|
||||
</select>
|
||||
<p id="period_type_help" class="mt-1 text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ __('Budget period duration') }}
|
||||
</p>
|
||||
@error('period_type')
|
||||
<p id="period_type_error" class="mt-1 text-sm text-red-600 dark:text-red-400" role="alert">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<!-- Period Dates -->
|
||||
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
|
||||
<div>
|
||||
<label for="period_start" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{{ __('Period Start Date') }} <span class="text-red-500" aria-label="{{ __('required') }}">*</span>
|
||||
</label>
|
||||
<input type="date"
|
||||
name="period_start"
|
||||
id="period_start"
|
||||
value="{{ old('period_start') }}"
|
||||
required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100 dark:focus:ring-offset-gray-800 @error('period_start') border-red-300 dark:border-red-500 @enderror"
|
||||
aria-describedby="@error('period_start') period_start_error @enderror">
|
||||
@error('period_start')
|
||||
<p id="period_start_error" class="mt-1 text-sm text-red-600 dark:text-red-400" role="alert">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="period_end" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{{ __('Period End Date') }} <span class="text-red-500" aria-label="{{ __('required') }}">*</span>
|
||||
</label>
|
||||
<input type="date"
|
||||
name="period_end"
|
||||
id="period_end"
|
||||
value="{{ old('period_end') }}"
|
||||
required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100 dark:focus:ring-offset-gray-800 @error('period_end') border-red-300 dark:border-red-500 @enderror"
|
||||
aria-describedby="@error('period_end') period_end_error @enderror">
|
||||
@error('period_end')
|
||||
<p id="period_end_error" class="mt-1 text-sm text-red-600 dark:text-red-400" role="alert">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Notes -->
|
||||
<div>
|
||||
<label for="notes" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{{ __('Notes') }} (™;)
|
||||
</label>
|
||||
<textarea name="notes"
|
||||
id="notes"
|
||||
rows="3"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100 dark:focus:ring-offset-gray-800 @error('notes') border-red-300 dark:border-red-500 @enderror"
|
||||
placeholder="{{ __('Optional notes about this budget...') }}"
|
||||
aria-describedby="notes_help @error('notes') notes_error @enderror">{{ old('notes') }}</textarea>
|
||||
<p id="notes_help" class="mt-1 text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ __('Additional information about this budget (optional)') }}
|
||||
</p>
|
||||
@error('notes')
|
||||
<p id="notes_error" class="mt-1 text-sm text-red-600 dark:text-red-400" role="alert">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="flex items-center justify-end gap-x-4 border-t border-gray-200 pt-6 dark:border-gray-700">
|
||||
<a href="{{ route('admin.budgets.index') }}"
|
||||
class="rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:bg-gray-700 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-600 dark:focus:ring-offset-gray-800">
|
||||
{{ __('Cancel') }}
|
||||
</a>
|
||||
<button type="submit"
|
||||
class="inline-flex justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:bg-indigo-500 dark:hover:bg-indigo-400 dark:focus:ring-offset-gray-800">
|
||||
{{ __('Create Budget') }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Help Section -->
|
||||
<div class="mt-6 rounded-lg bg-blue-50 p-4 dark:bg-blue-900/30 border-l-4 border-blue-400 dark:border-blue-500">
|
||||
<div class="flex">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-5 w-5 text-blue-400" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3">
|
||||
<h3 class="text-sm font-medium text-blue-800 dark:text-blue-200">
|
||||
{{ __('Next Steps') }}
|
||||
</h3>
|
||||
<div class="mt-2 text-sm text-blue-700 dark:text-blue-300">
|
||||
<p>{{ __('After creating the budget, you will be able to:') }}</p>
|
||||
<ul class="list-disc pl-5 mt-2 space-y-1">
|
||||
<li>{{ __('Add budget items for income and expense accounts') }}</li>
|
||||
<li>{{ __('Submit the budget for chair approval') }}</li>
|
||||
<li>{{ __('Activate the budget to start tracking actual amounts') }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
154
resources/views/admin/budgets/edit.blade.php
Normal file
154
resources/views/admin/budgets/edit.blade.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
|
||||
{{ __('Edit Budget') }} - {{ $budget->fiscal_year }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12" x-data="budgetEditor()">
|
||||
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
||||
<form method="POST" action="{{ route('admin.budgets.update', $budget) }}" class="space-y-6">
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
|
||||
<!-- Basic Info -->
|
||||
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
|
||||
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-4">{{ __('Basic Information') }}</h3>
|
||||
|
||||
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
|
||||
<div>
|
||||
<label for="name" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Budget Name') }} *</label>
|
||||
<input type="text" name="name" id="name" value="{{ old('name', $budget->name) }}" required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
|
||||
@error('name')<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="period_start" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Period Start') }} *</label>
|
||||
<input type="date" name="period_start" id="period_start" value="{{ old('period_start', $budget->period_start->format('Y-m-d')) }}" required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="period_end" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Period End') }} *</label>
|
||||
<input type="date" name="period_end" id="period_end" value="{{ old('period_end', $budget->period_end->format('Y-m-d')) }}" required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
|
||||
</div>
|
||||
|
||||
<div class="sm:col-span-2">
|
||||
<label for="notes" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Notes') }}</label>
|
||||
<textarea name="notes" id="notes" rows="3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">{{ old('notes', $budget->notes) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Income Items -->
|
||||
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">{{ __('Income') }} (6e)</h3>
|
||||
<button type="button" @click="addItem('income')" class="btn-secondary text-sm">+ {{ __('Add Income Item') }}</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<template x-for="(item, index) in incomeItems" :key="index">
|
||||
<div class="flex gap-4 items-start bg-gray-50 dark:bg-gray-900 p-4 rounded-md">
|
||||
<div class="flex-1">
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Account') }}</label>
|
||||
<select :name="'budget_items[income_' + index + '][chart_of_account_id]'" x-model="item.account_id" required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
|
||||
<option value="">{{ __('Select account...') }}</option>
|
||||
@foreach($incomeAccounts as $account)
|
||||
<option value="{{ $account->id }}">{{ $account->account_code }} - {{ $account->account_name_zh }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="w-48">
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Amount') }}</label>
|
||||
<input type="number" :name="'budget_items[income_' + index + '][budgeted_amount]'" x-model="item.amount" step="0.01" min="0" required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
|
||||
</div>
|
||||
<div class="pt-6">
|
||||
<button type="button" @click="removeItem('income', index)" class="text-red-600 hover:text-red-800 dark:text-red-400">
|
||||
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div x-show="incomeItems.length === 0" class="text-center py-8 text-gray-500 dark:text-gray-400">
|
||||
{{ __('No income items. Click "Add Income Item" to get started.') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Expense Items -->
|
||||
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">{{ __('Expenses') }} (/ú)</h3>
|
||||
<button type="button" @click="addItem('expense')" class="btn-secondary text-sm">+ {{ __('Add Expense Item') }}</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<template x-for="(item, index) in expenseItems" :key="index">
|
||||
<div class="flex gap-4 items-start bg-gray-50 dark:bg-gray-900 p-4 rounded-md">
|
||||
<div class="flex-1">
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Account') }}</label>
|
||||
<select :name="'budget_items[expense_' + index + '][chart_of_account_id]'" x-model="item.account_id" required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
|
||||
<option value="">{{ __('Select account...') }}</option>
|
||||
@foreach($expenseAccounts as $account)
|
||||
<option value="{{ $account->id }}">{{ $account->account_code }} - {{ $account->account_name_zh }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="w-48">
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Amount') }}</label>
|
||||
<input type="number" :name="'budget_items[expense_' + index + '][budgeted_amount]'" x-model="item.amount" step="0.01" min="0" required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
|
||||
</div>
|
||||
<div class="pt-6">
|
||||
<button type="button" @click="removeItem('expense', index)" class="text-red-600 hover:text-red-800 dark:text-red-400">
|
||||
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div x-show="expenseItems.length === 0" class="text-center py-8 text-gray-500 dark:text-gray-400">
|
||||
{{ __('No expense items. Click "Add Expense Item" to get started.') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="flex items-center justify-end gap-x-4">
|
||||
<a href="{{ route('admin.budgets.show', $budget) }}" class="btn-secondary">{{ __('Cancel') }}</a>
|
||||
<button type="submit" class="btn-primary">{{ __('Save Budget') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function budgetEditor() {
|
||||
return {
|
||||
incomeItems: @json($budget->budgetItems->filter(fn($item) => $item->chartOfAccount->isIncome())->map(fn($item) => ['account_id' => $item->chart_of_account_id, 'amount' => $item->budgeted_amount])->values()),
|
||||
expenseItems: @json($budget->budgetItems->filter(fn($item) => $item->chartOfAccount->isExpense())->map(fn($item) => ['account_id' => $item->chart_of_account_id, 'amount' => $item->budgeted_amount])->values()),
|
||||
|
||||
addItem(type) {
|
||||
if (type === 'income') {
|
||||
this.incomeItems.push({ account_id: '', amount: 0 });
|
||||
} else {
|
||||
this.expenseItems.push({ account_id: '', amount: 0 });
|
||||
}
|
||||
},
|
||||
|
||||
removeItem(type, index) {
|
||||
if (type === 'income') {
|
||||
this.incomeItems.splice(index, 1);
|
||||
} else {
|
||||
this.expenseItems.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</x-app-layout>
|
||||
210
resources/views/admin/budgets/index.blade.php
Normal file
210
resources/views/admin/budgets/index.blade.php
Normal file
@@ -0,0 +1,210 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
|
||||
{{ __('Budgets') }} (—¡)
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
||||
<!-- Success Message -->
|
||||
@if (session('status'))
|
||||
<div class="mb-4 rounded-md bg-green-50 p-4 dark:bg-green-900/30 border-l-4 border-green-400 dark:border-green-500" role="status" aria-live="polite">
|
||||
<div class="flex">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-5 w-5 text-green-400" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3">
|
||||
<p class="text-sm font-medium text-green-800 dark:text-green-200">
|
||||
{{ session('status') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800">
|
||||
<div class="px-4 py-5 sm:p-6">
|
||||
<!-- Header with Create Button -->
|
||||
<div class="sm:flex sm:items-center sm:justify-between mb-6">
|
||||
<div>
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-100">
|
||||
{{ __('Budget List') }}
|
||||
</h3>
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ __('Manage annual budgets and track financial performance') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="mt-4 sm:mt-0">
|
||||
<a href="{{ route('admin.budgets.create') }}"
|
||||
class="inline-flex items-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:bg-indigo-500 dark:hover:bg-indigo-400 dark:focus:ring-offset-gray-800"
|
||||
aria-label="{{ __('Create new budget') }}">
|
||||
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
|
||||
<path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" />
|
||||
</svg>
|
||||
{{ __('Create Budget') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filters -->
|
||||
<form method="GET" action="{{ route('admin.budgets.index') }}" class="mb-6 space-y-4" role="search" aria-label="{{ __('Filter budgets') }}">
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
|
||||
<div>
|
||||
<label for="fiscal_year" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{{ __('Fiscal Year') }} (t¦)
|
||||
</label>
|
||||
<select id="fiscal_year" name="fiscal_year"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
|
||||
<option value="">{{ __('All Years') }}</option>
|
||||
@foreach($fiscalYears as $year)
|
||||
<option value="{{ $year }}" @selected(request('fiscal_year') == $year)>
|
||||
{{ $year }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="status" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{{ __('Status') }} (ÀK)
|
||||
</label>
|
||||
<select id="status" name="status"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
|
||||
<option value="">{{ __('All Statuses') }}</option>
|
||||
<option value="draft" @selected(request('status') === 'draft')>{{ __('Draft') }}</option>
|
||||
<option value="submitted" @selected(request('status') === 'submitted')>{{ __('Submitted') }}</option>
|
||||
<option value="approved" @selected(request('status') === 'approved')>{{ __('Approved') }}</option>
|
||||
<option value="active" @selected(request('status') === 'active')>{{ __('Active') }}</option>
|
||||
<option value="closed" @selected(request('status') === 'closed')>{{ __('Closed') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="flex items-end">
|
||||
<button type="submit"
|
||||
class="inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:bg-gray-700 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-600 dark:focus:ring-offset-gray-800">
|
||||
{{ __('Filter') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Budgets Table -->
|
||||
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg dark:ring-gray-700">
|
||||
<table class="min-w-full divide-y divide-gray-300 dark:divide-gray-600">
|
||||
<caption class="sr-only">
|
||||
{{ __('List of budgets showing fiscal year, name, period, and status') }}
|
||||
</caption>
|
||||
<thead class="bg-gray-50 dark:bg-gray-900">
|
||||
<tr>
|
||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 dark:text-gray-100 sm:pl-6">
|
||||
{{ __('Fiscal Year') }}
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">
|
||||
{{ __('Name') }}
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">
|
||||
{{ __('Period') }}
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">
|
||||
{{ __('Status') }}
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">
|
||||
{{ __('Created By') }}
|
||||
</th>
|
||||
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6">
|
||||
<span class="sr-only">{{ __('Actions') }}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-800">
|
||||
@forelse($budgets as $budget)
|
||||
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700">
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 dark:text-gray-100 sm:pl-6">
|
||||
{{ $budget->fiscal_year }}
|
||||
</td>
|
||||
<td class="px-3 py-4 text-sm text-gray-900 dark:text-gray-100">
|
||||
{{ $budget->name }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ $budget->period_start->format('Y-m-d') }} ~ {{ $budget->period_end->format('Y-m-d') }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm">
|
||||
@if($budget->status === 'draft')
|
||||
<span class="inline-flex items-center rounded-full bg-gray-100 px-2.5 py-0.5 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-200" role="status" aria-label="{{ __('Status: Draft') }}">
|
||||
{{ __('Draft') }}
|
||||
</span>
|
||||
@elseif($budget->status === 'submitted')
|
||||
<span class="inline-flex items-center rounded-full bg-yellow-100 px-2.5 py-0.5 text-xs font-medium text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200" role="status" aria-label="{{ __('Status: Submitted') }}">
|
||||
{{ __('Submitted') }}
|
||||
</span>
|
||||
@elseif($budget->status === 'approved')
|
||||
<span class="inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900 dark:text-blue-200" role="status" aria-label="{{ __('Status: Approved') }}">
|
||||
{{ __('Approved') }}
|
||||
</span>
|
||||
@elseif($budget->status === 'active')
|
||||
<span class="inline-flex items-center rounded-full bg-green-100 px-2.5 py-0.5 text-xs font-medium text-green-800 dark:bg-green-900 dark:text-green-200" role="status" aria-label="{{ __('Status: Active') }}">
|
||||
{{ __('Active') }}
|
||||
</span>
|
||||
@elseif($budget->status === 'closed')
|
||||
<span class="inline-flex items-center rounded-full bg-gray-100 px-2.5 py-0.5 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-200" role="status" aria-label="{{ __('Status: Closed') }}">
|
||||
{{ __('Closed') }}
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ $budget->createdBy->name }}
|
||||
</td>
|
||||
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||
<a href="{{ route('admin.budgets.show', $budget) }}"
|
||||
class="text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800"
|
||||
aria-label="{{ __('View budget for fiscal year :year', ['year' => $budget->fiscal_year]) }}">
|
||||
{{ __('View') }}
|
||||
</a>
|
||||
@if($budget->canBeEdited())
|
||||
<span class="text-gray-300 dark:text-gray-600" aria-hidden="true"> | </span>
|
||||
<a href="{{ route('admin.budgets.edit', $budget) }}"
|
||||
class="text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800"
|
||||
aria-label="{{ __('Edit budget for fiscal year :year', ['year' => $budget->fiscal_year]) }}">
|
||||
{{ __('Edit') }}
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="px-3 py-8 text-center text-sm text-gray-500 dark:text-gray-400">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
<p class="mt-2 text-sm font-semibold">{{ __('No budgets found') }}</p>
|
||||
<p class="mt-1 text-sm">{{ __('Get started by creating a new budget.') }}</p>
|
||||
<div class="mt-6">
|
||||
<a href="{{ route('admin.budgets.create') }}"
|
||||
class="inline-flex items-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:bg-indigo-500 dark:hover:bg-indigo-400 dark:focus:ring-offset-gray-800">
|
||||
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
|
||||
<path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" />
|
||||
</svg>
|
||||
{{ __('Create Budget') }}
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
@if($budgets->hasPages())
|
||||
<div class="mt-6">
|
||||
{{ $budgets->links() }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
127
resources/views/admin/budgets/show.blade.php
Normal file
127
resources/views/admin/budgets/show.blade.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
|
||||
{{ __('Budget Details') }} - {{ $budget->fiscal_year }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8 space-y-6">
|
||||
@if (session('status'))
|
||||
<div class="rounded-md bg-green-50 p-4 dark:bg-green-900/30 border-l-4 border-green-400" role="status" aria-live="polite">
|
||||
<p class="text-sm text-green-800 dark:text-green-200">{{ session('status') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Budget Info -->
|
||||
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
|
||||
<div class="sm:flex sm:items-center sm:justify-between mb-4">
|
||||
<div>
|
||||
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">{{ $budget->name }}</h3>
|
||||
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ $budget->period_start->format('Y-m-d') }} ~ {{ $budget->period_end->format('Y-m-d') }}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
@if($budget->status === 'active')
|
||||
<span class="inline-flex rounded-full bg-green-100 px-3 py-1 text-sm font-medium text-green-800 dark:bg-green-900 dark:text-green-200"> {{ __('Active') }}</span>
|
||||
@elseif($budget->status === 'approved')
|
||||
<span class="inline-flex rounded-full bg-blue-100 px-3 py-1 text-sm font-medium text-blue-800 dark:bg-blue-900 dark:text-blue-200">{{ __('Approved') }}</span>
|
||||
@else
|
||||
<span class="inline-flex rounded-full bg-gray-100 px-3 py-1 text-sm font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-200">{{ __(ucfirst($budget->status)) }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex gap-3">
|
||||
@if($budget->canBeEdited())
|
||||
<a href="{{ route('admin.budgets.edit', $budget) }}" class="btn-secondary">{{ __('Edit') }}</a>
|
||||
@endif
|
||||
@if($budget->isDraft())
|
||||
<form method="POST" action="{{ route('admin.budgets.submit', $budget) }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn-primary">{{ __('Submit') }}</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Summary Cards -->
|
||||
<div class="grid grid-cols-1 gap-6 sm:grid-cols-4">
|
||||
<div class="bg-white shadow rounded-lg dark:bg-gray-800 p-5">
|
||||
<dt class="text-sm text-gray-500 dark:text-gray-400">{{ __('Budgeted Income') }}</dt>
|
||||
<dd class="text-2xl font-bold text-gray-900 dark:text-gray-100">NT$ {{ number_format($budget->total_budgeted_income) }}</dd>
|
||||
</div>
|
||||
<div class="bg-white shadow rounded-lg dark:bg-gray-800 p-5">
|
||||
<dt class="text-sm text-gray-500 dark:text-gray-400">{{ __('Budgeted Expense') }}</dt>
|
||||
<dd class="text-2xl font-bold text-gray-900 dark:text-gray-100">NT$ {{ number_format($budget->total_budgeted_expense) }}</dd>
|
||||
</div>
|
||||
<div class="bg-white shadow rounded-lg dark:bg-gray-800 p-5">
|
||||
<dt class="text-sm text-gray-500 dark:text-gray-400">{{ __('Actual Income') }}</dt>
|
||||
<dd class="text-2xl font-bold text-gray-900 dark:text-gray-100">NT$ {{ number_format($budget->total_actual_income) }}</dd>
|
||||
</div>
|
||||
<div class="bg-white shadow rounded-lg dark:bg-gray-800 p-5">
|
||||
<dt class="text-sm text-gray-500 dark:text-gray-400">{{ __('Actual Expense') }}</dt>
|
||||
<dd class="text-2xl font-bold text-gray-900 dark:text-gray-100">NT$ {{ number_format($budget->total_actual_expense) }}</dd>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Income Items -->
|
||||
@if($incomeItems->count() > 0)
|
||||
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
|
||||
<h3 class="text-base font-semibold text-gray-900 dark:text-gray-100 mb-4">{{ __('Income') }} (6e)</h3>
|
||||
<table class="min-w-full divide-y divide-gray-300 dark:divide-gray-600">
|
||||
<thead class="bg-gray-50 dark:bg-gray-900">
|
||||
<tr>
|
||||
<th scope="col" class="py-3 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Account') }}</th>
|
||||
<th scope="col" class="px-3 py-3 text-right text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Budgeted') }}</th>
|
||||
<th scope="col" class="px-3 py-3 text-right text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Actual') }}</th>
|
||||
<th scope="col" class="px-3 py-3 text-right text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Variance') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
|
||||
@foreach($incomeItems as $item)
|
||||
<tr>
|
||||
<td class="py-4 text-sm text-gray-900 dark:text-gray-100">{{ $item->chartOfAccount->account_name_zh }}</td>
|
||||
<td class="px-3 py-4 text-sm text-right tabular-nums text-gray-900 dark:text-gray-100">NT$ {{ number_format($item->budgeted_amount, 2) }}</td>
|
||||
<td class="px-3 py-4 text-sm text-right tabular-nums text-gray-900 dark:text-gray-100">NT$ {{ number_format($item->actual_amount, 2) }}</td>
|
||||
<td class="px-3 py-4 text-sm text-right tabular-nums {{ $item->variance >= 0 ? 'text-green-600 dark:text-green-400' : 'text-red-600 dark:text-red-400' }}">{{ $item->variance >= 0 ? '+' : '' }}NT$ {{ number_format($item->variance, 2) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Expense Items -->
|
||||
@if($expenseItems->count() > 0)
|
||||
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
|
||||
<h3 class="text-base font-semibold text-gray-900 dark:text-gray-100 mb-4">{{ __('Expenses') }} (/ú)</h3>
|
||||
<table class="min-w-full divide-y divide-gray-300 dark:divide-gray-600">
|
||||
<thead class="bg-gray-50 dark:bg-gray-900">
|
||||
<tr>
|
||||
<th scope="col" class="py-3 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Account') }}</th>
|
||||
<th scope="col" class="px-3 py-3 text-right text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Budgeted') }}</th>
|
||||
<th scope="col" class="px-3 py-3 text-right text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Actual') }}</th>
|
||||
<th scope="col" class="px-3 py-3 text-right text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Utilization') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
|
||||
@foreach($expenseItems as $item)
|
||||
<tr class="{{ $item->isOverBudget() ? 'bg-red-50 dark:bg-red-900/20' : '' }}">
|
||||
<td class="py-4 text-sm text-gray-900 dark:text-gray-100">
|
||||
{{ $item->chartOfAccount->account_name_zh }}
|
||||
@if($item->isOverBudget()) <span class="text-red-600"> </span> @endif
|
||||
</td>
|
||||
<td class="px-3 py-4 text-sm text-right tabular-nums text-gray-900 dark:text-gray-100">NT$ {{ number_format($item->budgeted_amount, 2) }}</td>
|
||||
<td class="px-3 py-4 text-sm text-right tabular-nums text-gray-900 dark:text-gray-100">NT$ {{ number_format($item->actual_amount, 2) }}</td>
|
||||
<td class="px-3 py-4 text-sm text-right {{ $item->utilization_percentage > 100 ? 'text-red-600 dark:text-red-400 font-semibold' : 'text-gray-900 dark:text-gray-100' }}">{{ number_format($item->utilization_percentage, 1) }}%</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
Reference in New Issue
Block a user