Compare commits

...

8 Commits

208 changed files with 12248 additions and 8871 deletions

18
.htaccess Normal file
View File

@ -0,0 +1,18 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>

View File

@ -0,0 +1,67 @@
<?php
namespace Modules\Attendance\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class AttendanceController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('attendance::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('attendance::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('attendance::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('attendance::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

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

View File

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

View File

View File

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

View File

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

View File

@ -0,0 +1,11 @@
{
"name": "Attendance",
"alias": "attendance",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Attendance\\Providers\\AttendanceServiceProvider"
],
"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,7 @@
@extends('attendance::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>Module: {!! config('attendance.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>Attendance 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-attendance', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-attendance', 'resources/assets/js/app.js') }} --}}
</body>

View File

View File

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

View File

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

View File

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

View File

@ -0,0 +1,67 @@
<?php
namespace Modules\Employee\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class EmployeeController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('employee::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('employee::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('employee::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('employee::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

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

View File

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

View File

View File

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

View File

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

View File

@ -0,0 +1,11 @@
{
"name": "Employee",
"alias": "employee",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Employee\\Providers\\EmployeeServiceProvider"
],
"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,237 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => 'Employee'])
<!-- end page title -->
<div class="card">
<div class="card-body">
<div class="row g-2">
<div class="col-sm-4">
<div class="search-box">
<input type="text" class="form-control" id="searchMemberList"
placeholder="Search for name or designation...">
<i class="ri-search-line search-icon"></i>
</div>
</div>
<!--end col-->
<div class="col-sm-auto ms-auto">
<div class="list-grid-nav hstack gap-1">
<button class="btn btn-success addMembers-modal" data-bs-toggle="modal"
data-bs-target="#addmemberModal"><i class="ri-add-fill me-1 align-bottom"></i> Create Employee</button>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div>
<div id="teamlist">
<div class="team-list row grid-view-filter" id="team-member-list">
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-9.jpg" alt="" class="img-fluid">
</div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="12"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal" data-bs-toggle="modal"
data-remove-id="12"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0"><img
src="assets/images/users/avatar-2.jpg" alt=""
class="member-img img-fluid d-block rounded-circle"></div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Nancy Martino</h5>
</a>
<p class="text-muted member-designation mb-0">Team Leader &amp; HR</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">225</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">197</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-12.jpg" alt="" class="img-fluid">
</div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn active"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="11"><i
class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a></li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="11"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0">
<div class="avatar-title bg-light text-primary rounded-circle text-uppercase border">HB
</div>
</div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Henry Baird</h5>
</a>
<p class="text-muted member-designation mb-0">Full Stack Developer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">352</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">376</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-11.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="10"><i
class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a></li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="10"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0"><img
src="assets/images/users/avatar-3.jpg" alt=""
class="member-img img-fluid d-block rounded-circle"></div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Frank Hook</h5>
</a>
<p class="text-muted member-designation mb-0">Project Manager</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">164</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">182</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div><!-- end col -->
</div>
<!--end row-->
</div><!-- container-fluid -->
</div>
@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>Employee 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-employee', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-employee', 'resources/assets/js/app.js') }} --}}
</body>

File diff suppressed because it is too large Load Diff

View File

View File

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

View File

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

View File

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

View File

