first commit

This commit is contained in:
Sampanna Rimal
2024-08-27 17:48:06 +05:45
commit 53c0140f58
10839 changed files with 1125847 additions and 0 deletions

View File

@ -0,0 +1,114 @@
<?php
namespace Modules\Meeting\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Employee\Repositories\EmployeeInterface;
use Modules\Employee\Repositories\EmployeeRepository;
use Modules\Meeting\Repositories\MeetingInterface;
use Modules\Meeting\Repositories\MeetingRepository;
use Modules\PMS\Repositories\ClientInterface;
use Modules\PMS\Repositories\ClientRepository;
class MeetingController extends Controller
{
private $meetingRepository;
private $employeeRepository;
private $clientRepository;
/**
* Display a listing of the resource.
*/
public function __construct(
MeetingInterface $meetingRepository,
EmployeeInterface $employeeRepository,
ClientInterface $clientRepository
) {
$this->meetingRepository = $meetingRepository;
$this->employeeRepository = $employeeRepository;
$this->clientRepository = $clientRepository;
}
public function index()
{
$data['title'] = 'Meeting Lists';
$data['meetingLists'] = $this->meetingRepository->findAll();
return view('meeting::meeting.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Meeting';
$data['editable'] = false;
$data['memberList'] = $this->employeeRepository->pluck();
$data['clientList'] = $this->clientRepository->pluck();
return view('meeting::meeting.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->meetingRepository->create($request->all());
toastr()->success('Meeting created successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('meeting.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
$data['title'] = 'Meeting Details';
$data['item'] = $this->meetingRepository->getMeetingById($id);
return view('meeting::meeting.show', $data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Leave';
$data['editable'] = true;
$data['meeting'] = $this->meetingRepository->getMeetingById($id);
return view('meeting::edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$inputData = $request->except(['_method', '_token']);
$this->meetingRepository->update($id, $inputData);
toastr()->success('Meeting Updated Succesfully');
return redirect()->route('meeting.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
$this->meetingRepository->delete($id);
toastr()->success('Meeting Deleted Succesfully');
}
}

View File

View File

@ -0,0 +1,41 @@
<?php
namespace Modules\Meeting\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Modules\PMS\Models\Client;
class Meeting extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $table = 'tbl_meetings';
protected $fillable = [
'title',
'date',
'meeting_with',
'client_id',
'members',
'start_time',
'end_time',
'location',
'description',
];
protected $casts = [
'members' => 'array',
'date' => 'date',
];
public $appends = [];
public function client()
{
return $this->belongsTo(Client::class, 'client_id');
}
}

View File

View File

View File

@ -0,0 +1,117 @@
<?php
namespace Modules\Meeting\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Modules\Meeting\Repositories\MeetingInterface;
use Modules\Meeting\Repositories\MeetingRepository;
class MeetingServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Meeting';
protected string $moduleNameLower = 'meeting';
/**
* 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(MeetingInterface::class, MeetingRepository::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.
*/
public function provides(): array
{
return [];
}
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\Meeting\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('Meeting', '/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('Meeting', '/routes/api.php'));
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Meeting\Repositories;
interface MeetingInterface
{
public function findAll();
public function getMeetingById($meetingId);
public function delete($meetingId);
public function create(array $meetingDetails);
public function update($meetingId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Meeting\Repositories;
use Modules\Meeting\Models\Meeting;
class MeetingRepository implements MeetingInterface
{
public function findAll()
{
return Meeting::get();
}
public function getMeetingById($meetingId)
{
return Meeting::findOrFail($meetingId);
}
public function delete($meetingId)
{
Meeting::destroy($meetingId);
}
public function create(array $meetingDetails)
{
return Meeting::create($meetingDetails);
}
public function update($meetingId, array $newDetails)
{
return Meeting::whereId($meetingId)->update($newDetails);
}
}

View File

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

View File

View File

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

View File

@ -0,0 +1,38 @@
<?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('tbl_meetings', function (Blueprint $table) {
$table->id();
$table->string('title')->nullable();
$table->date('date')->nullable();
$table->string('meeting_with')->nullable();
$table->unsignedBigInteger('client_id')->nullable();
$table->mediumText('members')->nullable();
$table->time('start_time')->nullable();
$table->time('end_time')->nullable();
$table->longText('description')->nullable();
$table->string('location')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_meetings');
}
};

View File

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

View File

@ -0,0 +1,11 @@
{
"name": "Meeting",
"alias": "meeting",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Meeting\\Providers\\MeetingServiceProvider"
],
"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

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

View File

@ -0,0 +1,23 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => $title])
<!-- end page title -->
<div class='card'>
<div class='card-body'>
{{ html()->form('POST')->route('meeting.store')->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('meeting::meeting.partials.action')
{{ html()->form()->close() }}
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,26 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => $title])
<!-- end page title -->
<div class='card'>
<div class='card-body'>
{{ html()->modelForm($meeting, 'PUT')->route('meeting.update', $meeting->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('meeting::meeting.partials.action')
{{ html()->closeModelForm() }}
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,94 @@
@extends('layouts.app')
@use('Carbon\Carbon')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => $title])
<!-- end page 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('meeting.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">
<table id="buttons-datatables" class="display table-sm table-bordered table">
<thead class="table-light">
<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">Meeting with</span></th>
<th class="tb-col"><span class="overline-title"> Client</span></th>
<th class="tb-col"><span class="overline-title"> Team Member</span></th>
<th class="tb-col"><span class="overline-title">Start Time</span></th>
<th class="tb-col"><span class="overline-title">End Time</span></th>
<th class="tb-col"><span class="overline-title">Location</span></th>
<th class="tb-col" data-sortable="false"><span class="overline-title">Action</span>
</th>
</tr>
</thead>
<tbody>
@foreach ($meetingLists as $index => $item)
<tr>
<td class="tb-col">{{ $index + 1 }}</td>
<td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">{{ $item->date?->format('Y-m-d') }}
<br><span
class="text-danger">({{ $item->date?->diffForHumans(Carbon::now()) }})</span>
</td>
<td class="tb-col">{{ $item->meeting_with }}</td>
<td class="tb-col">
{{ $item->meeting_with == 'client' ? $item->client?->client_name : '-' }}</td>
<td class="tb-col">
@if ($item->meeting_with == 'member')
<div class="avatar-group flex-nowrap">
@isset($item->members)
@foreach ($item->members as $memberId)
<div class="avatar-group-item">
<a href="javascript: void(0);" class="d-inline-block">
<img src="{{ asset(optional($employeeRepository->getEmployeeById($memberId))->profile_pic) }}"
alt="" class="rounded-circle avatar-xxs">
</a>
</div>
@endforeach
@endisset
</div>
@else
-
@endif
</td>
<td class="tb-col">{{ Carbon::parse($item->start_time)->format('h:i A') }}</td>
<td class="tb-col">{{ Carbon::parse($item->end_time)->format('h:i A') }}</td>
<td class="tb-col">{{ $item->location }}</td>
<td class="tb-col">
<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-line"></i>
</a>
<a href="{{ route('meeting.edit', $item->id) }}"
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
<a href="javascript:void(0);"
data-link="{{ route('meeting.destroy', $item->id) }}"
data-id="{{ $item->id }}" class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-line"></i></a>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,109 @@
<div class="row gy-3">
<div class="col-lg-4 col-md-6">
<div class="row">
<div class="col-lg-12">
{{ html()->label('Meeting with')->class('form-label') }}
<div class="row mt-2">
<div class="col-sm-3">
<div class="form-check form-radio-success">
{{ html()->radio('meeting_with', false, 'client')->class('form-check-input meeting-with')->checked($editable && $meeting->meeting_with == 'client') }}
{{ html()->label('Client')->class('form-check-label me-1') }}
</div>
</div>
<div class="col-sm-6">
<div class="form-check form-radio-success">
{{ html()->radio('meeting_with', false, 'member')->class('form-check-input meeting-with')->checked($editable && $meeting->meeting_with == 'member') }}
{{ html()->label('Office Members')->class('form-check-label me-1') }}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6">
{{ html()->label('Title')->class('form-label') }}
{{ html()->text('title')->class('form-control')->placeholder('Meeting Title')->required() }}
{{ html()->div('Please mention meeting title')->class('invalid-feedback') }}
</div>
<div class="col-lg-4 col-md-6">
{{ html()->label('Date')->class('form-label') }}
<div class="input-group">
{{ html()->text('date')->class('form-control flatpickr-date')->required() }}
<span class="input-group-text"><i class="ri-calendar-line"></i></span>
</div>
</div>
<div class="col-lg-4 col-md-6 client-dropdown d-none">
{{ html()->label('Client')->class('form-label') }}
{{ html()->select('client_id', $clientList)->class('form-select select2')->placeholder('Select Client') }}
</div>
<div class="col-lg-4 col-md-6 member-dropdown d-none">
{{ html()->label('Members')->class('form-label') }}
{{ html()->multiselect('members[]', $memberList)->class('form-control select2')->placeholder('Select Members')->value($task->members ?? null)->attributes(['multiple', 'id' => 'members']) }}
</div>
<div class="col-lg-4 col-md-6">
{{ html()->label('Start Time')->class('form-label') }}
<div class="input-group">
{{ html()->text('start_time')->class('form-control')->placeholder('Event Start Time')->attributes(['data-provider' => 'timepickr', 'data-time-basic' => 'true']) }}
<span class="input-group-text"><i class="ri-time-line"></i></span>
</div>
</div>
<div class="col-lg-4 col-md-6">
{{ html()->label('End Time')->class('form-label') }}
<div class="input-group">
{{ html()->text('end_time')->class('form-control')->placeholder('Event End Time')->attributes(['data-provider' => 'timepickr', 'data-time-basic' => 'true']) }}
<span class="input-group-text"><i class="ri-time-line"></i></span>
</div>
</div>
<div class="col-lg-4 col-md-6">
{{ html()->label('Location')->class('form-label') }}
{{ html()->text('location')->class('form-control')->placeholder('Meeting Location')->required() }}
</div>
<div class="col-lg-12 col-md-12">
{{ html()->label('Description')->class('form-label') }}
{{ html()->textarea('description')->class('form-control ckeditor-classic')->placeholder('Meeting Description') }}
</div>
<x-form-buttons :editable='$editable' label='Add' href="{{ route('meeting.index') }}" />
</div>
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.meeting-with').change(function() {
let value = $(this).val();
console.log(value);
if (value == 'member') {
$('.member-dropdown').removeClass('d-none');
$('.client-dropdown').addClass('d-none');
} else {
$('.member-dropdown').addClass('d-none');
$('.client-dropdown').removeClass('d-none');
}
});
});
</script>
@endpush

View File

@ -0,0 +1,64 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('layouts.partials.breadcrumb', ['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">Meeting Title</span></th>
<td>{{ $item->title }}</td>
</tr>
<tr>
<th><span class="fw-medium">Date</span></th>
<td> {{ $item->date }} </td>
</tr>
<tr>
<th><span class="fw-medium"> Client </span></th>
<td>{{ ($item->client)->client_name }}</td>
</tr>
<tr>
<th><span class="fw-medium">Team Member</span></th>
<td>{{ ($item->employee)->first_name }}</td>
</tr>
<tr>
<th><span class="fw-medium">Start Time</span></th>
<td>{{ Carbon::parse($item->start_time)->format('h:i A') }}</td>
</tr>
<tr>
<th><span class="fw-medium">End Time</span></th>
<td>{{ Carbon::parse($item->end_time)->format('h:i A') }}</td>
</tr>
<tr>
<th><span class="fw-medium">Location</span></th>
<td>{{ $item->location }}</td>
</tr>
<th><span class="fw-medium">Description</span></th>
<td>{{ $item->description }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="mb-3 text-end">
<a href="{{ route('meeting.index') }}" class="btn btn-secondary w-sm">Back</a>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

View File

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

View File

@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Meeting\Http\Controllers\MeetingController;
/*
|--------------------------------------------------------------------------
| 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([], function () {
Route::resource('meeting', MeetingController::class)->names('meeting');
});

View File

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