This commit is contained in:
Ranjan 2024-04-15 10:15:16 +05:45
parent d80b1aa0e9
commit 6ae0143005
41 changed files with 707 additions and 17 deletions

View File

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

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

View File

@ -0,0 +1,114 @@
<?php
namespace Modules\Taxation\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class TaxationServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Taxation';
protected string $moduleNameLower = 'taxation';
/**
* 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,15 @@
<?php
namespace Modules\Employee\Repositories;
interface EmployeeInterface
{
public function findAll();
public function getEmployeeById($employeeId);
public function getEmployeeByEmail($email);
public function delete($employeeId);
public function create($EmployeeDetails);
public function update($employeeId, array $newDetails);
public function pluck();
}

View File

@ -0,0 +1,58 @@
<?php
namespace Modules\Employee\Repositories;
use Modules\Employee\Models\Employee;
class EmployeeRepository implements EmployeeInterface
{
public function findAll()
{
return Employee::paginate(20);
}
public function getEmployeeById($employeeId)
{
return Employee::findOrFail($employeeId);
}
public function getEmployeeByEmail($email)
{
return Employee::where('email', $email)->first();
}
public function delete($employeeId)
{
Employee::destroy($employeeId);
}
public function create($employeeDetails)
{
return Employee::create($employeeDetails);
}
public function update($employeeId, array $newDetails)
{
return Employee::whereId($employeeId)->update($newDetails);
}
public function pluck()
{
return Employee::pluck('first_name', 'id');
}
// public function uploadImage($file)
// {
// if ($req->file()) {
// $fileName = time() . '_' . $req->file->getClientOriginalName();
// $filePath = $req->file('file')->storeAs('uploads', $fileName, 'public');
// $fileModel->name = time() . '_' . $req->file->getClientOriginalName();
// $fileModel->file_path = '/storage/' . $filePath;
// $fileModel->save();
// return back()
// ->with('success', 'File has been uploaded.')
// ->with('file', $fileName);
// }
// }
}

View File

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

View File

View File

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

View File

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

View File

@ -0,0 +1,11 @@
{
"name": "Taxation",
"alias": "taxation",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Taxation\\Providers\\TaxationServiceProvider"
],
"files": []
}

View File

@ -0,0 +1,15 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.5",
"sass": "^1.69.5",
"postcss": "^8.3.7",
"vite": "^4.0.0"
}
}

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Taxation 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-taxation', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-taxation', 'resources/assets/js/app.js') }} --}}
</body>

View File

@ -0,0 +1,30 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => $title])
<!-- end page title -->
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<form action="{{ route('leaveType.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('leave::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

@ -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">
{{ html()->modelForm($leave, 'PUT')->route('leave.update', $leave->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('leave::leave.partials.action')
{{ html()->closeModelForm() }}
</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,68 @@
@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 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('leaveType.create') }}" class="btn btn-success waves-effect waves-light"><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-sm table-bordered table" style="width:100%">
<thead>
<tr>
<th>S.N</th>
<th>Leave Type</th>
<th>Created By</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@forelse ($leaveTypes as $key => $leaveType)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $leaveType->employee_id }}</td>
<td>{{ $leaveType->start_date }}</td>
<td>{{ $leaveType->end_date }}</td>
<td>{{ $leaveType->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('leaveType.edit', $leaveType->leaveType_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('leaveType.destroy', $leaveType->leaveType_id) }}"
data-id="{{ $leaveType->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>
</div>
@endsection

View File

@ -0,0 +1,25 @@
<div class="mb-3">
<label for="employee_id" class="form-label">Employee Name</label>
{{ html()->select('employee_id', $employeeList)->class('form-select')->placeholder('Select Employee') }}
</div>
<div class="mb-3">
<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="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="text-end">
<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::leave.partials.action')
</form>
</div>
</div>
</div>
</div>

View File

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@ return [
| |
| Default module namespace. | Default module namespace.
| |
*/ */
'namespace' => 'Modules', 'namespace' => 'Modules',
@ -23,7 +23,7 @@ return [
| |
| Default module stubs. | Default module stubs.
| |
*/ */
'stubs' => [ 'stubs' => [
'enabled' => false, 'enabled' => false,
@ -69,7 +69,7 @@ return [
| This path is used to save the generated module. | This path is used to save the generated module.
| This path will also be added automatically to the list of scanned folders. | This path will also be added automatically to the list of scanned folders.
| |
*/ */
'modules' => base_path('Modules'), 'modules' => base_path('Modules'),
/* /*
@ -79,7 +79,7 @@ return [
| |
| Here you may update the modules' assets path. | Here you may update the modules' assets path.
| |
*/ */
'assets' => public_path('modules'), 'assets' => public_path('modules'),
/* /*
@ -90,7 +90,7 @@ return [
| Where you run the 'module:publish-migration' command, where do you publish the | Where you run the 'module:publish-migration' command, where do you publish the
| the migration files? | the migration files?
| |
*/ */
'migration' => base_path('database/migrations'), 'migration' => base_path('database/migrations'),
@ -101,7 +101,7 @@ return [
| |
| app folder name | app folder name
| for example can change it to 'src' or 'App' | for example can change it to 'src' or 'App'
*/ */
'app_folder' => 'app/', 'app_folder' => 'app/',
/* /*
@ -110,7 +110,7 @@ return [
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Customise the paths where the folders will be generated. | Customise the paths where the folders will be generated.
| Setting the generate key to false will not generate that folder | Setting the generate key to false will not generate that folder
*/ */
'generator' => [ 'generator' => [
// app/ // app/
'channels' => ['path' => 'app/Broadcasting', 'generate' => false], 'channels' => ['path' => 'app/Broadcasting', 'generate' => false],
@ -121,7 +121,7 @@ return [
'listener' => ['path' => 'app/Listeners', 'generate' => false], 'listener' => ['path' => 'app/Listeners', 'generate' => false],
'model' => ['path' => 'app/Models', 'generate' => true], 'model' => ['path' => 'app/Models', 'generate' => true],
'notifications' => ['path' => 'app/Notifications', 'generate' => false], 'notifications' => ['path' => 'app/Notifications', 'generate' => false],
'observer' => ['path' => 'app/Observers', 'generate' => false], 'observer' => ['path' => 'app/Observers', 'generate' => true],
'policies' => ['path' => 'app/Policies', 'generate' => false], 'policies' => ['path' => 'app/Policies', 'generate' => false],
'provider' => ['path' => 'app/Providers', 'generate' => true], 'provider' => ['path' => 'app/Providers', 'generate' => true],
'route-provider' => ['path' => 'app/Providers', 'generate' => true], 'route-provider' => ['path' => 'app/Providers', 'generate' => true],
@ -168,7 +168,7 @@ return [
| Here you can define which commands will be visible and used in your | Here you can define which commands will be visible and used in your
| application. You can add your own commands to merge section. | application. You can add your own commands to merge section.
| |
*/ */
'commands' => ConsoleServiceProvider::defaultCommands() 'commands' => ConsoleServiceProvider::defaultCommands()
->merge([ ->merge([
// New commands go here // New commands go here
@ -182,7 +182,7 @@ return [
| Here you define which folder will be scanned. By default will scan vendor | Here you define which folder will be scanned. By default will scan vendor
| directory. This is useful if you host the package in packagist website. | directory. This is useful if you host the package in packagist website.
| |
*/ */
'scan' => [ 'scan' => [
'enabled' => false, 'enabled' => false,
@ -197,7 +197,7 @@ return [
| |
| Here is the config for the composer.json file, generated by this package | Here is the config for the composer.json file, generated by this package
| |
*/ */
'composer' => [ 'composer' => [
'vendor' => env('MODULES_VENDOR', 'nwidart'), 'vendor' => env('MODULES_VENDOR', 'nwidart'),
@ -215,7 +215,7 @@ return [
| |
| Here is the config for setting up the caching feature. | Here is the config for setting up the caching feature.
| |
*/ */
'cache' => [ 'cache' => [
'enabled' => false, 'enabled' => false,
'driver' => 'file', 'driver' => 'file',
@ -228,7 +228,7 @@ return [
| Setting one to false will require you to register that part | Setting one to false will require you to register that part
| in your own Service Provider class. | in your own Service Provider class.
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'register' => [ 'register' => [
'translations' => true, 'translations' => true,
/** /**
@ -245,7 +245,7 @@ return [
| You can define new types of activators here, file, database, etc. The only | You can define new types of activators here, file, database, etc. The only
| required parameter is 'class'. | required parameter is 'class'.
| The file activator will store the activation status in storage/installed_modules | The file activator will store the activation status in storage/installed_modules
*/ */
'activators' => [ 'activators' => [
'file' => [ 'file' => [
'class' => FileActivator::class, 'class' => FileActivator::class,

View File

@ -3,5 +3,6 @@
"Employee": true, "Employee": true,
"Attendance": true, "Attendance": true,
"User": true, "User": true,
"Admin": true "Admin": true,
"Taxation": true
} }

View File

@ -107,8 +107,24 @@
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link menu-link" href="#MenuThree" data-bs-toggle="collapse" role="button" aria-expanded="false" <a class="nav-link menu-link" href="#taxation" data-bs-toggle="collapse" role="button" aria-expanded="false"
aria-controls="MenuThree"> 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">Users</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">
<i class="ri-dashboard-2-line"></i> <span data-key="t-masters">Master</span> <i class="ri-dashboard-2-line"></i> <span data-key="t-masters">Master</span>
</a> </a>
<div class="menu-dropdown collapse" id="MenuThree"> <div class="menu-dropdown collapse" id="MenuThree">

View File

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

View File

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