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

@@ -6,143 +6,9 @@
@section('content')
{{-- ── Add Event Form (always accessible, collapsible) ─────── --}}
<div class="cat-card p-4 mb-4" x-data="{ open: false }">
<div class="flex items-center justify-between">
<h3 class="text-sm font-bold text-gray-700 flex items-center gap-2">➕ New Event</h3>
<button class="btn-sakura text-xs px-4 py-1.5" @click="open = !open"
x-text="open ? '✕ Close' : '+ Add Event'"></button>
</div>
<form x-show="open" x-transition action="{{ route('schedule.store') }}" method="POST"
class="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-3"
id="new-event-form"
x-data="contractCheck('{{ route('contracts.check') }}')"
@submit.prevent="submitIfClear($el)">
@csrf
{{-- Hidden combined datetime fields --}}
<input type="hidden" name="start_time" id="start_time_hidden">
<input type="hidden" name="end_time" id="end_time_hidden">
<div class="sm:col-span-2">
<label class="text-xs font-semibold text-gray-600">Title <span class="text-pink-400">*</span></label>
<input type="text" name="title" class="input-soft mt-1" placeholder="Event title" required>
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Type</label>
<select name="event_type" class="input-soft mt-1">
<option value="task">📋 Task</option>
<option value="meeting">🤝 Meeting</option>
<option value="deadline">⏰ Deadline</option>
<option value="posting">📸 Posting</option>
</select>
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Client</label>
<select name="client_id" class="input-soft mt-1" x-model="clientId" @change="checkContract()">
<option value="">— None —</option>
@foreach($clients as $client)
<option value="{{ $client->id }}">{{ $client->name }}</option>
@endforeach
</select>
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Category</label>
<select name="category_id" class="input-soft mt-1" x-model="categoryId" @change="checkContract()">
<option value="">— None —</option>
@foreach($categoryTree as $parent)
<option value="{{ $parent->id }}">{{ $parent->icon }} {{ $parent->name }}</option>
@foreach($parent->children as $child)
<option value="{{ $child->id }}">&nbsp;&nbsp;↳ {{ $child->name }}</option>
@endforeach
@endforeach
</select>
</div>
{{-- Contract warning --}}
<div x-show="contractWarning" x-transition class="sm:col-span-2 rounded-2xl bg-amber-50 border border-amber-200 px-4 py-3 text-sm" style="display:none">
<div class="font-semibold text-amber-700 mb-1">⚠️ Exclusive Contract Active</div>
<p class="text-amber-600 text-xs" x-text="contractMessage"></p>
</div>
{{-- Start: date + time side by side --}}
<div>
<label class="text-xs font-semibold text-gray-600">Start Date <span class="text-pink-400">*</span></label>
<input type="date" id="start_date" class="input-soft mt-1" required>
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Start Time</label>
<input type="time" id="start_time_input" class="input-soft mt-1" value="09:00">
</div>
{{-- End: date + time side by side --}}
<div>
<label class="text-xs font-semibold text-gray-600">End Date</label>
<input type="date" id="end_date" class="input-soft mt-1">
</div>
<div>
<label class="text-xs font-semibold text-gray-600">End Time</label>
<input type="time" id="end_time_input" class="input-soft mt-1" value="18:00">
</div>
<div x-data="{ color: '#FFB7C5' }">
<label class="text-xs font-semibold text-gray-600">Color</label>
<input type="hidden" name="color" :value="color">
<div class="flex items-center gap-3 mt-1">
<input type="color" x-model="color"
class="w-9 h-9 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5 shrink-0">
<div class="flex gap-2 flex-wrap">
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF'] as $hex)
<button type="button"
class="w-7 h-7 rounded-full ring-2 ring-transparent hover:ring-gray-400 transition-all"
style="background:{{ $hex }}"
@click="color = '{{ $hex }}'"></button>
@endforeach
</div>
</div>
</div>
<div class="flex items-center gap-2 mt-1">
<input type="checkbox" name="is_priority" value="1" id="priority" class="w-4 h-4 accent-pink-400">
<label for="priority" class="text-xs text-gray-600 cursor-pointer">⭐ Priority</label>
</div>
<div class="sm:col-span-2">
<label class="text-xs font-semibold text-gray-600">Notes</label>
<textarea name="notes" rows="2" class="input-soft mt-1 resize-none text-sm"></textarea>
</div>
{{-- Active Contract checkbox --}}
<div class="sm:col-span-2" x-data="{ createContract: false }">
<div class="flex items-center gap-2">
<input type="checkbox" name="create_brand_contract" value="1" id="new_create_contract"
class="w-4 h-4 accent-pink-400" x-model="createContract">
<label for="new_create_contract" class="text-xs text-gray-600 cursor-pointer">
📄 Also create a Brand Contract for this event
</label>
</div>
<div x-show="createContract" x-transition class="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-3 bg-pink-50 rounded-2xl p-3">
<div class="sm:col-span-2">
<label class="text-xs font-semibold text-gray-600">Contract Title</label>
<input type="text" name="contract_title" class="input-soft mt-1 text-xs"
placeholder="e.g. Exclusive Posting Contract — BrandX">
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Contract Start</label>
<input type="date" name="contract_start_date" class="input-soft mt-1 text-xs">
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Contract End</label>
<input type="date" name="contract_end_date" class="input-soft mt-1 text-xs">
</div>
</div>
</div>
<div class="sm:col-span-2">
<button type="submit" class="btn-sakura w-full"
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">
🐾 Schedule It!
</button>
</div>
</form>
{{-- ── Add Event Button ─────────────────────────────────────── --}}
<div class="flex items-center justify-between mb-4">
<a href="{{ route('schedule.create') }}" class="btn-sakura text-sm px-5 py-2">+ Add Event</a>
</div>
{{-- ── Upcoming Alert Strip ─────────────────────────────────── --}}