diff --git a/Modules/Taxation/app/Http/Controllers/.gitkeep b/Modules/Taxation/app/Http/Controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/app/Http/Controllers/TaxationController.php b/Modules/Taxation/app/Http/Controllers/TaxationController.php new file mode 100644 index 0000000..41053bf --- /dev/null +++ b/Modules/Taxation/app/Http/Controllers/TaxationController.php @@ -0,0 +1,67 @@ +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')); + } +} diff --git a/Modules/Taxation/app/Providers/TaxationServiceProvider.php b/Modules/Taxation/app/Providers/TaxationServiceProvider.php new file mode 100644 index 0000000..f5c3b31 --- /dev/null +++ b/Modules/Taxation/app/Providers/TaxationServiceProvider.php @@ -0,0 +1,114 @@ +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; + } +} diff --git a/Modules/Taxation/app/Repositories/.gitkeep b/Modules/Taxation/app/Repositories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/app/Repositories/EmployeeInterface.php b/Modules/Taxation/app/Repositories/EmployeeInterface.php new file mode 100644 index 0000000..4f80cb3 --- /dev/null +++ b/Modules/Taxation/app/Repositories/EmployeeInterface.php @@ -0,0 +1,15 @@ +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); + // } + // } + +} diff --git a/Modules/Taxation/composer.json b/Modules/Taxation/composer.json new file mode 100644 index 0000000..eacdc33 --- /dev/null +++ b/Modules/Taxation/composer.json @@ -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/" + } + } +} diff --git a/Modules/Taxation/config/.gitkeep b/Modules/Taxation/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/config/config.php b/Modules/Taxation/config/config.php new file mode 100644 index 0000000..a7b5dc4 --- /dev/null +++ b/Modules/Taxation/config/config.php @@ -0,0 +1,5 @@ + 'Taxation', +]; diff --git a/Modules/Taxation/database/factories/.gitkeep b/Modules/Taxation/database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/database/migrations/.gitkeep b/Modules/Taxation/database/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/database/seeders/.gitkeep b/Modules/Taxation/database/seeders/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/database/seeders/TaxationDatabaseSeeder.php b/Modules/Taxation/database/seeders/TaxationDatabaseSeeder.php new file mode 100644 index 0000000..3e12b19 --- /dev/null +++ b/Modules/Taxation/database/seeders/TaxationDatabaseSeeder.php @@ -0,0 +1,16 @@ +call([]); + } +} diff --git a/Modules/Taxation/module.json b/Modules/Taxation/module.json new file mode 100644 index 0000000..7a2e930 --- /dev/null +++ b/Modules/Taxation/module.json @@ -0,0 +1,11 @@ +{ + "name": "Taxation", + "alias": "taxation", + "description": "", + "keywords": [], + "priority": 0, + "providers": [ + "Modules\\Taxation\\Providers\\TaxationServiceProvider" + ], + "files": [] +} diff --git a/Modules/Taxation/package.json b/Modules/Taxation/package.json new file mode 100644 index 0000000..d6fbfc8 --- /dev/null +++ b/Modules/Taxation/package.json @@ -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" + } +} diff --git a/Modules/Taxation/resources/assets/.gitkeep b/Modules/Taxation/resources/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/resources/assets/js/app.js b/Modules/Taxation/resources/assets/js/app.js new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/resources/assets/sass/app.scss b/Modules/Taxation/resources/assets/sass/app.scss new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/resources/views/.gitkeep b/Modules/Taxation/resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/resources/views/layouts/master.blade.php b/Modules/Taxation/resources/views/layouts/master.blade.php new file mode 100644 index 0000000..c2eecc3 --- /dev/null +++ b/Modules/Taxation/resources/views/layouts/master.blade.php @@ -0,0 +1,29 @@ + + + + + + + + + + Taxation Module - {{ config('app.name', 'Laravel') }} + + + + + + + + + + {{-- Vite CSS --}} + {{-- {{ module_vite('build-taxation', 'resources/assets/sass/app.scss') }} --}} + + + + @yield('content') + + {{-- Vite JS --}} + {{-- {{ module_vite('build-taxation', 'resources/assets/js/app.js') }} --}} + diff --git a/Modules/Taxation/resources/views/leave-type/create.blade.php b/Modules/Taxation/resources/views/leave-type/create.blade.php new file mode 100644 index 0000000..8fab614 --- /dev/null +++ b/Modules/Taxation/resources/views/leave-type/create.blade.php @@ -0,0 +1,30 @@ +@extends('layouts.app') + +@section('content') +
+
+ + @include('layouts.partials.breadcrumb', ['title' => $title]) + +
+
+
+
+
+ @csrf + @include('leave::leave.partials.action') +
+
+
+
+
+ + +
+ +
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Taxation/resources/views/leave-type/edit.blade.php b/Modules/Taxation/resources/views/leave-type/edit.blade.php new file mode 100644 index 0000000..a780d69 --- /dev/null +++ b/Modules/Taxation/resources/views/leave-type/edit.blade.php @@ -0,0 +1,47 @@ +@extends('layouts.app') + +@section('content') +
+
+ +
+
+
+

