pms module setup

This commit is contained in:
Ranjan 2024-04-16 11:38:27 +05:45
parent 4a396e6f98
commit 3f0d9a420b
30 changed files with 456 additions and 53 deletions

View File

@ -0,0 +1,67 @@
<?php
namespace Modules\PMS\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class PMSController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('pms::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('pms::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('pms::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('pms::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

View File

View File

View File

View File

@ -0,0 +1,114 @@
<?php
namespace Modules\PMS\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class PMSServiceProvider extends ServiceProvider
{
protected string $moduleName = 'PMS';
protected string $moduleNameLower = 'pms';
/**
* 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(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\PMS\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('PMS', '/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('PMS', '/routes/api.php'));
}
}

View File

30
Modules/PMS/composer.json Normal file
View File

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

View File

View File

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

View File

View File

View File

View File

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

11
Modules/PMS/module.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "PMS",
"alias": "pms",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\PMS\\Providers\\PMSServiceProvider"
],
"files": []
}

15
Modules/PMS/package.json Normal file
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

View File

View File

@ -0,0 +1,7 @@
@extends('pms::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>Module: {!! config('pms.name') !!}</p>
@endsection

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

View File

View File

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

View File

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

View File

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

View File

@ -4,5 +4,6 @@
"Attendance": true,
"User": true,
"Admin": true,
"Taxation": true
"Taxation": true,
"PMS": true
}

View File

@ -34,7 +34,34 @@
<a href="#" class="nav-link"> <i class="ri-home-line"></i>Dashboard </a>
</li>
<!--- PMS Start-->
<li class="nav-item">
<a class="nav-link menu-link" href="#PMS" data-bs-toggle="collapse" role="button" aria-expanded="false"
aria-controls="PMS">
<i class="ri-shopping-cart-2-line"></i> <span data-key="t-vendors">PMS</span>
</a>
<div class="menu-dropdown collapse" id="PMS">
<ul class="nav nav-sm flex-column">
<li class="nav-item">
<a href="{{ route('vendortypes.index') }}"
class="nav-link @if (\Request::is('vendortype') || \Request::is('vendortype/*')) active @endif">Client</a>
</li>
<li class="nav-item">
<a href="{{ route('vendortypes.index') }}"
class="nav-link @if (\Request::is('vendortype') || \Request::is('vendortype/*')) active @endif">Projects</a>
</li>
<li class="nav-item">
<a href="{{ route('vendors.index') }}"
class="nav-link @if (\Request::is('vendors') || \Request::is('vendors/*')) active @endif">Tasks</a>
</li>
</ul>
</div>
</li>
<!--- PMS End-->
{{-- <li class="nav-item">
<a class="nav-link menu-link" href="#MenuOne" data-bs-toggle="collapse" role="button" aria-expanded="false"
aria-controls="MenuOne">
<i class="ri-building-2-line"></i> <span data-key="t-companies">Company Setup</span>
@ -55,44 +82,25 @@
</ul>
</div>
</li>
</li> --}}
<li class="nav-item">
<a class="nav-link menu-link" href="#MenuTwo" data-bs-toggle="collapse" role="button" aria-expanded="false"
aria-controls="MenuTwo">
<i class="ri-shopping-cart-2-line"></i> <span data-key="t-vendors">Vendor Setup</span>
</a>
<div class="menu-dropdown collapse" id="MenuTwo">
<ul class="nav nav-sm flex-column">
<li class="nav-item">
<a href="{{ route('vendortypes.index') }}"
class="nav-link @if (\Request::is('vendortype') || \Request::is('vendortype/*')) active @endif">Vendor Type</a>
</li>
<li class="nav-item">
<a href="{{ route('vendors.index') }}"
class="nav-link @if (\Request::is('vendors') || \Request::is('vendors/*')) active @endif">Vendor</a>
</li>
</ul>
</div>
</li>
<li class="nav-item">
{{-- <li class="nav-item">
<a class="nav-link menu-link @if (\Request::is('employee') || \Request::is('employee/*')) active @endif"
href="{{ route('employee.index') }}">
<i class="ri-team-line"></i> <span data-key="t-widgets">Employee</span>
</a>
</li>
</li> --}}
<li class="nav-item">
{{-- <li class="nav-item">
<a class="nav-link menu-link @if (\Request::is('calendar') || \Request::is('calendar/*')) active @endif"
href="{{ route('calendar.index') }}">
<i class="ri-team-line"></i> <span data-key="t-widgets">Calendar</span>
</a>
</li>
</li> --}}
<li class="nav-item">
{{-- <li class="nav-item">
<a class="nav-link menu-link" href="#leave" data-bs-toggle="collapse" role="button" aria-expanded="false"
aria-controls="leave">
<i class="ri-shopping-cart-2-line"></i> <span data-key="t-vendors">Leave</span>
@ -112,27 +120,11 @@
</ul>
</div>
</li>
</li> --}}
<li class="nav-item">
<a class="nav-link menu-link" href="#taxation" data-bs-toggle="collapse" role="button" aria-expanded="false"
aria-controls="taxation">
<i class="ri-book-2-line"></i> <span data-key="t-masters">Taxation</span>
</a>
<div class="menu-dropdown collapse" id="taxation">
<ul class="nav nav-sm flex-column">
<li class="nav-item">
<a href="{{ route('user.index') }}"
class="nav-link @if (\Request::is('user') || \Request::is('user/*')) active @endif">Create Invoice</a>
</li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link menu-link" href="#MenuThree" data-bs-toggle="collapse" role="button"
aria-expanded="false" aria-controls="MenuThree">
<a class="nav-link menu-link" href="#MenuThree" data-bs-toggle="collapse" role="button" aria-expanded="false"
aria-controls="MenuThree">
<i class="ri-dashboard-2-line"></i> <span data-key="t-masters">Master</span>
</a>
<div class="menu-dropdown collapse" id="MenuThree">
@ -185,9 +177,9 @@
</div>
</li>
<li class="nav-item">
<a class="nav-link menu-link" href="#MenuFour" data-bs-toggle="collapse" role="button"
aria-expanded="false" aria-controls="MenuFour">
{{-- <li class="nav-item">
<a class="nav-link menu-link" href="#MenuFour" data-bs-toggle="collapse" role="button" aria-expanded="false"
aria-controls="MenuFour">
<i class="ri-dashboard-2-line"></i> <span data-key="t-hrs">HR</span>
</a>
<div class="menu-dropdown collapse" id="MenuFour">
@ -245,12 +237,15 @@
</ul>
</div>
</li>
</li> --}}
{{-- <li class="nav-item">
<a href="#" class="nav-link"> <i class="ri-settings-2-line"></i>Setting</a>
</li> --}}
</ul>
</div>
<!-- Sidebar -->