@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Leave\Repositories\LeaveInterface;
use Yoeunes\Toastr\Facades\Toastr;
class LeaveController extends Controller
{
@ -14,6 +15,12 @@ class LeaveController extends Controller
public function __construct(LeaveInterface $leaveRepository)
{
$this->leaveRepository = $leaveRepository;
$this->middleware('role_or_permission:access leaves|create leaves|edit leaves|delete leaves', ['only' => ['index', 'show']]);
$this->middleware('role_or_permission:create leaves', ['only' => ['create', 'store']]);
$this->middleware('role_or_permission:edit leaves', ['only' => ['edit', 'update']]);
$this->middleware('role_or_permission:delete leaves', ['only' => ['destroy']]);
}
/**
@ -22,8 +29,7 @@ class LeaveController extends Controller
public function index()
{
$data['leaves'] = $this->leaveRepository->findAll();
// dd($data['leaves']);
return view('leave::index');
return view('leave::index',$data);
}
/**
@ -43,7 +49,7 @@ class LeaveController extends Controller
$inputData = $request->all();
try {
$this->leaveRepository->create($inputData);
toastr()->success('Leave Created Succesfully');
Toastr()->success('Leave Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
@ -63,7 +69,9 @@ class LeaveController extends Controller
*/
public function edit($id)
{
return view('leave::edit');
$data['title'] = 'Edit Leave';
$data['leave'] = $this->leaveRepository->getLeaveById($id);
return view('leave::edit',$data);
}
/**
@ -71,7 +79,14 @@ class LeaveController extends Controller
*/
public function update(Request $request, $id): RedirectResponse
{
//
$inputData = $request->all();
try {
$this->leaveRepository->update($id,$inputData);
toastr()->success('Leave Updated Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('leave.index');
}
/**
@ -79,6 +94,7 @@ class LeaveController extends Controller
*/
public function destroy($id)
{
//
$this->leaveRepository->delete($id);
toastr()->success('Leave Deleted Succesfully');
}
}

View File

@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
class Leave extends Model
{
protected $table = 'leaves';
protected $primaryKey = 'leave_id';
protected $guarded = [];
}

View File

@ -28,7 +28,7 @@ class LeaveRepository implements LeaveInterface
public function update($leaveId, array $newDetails)
{
return Leave::whereId($leaveId)->update($newDetails);
return Leave::where('leave_id',$leaveId)->update($newDetails);
}
}

View File

@ -4,27 +4,13 @@
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
@include('layouts.partials.breadcrumb', ['title' => $title])
<!-- end page title -->
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<form action="{{ route('leave.store') }}" method="post" class="needs-validation" novalidate>
<form action="{{ route('leave.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('leave::partials.action')
</form>

View File

@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<form action="{{ route('leave.update', $leave->leave_id) }}" class="needs-validation" novalidate
method="post">
@csrf
@method('put')
<input type="hidden" name="leave_id" value="{{ $leave->leave_id }}">
@include('leave::partials.action')
</form>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -49,250 +49,60 @@
<div class="card-header align-items-center d-flex">
<h5 class="card-title flex-grow-1 mb-0">Leave Lists</h5>
<div class="flex-shrink-0">
<a href="{{ route('leave.create') }}" class="btn btn-success waves-effect waves-light"><i
<a href="{{ route('leave.create') }}" class="btn btn-success waves-effect waves-light btn-sm"><i
class="ri-add-fill me-1 align-bottom"></i> Add</a>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="buttons-datatables" class="display table-bordered table" style="width:100%">
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
<th>S.N</th>
<th>Employee Name</th>
<th>Start Date</th>
<th>End Date</th>
<th>Created At</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$433,060</td>
</tr>
<tr>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008/11/28</td>
<td>$162,700</td>
</tr>
<tr>
<td>Brielle Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>2012/12/02</td>
<td>$372,000</td>
</tr>
<tr>
<td>Herrod Chandler</td>
<td>Sales Assistant</td>
<td>San Francisco</td>
<td>59</td>
<td>2012/08/06</td>
<td>$137,500</td>
</tr>
<tr>
<td>Rhona Davidson</td>
<td>Integration Specialist</td>
<td>Tokyo</td>
<td>55</td>
<td>2010/10/14</td>
<td>$327,900</td>
</tr>
<tr>
<td>Colleen Hurst</td>
<td>Javascript Developer</td>
<td>San Francisco</td>
<td>39</td>
<td>2009/09/15</td>
<td>$205,500</td>
</tr>
<tr>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>2008/12/13</td>
<td>$103,600</td>
</tr>
<tr>
<td>Jena Gaines</td>
<td>Office Manager</td>
<td>London</td>
<td>30</td>
<td>2008/12/19</td>
<td>$90,560</td>
</tr>
<tr>
<td>Quinn Flynn</td>
<td>Support Lead</td>
<td>Edinburgh</td>
<td>22</td>
<td>2013/03/03</td>
<td>$342,000</td>
</tr>
<tr>
<td>Charde Marshall</td>
<td>Regional Director</td>
<td>San Francisco</td>
<td>36</td>
<td>2008/10/16</td>
<td>$470,600</td>
</tr>
<tr>
<td>Haley Kennedy</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>43</td>
<td>2012/12/18</td>
<td>$313,500</td>
</tr>
<tr>
<td>Tatyana Fitzpatrick</td>
<td>Regional Director</td>
<td>London</td>
<td>19</td>
<td>2010/03/17</td>
<td>$385,750</td>
</tr>
<tr>
<td>Michael Silva</td>
<td>Marketing Designer</td>
<td>London</td>
<td>66</td>
<td>2012/11/27</td>
<td>$198,500</td>
</tr>
<tr>
<td>Paul Byrd</td>
<td>Chief Financial Officer (CFO)</td>
<td>New York</td>
<td>64</td>
<td>2010/06/09</td>
<td>$725,000</td>
</tr>
<tr>
<td>Gloria Little</td>
<td>Systems Administrator</td>
<td>New York</td>
<td>59</td>
<td>2009/04/10</td>
<td>$237,500</td>
</tr>
<tr>
<td>Bradley Greer</td>
<td>Software Engineer</td>
<td>London</td>
<td>41</td>
<td>2012/10/13</td>
<td>$132,000</td>
</tr>
<tr>
<td>Dai Rios</td>
<td>Personnel Lead</td>
<td>Edinburgh</td>
<td>35</td>
<td>2012/09/26</td>
<td>$217,500</td>
</tr>
<tr>
<td>Jenette Caldwell</td>
<td>Development Lead</td>
<td>New York</td>
<td>30</td>
<td>2011/09/03</td>
<td>$345,000</td>
</tr>
<tr>
<td>Yuri Berry</td>
<td>Chief Marketing Officer (CMO)</td>
<td>New York</td>
<td>40</td>
<td>2009/06/25</td>
<td>$675,000</td>
</tr>
<tr>
<td>Caesar Vance</td>
<td>Pre-Sales Support</td>
<td>New York</td>
<td>21</td>
<td>2011/12/12</td>
<td>$106,450</td>
</tr>
<tr>
<td>Doris Wilder</td>
<td>Sales Assistant</td>
<td>Sydney</td>
<td>23</td>
<td>2010/09/20</td>
<td>$85,600</td>
</tr>
@forelse ($leaves as $key => $leave)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $leave->employee_id }}</td>
<td>{{ $leave->start_date }}</td>
<td>{{ $leave->end_date }}</td>
<td>{{ $leave->created_at }}</td>
<td>
<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('leave.edit', $leave->leave_id) }}"
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
<tr>
<td>Gavin Cortez</td>
<td>Team Leader</td>
<td>San Francisco</td>
<td>22</td>
<td>2008/10/26</td>
<td>$235,500</td>
</tr>
<tr>
<td>Martena Mccray</td>
<td>Post-Sales support</td>
<td>Edinburgh</td>
<td>46</td>
<td>2011/03/09</td>
<td>$324,050</td>
</tr>
<tr>
<td>Unity Butler</td>
<td>Marketing Designer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/12/09</td>
<td>$85,675</td>
</tr>
<a href="javascript:void(0);" data-link="{{ route('leave.destroy', $leave->leave_id) }}"
data-id="{{ $leave->leave_id }}" class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-line"></i></a>
</div>
</td>
</tr>
@empty
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div><!--end row-->
</div>
<!--end row-->
</div>
<!-- container-fluid -->
</div>
<!-- container-fluid -->
@include('leave::partials.view')
@endsection

