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:
@@ -4,10 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\ContentStatus;
|
||||
use App\Enums\EventStatus;
|
||||
use App\Models\BrandContract;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientCategory;
|
||||
use App\Models\ContentBrief;
|
||||
use App\Models\Event;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@@ -25,6 +27,14 @@ class EventController extends Controller
|
||||
->get();
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||
$categoryTree = $this->categoryTree();
|
||||
|
||||
return view('schedule.create', compact('clients', 'categoryTree'));
|
||||
}
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
$events = Event::with('client')->orderBy('start_time')->get();
|
||||
@@ -69,6 +79,9 @@ class EventController extends Controller
|
||||
'contract_title' => 'nullable|string|max:255',
|
||||
'contract_start_date' => 'nullable|date',
|
||||
'contract_end_date' => 'nullable|date|after_or_equal:contract_start_date',
|
||||
'add_to_content_board' => 'nullable|boolean',
|
||||
'content_platform' => 'nullable|string|max:50',
|
||||
'content_type' => 'nullable|string|max:50',
|
||||
]);
|
||||
|
||||
$validated['is_priority'] = $request->boolean('is_priority');
|
||||
@@ -76,6 +89,7 @@ class EventController extends Controller
|
||||
|
||||
$event = Event::create(Arr::except($validated, [
|
||||
'create_brand_contract', 'contract_title', 'contract_start_date', 'contract_end_date',
|
||||
'add_to_content_board', 'content_platform', 'content_type',
|
||||
]));
|
||||
|
||||
if ($request->boolean('create_brand_contract') && $event->client_id) {
|
||||
@@ -89,6 +103,19 @@ class EventController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
if ($request->boolean('add_to_content_board')) {
|
||||
ContentBrief::create([
|
||||
'title' => $event->title,
|
||||
'client_id' => $event->client_id,
|
||||
'category_id' => $event->category_id,
|
||||
'platform' => $request->input('content_platform', 'instagram'),
|
||||
'content_type' => $request->input('content_type', 'post'),
|
||||
'status' => ContentStatus::Drafting,
|
||||
'target_date' => $event->start_time->toDateString(),
|
||||
'notes' => $event->notes,
|
||||
]);
|
||||
}
|
||||
|
||||
return redirect()->route('schedule.index')
|
||||
->with('success', '🐾 Event scheduled!');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user