first change

This commit is contained in:
2025-07-27 17:40:56 +05:45
commit f8b9a6725b
3152 changed files with 229528 additions and 0 deletions

View File

@@ -0,0 +1,178 @@
<?php
namespace Modules\Reminder\Http\Controllers;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail;
use Modules\Employee\Models\Employee;
use Modules\Employee\Interfaces\EmployeeInterface;
use Modules\Reminder\Models\Reminder;
use Modules\Template\Emails\SendMail;
use Modules\Template\Repositories\TemplateRepository;
class ReminderController extends Controller
{
private $employee;
/**
* Display a listing of the resource.
*/
public function __construct(
EmployeeInterface $employee,
) {
$this->employee = $employee;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Reminder Lists';
$reminders = Reminder::all()->map(function ($reminder) {
$reminder->assignedEmployees = collect($reminder->members['ids'] ?? [])
->map(function ($id) {
return $this->employee->getEmployeeById($id);
})
->filter();
return $reminder;
});
if (auth()->user()->hasRole('employee')) {
$userId = auth()->user()->employee_id;
$reminders = $reminders->filter(function ($reminder) use ($userId) {
$memberIds = collect($reminder->members['ids'] ?? []);
return $reminder->createdBy == $userId || $memberIds->contains($userId);
});
}
$data['reminderLists'] = $reminders;
return view('reminder::reminder.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Reminder';
$data['editable'] = false;
$data['employeeList'] = $this->employee->pluck(1);
return view('reminder::reminder.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$inputData = $request->except('_token');
$inputData['createdBy'] = Auth::user()->id;
if (auth()->user()->hasRole('employee')) {
$inputData['createdBy'] = auth()->user()->employee_id;
}
$reminderDateTime = Carbon::createFromFormat('Y-m-d H:i', $inputData['reminder_date'] . ' ' . $inputData['reminder_time'], config('app.timezone'));
if ($reminderDateTime->isPast()) {
flash()->error('The reminder date and time must be in the future.');
return back()->withInput();
}
$uploadedFiles = [];
if ($request->hasFile('files')) {
$files = $request->file('files');
if (is_array($files)) {
foreach ($files as $file) {
$uploadedFiles[] = uploadImage($file, 'uploads/reminders/files');
}
} else {
$uploadedFiles[] = uploadImage($files, 'uploads/reminders/files');
}
}
$inputData['files'] = $uploadedFiles;
$reminder = Reminder::create($inputData);
if (config('app.send_mail')) {
$templateModel = (new TemplateRepository())->where(['alias' => 'reminder-template'])->first();
$message = $templateModel->message;
$message = str_replace('#image', asset('storage/' . setting('logo_pic')), $message);
$message = str_replace('#reminder_title', $reminder->title, $message);
$message = str_replace('#reminder_desc', $reminder->description, $message);
$message = str_replace('#reminder_date', Carbon::parse($reminder->reminder_date)->format('d M, Y'), $message);
$message = str_replace('#reminder_time', Carbon::parse($reminder->reminder_time)->format('h:i A'), $message);
$members = $reminder->members ?? [];
foreach ($members as $memberId) {
$employee = $this->employee->getEmployeeById($memberId);
$data = [
'subject' => "New Reminder Assigned: $reminder->title",
'body' => $message,
];
$mail = new SendMail($data);
if (!empty($uploadedFiles)) {
foreach ($uploadedFiles as $filePath) {
$mail->attach(storage_path('app/' . $filePath), [
'as' => basename($filePath),
'mime' => mime_content_type(storage_path('app/' . $filePath))
]);
}
}
Mail::to($employee->email)->send($mail);
}
}
flash()->success('Reminder created successfully!');
return to_route('reminder.index');
}
/**
* Show the specified resource.
*/
public function show(Reminder $reminder)
{
$data['title'] = 'Show Reminder';
$data['reminder'] = $reminder;
return view('reminder::reminder.show', $data);
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Reminder $reminder)
{
$originalFiles = json_decode($reminder->getRawOriginal('files'));
if (!empty($originalFiles) && is_array($originalFiles)) {
foreach ($originalFiles as $filePath) {
removeFileFromStorage($filePath);
}
}
$reminder->delete();
return response()->json([
'success' => true,
'message' => 'Reminder deleted successfully!'
]);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Modules\Reminder\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Employee\Models\Employee;
use Modules\Reminder\Database\Factories\ReminderFactory;
class Reminder extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'members',
'files',
'reminder_date',
'reminder_time',
'createdBy',
'description',
];
/**
* The attributes that should be cast to native types.
*/
protected $casts = [
'members' => 'array',
'files' => 'array',
'reminder_date' => 'date',
'reminder_time' => 'datetime',
];
}

View File

View File

@@ -0,0 +1,32 @@
<?php
namespace Modules\Reminder\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
{
}
}

View File

@@ -0,0 +1,120 @@
<?php
namespace Modules\Reminder\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class ReminderServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Reminder';
protected string $moduleNameLower = 'reminder';
/**
* 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->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;
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Modules\Reminder\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('Reminder', '/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('Reminder', '/routes/api.php'));
}
}

View File

@@ -0,0 +1,30 @@
{
"name": "nwidart/reminder",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Reminder\\": "app/",
"Modules\\Reminder\\Database\\Factories\\": "database/factories/",
"Modules\\Reminder\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\Reminder\\Tests\\": "tests/"
}
}
}

View File

View File

@@ -0,0 +1,5 @@
<?php
return [
'name' => 'Reminder',
];

View File

@@ -0,0 +1,36 @@
<?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('reminders', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->json('members');
$table->json('files')->nullable();
$table->date('reminder_date');
$table->time('reminder_time');
$table->unsignedBigInteger('createdBy');
$table->longText('description')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('reminders');
}
};

View File

@@ -0,0 +1,16 @@
<?php
namespace Modules\Reminder\Database\Seeders;
use Illuminate\Database\Seeder;
class ReminderDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}

View File

@@ -0,0 +1,11 @@
{
"name": "Reminder",
"alias": "reminder",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Reminder\\Providers\\ReminderServiceProvider"
],
"files": []
}

View 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"
}
}

View 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>Reminder 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-reminder', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-reminder', 'resources/assets/js/app.js') }} --}}
</body>

View File

@@ -0,0 +1,16 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<x-dashboard.breadcumb :title="$title" />
{{ html()->form('POST')->route('reminder.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('reminder::reminder.partials.action')
{{ html()->form()->close() }}
</div>
</div>
@endsection

View File

@@ -0,0 +1,12 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<x-dashboard.breadcumb :title="$title" />
{{ html()->modelForm($reminder, 'PUT')->route('reminder.update', $reminder->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('reminder::reminder.partials.action')
{{ html()->closeModelForm() }}
</div>
@endsection

View File

@@ -0,0 +1,77 @@
@extends('layouts.app')
@inject('employeeRepository', 'Modules\Employee\Repositories\EmployeeRepository')
@use('Carbon\Carbon')
@section('content')
<div class="container-fluid">
<x-dashboard.breadcumb :title="$title" />
<div class="mb-1 text-end">
@can('reminder.create')
<a href="{{ route('reminder.create') }}" class="btn btn-primary 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 table-layoutt">
<table id="datatable" class="display table-sm table-bordered table">
<thead class="table-dark">
<tr>
<th class="tb-col"><span class="overline-title">S.N</span></th>
<th class="tb-col"><span class="overline-title">Title</span></th>
<th class="tb-col"><span class="overline-title">Date</span></th>
<th class="tb-col"><span class="overline-title"> Reminder Members</span></th>
<th class="tb-col" data-sortable="false"><span class="overline-title">Action</span>
</th>
</tr>
</thead>
<tbody>
@foreach ($reminderLists as $item)
<tr>
<td class="tb-col">{{ $loop->iteration }}</td>
<td class="tb-col">
<a href="{{ route('reminder.show', $item->id) }}"> {{ $item->title }} </a>
</td>
<td class="tb-col">{{ $item->reminder_date?->format('Y-m-d') }}
<br>
<span class="text-success fs-12">[{{ Carbon::parse($item->reminder_time)->format('h:i A') }} ]</span>
</td>
<td class="tb-col">
<div class="avatar-group flex-nowrap">
@foreach ($item->assignedEmployees as $employee)
<div class="avatar-group-item">
<a href="javascript:void(0);" class="d-inline-block" data-bs-toggle="tooltip"
data-bs-trigger="hover" data-bs-placement="top" title="{{ $employee->full_name }}">
<img src="{{ asset($employee->profile_pic) }}" alt=""
class="rounded-circle avatar-xs">
</a>
</div>
@endforeach
</div>
</td>
<td class="tb-col">
<div class="hstack flex-wrap gap-3">
@can('reminder.show')
<a href="{{ route('reminder.show', $item->id) }}" class="link-secondary fs-15 view-item-btn">
<i class="ri-eye-fill"></i>
</a>
@endcan
@can('reminder.destroy')
<a href="javascript:void(0);" data-link="{{ route('reminder.destroy', $item->id) }}"
data-id="{{ $item->id }}" class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-fill"></i></a>
@endcan
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,58 @@
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<div class="row gy-3">
<!-- Title and Members (Single Row) -->
<div class="col-lg-6">
{{ html()->label('Title')->class('form-label') }}
{{ html()->text('title')->class('form-control')->placeholder('Reminder Title')->required() }}
{{ html()->div('Please mention reminder title')->class('invalid-feedback') }}
</div>
<div class="col-lg-6">
{{ html()->label('Team Members')->class('form-label') }}
{{ html()->multiselect('members[ids][]', $employeeList, isset($selectedMembers))->class('form-control select2')->attributes(['multiple']) }}
{{ html()->div('Please select team members')->class('invalid-feedback') }}
</div>
<!-- File Uploads and Date-Time (Single Row) -->
<div class="col-lg-6">
{{ html()->label('File Uploads')->class('form-label') }}
{{ html()->file('files[]')->class('form-control')->attributes(['multiple']) }}
</div>
<div class="col-lg-6">
<div class="row gy-2">
<div class="col">
{{ html()->label('Reminder Date')->class('form-label') }}
{{ html()->text('reminder_date')->class('form-control flatpickr-date')->value(date('Y-m-d'))->required() }}
{{ html()->div('Reminder Date is required')->class('invalid-feedback') }}
</div>
<div class="col">
{{ html()->label('Reminder Time')->class('form-label') }}
{{ html()->time('reminder_time')->class('form-control')->required() }}
{{ html()->div('Reminder Time is required')->class('invalid-feedback') }}
</div>
</div>
</div>
<!-- Description -->
<div class="col-lg-12">
{{ html()->label('Description')->class('form-label') }}
{{ html()->textarea('description')->class('form-control ckeditor-classic')->placeholder('Add a description...') }}
</div>
<!-- Submit Button -->
<div class="col-lg-12 text-end">
<x-form-buttons :editable="$editable" label="Add Reminder" href="{{ route('reminder.index') }}" />
</div>
</div>
</div>
</div>
</div>
</div>
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@@ -0,0 +1,230 @@
@extends('layouts.app')
@inject('employeeRepository', 'Modules\Employee\Repositories\EmployeeRepository')
@use('Carbon\Carbon')
@section('content')
<div class="container-fluid">
<x-dashboard.breadcumb :title="$title" />
<div class="row">
<!-- Reminder Details Box -->
<div class="col-md-7">
<div class="card card-body">
<!-- Reminder Details -->
<div class="col-md">
<h4 class="fw-bold">{{ $reminder->title }}</h4>
<div class="hstack flex-wrap gap-3">
<div><i class="ri-calendar-line me-1 align-bottom"></i> {{ Carbon::parse($reminder->reminder_date)->format('d M, Y') }}</div>
<div><i class="ri-clock-line me-1 align-bottom"></i> {{ Carbon::parse($reminder->reminder_time)->format('h:i A') }}</div>
</div>
</div>
<div class="border-top border-top-dashed mt-4 pt-3">
<div class="row gy-2">
<div class="col-lg-6 col-sm-6">
<div>
<p class="text-uppercase fw-medium mb-2">Reminder Date:</p>
<h5 class="fs-15 mb-0">{{ Carbon::parse($reminder->reminder_date)->format('d M, Y') }}</h5>
</div>
</div>
<div class="col-lg-6 col-sm-6">
<div>
<p class="text-uppercase fw-medium mb-2">Reminder Time:</p>
<h5 class="fs-15 mb-0">{{ Carbon::parse($reminder->reminder_time)->format('h:i A') }}</h5>
</div>
</div>
<div class="col-lg-12">
<div>
<p class="text-uppercase fw-medium mb-2">Description:</p>
<h5 class="fs-13 mb-0" id="description">
@php
$fullDescription = strip_tags($reminder->description);
$shortDescription = implode(' ', array_slice(explode(' ', $fullDescription), 0, 100)) . '...';
$isLongDescription = str_word_count($fullDescription) > 100;
@endphp
<h5 class="fs-13 mb-0" id="description">
{!! $shortDescription !!}
</h5>
@if($isLongDescription)
<a href="javascript:void(0);" id="read-more" class="text-primary">
Read More
</a>
@endif
</div>
</div>
</div>
</div>
<!-- Actions: Edit and Back Buttons -->
<div class="mt-3 text-end">
<a href="{{ route('reminder.index') }}" class="btn btn-sm btn-danger">
<i class="ri-arrow-left-circle-fill text-white me-2"></i>Back
</a>
</div>
</div>
</div>
<!-- Attached Documents Section -->
<div class="col-md-5">
<div class="card card-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="fw-semibold mb-0">
<i class="ri-attachment-line me-2 text-muted"></i>Attached Documents
</h5>
@if($reminder->files && count($reminder->files) > 0)
<span class="badge bg-info-subtle text-info">
{{ count($reminder->files) }} File(s)
</span>
@endif
</div>
@if($reminder->files && count($reminder->files) > 0)
<div class="file-list">
@foreach($reminder->files as $file)
@php
$fileExtension = pathinfo($file, PATHINFO_EXTENSION);
$fileSize = filesize(storage_path('app/public/' . $file)) / 1024; // Size in KB
@endphp
<div class="file-item d-flex align-items-center justify-content-between border-bottom py-2">
<div class="d-flex align-items-center">
<div class="file-icon me-3">
@switch($fileExtension)
@case('pdf')
<i class="ri-file-pdf-line text-danger fs-3"></i>
@break
@case('jpg')
@case('jpeg')
@case('png')
@case('gif')
<i class="ri-image-line text-info fs-3"></i>
@break
@case('doc')
@case('docx')
<i class="ri-file-word-line text-primary fs-3"></i>
@break
@case('xls')
@case('xlsx')
<i class="ri-file-excel-line text-success fs-3"></i>
@break
@default
<i class="ri-file-line text-muted fs-3"></i>
@endswitch
</div>
<div class="file-details">
<h6 class="mb-1 text-truncate" style="max-width: 200px;">
{{ basename($file) }}
</h6>
<small class="text-muted">
{{ number_format($fileSize, 2) }} KB |
{{ strtoupper($fileExtension) }}
</small>
</div>
</div>
<div class="file-actions">
<!-- Image: Lightbox View -->
@if(in_array($fileExtension, ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg']))
<button class="btn btn-sm btn-outline-primary"
data-bs-toggle="modal"
data-bs-target="#imageModal-{{ $loop->index }}"
title="View Image">
<i class="ri-eye-line"></i> View Image
</button>
@elseif(in_array($fileExtension, ['pdf']))
<a href="{{ asset('storage/'.$file) }}"
target="_blank"
class="btn btn-sm btn-outline-danger me-1"
title="View PDF">
<i class="ri-file-pdf-line"></i>
</a>
@endif
<a href="{{ asset('storage/'.$file) }}"
download
class="btn btn-sm btn-outline-success"
title="Download">
<i class="ri-download-2-line"></i>
</a>
</div>
</div>
<!-- Existing Image Modal (unchanged) -->
@if(in_array($fileExtension, ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg']))
<div class="modal fade" id="imageModal-{{ $loop->index }}" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-body text-center">
<img src="{{ asset('storage/'.$file) }}" class="img-fluid rounded" alt="Image">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@endif
@endforeach
</div>
@else
<div class="text-center py-4">
<i class="ri-attachment-2-line text-muted" style="font-size: 3rem;"></i>
<p class="text-muted mt-2">No files attached to this reminder</p>
</div>
@endif
</div>
<!-- Assigned Members Section Below the Attached Documents -->
@if($reminder->members && count($reminder->members) > 0)
<div class="card card-body mt-3">
<h5 class="fw-semibold mb-3">Assigned Members</h5>
<ul class="list-group list-group-flush">
@foreach($reminder->members['ids'] as $memberId)
@php
$employee = $employeeRepository->getEmployeeById($memberId);
@endphp
<li class="list-group-item d-flex align-items-center py-1">
<div class="flex-shrink-0">
<img src="{{ $employee->profile_pic }}" alt="profile" class="avatar-xs rounded-circle">
</div>
<div class="flex-grow-1 ms-2">
<h6 class="mb-0 fs-14">{{ $employee->full_name }}</h6>
<p class="text-muted mb-0 fs-12">{{ $employee->email }}</p>
</div>
</li>
@endforeach
</ul>
</div>
@else
<p class="text-muted text-center">No members assigned.</p>
@endif
</div>
</div>
</div>
@endsection
@push('js')
<script>
$(document).ready(function(){
const $description = $('#description');
const $readMore = $('#read-more');
const fullDescription = `{!! addslashes(strip_tags($reminder->description)) !!}`;
const shortDescription = `{{ implode(' ', array_slice(explode(' ', strip_tags($reminder->description)), 0, 100)) }}...`;
$readMore.click(function(){
if ($description.hasClass('expanded')) {
$description.removeClass('expanded');
$description.text(shortDescription);
$readMore.text('Read More');
} else {
$description.addClass('expanded');
$description.text(fullDescription);
$readMore.text('Show Less');
}
});
});
</script>
@endpush

View File

View File

@@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Reminder\Http\Controllers\ReminderController;
/*
*--------------------------------------------------------------------------
* 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('reminder', ReminderController::class)->names('reminder');
});

View File

@@ -0,0 +1,21 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Reminder\Http\Controllers\ReminderController;
/*
|--------------------------------------------------------------------------
| 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::resource('reminder', ReminderController::class)->names('reminder')->except('edit', 'update');
});

View File

View File

View File

@@ -0,0 +1,26 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
build: {
outDir: '../../public/build-reminder',
emptyOutDir: true,
manifest: true,
},
plugins: [
laravel({
publicDirectory: '../../public',
buildDirectory: 'build-reminder',
input: [
__dirname + '/resources/assets/sass/app.scss',
__dirname + '/resources/assets/js/app.js'
],
refresh: true,
}),
],
});
//export const paths = [
// 'Modules/Reminder/resources/assets/sass/app.scss',
// 'Modules/Reminder/resources/assets/js/app.js',
//];