View File

@ -1,27 +1,38 @@
<div class="mb-3">
<label for="employeeName" class="form-label">Employee Name</label>
<input type="text" class="form-control" id="employeeName" placeholder="Enter emploree name" name="employeeName"
required>
<label for="employee_id" class="form-label">Employee Name</label>
<input type="text" class="form-control" id="employee_id" placeholder="Enter employee name" name="employee_id"
value="{{ old('end_date', $leave->employee_id ?? '') }}" required>
<div class="invalid-feedback">
Please enter Employee Name.
Please enter employee name.
</div>
</div>
<div class="mb-3">
{{-- <div class="mb-3">
<label for="employeeUrl" class="form-label">Employee Department URL</label>
<input type="url" class="form-control" id="employeeUrl" placeholder="Enter emploree url" name="employeeUrl">
</div>
</div> --}}
<div class="mb-3">
<label for="StartleaveDate" class="form-label">Start Leave Date</label>
<input type="date" class="form-control" id="StartleaveDate" name="start_date">
<label for="start_date" class="form-label">Start Leave Date</label>
<input type="date" class="form-control" id="start_date" name="start_date"
value="{{ old('start_date', $leave->start_date ?? '') }}">
</div>
<div class="mb-3">
<label for="EndleaveDate" class="form-label">End Leave Date</label>
<input type="date" class="form-control" id="EndleaveDate" name="end_date">
<label for="end_date" class="form-label">End Leave Date</label>
<input type="date" class="form-control" id="end_date" name="end_date"
value="{{ old('end_date', $leave->end_date ?? '') }}">
</div>
{{--
<div class="mb-3">
<label for="VertimeassageInput" class="form-label">Message</label>
<textarea class="form-control" id="VertimeassageInput" rows="3" placeholder="Enter your message" name="remark"></textarea>
</div>
</div> --}}
<div class="text-end">
<button type="submit" class="btn btn-primary">Add Leave</button>
<button type="submit" class="btn btn-primary">{{ isset($leave) ? 'Update' : 'Add Leave' }}</button>
</div>
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,16 @@
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-modal="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalgridLabel">View Leave</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form action="{{ route('leave.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('leave::partials.action')
</form>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,72 @@
<?php
namespace Modules\User\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$data = User::latest()->get();
$editable = false;
return view('user::index', compact('data', 'editable'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = "Create User";
return view('user::create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('user::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = "Edit User";
$data['user'] = User::findOrFail($id);
return view('user::edit', $data);
}
/**
* 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

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

View File

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

View File

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

View File

View File

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

View File

View File

View File

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

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

@ -0,0 +1,11 @@
{
"name": "User",
"alias": "user",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\User\\Providers\\UserServiceProvider"
],
"files": []
}

15
Modules/User/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,44 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('user::partials.action', ['btnType' => 'Save'])
</form>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,44 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('user::partials.action', ['btnType' => 'Save'])
</form>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,73 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h4>{{ label('Users List') }}</h4>
<a href="{{ route('user.create') }}" class="btn btn-info"><span>{{ label('Create New') }}</span></a>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
<thead class="">
<tr>
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Email') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('User Name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Role') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Branch') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Employee') }}</span></th>
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
</th>
</tr>
</thead>
<tbody>
@php
$i = 1;
@endphp
@foreach ($data as $item)
<tr data-id="{{ $item->id }}" data-display_order="{{ $item->display_order }}"
class="draggable-row">
<td class="tb-col">{{ $i++ }}</td>
<td class="tb-col">{{ $item->name }}</td>
<td class="tb-col">{{ $item->email }}</td>
<td class="tb-col">{{ $item->username }}</td>
<td class="tb-col">{!! getFieldData('tbl_roles', 'title', 'role_id', $item->roles_id) !!}
<td class="tb-col">{!! getFieldData('tbl_branches', 'title', 'branch_id', $item->branches_id) !!}
<td class="tb-col">{!! getFieldData('tbl_employees', 'title', 'employee_id', $item->employees_id) !!}
</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('user.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('user.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>
</div>
</div>
</div>
@include('user::partials.view')
@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>User 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-user', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-user', 'resources/assets/js/app.js') }} --}}
</body>

View File

@ -0,0 +1,23 @@
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" placeholder="Enter name" name="name"
value="{{ old('end_date', $leave->name ?? '') }}" required>
<div class="invalid-feedback">
Please enter employee name.
</div>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="text" class="form-control" id="email" name="email"
value="{{ old('email', $leave->email ?? '') }}">
</div>
<div class="text-end">
<button type="submit" class="btn btn-primary">{{ $btnType }}</button>
</div>
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,16 @@
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-modal="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalgridLabel">View User</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('user::partials.action', ['btnType' => 'View'])
</form>
</div>
</div>
</div>
</div>

View File

View File

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

View File

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

View File

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

View File

@ -1,218 +1,211 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Countries;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
namespace App\Http\Controllers;
class CountriesController extends Controller
{
protected $modelService;
public function __construct(Countries $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
createActivityLog(CountriesController::class, 'index', ' Countries index');
$data = Countries::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.countries.index", compact('data'));
}
use App\Http\Controllers\Controller;
use App\Models\Country\Country;
use App\Service\CommonModelService;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use Log;
public function create(Request $request)
{
createActivityLog(CountriesController::class, 'create', ' Countries create');
$TableData = Countries::where('status','<>',-1)->orderBy('display_order')->get();
$editable=false;
return view("crud.generated.countries.edit",compact('TableData','editable'));
}
class CountriesController extends Controller
{
protected $modelService;
public function __construct(Country $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
// createActivityLog(CountriesController::class, 'index', ' Country index');
$data = Country::where('status', '<>', -1)->orderBy('display_order')->get();
public function store(Request $request)
{
createActivityLog(CountriesController::class, 'store', ' Countries store');
$validator = Validator::make($request->all(), [
//ADD REQUIRED FIELDS FOR VALIDATION
]);
return view("crud.generated.countries.index", compact('data'));
}
if ($validator->fails()) {
return response()->json([
'error' => $validator->errors(),
],500);
}
$request->request->add(['alias' => slugify($request->title)]);
$request->request->add(['display_order' => getDisplayOrder('tbl_countries')]);
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
$requestData=$request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL').'/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$operationNumber = getOperationNumber();
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
} catch (\Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'store', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Countries Created Successfully.'], 200);
}
return redirect()->route('countries.index')->with('success','The Countries created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Countries::find($id);
$companyArticle->display_order = $index + 1;
$companyArticle->save();
}
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
}
public function updatealias(Request $request)
{
$articleId = $request->input('articleId');
$newAlias = $request->input('newAlias');
$companyArticle = Countries::find($articleId);
if (!$companyArticle) {
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
}
$companyArticle->alias = $newAlias;
$companyArticle->save();
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
}
public function create(Request $request)
{
// createActivityLog(CountriesController::class, 'create', ' Country create');
$TableData = Country::where('status', '<>', -1)->orderBy('display_order')->get();
$editable = false;
return view("crud.generated.countries.edit", compact('TableData', 'editable'));
}
public function show(Request $request, $id)
{
createActivityLog(CountriesController::class, 'show', ' Countries show');
$data = Countries::findOrFail($id);
return view("crud.generated.countries.show", compact('data'));
}
public function store(Request $request)
{
// createActivityLog(CountriesController::class, 'store', ' Country store');
$validator = Validator::make($request->all(), [
//ADD REQUIRED FIELDS FOR VALIDATION
]);
public function edit(Request $request, $id)
{
createActivityLog(CountriesController::class, 'edit', ' Countries edit');
$TableData = Countries::where('status','<>',-1)->orderBy('display_order')->get();
$data = Countries::findOrFail($id);
$editable=true;
return view("crud.generated.countries.edit", compact('data','TableData','editable'));
}
public function update(Request $request, $id)
{
createActivityLog(CountriesController::class, 'update', ' Countries update');
$validator = Validator::make($request->all(), [
//ADD VALIDATION FOR REQIRED FIELDS
]);
if ($validator->fails()) {
return response()->json([
'error' => $validator->errors(),
],500);
}
$requestData=$request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL').'/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('country_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'update', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Countries updated Successfully.'], 200);
}
// return redirect()->route('countries.index')->with('success','The Countries updated Successfully.');
return redirect()->back()->with('success', 'The Countries updated successfully.');
}
public function destroy(Request $request,$id)
{
createActivityLog(CountriesController::class, 'destroy', ' Countries destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Countries Deleted Successfully.'],200);
}
public function toggle(Request $request,$id)
{
createActivityLog(CountriesController::class, 'destroy', ' Countries destroy');
$data = Countries::findOrFail($id);
$requestData=['status'=>($data->status==1)?0:1];
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Countries Deleted Successfully.'],200);
}
public function clone(Request $request,$id)
{
createActivityLog(CountriesController::class, 'clone', ' Countries clone');
$data = Countries::findOrFail($id);
unset($data['updatedby']);
unset($data['createdby']);
$requestData=$data->toArray();
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Countries Clonned Successfully.'],200);
}
if ($validator->fails()) {
return response()->json([
'error' => $validator->errors(),
], 500);
}
$request->request->add(['alias' => slugify($request->title)]);
$request->request->add(['display_order' => getDisplayOrder('tbl_countries')]);
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
$requestData = $request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL') . '/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$operationNumber = getOperationNumber();
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
} catch (\Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'store', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Country Created Successfully.'], 200);
}
return redirect()->route('countries.index')->with('success', 'The Country created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Country::find($id);
$companyArticle->display_order = $index + 1;
$companyArticle->save();
}
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
}
public function updatealias(Request $request)
{
$articleId = $request->input('articleId');
$newAlias = $request->input('newAlias');
$companyArticle = Country::find($articleId);
if (!$companyArticle) {
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
}
$companyArticle->alias = $newAlias;
$companyArticle->save();
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
}
public function show(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'show', ' Country show');
$data = Country::findOrFail($id);
return view("crud.generated.countries.show", compact('data'));
}
public function edit(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'edit', ' Country edit');
$TableData = Country::where('status', '<>', -1)->orderBy('display_order')->get();
$data = Country::findOrFail($id);
$editable = true;
return view("crud.generated.countries.edit", compact('data', 'TableData', 'editable'));
}
public function update(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'update', ' Country update');
$validator = Validator::make($request->all(), [
//ADD VALIDATION FOR REQIRED FIELDS
]);
if ($validator->fails()) {
return response()->json([
'error' => $validator->errors(),
], 500);
}
$requestData = $request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL') . '/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('country_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'update', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Country updated Successfully.'], 200);
}
// return redirect()->route('countries.index')->with('success','The Country updated Successfully.');
return redirect()->back()->with('success', 'The Country updated successfully.');
}
public function destroy(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'destroy', ' Country destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Country Deleted Successfully.'], 200);
}
public function toggle(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'destroy', ' Country destroy');
$data = Country::findOrFail($id);
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Country Deleted Successfully.'], 200);
}
public function clone (Request $request, $id)
{
// createActivityLog(CountriesController::class, 'clone', ' Country clone');
$data = Country::findOrFail($id);
unset($data['updatedby']);
unset($data['createdby']);
$requestData = $data->toArray();
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Country Clonned Successfully.'], 200);
}
}

View File

@ -2,7 +2,6 @@
namespace App\Http\Controllers;
use App\Helpers\BibClass;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
@ -41,7 +40,7 @@ class GeneralFormController extends Controller
'icon',
'favicon',
'og_image',
'no_image'
'no_image',
);
self::$textEditorFields = array('details', 'description', 'text', 'qualification', 'experience', 'required_documents', 'biodata', 'privacy_policy', 'content1', 'content2', 'content3');
self::$textAreaFields = array('copyright', 'remarks', 'seo_keywords', 'seo_description', 'seo_descriptions', 'intro', 'meta_tags', 'google_map', 'og_tags');
@ -67,10 +66,10 @@ class GeneralFormController extends Controller
$databasdeName = DB::connection()->getDatabaseName();
$allTables = [];
foreach ($tables as $table) {
$table_field = "Tables_in_$databasdeName";
// dd($table->$table_field);
if(strpos($table->$table_field,"_logs")){continue;}
if (strpos($table->$table_field, "_logs")) {continue;}
$allTables[$table->$table_field] = $table->$table_field;
}
return view('crud.form.create', compact('allTables'));
@ -79,7 +78,6 @@ class GeneralFormController extends Controller
}
}
public function store(Request $request)
{
// dd($request->all());
@ -111,8 +109,6 @@ class GeneralFormController extends Controller
$data['TableRows'] = DB::select("select * from " . $data['TableName']);
return view("crud.settings.dictonary", $data);
case 'curd':
$data['tableName'] = $tableName;
$data['directoryName'] = $directoryName;
@ -162,7 +158,7 @@ class GeneralFormController extends Controller
$string = '_id';
$foreign = [];
foreach ($all_columns as $key => $column) {
if (str_contains($column, $string) !== FALSE) { // Yoshi version
if (str_contains($column, $string) !== false) { // Yoshi version
$foreign[] = $column;
}
}
@ -188,8 +184,6 @@ class GeneralFormController extends Controller
return array_column(DB::select("SHOW COLUMNS FROM $TableName"), 'Field');
}
public static function ajaxShowContent($TableName, $directoryName)
{
$TableName = strtolower($TableName);
@ -206,20 +200,23 @@ class GeneralFormController extends Controller
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName));
$showContent = "
";
foreach ($TableCols as $key => $TableCol):
$TableCol = $TableCol->Field;
if ($key == 0 || $TableCol == 'createdOn' || $TableCol == 'createdBy' || $TableCol == 'updatedBy' || $TableCol == 'created_at' || $TableCol == 'updated_at')
if ($key == 0 || $TableCol == 'createdOn' || $TableCol == 'createdBy' || $TableCol == 'updatedBy' || $TableCol == 'created_at' || $TableCol == 'updated_at') {
continue;
}
$TableColLabel = ucwords(str_replace("_", " ", $TableCol));
if ($TableCol == 'status')
if ($TableCol == 'status') {
$showContent .= "<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class=\"{{\$data->$TableCol == 1 ? 'text-success' : 'text-danger'}}\">{{\$data->$TableCol == 1 ? 'Active' : 'Inactive'}}</span></p>";
else
class=\"{{\$data->$TableCol == 1 ? 'text-success' : 'text-danger'}}\">{{\$data->$TableCol == 1 ? 'Active' : 'Inactive'}}</span></p>";
} else {
$showContent .= '<p><b>' . $TableColLabel . " :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{\$data->$TableCol}}</span></p>";
}
endforeach;
$showContent .= "<div class=\"d-flex justify-content-between\">
@ -257,12 +254,12 @@ class GeneralFormController extends Controller
$Table_pk = $all_columns[0];
$all_foreign_table = self::getForeignTable($all_columns);
$all_foreignKey = [];
if ($all_foreign_table)
if ($all_foreign_table) {
foreach ($all_foreign_table as $key => $tablename) {
$all_foreignKey[$tablename] = self::getTableColumns($tablename);
$all_foreignKey[$tablename] = $all_foreignKey[$tablename][0] ?? null;
}
}
$editContent = "
<form action=\"{{\$editable?route('$routeName.update',[\$data->$Table_pk]):route('$routeName.store')}}\" id=\"updateCustomForm\" method=\"POST\" >\n @csrf ";
@ -283,7 +280,7 @@ class GeneralFormController extends Controller
$editContent .= "{{createCustomSelect('$TableName', 'title', '" . $TableCols[0]->Field . "', \$editable?\$data->$TableCol:'', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}";
$editContent .= "</div>";
break;
case (strpos($TableCol, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE
case (strpos($TableCol, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE
$FTNameRaw = str_replace("s_id", "s", $TableCol);
$FTName = "tbl_" . str_replace("s_id", "s", $TableCol);
$FTCols = DB::select("describe " . $FTName);
@ -325,7 +322,6 @@ class GeneralFormController extends Controller
}
}
endforeach;
$editContent .= ' <div class="col-md-12">';
$editContent .= "<?php createButton(\"btn-primary btn-update\",\"\",\"Submit\"); ?>\n";
@ -333,8 +329,6 @@ class GeneralFormController extends Controller
$editContent .= "</div>";
$editContent .= " </form>";
return $editContent;
} //end of ajaxEditContent method
public static function editContent($TableName, $directoryName)
@ -352,7 +346,7 @@ class GeneralFormController extends Controller
$folder .= str_replace("tbl_", "", $TableName);
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName));
$editContent = "@extends('backend.template')
$editContent = "@extends('layouts.app')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
@ -392,7 +386,7 @@ class GeneralFormController extends Controller
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName));
$addContent = "@extends('backend.template')
$addContent = "@extends('layouts.app')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
@ -418,96 +412,95 @@ class GeneralFormController extends Controller
/*
public static function ajaxAddContent($TableName, $directoryName)
{
$TableName = strtolower($TableName);
$TableCols = DB::select("describe " . $TableName);
$TableRows = DB::select("select * from " . $TableName);
$folder = '';
$routeName = '';
if (!empty($directoryName)) {
$folder .= strtolower($directoryName) . '/';
$routeName .= strtolower($directoryName) . '.';
}
$routeName .= strtolower(str_replace("tbl_", "", $TableName));
$folder .= str_replace("tbl_", "", $TableName);
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName));
$TableName = strtolower($TableName);
$TableCols = DB::select("describe " . $TableName);
$TableRows = DB::select("select * from " . $TableName);
$folder = '';
$routeName = '';
if (!empty($directoryName)) {
$folder .= strtolower($directoryName) . '/';
$routeName .= strtolower($directoryName) . '.';
}
$routeName .= strtolower(str_replace("tbl_", "", $TableName));
$folder .= str_replace("tbl_", "", $TableName);
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName));
$all_columns = self::getTableColumns($TableName);
$all_foreign_table = self::getForeignTable($all_columns);
$all_foreignKey = [];
if ($all_foreign_table)
foreach ($all_foreign_table as $key => $tablename) {
$all_foreignKey[$tablename] = self::getTableColumns($tablename);
$all_foreignKey[$tablename] = $all_foreignKey[$tablename][0] ?? null;
}
$all_columns = self::getTableColumns($TableName);
$all_foreign_table = self::getForeignTable($all_columns);
$all_foreignKey = [];
if ($all_foreign_table)
foreach ($all_foreign_table as $key => $tablename) {
$all_foreignKey[$tablename] = self::getTableColumns($tablename);
$all_foreignKey[$tablename] = $all_foreignKey[$tablename][0] ?? null;
}
$addContent = "
<form action=\"{{\$editable?route('$routeName.update',[\$data->$Table_pk]):route('$routeName.store')}}\" id=\"storeCustomForm\" method=\"POST\">\n @csrf \n";
$addContent .= '<div class="row">';
foreach ($TableCols as $key => $TableCol):
$TableCol = $TableCol->Field;
if (!in_array($TableCol, self::$HiddenCols)) {
$TableColLabel = ucwords(str_replace("_", " ", $TableCol));
$addContent = "
<form action=\"{{\$editable?route('$routeName.update',[\$data->$Table_pk]):route('$routeName.store')}}\" id=\"storeCustomForm\" method=\"POST\">\n @csrf \n";
$addContent .= '<div class="row">';
foreach ($TableCols as $key => $TableCol):
$TableCol = $TableCol->Field;
if (!in_array($TableCol, self::$HiddenCols)) {
$TableColLabel = ucwords(str_replace("_", " ", $TableCol));
switch ($TableCol) {
case $TableCols[0]->Field:
break;
case (strpos($TableCol, "parent_") !== false):
$addContent .= '<div class="col-lg-6">';
$addContent .= "{{createCustomSelect('$TableName', 'title', '" . $TableCols[0]->Field . "', '', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}";
$addContent .= "</div>";
break;
case (strpos($TableCol, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE
$FTNameRaw = str_replace("s_id", "s", $TableCol);
$FTName = "tbl_" . str_replace("s_id", "s", $TableCol);
$FTCols = DB::select("describe " . $FTName);
$addContent .= '<div class="col-lg-6">';
//createCustomSelect($tableName, $fieldNameToDisplay, $fieldNameForValue, $defaultValueSelected, $displayTextForLabel, $HTMLElementName, $additionalClass = "form-control", $defaultCondition = null)
$addContent .= "{{createCustomSelect('$FTName', 'title', '" . $FTCols[0]->Field . "', '', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}";
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$textEditorFields)):
$addContent .= '<div class="col-lg-12 pb-2">';
$addContent .= "{{createTextarea(\"$TableCol\",\"$TableCol ckeditor-classic\",\"$TableColLabel\")}}\n";
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$textAreaFields)):
$addContent .= '<div class="col-lg-12 pb-2">';
$addContent .= "{{createPlainTextArea(\"$TableCol\",\"$TableCol \",\"$TableColLabel\")}}\n";
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$imageFields)):
$addContent .= '<div class="col-lg-12 pb-2">';
$addContent .= "{{createImageInput(\"$TableCol\",\"$TableColLabel\")}}\n";
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$dateFields)):
$addContent .= '<div class="col-lg-6 pb-2">';
$addContent .= "{{createDate(\"$TableCol\",\"$TableColLabel\",'',date('Y-m-d'))}}\n"; //createDate($name, $display = "",$class = "datepicker", $default = "")
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$passwordFields)):
$addContent .= '<div class="col-lg-6 pb-2">';
$addContent .= "{{createPassword(\"$TableCol\",\"$TableColLabel\",'')}}\n"; //createDate($name, $display = "",$class = "datepicker", $default = "")
$addContent .= "</div>";
break;
default:
$addContent .= '<div class="col-lg-6">';
$addContent .= "{{createText(\"$TableCol\",\"$TableCol\",\"$TableColLabel\")}}\n";
$addContent .= "</div>";
}
}
endforeach;
$addContent .= ' <br> <div class="col-md-12">';
$addContent .= "<?php createButton(\"btn-primary btn-store\",\"\",\"Submit\"); ?>\n";
$addContent .= "<?php createButton(\"btn-primary btn-cancel\",\"\",\"Cancel\",route('$routeName.index')); ?>\n";
$addContent .= "</div>";
$addContent .= " </form>";
switch ($TableCol) {
case $TableCols[0]->Field:
break;
case (strpos($TableCol, "parent_") !== false):
$addContent .= '<div class="col-lg-6">';
$addContent .= "{{createCustomSelect('$TableName', 'title', '" . $TableCols[0]->Field . "', '', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}";
$addContent .= "</div>";
break;
case (strpos($TableCol, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE
$FTNameRaw = str_replace("s_id", "s", $TableCol);
$FTName = "tbl_" . str_replace("s_id", "s", $TableCol);
$FTCols = DB::select("describe " . $FTName);
$addContent .= '<div class="col-lg-6">';
//createCustomSelect($tableName, $fieldNameToDisplay, $fieldNameForValue, $defaultValueSelected, $displayTextForLabel, $HTMLElementName, $additionalClass = "form-control", $defaultCondition = null)
$addContent .= "{{createCustomSelect('$FTName', 'title', '" . $FTCols[0]->Field . "', '', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}";
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$textEditorFields)):
$addContent .= '<div class="col-lg-12 pb-2">';
$addContent .= "{{createTextarea(\"$TableCol\",\"$TableCol ckeditor-classic\",\"$TableColLabel\")}}\n";
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$textAreaFields)):
$addContent .= '<div class="col-lg-12 pb-2">';
$addContent .= "{{createPlainTextArea(\"$TableCol\",\"$TableCol \",\"$TableColLabel\")}}\n";
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$imageFields)):
$addContent .= '<div class="col-lg-12 pb-2">';
$addContent .= "{{createImageInput(\"$TableCol\",\"$TableColLabel\")}}\n";
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$dateFields)):
$addContent .= '<div class="col-lg-6 pb-2">';
$addContent .= "{{createDate(\"$TableCol\",\"$TableColLabel\",'',date('Y-m-d'))}}\n"; //createDate($name, $display = "",$class = "datepicker", $default = "")
$addContent .= "</div>";
break;
case (in_array($TableCol, self::$passwordFields)):
$addContent .= '<div class="col-lg-6 pb-2">';
$addContent .= "{{createPassword(\"$TableCol\",\"$TableColLabel\",'')}}\n"; //createDate($name, $display = "",$class = "datepicker", $default = "")
$addContent .= "</div>";
break;
default:
$addContent .= '<div class="col-lg-6">';
$addContent .= "{{createText(\"$TableCol\",\"$TableCol\",\"$TableColLabel\")}}\n";
$addContent .= "</div>";
}
}
endforeach;
$addContent .= ' <br> <div class="col-md-12">';
$addContent .= "<?php createButton(\"btn-primary btn-store\",\"\",\"Submit\"); ?>\n";
$addContent .= "<?php createButton(\"btn-primary btn-cancel\",\"\",\"Cancel\",route('$routeName.index')); ?>\n";
$addContent .= "</div>";
$addContent .= " </form>";
return $addContent;
return $addContent;
} //End of ajax addContent
*/
*/
public static function showContent($TableName, $directoryName)
{
$TableName = strtolower($TableName);
@ -524,7 +517,7 @@ class GeneralFormController extends Controller
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName));
$showContent = "@extends('backend.template')
$showContent = "@extends('layouts.app')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
@ -537,7 +530,7 @@ class GeneralFormController extends Controller
$showContent .= "
</div>
</div>
@endSection";
$path = base_path() . "/resources/views/crud/generated/$folder/";
@ -553,7 +546,6 @@ class GeneralFormController extends Controller
return $showContent;
}
public static function migrationContent($tableName)
{
$tableName = strtolower($tableName);
@ -607,7 +599,7 @@ class GeneralFormController extends Controller
$file = fopen(base_path() . "/database/migrations/" . date('Y_m_d_his') . "_create_" . $tableName . "_table.php", 'w');
fwrite($file, $contentString);
fclose($file);
*/
*/
return $contentString;
}
@ -653,9 +645,6 @@ class GeneralFormController extends Controller
fclose($file);
}
return $RouteContent;
}
@ -679,7 +668,7 @@ class GeneralFormController extends Controller
$tableFields = DB::select("describe $TableName");
$translated = label('' . $title);
$HiddenColumns = array($primaryKey, "remarks", "createdon", "createdby", "updatedby", "seo_title", "seo_descriptions", "seo_keywords", "google_map", "seo_description", "og_tags", "created_at", "updated_at", "description", "details", "text", "display_order", "status");
$listContent = '@extends(\'backend.template\')
$listContent = '@extends(\'layouts.app\')
@section(\'content\')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
@ -694,7 +683,7 @@ class GeneralFormController extends Controller
foreach ($columns as $key => $column) {
if (!in_array($column, $HiddenColumns))
if (!in_array($column, $HiddenColumns)) {
switch ($column) {
case (strpos($column, "parent_") !== false):
$listContent .= '<th class="tb-col"><span class="overline-title">{{ label("Parent") }}</span></th>' . PHP_EOL;
@ -706,6 +695,7 @@ class GeneralFormController extends Controller
default:
$listContent .= '<th class="tb-col"><span class="overline-title">{{ label("' . $column . '") }}</span></th>' . PHP_EOL;
}
}
}
$listContent .= '<th class="tb-col" data-sortable="false"><span
@ -718,7 +708,7 @@ class GeneralFormController extends Controller
$i = 1;
@endphp
@foreach ($data as $item)
<tr data-id="{{$item->' . $columns[0] . '}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>">
<td class="tb-col">{{ $i++ }}</td>';
foreach ($columns as $key => $column) {
@ -730,7 +720,7 @@ class GeneralFormController extends Controller
$listContent .= '{!! getFieldData("' . $TableName . '", "title", "' . $columns[0] . '", $item->' . $column . ') !!}' . PHP_EOL;
$listContent .= '</td>' . PHP_EOL;
break;
case (strpos($column, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE
case (strpos($column, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE
$FTNameRaw = str_replace("s_id", "s", $column);
$FTName = "tbl_" . str_replace("s_id", "s", $column);
$FTCols = DB::select("describe " . $FTName);
@ -774,24 +764,24 @@ class GeneralFormController extends Controller
<a href="{{route(' . "'" . $routeName . 'toggle' . "'" . ',[$item->' . $primaryKey . '])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label(\'Unpublish\'):label(\'Publish\') }}
</a>
</li>
<li>
<a href="{{route(' . "'" . $routeName . 'clone' . "'" . ',[$item->' . $primaryKey . '])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label(\'Clone\') }}
</a>
</li>
<li>
<a href="{{route(' . "'" . $routeName . 'destroy' . "'" . ',[$item->' . $primaryKey . '])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> {{ label(\'Delete\') }}
</a>
</li>
</ul>
</div>
</td>
</tr>
@ -800,12 +790,12 @@ class GeneralFormController extends Controller
</tbody>
</table>
</div>
</div>
@endsection
@push("css")
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@ -841,7 +831,7 @@ $(document).ready(function(e) {
articleId: articleId,
newAlias: newAlias
};
$.ajax({
url: ajaxUrl,
type: \'POST\',
@ -1014,7 +1004,6 @@ function confirmClone(url) {
//ajax complete List
public static function modelContent($tableName, $directoryName)
{
$tableName = strtolower($tableName);
@ -1025,7 +1014,6 @@ function confirmClone(url) {
$modelClass = ucfirst(str_replace("tbl_", "", $tableName));
$tableFields = DB::select("describe $tableName");
$pkField = $tableFields[0]->Field;
@ -1052,7 +1040,7 @@ function confirmClone(url) {
class $modelClass extends Model
{
use HasFactory, CreatedUpdatedBy;
protected \$primaryKey = '$pkField';
public \$timestamps = true;
protected \$fillable =[
@ -1098,7 +1086,6 @@ function confirmClone(url) {
return $contentString;
}
public static function controllerContent($tableName, $directoryName)
{
$tableName = strtolower($tableName);
@ -1140,7 +1127,7 @@ function confirmClone(url) {
{
createActivityLog($controllerName::class, 'index', '$directoryName $modelClass index');
\$data = $modelClass::where('status','<>',-1)->orderBy('display_order')->get();
return view(\"crud.generated.$viewName.index\", compact('data'));
}
@ -1174,7 +1161,7 @@ function confirmClone(url) {
});
array_walk_recursive(\$requestData, function (&\$value) {
\$value = str_replace(env('APP_URL'), '', \$value);
});
});
DB::beginTransaction();
try {
\$operationNumber = getOperationNumber();
@ -1191,22 +1178,22 @@ function confirmClone(url) {
}
return redirect()->route('$viewName.index')->with('success','The $modelClass created Successfully.');
}
public function sort(Request \$request)
{
\$idOrder = \$request->input('id_order');
foreach (\$idOrder as \$index => \$id) {
\$companyArticle = $modelClass::find(\$id);
\$companyArticle->display_order = \$index + 1;
\$companyArticle->save();
}
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
}
public function updatealias(Request \$request)
{
\$articleId = \$request->input('articleId');
\$newAlias = \$request->input('newAlias');
\$companyArticle = $modelClass::find(\$articleId);
@ -1217,15 +1204,15 @@ function confirmClone(url) {
\$companyArticle->save();
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
}
public function show(Request \$request, \$id)
{
createActivityLog($controllerName::class, 'show', '$directoryName $modelClass show');
\$data = $modelClass::findOrFail(\$id);
return view(\"crud.generated.$viewName.show\", compact('data'));
}
@ -1331,9 +1318,9 @@ function confirmClone(url) {
DB::commit();
return response()->json(['status'=>true,'message'=>'The $modelClass Clonned Successfully.'],200);
}
}
";
// $filename = ($controllerPath != "") ? $controllerPath . "/" : "";

View File

@ -1,6 +1,6 @@
<?php
namespace App\Modules\Models\Country;
namespace App\Models\Country;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@ -8,12 +8,12 @@ use Illuminate\Database\Eloquent\Model;
class Country extends Model
{
use HasFactory;
protected $table = 'tbl_countries';
protected $fillable = [
'country_name',
'phone_code',
'country_code',
'status'
'status',
];
public function provinces()
@ -23,6 +23,6 @@ class Country extends Model
public static function getCountries()
{
return self::select('id','country_name')->where('status','Active')->get();
return self::select('id', 'country_name')->where('status', 'Active')->get();
}
}

Some files were not shown because too many files have changed in this diff Show More