Add contract management and invoice settings pages

- Created a new Blade view for managing brand contracts with forms for adding and editing contracts, including client and category selection.
- Implemented success message notifications for contract actions.
- Added a new Blade view for invoice settings, allowing customization of invoice number format, header branding, and default values for new invoices.
- Introduced a new PDF view for generating rate cards with customizable styles based on user profile settings.
- Developed a profile management page for rate cards, enabling users to update their identity, appearance, and visibility settings.
This commit is contained in:
I-Fun
2026-04-01 21:47:34 +07:00
parent d3c35ad730
commit 22f03ccca7
48 changed files with 2415 additions and 296 deletions

View File

@@ -6,6 +6,7 @@ namespace App\Http\Controllers;
use App\Enums\EventStatus;
use App\Models\Client;
use App\Models\ClientCategory;
use App\Models\Event;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
@@ -14,10 +15,19 @@ use Illuminate\View\View;
class EventController extends Controller
{
private function categoryTree(): \Illuminate\Support\Collection
{
return ClientCategory::with('children')
->whereNull('parent_id')
->orderBy('sort_order')
->get();
}
public function index(): View
{
$events = Event::with('client')->orderBy('start_time')->get();
$clients = Client::where('status', 'active')->orderBy('name')->get();
$events = Event::with('client')->orderBy('start_time')->get();
$clients = Client::where('status', 'active')->orderBy('name')->get();
$categoryTree = $this->categoryTree();
// Format for FullCalendar
$calendarEvents = $events->map(fn (Event $e) => [
@@ -35,7 +45,7 @@ class EventController extends Controller
],
]);
return view('schedule.index', compact('events', 'clients', 'calendarEvents'));
return view('schedule.index', compact('events', 'clients', 'calendarEvents', 'categoryTree'));
}
public function store(Request $request): RedirectResponse
@@ -44,6 +54,7 @@ class EventController extends Controller
'title' => 'required|string|max:255',
'description' => 'nullable|string',
'client_id' => 'nullable|exists:clients,id',
'category_id' => 'nullable|exists:client_categories,id',
'event_type' => 'required|in:task,meeting,deadline,posting',
'start_time' => 'required|date',
'end_time' => 'nullable|date|after:start_time',
@@ -65,10 +76,11 @@ class EventController extends Controller
public function edit(Event $event): View
{
$clients = Client::where('status', 'active')->orderBy('name')->get();
$statuses = EventStatus::cases();
$clients = Client::where('status', 'active')->orderBy('name')->get();
$statuses = EventStatus::cases();
$categoryTree = $this->categoryTree();
return view('schedule.edit', compact('event', 'clients', 'statuses'));
return view('schedule.edit', compact('event', 'clients', 'statuses', 'categoryTree'));
}
public function update(Request $request, Event $event): RedirectResponse
@@ -77,6 +89,7 @@ class EventController extends Controller
'title' => 'required|string|max:255',
'description' => 'nullable|string',
'client_id' => 'nullable|exists:clients,id',
'category_id' => 'nullable|exists:client_categories,id',
'event_type' => 'required|in:task,meeting,deadline,posting',
'start_time' => 'required|date',
'end_time' => 'nullable|date',