180 lines
8.8 KiB
PHP
180 lines
8.8 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', '일정 등록')
|
|
|
|
@section('content')
|
|
<div class="container mx-auto px-4 py-6 max-w-2xl">
|
|
{{-- 페이지 헤더 --}}
|
|
<div class="mb-6">
|
|
<a href="{{ route('finance.fund-schedules.index') }}" class="text-sm text-gray-500 hover:text-gray-700 inline-flex items-center gap-1 mb-2">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
|
|
</svg>
|
|
자금계획일정으로
|
|
</a>
|
|
<h1 class="text-2xl font-bold text-gray-800">일정 등록</h1>
|
|
</div>
|
|
|
|
{{-- 등록 폼 --}}
|
|
<div class="bg-white rounded-lg shadow-sm p-6">
|
|
<form id="scheduleForm"
|
|
hx-post="{{ route('api.admin.fund-schedules.store') }}"
|
|
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}", "Accept": "application/json"}'
|
|
hx-target="#form-message"
|
|
hx-swap="innerHTML"
|
|
class="space-y-6">
|
|
|
|
{{-- 메시지 영역 --}}
|
|
<div id="form-message"></div>
|
|
|
|
{{-- 일정 유형 --}}
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">
|
|
일정 유형 <span class="text-red-500">*</span>
|
|
</label>
|
|
<div class="grid grid-cols-2 gap-4">
|
|
@foreach($types as $value => $label)
|
|
<label class="relative flex cursor-pointer rounded-lg border p-4 focus:outline-none
|
|
{{ $value === 'income' ? 'border-green-300 bg-green-50 has-[:checked]:border-green-500 has-[:checked]:ring-2 has-[:checked]:ring-green-500' : 'border-red-300 bg-red-50 has-[:checked]:border-red-500 has-[:checked]:ring-2 has-[:checked]:ring-red-500' }}">
|
|
<input type="radio" name="schedule_type" value="{{ $value }}"
|
|
class="sr-only" {{ $value === 'expense' ? 'checked' : '' }}>
|
|
<span class="flex flex-1">
|
|
<span class="flex flex-col">
|
|
<span class="block text-sm font-medium {{ $value === 'income' ? 'text-green-900' : 'text-red-900' }}">
|
|
{{ $label }}
|
|
</span>
|
|
</span>
|
|
</span>
|
|
<svg class="h-5 w-5 {{ $value === 'income' ? 'text-green-600' : 'text-red-600' }} hidden [input:checked~&]:block" viewBox="0 0 20 20" fill="currentColor">
|
|
<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>
|
|
</label>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
|
|
{{-- 일정명 --}}
|
|
<div>
|
|
<label for="title" class="block text-sm font-medium text-gray-700 mb-1">
|
|
일정명 <span class="text-red-500">*</span>
|
|
</label>
|
|
<input type="text" name="title" id="title" required
|
|
placeholder="예: 프로젝트 대금 입금, 사무실 임대료 지급"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500">
|
|
</div>
|
|
|
|
{{-- 예정일 & 금액 --}}
|
|
<div class="grid grid-cols-2 gap-4">
|
|
<div>
|
|
<label for="scheduled_date" class="block text-sm font-medium text-gray-700 mb-1">
|
|
예정일 <span class="text-red-500">*</span>
|
|
</label>
|
|
<input type="date" name="scheduled_date" id="scheduled_date" required
|
|
value="{{ $defaultDate }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500">
|
|
</div>
|
|
<div>
|
|
<label for="amount" class="block text-sm font-medium text-gray-700 mb-1">
|
|
금액 <span class="text-red-500">*</span>
|
|
</label>
|
|
<input type="number" name="amount" id="amount" required
|
|
value="0" min="0" step="1"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500">
|
|
</div>
|
|
</div>
|
|
|
|
{{-- 거래상대방 --}}
|
|
<div>
|
|
<label for="counterparty" class="block text-sm font-medium text-gray-700 mb-1">
|
|
거래상대방
|
|
</label>
|
|
<input type="text" name="counterparty" id="counterparty"
|
|
placeholder="거래 상대방 이름"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500">
|
|
</div>
|
|
|
|
{{-- 관련 계좌 --}}
|
|
<div>
|
|
<label for="related_bank_account_id" class="block text-sm font-medium text-gray-700 mb-1">
|
|
관련 계좌
|
|
</label>
|
|
<select name="related_bank_account_id" id="related_bank_account_id"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500">
|
|
<option value="">선택안함</option>
|
|
@foreach($accounts as $account)
|
|
<option value="{{ $account->id }}">{{ $account->bank_name }} - {{ $account->account_number }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
{{-- 분류 --}}
|
|
<div>
|
|
<label for="category" class="block text-sm font-medium text-gray-700 mb-1">
|
|
분류
|
|
</label>
|
|
<select name="category" id="category"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500">
|
|
<option value="">선택안함</option>
|
|
<option value="매출">매출</option>
|
|
<option value="매입">매입</option>
|
|
<option value="급여">급여</option>
|
|
<option value="임대료">임대료</option>
|
|
<option value="운영비">운영비</option>
|
|
<option value="세금">세금</option>
|
|
<option value="대출">대출</option>
|
|
<option value="투자">투자</option>
|
|
<option value="기타">기타</option>
|
|
</select>
|
|
</div>
|
|
|
|
{{-- 설명 --}}
|
|
<div>
|
|
<label for="description" class="block text-sm font-medium text-gray-700 mb-1">
|
|
설명
|
|
</label>
|
|
<textarea name="description" id="description" rows="2"
|
|
placeholder="상세 설명"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500"></textarea>
|
|
</div>
|
|
|
|
{{-- 메모 --}}
|
|
<div>
|
|
<label for="memo" class="block text-sm font-medium text-gray-700 mb-1">
|
|
메모
|
|
</label>
|
|
<textarea name="memo" id="memo" rows="2"
|
|
placeholder="내부 메모"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500"></textarea>
|
|
</div>
|
|
|
|
{{-- 버튼 --}}
|
|
<div class="flex justify-end gap-3 pt-4 border-t">
|
|
<a href="{{ route('finance.fund-schedules.index') }}"
|
|
class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors">
|
|
취소
|
|
</a>
|
|
<button type="submit"
|
|
class="px-6 py-2 bg-emerald-600 hover:bg-emerald-700 text-white rounded-lg transition-colors">
|
|
등록
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script>
|
|
document.body.addEventListener('htmx:afterRequest', function(event) {
|
|
if (event.detail.successful) {
|
|
try {
|
|
const response = JSON.parse(event.detail.xhr.responseText);
|
|
if (response.success) {
|
|
window.location.href = '{{ route('finance.fund-schedules.index') }}';
|
|
}
|
|
} catch (e) {}
|
|
}
|
|
});
|
|
</script>
|
|
@endpush
|