first change
This commit is contained in:
0
Modules/Content/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Content/app/Http/Controllers/.gitkeep
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Content\Interfaces\ContentCategoryInterface;
|
||||
use Modules\Content\Models\ContentCategory;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class ContentCategoryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
protected $contentCategory;
|
||||
public function __construct(ContentCategoryInterface $contentCategory)
|
||||
{
|
||||
$this->contentCategory = $contentCategory;
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data['title'] = 'Content Category List';
|
||||
|
||||
if ($request->ajax()) {
|
||||
$model = ContentCategory::query();
|
||||
|
||||
return DataTables::eloquent($model)
|
||||
// ->setRowId('{{$id}}')
|
||||
->addIndexColumn()
|
||||
->editColumn('desc', function ($row) {
|
||||
return \Str::limit($row->desc, 20);
|
||||
})
|
||||
->addColumn('action', 'content::content-category.datatables.action-btn')
|
||||
->addColumn('status', '{!! $status_name !!}')
|
||||
->rawColumns(['action', 'status', 'desc'])
|
||||
->toJson();
|
||||
}
|
||||
return view('content::content-category.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Content Category';
|
||||
$data['status'] = ContentCategory::STATUS;
|
||||
$data['editable'] = false;
|
||||
return view('content::content-category.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->contentCategory->create($request->all());
|
||||
return redirect()->route('contentCategory.index')->with('success', 'Content Category has been created!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
try {
|
||||
$data['title'] = 'Show Content Category';
|
||||
$data['contentCategory'] = $this->contentCategory->getContentCategoryById($id);
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'view' => view('content::content-category.show', $data)->render(),
|
||||
], 200);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'msg' => $th->getMessage(),
|
||||
], 500);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Content Category';
|
||||
$data['editable'] = true;
|
||||
$data['status'] = ContentCategory::STATUS;
|
||||
$data['contentCategory'] = $this->contentCategory->getContentCategoryById($id);
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'view' => view('content::content-category.edit', $data)->render(),
|
||||
'msg' => 'Fetch successfully',
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
try {
|
||||
|
||||
$this->contentCategory->update($id, $inputData);
|
||||
|
||||
return redirect()->route('contentCategory.index')->with('success', 'Content Category has been updated!');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
return redirect()->back()->withError($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$Model = $this->contentCategory->getContentCategoryById($id);
|
||||
|
||||
$Model->delete();
|
||||
|
||||
flash()->success('Content Category deleted succesfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
|
||||
return redirect()->back()->withError($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Content Category deleted succesfully']);
|
||||
}
|
||||
}
|
427
Modules/Content/app/Http/Controllers/ContentController.php
Normal file
427
Modules/Content/app/Http/Controllers/ContentController.php
Normal file
@@ -0,0 +1,427 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Modules\Content\Interfaces\ContentCategoryInterface;
|
||||
use Modules\Content\Interfaces\ContentInterface;
|
||||
use Modules\Content\Models\Content;
|
||||
use Modules\Employee\Models\Employee;
|
||||
use Modules\Product\Interfaces\ProductInterface;
|
||||
use Modules\User\Services\UserService;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class ContentController extends Controller
|
||||
{
|
||||
private $content;
|
||||
private $product;
|
||||
private $category;
|
||||
private $user;
|
||||
|
||||
public function __construct(
|
||||
ContentInterface $content,
|
||||
ProductInterface $product,
|
||||
ContentCategoryInterface $category,
|
||||
UserService $user
|
||||
) {
|
||||
$this->content = $content;
|
||||
$this->product = $product;
|
||||
$this->category = $category;
|
||||
$this->user = $user;
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data['title'] = 'Schedule Content List';
|
||||
$data['status'] = Content::STATUS;
|
||||
$data['products'] = $this->product->getProductList();
|
||||
$data['categories'] = $this->category->getContentCategoryList();
|
||||
|
||||
if ($request->ajax()) {
|
||||
|
||||
$model = Content::query();
|
||||
$model->latest();
|
||||
|
||||
if ($request->has('filters')) {
|
||||
$filters = $request->get('filters');
|
||||
$this->applyFilters($model, $filters);
|
||||
}
|
||||
return DataTables::eloquent($model)
|
||||
->addIndexColumn()
|
||||
// ->setRowClass('{{"align-middle"}}')
|
||||
->addColumn('product', function (Content $content) {
|
||||
$productName = $content->product?->name ?? 'N/A';
|
||||
$clientName = $content->product?->client?->name ?? 'N/A';
|
||||
|
||||
$html = '<div class="d-flex align-items-center"><div class="flex-shrink-0">';
|
||||
$html .= '<h5 class="fs-14 mb-0">' . $productName . '</h5>';
|
||||
$html .= '<p class="fs-12 mb-0 text-primary"><em> ' . $clientName . '</em></p>';
|
||||
$html .= '</div></div>';
|
||||
|
||||
return $html;
|
||||
})
|
||||
->addColumn('createdby', function (Content $content) {
|
||||
$createdByName = $content->createdBy?->name ?? 'Unknown';
|
||||
$createdAt = $content->created_at?->format('d M, Y | H:i:s') ?? '-';
|
||||
|
||||
$html = '<div class="d-flex align-items-center"><div class="flex-shrink-0">';
|
||||
$html .= '<h5 class="fs-14 mb-0">' . $createdByName . '</h5>';
|
||||
$html .= '<p class="fs-12 mb-0 text-muted"><em> ' . $createdAt . '</em></p>';
|
||||
$html .= '</div></div>';
|
||||
|
||||
return $html;
|
||||
})
|
||||
->addColumn('category', function (Content $content) {
|
||||
return $content->category?->title;
|
||||
})
|
||||
->addColumn('status', '{!! $status_name !!}')
|
||||
->addColumn('action', 'content::content.datatables.action-btn')
|
||||
->rawColumns(['action', 'status', 'product', 'createdby'])
|
||||
->toJson();
|
||||
|
||||
}
|
||||
|
||||
return view('content::content.all', $data);
|
||||
|
||||
}
|
||||
|
||||
public function draft(Request $request)
|
||||
{
|
||||
$data['title'] = 'Content List';
|
||||
$data['status'] = Content::STATUS;
|
||||
$data['products'] = $this->product->getProductList();
|
||||
$data['categories'] = $this->category->getContentCategoryList();
|
||||
|
||||
if ($request->ajax()) {
|
||||
$model = Content::query();
|
||||
$model->where('status', 11)->latest();
|
||||
|
||||
if ($request->has('filters')) {
|
||||
$filters = $request->get('filters');
|
||||
$this->applyFilters($model, $filters);
|
||||
}
|
||||
|
||||
return DataTables::eloquent($model)
|
||||
->addIndexColumn()
|
||||
->addColumn('title', function(Content $content){
|
||||
return '<a target="_blank" href="'. route('content.show', $content->id) .'">'. $content->title .'</a>';
|
||||
})
|
||||
->addColumn('product', function (Content $content) {
|
||||
$html = '<div class="d-flex align-items-center"><div class="flex-shrink-0"><h5 class="fs-14 mb-0">' . $content->product?->name . '</h5>';
|
||||
$html .= '<p class="fs-12 mb-0 text-primary"><em> ' . @$content->product?->client->name . '</em></p>';
|
||||
$html .= '</div></div>';
|
||||
return $html;
|
||||
})
|
||||
->addColumn('createdby', function (Content $content) {
|
||||
$createdByName = $content->createdBy ? $content->createdBy->name : 'N/A';
|
||||
$createdAt = $content->created_at ? $content->created_at->format('d M, Y | H:i:s') : 'N/A';
|
||||
$html = '<div class="d-flex align-items-center"><div class="flex-shrink-0"><h5 class="fs-14 mb-0">' . $createdByName . '</h5>';
|
||||
$html .= '<p class="fs-12 mb-0 text-danger"><em> ' . $createdAt . '</em></p>';
|
||||
$html .= '</div></div>';
|
||||
return $html;
|
||||
})
|
||||
->addColumn('category', function (Content $content) {
|
||||
return $content->category?->title;
|
||||
})
|
||||
->addColumn('status', '{!! $status_name !!}')
|
||||
->addColumn('action', 'content::content.datatables.action-btn')
|
||||
->rawColumns(['action', 'title', 'product', 'status', 'createdby'])
|
||||
->toJson();
|
||||
|
||||
}
|
||||
|
||||
return view('content::content.index', $data);
|
||||
}
|
||||
|
||||
protected function applyFilters($query, $filters)
|
||||
{
|
||||
// Global Search
|
||||
if (!empty($filters['search'])) {
|
||||
$query->where(function ($q) use ($filters) {
|
||||
$q->where('title', 'like', '%' . $filters['search'] . '%');
|
||||
// $q->orWhere('email', 'like', '%' . $filters['search'] . '%'); // Uncomment if needed
|
||||
});
|
||||
}
|
||||
|
||||
// Date Filter
|
||||
if (!empty($filters['date'])) {
|
||||
$dateFilter = explode("to", $filters['date']);
|
||||
$startDate = trim($dateFilter[0]);
|
||||
$endDate = trim($dateFilter[1]);
|
||||
if ($startDate === $endDate) {
|
||||
$query->where('created_at', '>=', $startDate);
|
||||
} else {
|
||||
$query->whereBetween('created_at', [$startDate, $endDate]);
|
||||
}
|
||||
}
|
||||
|
||||
// Product Filter
|
||||
if (!empty($filters['product_id'])) {
|
||||
$query->where('product_id', $filters['product_id']);
|
||||
}
|
||||
|
||||
// Category Filter
|
||||
if (!empty($filters['category_id'])) {
|
||||
$query->where('category_id', $filters['category_id']);
|
||||
}
|
||||
|
||||
// Status Filter
|
||||
if (!empty($filters['status'])) {
|
||||
$query->where('status', $filters['status']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Content';
|
||||
$data['editable'] = false;
|
||||
$data['status'] = Content::STATUS;
|
||||
$data['products'] = $this->product->getProductList();
|
||||
$data['categories'] = $this->category->getContentCategoryList();
|
||||
|
||||
return view('content::content.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
||||
$inputData = $request->all();
|
||||
$ClientLog = $this->product->getProductById($inputData['product_id'])->client;
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return to_route('content.create')->withError($validator->errors()->all());
|
||||
}
|
||||
|
||||
try {
|
||||
if ($request->hasFile('creative')) {
|
||||
$inputData['creative'] = uploadImage($request->creative);
|
||||
}
|
||||
|
||||
$this->content->create($inputData);
|
||||
|
||||
$ClientLog->createLog([
|
||||
'title' => 'Content Created',
|
||||
'data' => "A new content titled '{$request->title}' has been created with the status: '" . (Content::STATUS[$request->status] ?? 'Unknown') . "'.",
|
||||
]);
|
||||
|
||||
$employeId = auth()->user()->employee_id;
|
||||
if ($employeId) {
|
||||
Employee::findOrFail($employeId)->createLog([
|
||||
'title' => 'Content Created',
|
||||
'data' => "A new content titled '{$request->title}' has been created with the status: '" . (Content::STATUS[$request->status] ?? 'Unknown') . "'.",
|
||||
]);
|
||||
}
|
||||
|
||||
// $userList = $this->user->getAllUsersNoticeByEmployee();
|
||||
|
||||
// sendNotification($userList, [
|
||||
// 'msg' => 'New Notice for Employee',
|
||||
// ]);
|
||||
return redirect()->route('content.index')->with('success', 'Content has been created!');
|
||||
} catch (\Throwable $th) {
|
||||
return redirect()->back()->withError($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show Content Schedule';
|
||||
$content = $data['content'] = $this->content->getContentById($id);
|
||||
$data['statusList'] = Content::STATUS;
|
||||
|
||||
if ($content->release_date) {
|
||||
$releasedDateTime = Carbon::createFromFormat('Y-m-d H:i:s', $content->getRawOriginal('release_date') . ' ' . $content->getRawOriginal('release_time'));
|
||||
$now = Carbon::now();
|
||||
|
||||
if ($releasedDateTime->isFuture()) {
|
||||
$data['formatedTime'] = $releasedDateTime->diffForHumans($now, [
|
||||
'parts' => 3,
|
||||
'join' => true,
|
||||
]);
|
||||
$data['class'] = 'text-success';
|
||||
|
||||
} else {
|
||||
$data['formatedTime'] = $releasedDateTime->diffForHumans($now, [
|
||||
'parts' => 3,
|
||||
'join' => true,
|
||||
]);
|
||||
$data['class'] = 'text-danger';
|
||||
}
|
||||
}
|
||||
|
||||
return view('content::content.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Content';
|
||||
$data['content'] = $this->content->getContentById($id);
|
||||
$data['editable'] = true;
|
||||
$data['status'] = Content::STATUS;
|
||||
$data['products'] = $this->product->getProductList();
|
||||
$data['categories'] = $this->category->getContentCategoryList();
|
||||
return view('content::content.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
$clientLog = $this->product->getProductById($inputData['product_id'])->client;
|
||||
$title = $inputData['title'];
|
||||
|
||||
try {
|
||||
if ($request->hasFile('creative')) {
|
||||
$inputData['creative'] = uploadImage($request->creative);
|
||||
|
||||
// Add log for file upload
|
||||
$clientLog->createLog([
|
||||
'title' => 'Content Updated with Document',
|
||||
'data' => "The content titled '{$title}' has been updated with a new document and the status: '" . (Content::STATUS[$request->status] ?? 'Unknown') . "'.",
|
||||
]);
|
||||
}
|
||||
|
||||
$this->content->update($id, $inputData);
|
||||
|
||||
$clientLog->createLog([
|
||||
'title' => 'Content Updated',
|
||||
'data' => "A new content titled '{$request->title}' has been created with the status: '"
|
||||
. (Content::STATUS[$request->status] ?? 'Unknown') . "'.",
|
||||
]);
|
||||
|
||||
$employeId = auth()->user()->employee_id;
|
||||
if ($employeId) {
|
||||
Employee::findOrFail($employeId)->createLog([
|
||||
'title' => 'Content Updated',
|
||||
'data' => "A new content titled '{$request->title}' has been created with the status: '"
|
||||
. (Content::STATUS[$request->status] ?? 'Unknown') . "'.",
|
||||
]);
|
||||
}
|
||||
|
||||
return redirect()->route('content.index')->with('success', 'Content has been updated!');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
return redirect()->back()->withError($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$content = $this->content->getContentById($id);
|
||||
$clientLog = $content->product->client;
|
||||
$clientLog->createLog([
|
||||
'title' => 'Content Deleted',
|
||||
'data' => "The content titled '{$content->title}' has been deleted.",
|
||||
]);
|
||||
|
||||
$content->delete();
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Content deleted succesfully']);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
|
||||
return redirect()->back()->withError($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function schedule()
|
||||
{
|
||||
try {
|
||||
$content = $this->content->getContentById(request()->id);
|
||||
$statusValue = Content::STATUS[request()->status];
|
||||
|
||||
$content->update([
|
||||
'status' => request()->status,
|
||||
'release_date' => request()->release_date,
|
||||
'release_time' => request()->release_time,
|
||||
'remarks' => request()->remarks,
|
||||
]);
|
||||
|
||||
// Log for the client and employee
|
||||
$releaseDateTime = Carbon::parse(request()->release_date . ' ' . request()->release_time)->format('l, F j, Y \a\t g:i A');
|
||||
$content->product->client->createLog([
|
||||
'title' => 'Content Scheduled',
|
||||
'data' => "Content titled '{$content->title}' has been scheduled for release on {$releaseDateTime}. Status updated to '$statusValue'.",
|
||||
]);
|
||||
$employeeId = auth()->user()->employee_id;
|
||||
if ($employeeId) {
|
||||
Employee::findOrFail($employeeId)->createLog([
|
||||
'title' => 'Content Scheduled',
|
||||
'data' => "You scheduled the content titled '{$content->title}' for release on {$releaseDateTime}. Status updated to '$statusValue'.",
|
||||
]);
|
||||
}
|
||||
|
||||
flash()->addSuccess("Content has been " . lcfirst($statusValue) . ".");
|
||||
return redirect()->back();
|
||||
} catch (\Throwable $th) {
|
||||
flash()->addError('Something went Wrong, Please try again!');
|
||||
return redirect()->back()->withError($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function updateStatus()
|
||||
{
|
||||
try {
|
||||
$content = $this->content->getContentById(request()->id);
|
||||
$previousStatus = Content::STATUS[$content->status];
|
||||
$currentStatus = Content::STATUS[request()->status];
|
||||
|
||||
$content->update([
|
||||
'status' => request()->status,
|
||||
]);
|
||||
|
||||
$content->product->client->createLog([
|
||||
'title' => 'Content Status Changed',
|
||||
'data' => "Content status Changed from '$previousStatus' to '$currentStatus'.",
|
||||
]);
|
||||
$employeId = auth()->user()->employee_id;
|
||||
if ($employeId) {
|
||||
Employee::findOrFail($employeId)->createLog([
|
||||
'title' => 'Content Created',
|
||||
'data' => "Content status Changed from '$previousStatus' to '$currentStatus'.",
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'msg' => "Content status has been successfully updated to '" . lcfirst($currentStatus) . "'.",
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
return redirect()->back()->withError($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getContentModal($id)
|
||||
{
|
||||
$data['content'] = $this->content->getContentById($id);
|
||||
return view('content::content.partials._edit-modal', $data);
|
||||
}
|
||||
}
|
26
Modules/Content/app/Http/Requests/ContentCategoryRequest.php
Normal file
26
Modules/Content/app/Http/Requests/ContentCategoryRequest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ContentCategoryRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
15
Modules/Content/app/Interfaces/ContentCategoryInterface.php
Normal file
15
Modules/Content/app/Interfaces/ContentCategoryInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Interfaces;
|
||||
|
||||
interface ContentCategoryInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getContentCategoryById($ContentCategoryId);
|
||||
public function getContentCategoryList();
|
||||
public function create(array $ContentCategoryDetails);
|
||||
public function update($ContentCategoryId, array $newDetails);
|
||||
public function delete($ContentCategoryId);
|
||||
public function pluck();
|
||||
public function count();
|
||||
}
|
18
Modules/Content/app/Interfaces/ContentInterface.php
Normal file
18
Modules/Content/app/Interfaces/ContentInterface.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Interfaces;
|
||||
|
||||
interface ContentInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function findAllUpcomingScheduledContent();
|
||||
public function getContentById($ContentId);
|
||||
public function getContentByEmail($email);
|
||||
public function delete($ContentId);
|
||||
public function create($ContentDetails);
|
||||
public function update($ContentId, array $newDetails);
|
||||
public function pluck();
|
||||
public function count();
|
||||
|
||||
|
||||
}
|
90
Modules/Content/app/Models/Content.php
Normal file
90
Modules/Content/app/Models/Content.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Models;
|
||||
|
||||
use App\Traits\CreatedUpdatedBy;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Modules\Admin\Models\ActivityLog;
|
||||
use Modules\Product\Models\Product;
|
||||
|
||||
class Content extends Model
|
||||
{
|
||||
use HasFactory, CreatedUpdatedBy;
|
||||
|
||||
const STATUS = [
|
||||
11 => 'Draft',
|
||||
12 => 'Scheduled',
|
||||
13 => 'Published',
|
||||
14 => 'Archived',
|
||||
];
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'product_id',
|
||||
'category_id',
|
||||
'release_date',
|
||||
'release_time',
|
||||
'creative',
|
||||
'caption',
|
||||
'desc',
|
||||
'order',
|
||||
'createdby',
|
||||
'updatedby',
|
||||
'status',
|
||||
'remarks',
|
||||
];
|
||||
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
protected $casts = [
|
||||
'release_date' => 'date:Y-m-d',
|
||||
'release_time' => 'datetime:H:i:s',
|
||||
];
|
||||
|
||||
protected function statusName(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function (mixed $value, array $attributes) {
|
||||
switch ($attributes['status']) {
|
||||
case '11':
|
||||
return '<span class="badge bg-dark">' . self::STATUS[$attributes['status']] . '</span>';
|
||||
case '12':
|
||||
return '<span class="badge bg-success">' . self::STATUS[$attributes['status']] . '</span>';
|
||||
case '13':
|
||||
return '<span class="badge bg-primary">' . self::STATUS[$attributes['status']] . '</span>';
|
||||
case '14':
|
||||
return '<span class="badge bg-danger">' . self::STATUS[$attributes['status']] . '</span>';
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
},
|
||||
set: fn($value) => $value,
|
||||
);
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class, 'product_id');
|
||||
}
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(ContentCategory::class, 'category_id');
|
||||
}
|
||||
|
||||
public function activityLogs(): MorphMany
|
||||
{
|
||||
return $this->morphMany(ActivityLog::class, 'loggable')->latest();
|
||||
}
|
||||
|
||||
public function createLog($data)
|
||||
{
|
||||
return $this->activityLogs()->create($data);
|
||||
}
|
||||
}
|
20
Modules/Content/app/Models/ContentCategory.php
Normal file
20
Modules/Content/app/Models/ContentCategory.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ContentCategory extends Model
|
||||
{
|
||||
use HasFactory, StatusTrait;
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'desc',
|
||||
'order',
|
||||
'status',
|
||||
];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
}
|
0
Modules/Content/app/Providers/.gitkeep
Normal file
0
Modules/Content/app/Providers/.gitkeep
Normal file
126
Modules/Content/app/Providers/ContentServiceProvider.php
Normal file
126
Modules/Content/app/Providers/ContentServiceProvider.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Content\Interfaces\ContentCategoryInterface;
|
||||
use Modules\Content\Interfaces\ContentInterface;
|
||||
use Modules\Content\Repositories\ContentCategoryRepository;
|
||||
use Modules\Content\Repositories\ContentRepository;
|
||||
|
||||
class ContentServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Content';
|
||||
|
||||
protected string $moduleNameLower = 'content';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(ContentInterface::class, ContentRepository::class);
|
||||
$this->app->bind(ContentCategoryInterface::class, ContentCategoryRepository::class);
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', '')));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
32
Modules/Content/app/Providers/EventServiceProvider.php
Normal file
32
Modules/Content/app/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event handler mappings for the application.
|
||||
*
|
||||
* @var array<string, array<int, string>>
|
||||
*/
|
||||
protected $listen = [];
|
||||
|
||||
/**
|
||||
* Indicates if events should be discovered.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $shouldDiscoverEvents = true;
|
||||
|
||||
/**
|
||||
* Configure the proper event listeners for email verification.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureEmailVerification(): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
49
Modules/Content/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Content/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
Route::middleware('web')->group(module_path('Content', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Content', '/routes/api.php'));
|
||||
}
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Repositories;
|
||||
|
||||
use Modules\Content\Interfaces\ContentCategoryInterface;
|
||||
use Modules\Content\Models\ContentCategory;
|
||||
|
||||
class ContentCategoryRepository implements ContentCategoryInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return ContentCategory::when(true, function ($query) {
|
||||
|
||||
})->latest()->paginate(20);
|
||||
}
|
||||
|
||||
public function getContentCategoryById($ContentCategoryId)
|
||||
{
|
||||
return ContentCategory::findOrFail($ContentCategoryId);
|
||||
}
|
||||
|
||||
public function getContentCategoryList()
|
||||
{
|
||||
return ContentCategory::pluck('title', 'id');
|
||||
}
|
||||
|
||||
public function delete($ContentCategoryId)
|
||||
{
|
||||
ContentCategory::destroy($ContentCategoryId);
|
||||
}
|
||||
|
||||
public function create($ContentCategoryDetails)
|
||||
{
|
||||
return ContentCategory::create($ContentCategoryDetails);
|
||||
}
|
||||
|
||||
public function update($ContentCategoryId, array $newDetails)
|
||||
{
|
||||
return ContentCategory::whereId($ContentCategoryId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck(){
|
||||
return ContentCategory::pluck('title', 'id');
|
||||
}
|
||||
public function count(){
|
||||
return ContentCategory::count();
|
||||
}
|
||||
}
|
62
Modules/Content/app/Repositories/ContentRepository.php
Normal file
62
Modules/Content/app/Repositories/ContentRepository.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Repositories;
|
||||
|
||||
use Modules\Content\Interfaces\ContentInterface;
|
||||
use Modules\Content\Models\Content;
|
||||
|
||||
class ContentRepository implements ContentInterface
|
||||
{
|
||||
|
||||
public function findAll()
|
||||
{
|
||||
return Content::all();
|
||||
}
|
||||
|
||||
public function findAllUpcomingScheduledContent()
|
||||
{
|
||||
|
||||
return Content::when(true, function($query){
|
||||
if (auth()->user()->hasRole('employee')) {
|
||||
$query->where("createdby", auth()->user()->id);
|
||||
}
|
||||
})
|
||||
->where('status', 12)
|
||||
->whereDate('release_date', '>=', now())
|
||||
->get();
|
||||
}
|
||||
|
||||
public function getContentById($ContentId)
|
||||
{
|
||||
return Content::findOrFail($ContentId);
|
||||
}
|
||||
|
||||
public function getContentByEmail($email)
|
||||
{
|
||||
return Content::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($ContentId)
|
||||
{
|
||||
Content::destroy($ContentId);
|
||||
}
|
||||
|
||||
public function create($ContentDetails)
|
||||
{
|
||||
return Content::create($ContentDetails);
|
||||
}
|
||||
|
||||
public function update($ContentId, array $newDetails)
|
||||
{
|
||||
return Content::whereId($ContentId)->update($newDetails);
|
||||
}
|
||||
public function pluck()
|
||||
{
|
||||
return Content::pluck('title', 'id');
|
||||
}
|
||||
public function count()
|
||||
{
|
||||
return Content::count();
|
||||
}
|
||||
|
||||
}
|
30
Modules/Content/composer.json
Normal file
30
Modules/Content/composer.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "nwidart/content",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Content\\": "app/",
|
||||
"Modules\\Content\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Content\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Content\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Content/config/.gitkeep
Normal file
0
Modules/Content/config/.gitkeep
Normal file
5
Modules/Content/config/config.php
Normal file
5
Modules/Content/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Content',
|
||||
];
|
0
Modules/Content/database/factories/.gitkeep
Normal file
0
Modules/Content/database/factories/.gitkeep
Normal file
0
Modules/Content/database/migrations/.gitkeep
Normal file
0
Modules/Content/database/migrations/.gitkeep
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('contents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title')->nullable();
|
||||
$table->unsignedBigInteger('product_id')->nullable();
|
||||
$table->unsignedBigInteger('category_id')->nullable();
|
||||
$table->date('release_date')->nullable();
|
||||
$table->time('release_time')->nullable();
|
||||
$table->longText('desc')->nullable();
|
||||
$table->string('caption')->nullable();
|
||||
$table->string('creative')->nullable();
|
||||
$table->integer('order')->nullable();
|
||||
$table->integer('status')->default(11);
|
||||
$table->longText('remarks')->nullable();
|
||||
$table->unsignedBigInteger('createdby')->nullable();
|
||||
$table->unsignedBigInteger('updatedby')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contents');
|
||||
}
|
||||
};
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('content_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title')->nullable();
|
||||
$table->longText('desc')->nullable();
|
||||
$table->integer('order')->nullable();
|
||||
$table->integer('status')->default(11);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('content_categories');
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('content_schedules', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('client_id')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('content_schedules');
|
||||
}
|
||||
};
|
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('content_schedule_details', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('content_schedule_id');
|
||||
$table->unsignedBigInteger('content_category_id');
|
||||
$table->unsignedBigInteger('product_id');
|
||||
$table->date('release_date');
|
||||
$table->time('time');
|
||||
$table->integer('status')->default(12);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('content_schedule_details');
|
||||
}
|
||||
};
|
0
Modules/Content/database/seeders/.gitkeep
Normal file
0
Modules/Content/database/seeders/.gitkeep
Normal file
16
Modules/Content/database/seeders/ContentDatabaseSeeder.php
Normal file
16
Modules/Content/database/seeders/ContentDatabaseSeeder.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Content\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ContentDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
11
Modules/Content/module.json
Normal file
11
Modules/Content/module.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Content",
|
||||
"alias": "content",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Content\\Providers\\ContentServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Content/package.json
Normal file
15
Modules/Content/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^1.1.2",
|
||||
"laravel-vite-plugin": "^0.7.5",
|
||||
"sass": "^1.69.5",
|
||||
"postcss": "^8.3.7",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
0
Modules/Content/resources/assets/.gitkeep
Normal file
0
Modules/Content/resources/assets/.gitkeep
Normal file
0
Modules/Content/resources/assets/js/app.js
Normal file
0
Modules/Content/resources/assets/js/app.js
Normal file
0
Modules/Content/resources/assets/sass/app.scss
Normal file
0
Modules/Content/resources/assets/sass/app.scss
Normal file
0
Modules/Content/resources/views/.gitkeep
Normal file
0
Modules/Content/resources/views/.gitkeep
Normal file
@@ -0,0 +1,14 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
|
||||
{{ html()->form('POST')->route('contentCategory.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('content::content-category.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
|
@@ -0,0 +1,18 @@
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('contentCategory.show')
|
||||
<a href="javascript:void(0);" data-link="{{ route('contentCategory.show', $id) }}"
|
||||
class="link-secondary fs-15 view-item-btn">
|
||||
<i class="ri-eye-fill"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('contentCategory.edit')
|
||||
<a href="javascript:void(0);" data-link="{{ route('contentCategory.edit', $id) }}"
|
||||
class="link-primary fs-15 edit-item-btn"><i class="ri-edit-2-fill"></i></a>
|
||||
@endcan
|
||||
|
||||
@can('contentCategory.destroy')
|
||||
<a href="javascript:void(0);" data-link="{{ route('contentCategory.destroy', $id) }}" data-id="{{ $id }}"
|
||||
class="link-danger fs-15 remove-item"><i class="ri-delete-bin-fill"></i></a>
|
||||
@endcan
|
||||
|
||||
</div>
|
@@ -0,0 +1,26 @@
|
||||
{{ html()->modelForm($contentCategory, 'PUT')->route('contentCategory.update', $contentCategory->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
<div class="row gy-1">
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Title')->class('form-label') }}
|
||||
{{ html()->text('title')->class('form-control')->placeholder('Title')->required() }}
|
||||
{{ html()->div('Please Enter Title')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Status')->class('form-label') }}
|
||||
{{ html()->select('status', $status)->class('form-control select2') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->textarea('desc')->class('form-control')->placeholder('Enter Desc') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mt-2 text-end">
|
||||
<button type="submit" class="btn btn-success btn-sm w-sm">Update</button>
|
||||
</div>
|
||||
{{ html()->closeModelForm() }}
|
@@ -0,0 +1,88 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
{{ html()->form('POST')->route('contentCategory.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('content::content-category.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-9">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@php
|
||||
$columns = [
|
||||
[
|
||||
'title' => 'SN',
|
||||
'data' => 'DT_RowIndex',
|
||||
'name' => 'DT_RowIndex',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
],
|
||||
['title' => 'Title', 'data' => 'title', 'name' => 'title'],
|
||||
['title' => 'Description', 'data' => 'desc', 'name' => 'desc'],
|
||||
['title' => 'Status', 'data' => 'status', 'name' => 'status'],
|
||||
['title' => 'Action', 'data' => 'action', 'orderable' => false, 'searchable' => false],
|
||||
];
|
||||
@endphp
|
||||
<x-data-table-script :route="route('contentCategory.index')" :columns="$columns" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="viewModalgridLabel" aria-modal="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="viewModalgridLabel"></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$('body').on('click', '.edit-item-btn', function(event) {
|
||||
event.preventDefault()
|
||||
const url = $(this).data('link')
|
||||
modalFunction(url)
|
||||
})
|
||||
|
||||
$('body').on('click', '.view-item-btn', function(event) {
|
||||
event.preventDefault()
|
||||
const url = $(this).data('link')
|
||||
modalFunction(url)
|
||||
})
|
||||
|
||||
const modalFunction = (url) => {
|
||||
let myModalEl = $('#itemModal')
|
||||
myModalEl.find('.modal-title').text('View')
|
||||
var myModal = new bootstrap.Modal(myModalEl, {
|
||||
keyboard: false
|
||||
})
|
||||
|
||||
$.get(url, function(res, status) {
|
||||
myModalEl.find('.modal-body').html(res.view);
|
||||
myModal.toggle();
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@endpush
|
@@ -0,0 +1,88 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-title border-bottom">
|
||||
<h4 class="fs-12">Add Content Category</h4>
|
||||
</div>
|
||||
<div class="row gy-1">
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Title')->class('form-label') }}
|
||||
{{ html()->text('title')->class('form-control')->placeholder('Title')->required() }}
|
||||
{{ html()->div('Please Enter Title')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->textarea('desc')->class('form-control')->placeholder('Enter Desc') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-2 text-end">
|
||||
<a href="{{ route('contentCategory.index') }}" class="btn btn-danger btn-sm w-sm">Cancel</a>
|
||||
<button type="submit" class="btn btn-success btn-sm w-sm">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
|
||||
|
||||
{{-- <div class="row">
|
||||
<div class="col-lg-9">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row gy-3">
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Title')->class('form-label') }}
|
||||
{{ html()->text('title')->class('form-control')->placeholder('Title')->required() }}
|
||||
{{ html()->div('Please Enter Title')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->textarea('desc')->class('form-control ckeditor-classic') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="col-lg-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-0">Publish</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row gy-3">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Status')->class('form-label') }}
|
||||
{{ html()->select('status', $status)->class('form-control select2') }}
|
||||
</div>
|
||||
|
||||
<x-form-buttons :editable="$editable" label="Add" href="{{ route('contentCategory.index') }}" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
@@ -0,0 +1,8 @@
|
||||
<ul class="list-inline d-flex flex-column flex-wrap gap-2">
|
||||
<li class="list-inline-item">
|
||||
Title: <span class="fw-medium">{{ $contentCategory->title }}</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
Description: <span class="fw-medium">{!! $contentCategory->desc !!}</span>
|
||||
</li>
|
||||
</ul>
|
35
Modules/Content/resources/views/content/all.blade.php
Normal file
35
Modules/Content/resources/views/content/all.blade.php
Normal file
@@ -0,0 +1,35 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
|
||||
@include('content::content.partials.filter')
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@php
|
||||
$columns = [
|
||||
[
|
||||
'title' => 'SN',
|
||||
'data' => 'DT_RowIndex',
|
||||
'name' => 'DT_RowIndex',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
],
|
||||
['title' => 'Title', 'data' => 'title', 'name' => 'title'],
|
||||
['title' => 'Product', 'data' => 'product', 'name' => 'product'],
|
||||
['title' => 'Category', 'data' => 'category', 'name' => 'category'],
|
||||
['title' => 'Created By', 'data' => 'createdby', 'name' => 'createdby'],
|
||||
['title' => 'Status', 'data' => 'status', 'name' => 'status'],
|
||||
['title' => 'Action', 'data' => 'action', 'orderable' => false, 'searchable' => false],
|
||||
];
|
||||
@endphp
|
||||
|
||||
<x-data-table-script :route="route('content.index')" :columns="$columns" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
12
Modules/Content/resources/views/content/create.blade.php
Normal file
12
Modules/Content/resources/views/content/create.blade.php
Normal file
@@ -0,0 +1,12 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
{{ html()->form('POST')->route('content.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('content::content.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
@endsection
|
@@ -0,0 +1,15 @@
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('content.show')
|
||||
<a href="{{ route('content.show', $id) }}" class="link-secondary fs-15 view-item-btn"><i class="ri-eye-fill"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('content.edit')
|
||||
<a href="{{ route('content.edit', $id) }}" class="link-primary fs-15 edit-item-btn"><i class="ri-edit-2-fill"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('content.destroy')
|
||||
<a href="javascript:void(0);" data-link="{{ route('content.destroy', $id) }}" data-id="{{ $id }}"
|
||||
class="link-danger fs-15 remove-item-btn"><i class="ri-delete-bin-fill"></i></a>
|
||||
@endcan
|
||||
|
||||
</div>
|
21
Modules/Content/resources/views/content/edit.blade.php
Normal file
21
Modules/Content/resources/views/content/edit.blade.php
Normal file
@@ -0,0 +1,21 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
|
||||
{{ html()->modelForm($content, 'PUT')->route('content.update', $content->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
@include('content::content.partials.action')
|
||||
|
||||
{{ html()->closeModelForm() }}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@endsection
|
||||
|
||||
|
46
Modules/Content/resources/views/content/index.blade.php
Normal file
46
Modules/Content/resources/views/content/index.blade.php
Normal file
@@ -0,0 +1,46 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
|
||||
@include('content::content.partials.filter')
|
||||
|
||||
|
||||
<div class="mb-1 text-end">
|
||||
@can('content.create')
|
||||
<a href="{{ route('content.create') }}" class="btn btn-primary btn-sm waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create</a>
|
||||
@endcan
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{{-- @dd($status) --}}
|
||||
@php
|
||||
$columns = [
|
||||
[
|
||||
'title' => 'SN',
|
||||
'data' => 'DT_RowIndex',
|
||||
'name' => 'DT_RowIndex',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
],
|
||||
['title' => 'Title', 'data' => 'title', 'name' => 'title'],
|
||||
['title' => 'Product', 'data' => 'product', 'name' => 'product'],
|
||||
['title' => 'Category', 'data' => 'category', 'name' => 'category'],
|
||||
// ['title' => 'Created Date', 'data' => 'created_at', 'name' => 'created_at'],
|
||||
['title' => 'Created By', 'data' => 'createdby', 'name' => 'createdby'],
|
||||
['title' => 'Status', 'data' => 'status', 'name' => 'status'],
|
||||
['title' => 'Action', 'data' => 'action', 'orderable' => false, 'searchable' => false],
|
||||
];
|
||||
@endphp
|
||||
|
||||
<x-data-table-script :route="route('content.draft')" :columns="$columns" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@@ -0,0 +1,82 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="event-details rounded border p-3">
|
||||
<div class="d-flex mb-2">
|
||||
<div class="flex-grow-1 d-flex align-items-center">
|
||||
<div class="me-3 flex-shrink-0">
|
||||
<i class="ri-text text-muted fs-16"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h6 class="d-block fw-semibold mb-0" id="event-start-date-tag">{{ $content->title }}</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
<div class="me-3 flex-shrink-0">
|
||||
<i class="ri-calendar-event-line text-muted fs-16"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h6 class="d-block fw-semibold mb-0">{{ $content->release_date?->format('Y-m-d') }}
|
||||
{{ $content->release_time?->format('h:i A') }} {!! $content->status_name !!}</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
<div class="me-3 flex-shrink-0">
|
||||
<i class="ri-map-pin-user-fill text-muted fs-16"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h6 class="d-block fw-semibold mb-0">{{ $content->product?->client?->name }}</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
<div class="me-3 flex-shrink-0">
|
||||
<i class="ri-product-hunt-line text-muted fs-16"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h6 class="d-block fw-semibold mb-0"> <span id="event-location-tag">{{ $content->product?->name }}</span></h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="me-3 flex-shrink-0">
|
||||
<i class="ri-menu-2-line text-muted fs-16"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<p class="d-block text-muted mb-0" id="event-description-tag">{{ $content->category?->title }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($content->status != 13)
|
||||
<div class="col-12 mt-3">
|
||||
<form id="contentForm" action="{{ route('content.updateStatus', $content->id) }}" method="POST">
|
||||
@csrf
|
||||
<div class="row g-3">
|
||||
|
||||
{{ html()->hidden('id', $content->id) }}
|
||||
|
||||
<div class="col-12">
|
||||
<div>
|
||||
{{ html()->label('Status')->for('status')->class('form-label') }}
|
||||
{{ html()->select('status', config('constants.content_status_options'), 12)->id('status')->class('form-control')->required(true) }}
|
||||
</div>
|
||||
</div><!--end col-->
|
||||
|
||||
<div class="col-12">
|
||||
<div>
|
||||
{{ html()->label('Remarks')->for('approval_remarks')->class('form-label') }}
|
||||
{{ html()->textarea('remarks')->id('remarks')->class('form-control')->attributes(['rows' => 3])->required(true) }}
|
||||
</div>
|
||||
</div><!--end col-->
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="hstack justify-content-end gap-2">
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Close</button>
|
||||
<button id="submit" type="submit" class="btn btn-primary">Update</button>
|
||||
</div>
|
||||
</div><!--end col-->
|
||||
</div><!--end row-->
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
@@ -0,0 +1,96 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row gy-3">
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Title')->class('form-label') }}
|
||||
{{ html()->text('title')->class('form-control')->placeholder('Title')->required() }}
|
||||
{{ html()->div('Please Enter Title')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Product')->class('form-label') }}
|
||||
{{ html()->select('product_id', $products)->class('form-control select2')->placeholder('Select Product')->required() }}
|
||||
{{ html()->div('Please Select Product')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Category')->class('form-label') }}
|
||||
{{ html()->select('category_id', $categories)->class('form-control select2')->placeholder('Select Category') }}
|
||||
{{ html()->div('Please Select Category')->class('invalid-feedback') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Caption')->class('form-label') }}
|
||||
{{ html()->textarea('caption')->class('form-control ckeditor-classic') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="col-lg-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-0">Publish</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row gy-3">
|
||||
@php
|
||||
$filteredStatus = array_filter(
|
||||
$status,
|
||||
function ($key) {
|
||||
return $key == 11; // Only include 'Draft'
|
||||
},
|
||||
ARRAY_FILTER_USE_KEY,
|
||||
);
|
||||
@endphp
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Status')->class('form-label') }}
|
||||
{{ html()->select('status', $filteredStatus)->class('form-control select2') }}
|
||||
</div>
|
||||
|
||||
<x-form-buttons :editable="$editable" label="Add" href="{{ route('content.index') }}" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-0">Document</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Image')->class('form-label visually-hidden') }}
|
||||
{{ html()->file('creative')->class('form-control dropify')->attributes([
|
||||
'data-default-file' => $editable ? asset('storage/' . $content?->creative) : null,
|
||||
'data-height' => 200,
|
||||
]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
@@ -0,0 +1,62 @@
|
||||
<div class="card bg-light">
|
||||
<div class="card-header border-bottom-dashed">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="flex-grow-1">
|
||||
<h6 class="card-title mb-0">Advance Filter</h6>
|
||||
</div>
|
||||
<div class="flex-shrink-0">
|
||||
<ul class="list-inline card-toolbar-menu d-flex align-items-center mb-0">
|
||||
|
||||
<li class="list-inline-item">
|
||||
<a class="minimize-card align-middle" data-bs-toggle="collapse" href="#collapseExample2" role="button"
|
||||
aria-expanded="false" aria-controls="collapseExample2">
|
||||
<i class="mdi mdi-plus plus align-middle"></i>
|
||||
<i class="mdi mdi-minus minus align-middle"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body show collapse" id="collapseExample2">
|
||||
{{ html()->form('GET')->id('filter-form')->open() }}
|
||||
<div class="row">
|
||||
<div class="col-sm-3 mb-1">
|
||||
{{ html()->label('Search')->class('form-label') }}
|
||||
<div class="search-box">
|
||||
{{ html()->text('search')->class('form-control form-control-sm')->placeholder('Search...') }}
|
||||
<i class="ri-search-line search-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 mb-1">
|
||||
{{ html()->label('Date')->class('form-label') }}
|
||||
{{ html()->text('date')->class('form-control form-control-sm daterange-custom-picker')->value(request('date'))->placeholder('Date Range')}}
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 mb-1">
|
||||
{{ html()->label('Status')->class('form-label') }}
|
||||
{{ html()->select('status', $status)->placeholder('Select Status')->value(request('status'))->class('form-control form-control-sm') }}
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 mb-1">
|
||||
{{ html()->label('Product')->class('form-label') }}
|
||||
{{ html()->select('product_id', $products)->placeholder('Select Product')->value(request('product_id'))->class('form-control form-control-sm') }}
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 mb-1">
|
||||
{{ html()->label('Category')->class('form-label') }}
|
||||
{{ html()->select('category_id', $categories)->placeholder('Select Category')->value(request('category_id'))->class('form-control form-control-sm') }}
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-center list-grid-nav hstack mt-2 gap-1">
|
||||
<button type="submit" class="btn btn-warning btn-sm">Filter</button>
|
||||
<a href="{{ route(Route::currentRouteName()) }}" class="btn btn-danger btn-sm reset-filter">Reset</a>
|
||||
</div>
|
||||
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
180
Modules/Content/resources/views/content/show.blade.php
Normal file
180
Modules/Content/resources/views/content/show.blade.php
Normal file
@@ -0,0 +1,180 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card mt-n4 mx-n4">
|
||||
<div class="bg-warning-subtle">
|
||||
<div class="card-body px-4 pb-0">
|
||||
<div class="row mb-3">
|
||||
<div class="col-md">
|
||||
<div class="row align-items-center g-3">
|
||||
<div class="col-md">
|
||||
<div>
|
||||
<h4 class="fw-bold">{{ $content->title }}</h4>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
<div>{!! nl2br($content->caption) !!}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-auto">
|
||||
<div class="hstack flex-wrap gap-1">
|
||||
{{-- @can('content.changeStatus') --}}
|
||||
<a href="javascript:void(0);" class="btn btn-success" data-bs-toggle="modal"
|
||||
data-bs-target="#contentApproveModal">
|
||||
<i class="ri-timer-line me-1 align-bottom"></i> Schedule Now
|
||||
</a>
|
||||
{{-- @endcan --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs-custom border-bottom-0" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link active fw-semibold" data-bs-toggle="tab" href="#project-overview"
|
||||
role="tab" aria-selected="true">Overview</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="tab-content text-muted">
|
||||
<div class="tab-pane fade show active" id="project-overview" role="tabpanel">
|
||||
<div class="row">
|
||||
<div class="col-xl-9 col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="text-muted">
|
||||
<h6 class="fw-semibold text-uppercase mb-3">Summary</h6>
|
||||
<table class="table table-borderless mb-0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Product</span></th>
|
||||
<td>{{ $content->product?->name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Client</span></th>
|
||||
<td>{{ $content->product?->client?->name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Category</span></th>
|
||||
<td>{{ $content->category?->title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Description</span></th>
|
||||
<td>{!! $content->caption !!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Status</span></th>
|
||||
<td>{!! $content->status_name !!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Schedule Detail</span></th>
|
||||
<td>
|
||||
@if (config('constants.content_status_options')[$content->status] == 'Scheduled')
|
||||
<span>{{ $content->release_date }}</span>
|
||||
<span>{{ \Carbon\Carbon::parse($content->release_time)?->format('h:i A') }}</span>
|
||||
@else
|
||||
<span class="text-danger">Not Scheduled</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-3 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-header align-items-center d-flex border-bottom-dashed">
|
||||
<h4 class="card-title flex-grow-1 mb-0">Attachment</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-body text-center">
|
||||
@if ($content->creative)
|
||||
@php
|
||||
$fileExtension = pathinfo(
|
||||
$content->creative,
|
||||
PATHINFO_EXTENSION,
|
||||
);
|
||||
$isImage = in_array(strtolower($fileExtension), [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
'gif',
|
||||
'bmp',
|
||||
'webp',
|
||||
]);
|
||||
@endphp
|
||||
|
||||
@if ($isImage)
|
||||
<img src="{{ asset('storage/' . $content->creative) }}"
|
||||
alt="Attachment Image" height="100" id="attachmentImage"
|
||||
style="cursor: pointer;">
|
||||
@else
|
||||
<i class="ri-file-line" style="font-size: 50px;"></i>
|
||||
@endif
|
||||
|
||||
<div class="mt-3">
|
||||
<!-- Download Button -->
|
||||
<a href="{{ asset('storage/' . $content->creative) }}" download
|
||||
class="btn btn-primary btn-sm">
|
||||
<i class="ri-download-2-line"></i> Download
|
||||
</a>
|
||||
|
||||
<!-- Zoom-In Button -->
|
||||
@if ($isImage)
|
||||
<button class="btn btn-secondary btn-sm" id="zoomInButton"
|
||||
data-bs-toggle="modal" data-bs-target="#zoomModal">
|
||||
<i class="ri-zoom-in-line"></i> Zoom In
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<p class="text-muted">No Attachment Available</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="zoomModal" tabindex="-1" aria-labelledby="zoomModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
</div>
|
||||
<div class="modal-body text-center">
|
||||
<img src="{{ asset('storage/' . $content->creative) }}" alt="Zoomed Attachment" class="img-fluid"
|
||||
id="zoomedImage">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<x-approve-modal :data="$content" route="{{ route('content.schedule') }}" name="content" :statusList="$statusList" />
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#zoomInButton').on('click', function() {
|
||||
let src = $('#attachmentImage').attr('src');
|
||||
$('#zoomedImage').attr('src', src);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
13
Modules/Content/resources/views/content1/create.blade.php
Normal file
13
Modules/Content/resources/views/content1/create.blade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
|
||||
{{ html()->form('POST')->route('content.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('content::content.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
@endsection
|
@@ -0,0 +1,9 @@
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
<a href="javascript:void(0);" class="link-info fs-15 view-item-btn" data-bs-toggle="modal" data-bs-target="#viewModal">
|
||||
<i class="ri-eye-fill"></i>
|
||||
</a>
|
||||
<a href="{{ route('content.edit', $id) }}" class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-fill"></i></a>
|
||||
|
||||
<a href="javascript:void(0);" data-link="{{ route('content.destroy', $id) }}" data-id="{{ $id }}"
|
||||
class="link-danger fs-15 remove-item"><i class="ri-delete-bin-fill"></i></a>
|
||||
</div>
|
18
Modules/Content/resources/views/content1/edit.blade.php
Normal file
18
Modules/Content/resources/views/content1/edit.blade.php
Normal file
@@ -0,0 +1,18 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
|
||||
{{ html()->modelForm($content, 'PUT')->route('content.update', $content->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
@include('content::content.partials.action')
|
||||
|
||||
{{ html()->closeModelForm() }}
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
34
Modules/Content/resources/views/content1/index.blade.php
Normal file
34
Modules/Content/resources/views/content1/index.blade.php
Normal file
@@ -0,0 +1,34 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">{{ $title }}</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('content.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@php
|
||||
$columns = [
|
||||
['title' => 'ID', 'data' => 'id', 'name' => 'id'],
|
||||
['title' => 'Title', 'data' => 'title', 'name' => 'title'],
|
||||
['title' => 'Product', 'data' => 'product', 'name' => 'product'],
|
||||
['title' => 'Category', 'data' => 'category', 'name' => 'category'],
|
||||
['title' => 'Created Date', 'data' => 'created_at', 'name' => 'created_at'],
|
||||
['title' => 'Status', 'data' => 'status', 'name' => 'status'],
|
||||
['title' => 'Action', 'data' => 'action', 'orderable' => false, 'searchable' => false],
|
||||
];
|
||||
@endphp
|
||||
|
||||
<x-data-table-script :route="route('content.index')" :columns="$columns" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@@ -0,0 +1,107 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row gy-3">
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Title')->class('form-label') }}
|
||||
{{ html()->text('title')->class('form-control')->placeholder('Title')->required() }}
|
||||
{{ html()->div('Please Enter Title')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-md-6">
|
||||
{{ html()->label('Date')->class('form-label') }}
|
||||
{{ html()->date('date')->class('form-control flatpickr-date')->placeholder('Date')->required() }}
|
||||
{{ html()->div('Please Enter Date')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Release Date')->class('form-label') }}
|
||||
{{ html()->date('release_date')->class('form-control flatpickr-date')->placeholder('Release Date')->required() }}
|
||||
{{ html()->div('Please Enter Release Date')->class('invalid-feedback') }}
|
||||
</div> --}}
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Product')->class('form-label') }}
|
||||
{{ html()->select('product_id', $products)->class('form-control select2')->placeholder('Select Product')->required() }}
|
||||
{{ html()->div('Please Select Product')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Category')->class('form-label') }}
|
||||
{{ html()->select('category_id', $categories)->class('form-control select2')->placeholder('Select Category') }}
|
||||
{{ html()->div('Please Select Category')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-md-6">
|
||||
{{ html()->label('Upload Document')->class('form-label') }}
|
||||
{{ html()->file('creative')->class('form-control') }}
|
||||
</div> --}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Caption')->class('form-label') }}
|
||||
{{ html()->textarea('caption')->class('form-control ckeditor-classic') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="col-lg-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-0">Publish</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Status')->class('form-label') }}
|
||||
{{ html()->select('status', $status)->class('form-control select21') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-0">Document</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Image')->class('form-label visually-hidden') }}
|
||||
{{ html()->file('creative')->class('form-control dropify')->attributes([
|
||||
'data-default-file' => $editable ? asset('storage/' . $content?->creativedocument_path) : null,
|
||||
'data-height' => 200,
|
||||
]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
|
||||
<div class="py-2 text-end">
|
||||
<x-form-buttons :editable="$editable" label="Add" href="{{ route('content.index') }}" />
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
39
Modules/Content/resources/views/content1/show.blade.php
Normal file
39
Modules/Content/resources/views/content1/show.blade.php
Normal file
@@ -0,0 +1,39 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<x-dashboard.breadcumb :title="$title" />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-body p-4">
|
||||
<div>
|
||||
<div class="table-responsive">
|
||||
<table class="table-borderless mb-0 table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Content Caption</span></th>
|
||||
<td>{{ $content->caption }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Desc</span></th>
|
||||
<td>{{ $content->description }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('client.index') }}" class="btn btn-secondary w-sm">Back</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
7
Modules/Content/resources/views/index.blade.php
Normal file
7
Modules/Content/resources/views/index.blade.php
Normal file
@@ -0,0 +1,7 @@
|
||||
@extends('content::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>Module: {!! config('content.name') !!}</p>
|
||||
@endsection
|
29
Modules/Content/resources/views/layouts/master.blade.php
Normal file
29
Modules/Content/resources/views/layouts/master.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>Content Module - {{ config('app.name', 'Laravel') }}</title>
|
||||
|
||||
<meta name="description" content="{{ $description ?? '' }}">
|
||||
<meta name="keywords" content="{{ $keywords ?? '' }}">
|
||||
<meta name="author" content="{{ $author ?? '' }}">
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
||||
|
||||
{{-- Vite CSS --}}
|
||||
{{-- {{ module_vite('build-content', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-content', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
0
Modules/Content/routes/.gitkeep
Normal file
0
Modules/Content/routes/.gitkeep
Normal file
19
Modules/Content/routes/api.php
Normal file
19
Modules/Content/routes/api.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Content\Http\Controllers\ContentController;
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------------------
|
||||
* API Routes
|
||||
*--------------------------------------------------------------------------
|
||||
*
|
||||
* Here is where you can register API routes for your application. These
|
||||
* routes are loaded by the RouteServiceProvider within a group which
|
||||
* is assigned the "api" middleware group. Enjoy building your API!
|
||||
*
|
||||
*/
|
||||
|
||||
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
|
||||
Route::apiResource('content', ContentController::class)->names('content');
|
||||
});
|
27
Modules/Content/routes/web.php
Normal file
27
Modules/Content/routes/web.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Content\Http\Controllers\ContentCategoryController;
|
||||
use Modules\Content\Http\Controllers\ContentController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group(['middleware' => ['web', 'auth', 'permission'], 'prefix' => 'admin/'], function () {
|
||||
|
||||
Route::post('content/schedule', [ContentController::class, 'schedule'])->name('content.schedule');
|
||||
Route::get('content-draft', [ContentController::class, 'draft'])->name('content.draft');
|
||||
Route::post('content/update-status/{id}', [ContentController::class, 'updateStatus'])->name('content.updateStatus');
|
||||
Route::get('content/partials/edit/{id}', [ContentController::class, 'getContentModal'])->name('content.partials.edit');
|
||||
Route::resource('content', ContentController::class)->names('content');
|
||||
|
||||
Route::resource('content-category', ContentCategoryController::class)->names('contentCategory');
|
||||
});
|
0
Modules/Content/tests/Feature/.gitkeep
Normal file
0
Modules/Content/tests/Feature/.gitkeep
Normal file
0
Modules/Content/tests/Unit/.gitkeep
Normal file
0
Modules/Content/tests/Unit/.gitkeep
Normal file
26
Modules/Content/vite.config.js
Normal file
26
Modules/Content/vite.config.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: '../../public/build-content',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-content',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/Content/resources/assets/sass/app.scss',
|
||||
// 'Modules/Content/resources/assets/js/app.js',
|
||||
//];
|
Reference in New Issue
Block a user