{{ $title }}

+ +
+ +
+ +
+
+
+ +
+
+
+
+ + {{ html()->modelForm($leave, 'PUT')->route('leave.update', $leave->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }} + + @include('leave::leave.partials.action') + + {{ html()->closeModelForm() }} + +
+
+
+
+ + +
+ +
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Taxation/resources/views/leave-type/index.blade.php b/Modules/Taxation/resources/views/leave-type/index.blade.php new file mode 100644 index 0000000..ff62f20 --- /dev/null +++ b/Modules/Taxation/resources/views/leave-type/index.blade.php @@ -0,0 +1,68 @@ +@extends('layouts.app') + +@section('content') +
+
+ + +
+
+
+
+
Leave Lists
+
+ Add +
+
+ +
+
+ + + + + + + + + + + + @forelse ($leaveTypes as $key => $leaveType) + + + + + + + + + @empty + @endforelse + +
S.NLeave TypeCreated ByStatusAction
{{ $key + 1 }}{{ $leaveType->employee_id }}{{ $leaveType->start_date }}{{ $leaveType->end_date }}{{ $leaveType->created_at }} +
+ + + + + + + +
+
+
+
+
+
+
+ +
+
+@endsection diff --git a/Modules/Taxation/resources/views/leave-type/partials/action.blade.php b/Modules/Taxation/resources/views/leave-type/partials/action.blade.php new file mode 100644 index 0000000..50e04e8 --- /dev/null +++ b/Modules/Taxation/resources/views/leave-type/partials/action.blade.php @@ -0,0 +1,25 @@ +
+ + + {{ html()->select('employee_id', $employeeList)->class('form-select')->placeholder('Select Employee') }} +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +@push('js') + +@endpush diff --git a/Modules/Taxation/resources/views/leave-type/partials/view.blade.php b/Modules/Taxation/resources/views/leave-type/partials/view.blade.php new file mode 100644 index 0000000..67a8c0e --- /dev/null +++ b/Modules/Taxation/resources/views/leave-type/partials/view.blade.php @@ -0,0 +1,16 @@ + diff --git a/Modules/Taxation/resources/views/leave-type/show.blade.php b/Modules/Taxation/resources/views/leave-type/show.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/routes/.gitkeep b/Modules/Taxation/routes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Taxation/routes/api.php b/Modules/Taxation/routes/api.php new file mode 100644 index 0000000..bb866da --- /dev/null +++ b/Modules/Taxation/routes/api.php @@ -0,0 +1,19 @@ +prefix('v1')->group(function () { + Route::apiResource('taxation', TaxationController::class)->names('taxation'); +}); diff --git a/Modules/Taxation/routes/web.php b/Modules/Taxation/routes/web.php new file mode 100644 index 0000000..21b2fac --- /dev/null +++ b/Modules/Taxation/routes/web.php @@ -0,0 +1,19 @@ +names('taxation'); +}); diff --git a/Modules/Taxation/vite.config.js b/Modules/Taxation/vite.config.js new file mode 100644 index 0000000..26eeeda --- /dev/null +++ b/Modules/Taxation/vite.config.js @@ -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', +//]; \ No newline at end of file diff --git a/config/modules.php b/config/modules.php index fa95874..ae3ff65 100644 --- a/config/modules.php +++ b/config/modules.php @@ -12,7 +12,7 @@ return [ | | Default module namespace. | - */ + */ 'namespace' => 'Modules', @@ -23,7 +23,7 @@ return [ | | Default module stubs. | - */ + */ 'stubs' => [ 'enabled' => false, @@ -69,7 +69,7 @@ return [ | This path is used to save the generated module. | This path will also be added automatically to the list of scanned folders. | - */ + */ 'modules' => base_path('Modules'), /* @@ -79,7 +79,7 @@ return [ | | Here you may update the modules' assets path. | - */ + */ 'assets' => public_path('modules'), /* @@ -90,7 +90,7 @@ return [ | Where you run the 'module:publish-migration' command, where do you publish the | the migration files? | - */ + */ 'migration' => base_path('database/migrations'), @@ -101,7 +101,7 @@ return [ | | app folder name | for example can change it to 'src' or 'App' - */ + */ 'app_folder' => 'app/', /* @@ -110,7 +110,7 @@ return [ |-------------------------------------------------------------------------- | Customise the paths where the folders will be generated. | Setting the generate key to false will not generate that folder - */ + */ 'generator' => [ // app/ 'channels' => ['path' => 'app/Broadcasting', 'generate' => false], @@ -121,7 +121,7 @@ return [ 'listener' => ['path' => 'app/Listeners', 'generate' => false], 'model' => ['path' => 'app/Models', 'generate' => true], 'notifications' => ['path' => 'app/Notifications', 'generate' => false], - 'observer' => ['path' => 'app/Observers', 'generate' => false], + 'observer' => ['path' => 'app/Observers', 'generate' => true], 'policies' => ['path' => 'app/Policies', 'generate' => false], '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 | application. You can add your own commands to merge section. | - */ + */ 'commands' => ConsoleServiceProvider::defaultCommands() ->merge([ // New commands go here @@ -182,7 +182,7 @@ return [ | 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. | - */ + */ 'scan' => [ 'enabled' => false, @@ -197,7 +197,7 @@ return [ | | Here is the config for the composer.json file, generated by this package | - */ + */ 'composer' => [ 'vendor' => env('MODULES_VENDOR', 'nwidart'), @@ -215,7 +215,7 @@ return [ | | Here is the config for setting up the caching feature. | - */ + */ 'cache' => [ 'enabled' => false, 'driver' => 'file', @@ -228,7 +228,7 @@ return [ | Setting one to false will require you to register that part | in your own Service Provider class. |-------------------------------------------------------------------------- - */ + */ 'register' => [ 'translations' => true, /** @@ -245,7 +245,7 @@ return [ | You can define new types of activators here, file, database, etc. The only | required parameter is 'class'. | The file activator will store the activation status in storage/installed_modules - */ + */ 'activators' => [ 'file' => [ 'class' => FileActivator::class, diff --git a/modules_statuses.json b/modules_statuses.json index c9a3888..a4a5c28 100644 --- a/modules_statuses.json +++ b/modules_statuses.json @@ -3,5 +3,6 @@ "Employee": true, "Attendance": true, "User": true, - "Admin": true + "Admin": true, + "Taxation": true } \ No newline at end of file diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index 23c4d6a..a9cdf1a 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -107,8 +107,24 @@ + +