113 lines
6.9 KiB
PHP
113 lines
6.9 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<div class="max-w-3xl mx-auto space-y-6">
|
|
<!-- Page Header -->
|
|
<div class="flex items-center gap-4">
|
|
<a href="{{ route('petty-cashes.show', $pettyCash) }}" class="p-2 text-gray-500 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/></svg>
|
|
</a>
|
|
<h1 class="text-2xl font-bold text-gray-900">{{ __('pettyCash.add_expense') }}</h1>
|
|
</div>
|
|
|
|
<!-- Petty Cash Info -->
|
|
<div class="bg-teal-50 rounded-xl border border-teal-200 p-4">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-sm font-medium text-teal-900">{{ $pettyCash->title }}</p>
|
|
<p class="text-xs text-teal-700">{{ $pettyCash->project?->name }}</p>
|
|
</div>
|
|
<div class="text-start">
|
|
<p class="text-xs text-teal-600">{{ __('pettyCash.remaining') }}</p>
|
|
<p class="text-lg font-bold text-teal-900">{{ format_currency((float)$pettyCash->remaining, $pettyCash->currency?->code) }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Form -->
|
|
<form method="POST" action="{{ route('petty-cashes.store-expense', $pettyCash) }}" enctype="multipart/form-data" class="bg-white rounded-xl border border-gray-200 p-6 space-y-5">
|
|
@csrf
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
|
<!-- Title -->
|
|
<div class="md:col-span-2">
|
|
<label for="title" class="block text-sm font-medium text-gray-700 mb-1">{{ __('expense.title') }} <span class="text-red-500">*</span></label>
|
|
<input type="text" id="title" name="title" value="{{ old('title') }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500" required>
|
|
</div>
|
|
|
|
<!-- Category -->
|
|
<div>
|
|
<label for="category" class="block text-sm font-medium text-gray-700 mb-1">{{ __('expense.category') }} <span class="text-red-500">*</span></label>
|
|
<select id="category" name="category" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500" required>
|
|
@foreach($categories as $cat)
|
|
<option value="{{ $cat }}" {{ old('category') === $cat ? 'selected' : '' }}>{{ __('expense.category_' . $cat) }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Amount -->
|
|
<div>
|
|
<label for="amount" class="block text-sm font-medium text-gray-700 mb-1">{{ __('expense.amount') }} <span class="text-red-500">*</span></label>
|
|
<input type="number" id="amount" name="amount" value="{{ old('amount') }}" step="0.01" min="0"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500" required>
|
|
</div>
|
|
|
|
<!-- Currency -->
|
|
<div>
|
|
<label for="currency_id" class="block text-sm font-medium text-gray-700 mb-1">{{ __('pettyCash.currency') }} <span class="text-red-500">*</span></label>
|
|
<select id="currency_id" name="currency_id" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500" required>
|
|
@foreach($currencies as $currency)
|
|
<option value="{{ $currency->id }}" {{ old('currency_id', $pettyCash->currency_id ?? $baseCurrency?->id ?? '') == $currency->id ? 'selected' : '' }}>
|
|
{{ $currency->code }} - {{ $currency->name }}
|
|
@if($currency->id === $baseCurrency?->id) ({{ __('pettyCash.base_currency') }})@endif
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
<p class="mt-1 text-xs text-gray-400">{{ __('pettyCash.currency_conversion_note') }}</p>
|
|
</div>
|
|
|
|
<!-- Expense Date -->
|
|
<div>
|
|
<label for="expense_date" class="block text-sm font-medium text-gray-700 mb-1">{{ __('expense.date') }} <span class="text-red-500">*</span></label>
|
|
<input type="text" id="expense_date" name="expense_date" value="{{ old('expense_date', \App\Helpers\CalendarHelper::getCurrentDate()) }}" placeholder="1403/01/01"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500" required>
|
|
</div>
|
|
|
|
<!-- Description -->
|
|
<div class="md:col-span-2">
|
|
<label for="description" class="block text-sm font-medium text-gray-700 mb-1">{{ __('expense.description') }}</label>
|
|
<textarea id="description" name="description" rows="3"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">{{ old('description') }}</textarea>
|
|
</div>
|
|
|
|
<!-- Receipt Upload -->
|
|
<div class="md:col-span-2">
|
|
<label for="receipt" class="block text-sm font-medium text-gray-700 mb-1">{{ __('pettyCash.receipt') }}</label>
|
|
<input type="file" id="receipt" name="receipt" accept="jpg,jpeg,png,pdf,doc,docx"
|
|
class="w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-medium file:bg-teal-50 file:text-teal-700 hover:file:bg-teal-100">
|
|
<p class="mt-1 text-xs text-gray-400">{{ __('pettyCash.receipt_help') }}</p>
|
|
</div>
|
|
|
|
<!-- Additional Attachments -->
|
|
<div class="md:col-span-2">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __('attachment.additional_files') }}</label>
|
|
<input type="file" name="attachments[]" multiple accept=".jpg,.jpeg,.png,.pdf,.doc,.docx"
|
|
class="w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-medium file:bg-gray-50 file:text-gray-700 hover:file:bg-gray-100">
|
|
<p class="mt-1 text-xs text-gray-400">{{ __('attachment.max_files_help') }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="flex items-center justify-end gap-3 pt-4 border-t border-gray-200">
|
|
<a href="{{ route('petty-cashes.show', $pettyCash) }}" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors">
|
|
{{ __('common.cancel') }}
|
|
</a>
|
|
<button type="submit" class="px-6 py-2 text-sm font-medium text-white bg-teal-600 rounded-lg hover:bg-teal-700 transition-colors">
|
|
{{ __('common.create') }}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endsection
|