feat: add notes management feature with CRUD operations

- Created Note model and controller for handling notes.
- Added routes for notes CRUD operations.
- Implemented notes index view with search and pinning functionality.
- Created migration for notes table with necessary fields.
- Developed event creation form with client and contract options.
This commit is contained in:
I-Fun
2026-04-02 23:24:38 +07:00
parent 5748b163b6
commit 1b90f730a6
25 changed files with 1524 additions and 390 deletions

View File

@@ -15,73 +15,78 @@
@endif
{{-- Add Contract --}}
<div class="cat-card overflow-hidden">
<div class="cat-card overflow-hidden" x-data="{ open: {{ $errors->any() ? 'true' : 'false' }} }">
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
<span class="text-xl">➕</span>
<h2 class="font-bold text-gray-700">Add New Contract</h2>
<button type="button" @click="open = !open"
class="btn-sakura text-xs"
x-text="open ? '✕ Close' : '+ Add New Contract'">
</button>
</div>
<div x-show="open" x-transition style="display:none">
<form action="{{ route('contracts.store') }}" method="POST"
class="p-5 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 border-b border-pink-50">
@csrf
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title <span class="text-pink-400">*</span></label>
<input type="text" name="title" required maxlength="255"
placeholder="e.g. Exclusive – Energy Drinks 2025"
class="input-soft" value="{{ old('title') }}">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Brand / Client</label>
<select name="client_id" class="input-soft">
<option value="">— No specific client —</option>
@foreach($clients as $c)
<option value="{{ $c->id }}" {{ old('client_id') == $c->id ? 'selected' : '' }}>
{{ $c->name }}
</option>
@endforeach
</select>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Category (exclusive) <span class="text-pink-400">*</span></label>
<select name="category_id" required class="input-soft">
<option value="">— Select category —</option>
@foreach($categoryTree as $parent)
<option value="{{ $parent->id }}" {{ old('category_id') == $parent->id ? 'selected' : '' }}>
{{ $parent->icon }} {{ $parent->name }}
</option>
@foreach($parent->children as $child)
<option value="{{ $child->id }}" {{ old('category_id') == $child->id ? 'selected' : '' }}>
&nbsp;&nbsp;↳ {{ $child->name }}
</option>
@endforeach
@endforeach
</select>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Start Date <span class="text-pink-400">*</span></label>
<input type="date" name="start_date" required class="input-soft"
value="{{ old('start_date', today()->toDateString()) }}">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">End Date <span class="text-pink-400">*</span></label>
<input type="date" name="end_date" required class="input-soft"
value="{{ old('end_date') }}">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Notes</label>
<input type="text" name="notes" maxlength="500" placeholder="Optional notes…"
class="input-soft" value="{{ old('notes') }}">
</div>
<div class="sm:col-span-2 lg:col-span-3 flex justify-end pt-1">
<button type="submit" class="btn-sakura px-6 py-2.5">📋 Add Contract</button>
</div>
</form>
</div>
<form action="{{ route('contracts.store') }}" method="POST"
class="p-5 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
@csrf
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title <span class="text-pink-400">*</span></label>
<input type="text" name="title" required maxlength="255"
placeholder="e.g. Exclusive – Energy Drinks 2025"
class="input-soft" value="{{ old('title') }}">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Brand / Client</label>
<select name="client_id" class="input-soft">
<option value="">— No specific client —</option>
@foreach($clients as $c)
<option value="{{ $c->id }}" {{ old('client_id') == $c->id ? 'selected' : '' }}>
{{ $c->name }}
</option>
@endforeach
</select>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Category (exclusive) <span class="text-pink-400">*</span></label>
<select name="category_id" required class="input-soft">
<option value="">— Select category —</option>
@foreach($categoryTree as $parent)
<option value="{{ $parent->id }}" {{ old('category_id') == $parent->id ? 'selected' : '' }}>
{{ $parent->icon }} {{ $parent->name }}
</option>
@foreach($parent->children as $child)
<option value="{{ $child->id }}" {{ old('category_id') == $child->id ? 'selected' : '' }}>
&nbsp;&nbsp;↳ {{ $child->name }}
</option>
@endforeach
@endforeach
</select>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Start Date <span class="text-pink-400">*</span></label>
<input type="date" name="start_date" required class="input-soft"
value="{{ old('start_date', today()->toDateString()) }}">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">End Date <span class="text-pink-400">*</span></label>
<input type="date" name="end_date" required class="input-soft"
value="{{ old('end_date') }}">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Notes</label>
<input type="text" name="notes" maxlength="500" placeholder="Optional notes…"
class="input-soft" value="{{ old('notes') }}">
</div>
<div class="sm:col-span-2 lg:col-span-3 flex justify-end pt-1">
<button type="submit" class="btn-sakura px-6 py-2.5">📋 Add Contract</button>
</div>
</form>
</div>
{{-- Contracts List --}}
<div class="cat-card overflow-hidden">
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
<span class="text-xl">📋</span>
<h2 class="font-bold text-gray-700">Active & Upcoming Contracts</h2>
<h2 class="font-bold text-gray-700">All Contracts</h2>
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full">
{{ $contracts->count() }} total
</span>