From cfd2147536718def09c94d1605d09c1f876170a6 Mon Sep 17 00:00:00 2001
From: Ranjan
Date: Sun, 7 Apr 2024 13:13:58 +0545
Subject: [PATCH] leave user employee module setup
---
.htaccess | 18 +
.../Attendance/app/Http/Controllers/.gitkeep | 0
.../Http/Controllers/AttendanceController.php | 67 ++
Modules/Attendance/app/Http/Requests/.gitkeep | 0
Modules/Attendance/app/Models/.gitkeep | 0
Modules/Attendance/app/Providers/.gitkeep | 0
.../Providers/AttendanceServiceProvider.php | 114 +++
.../app/Providers/RouteServiceProvider.php | 49 ++
Modules/Attendance/app/Repositories/.gitkeep | 0
Modules/Attendance/composer.json | 30 +
Modules/Attendance/config/.gitkeep | 0
Modules/Attendance/config/config.php | 5 +
.../Attendance/database/factories/.gitkeep | 0
.../Attendance/database/migrations/.gitkeep | 0
Modules/Attendance/database/seeders/.gitkeep | 0
.../seeders/AttendanceDatabaseSeeder.php | 16 +
Modules/Attendance/module.json | 11 +
Modules/Attendance/package.json | 15 +
Modules/Attendance/resources/assets/.gitkeep | 0
Modules/Attendance/resources/assets/js/app.js | 0
.../Attendance/resources/assets/sass/app.scss | 0
Modules/Attendance/resources/views/.gitkeep | 0
.../resources/views/index.blade.php | 7 +
.../resources/views/layouts/master.blade.php | 29 +
Modules/Attendance/routes/.gitkeep | 0
Modules/Attendance/routes/api.php | 19 +
Modules/Attendance/routes/web.php | 19 +
Modules/Attendance/vite.config.js | 26 +
Modules/Employee/app/Http/Requests/.gitkeep | 0
Modules/Employee/app/Models/Employee.php | 13 -
.../app/Providers/EmployeeServiceProvider.php | 3 -
.../app/Repositories/EmployeeInterface.php | 12 -
.../app/Repositories/EmployeeRepository.php | 34 -
Modules/Employee/database/factories/.gitkeep | 0
.../Employee/resources/views/index.blade.php | 820 +-----------------
.../Leave/resources/views/create.blade.php | 16 +-
Modules/Leave/resources/views/index.blade.php | 49 +-
Modules/User/app/Http/Controllers/.gitkeep | 0
.../app/Http/Controllers/UserController.php | 72 ++
Modules/User/app/Http/Requests/.gitkeep | 0
Modules/User/app/Models/.gitkeep | 0
Modules/User/app/Providers/.gitkeep | 0
.../app/Providers/RouteServiceProvider.php | 49 ++
.../app/Providers/UserServiceProvider.php | 114 +++
Modules/User/app/Repositories/.gitkeep | 0
Modules/User/composer.json | 30 +
Modules/User/config/.gitkeep | 0
Modules/User/config/config.php | 5 +
Modules/User/database/factories/.gitkeep | 0
Modules/User/database/migrations/.gitkeep | 0
Modules/User/database/seeders/.gitkeep | 0
.../database/seeders/UserDatabaseSeeder.php | 16 +
Modules/User/module.json | 11 +
Modules/User/package.json | 15 +
Modules/User/resources/assets/.gitkeep | 0
Modules/User/resources/assets/js/app.js | 0
Modules/User/resources/assets/sass/app.scss | 0
Modules/User/resources/views/.gitkeep | 0
Modules/User/resources/views/create.blade.php | 44 +
Modules/User/resources/views/edit.blade.php | 44 +
Modules/User/resources/views/index.blade.php | 73 ++
.../resources/views/layouts/master.blade.php | 29 +
.../resources/views/partials/action.blade.php | 23 +
.../resources/views/partials/view.blade.php | 16 +
Modules/User/routes/.gitkeep | 0
Modules/User/routes/api.php | 19 +
Modules/User/routes/web.php | 19 +
Modules/User/vite.config.js | 26 +
app/Http/Controllers/CountriesController.php | 413 +++++----
.../Controllers/GeneralFormController.php | 275 +++---
...rcontroller.php => Usercontroller.php.bak} | 0
app/Models/Country/Country.php | 8 +-
app/Service/CommonModelService.php | 217 +++++
composer.lock | 4 +-
modules_statuses.json | 3 +-
public/assets/js/custom.js | 153 ++--
public/assets/js/pages/datatables.init.js | 2 +-
resources/views/crud/form/create.blade.php | 66 +-
resources/views/crud/form/tables.blade.php | 114 +--
.../crud/generated/branches/create.blade.php | 72 +-
.../crud/generated/branches/edit.blade.php | 72 +-
.../crud/generated/branches/index.blade.php | 475 +++++-----
.../crud/generated/branches/show.blade.php | 70 +-
.../crud/generated/castes/edit.blade.php | 39 +-
.../crud/generated/castes/index.blade.php | 432 ++++-----
.../crud/generated/castes/show.blade.php | 59 +-
.../crud/generated/cities/edit.blade.php | 46 +-
.../crud/generated/cities/index.blade.php | 439 +++++-----
.../crud/generated/cities/show.blade.php | 61 +-
.../crud/generated/companies/edit.blade.php | 52 +-
.../crud/generated/companies/index.blade.php | 451 +++++-----
.../crud/generated/companies/show.blade.php | 63 +-
.../generated/companytypes/edit.blade.php | 43 +-
.../generated/companytypes/index.blade.php | 433 ++++-----
.../generated/companytypes/show.blade.php | 60 +-
.../crud/generated/countries/create.blade.php | 57 +-
.../crud/generated/countries/edit.blade.php | 71 +-
.../crud/generated/countries/index.blade.php | 478 +++++-----
.../crud/generated/countries/show.blade.php | 60 +-
.../views/crud/generated/dags/edit.blade.php | 39 +-
.../views/crud/generated/dags/index.blade.php | 432 ++++-----
.../views/crud/generated/dags/show.blade.php | 59 +-
.../crud/generated/departments/edit.blade.php | 46 +-
.../generated/departments/index.blade.php | 440 +++++-----
.../crud/generated/departments/show.blade.php | 61 +-
.../generated/designations/edit.blade.php | 46 +-
.../generated/designations/index.blade.php | 444 +++++-----
.../generated/designations/show.blade.php | 61 +-
.../crud/generated/districts/edit.blade.php | 46 +-
.../crud/generated/districts/index.blade.php | 440 +++++-----
.../crud/generated/districts/show.blade.php | 61 +-
.../crud/generated/employees/edit.blade.php | 433 ++++++---
.../crud/generated/employees/index.blade.php | 575 ++++++------
.../crud/generated/employees/show.blade.php | 90 +-
.../crud/generated/ethnicities/edit.blade.php | 39 +-
.../generated/ethnicities/index.blade.php | 433 ++++-----
.../crud/generated/ethnicities/show.blade.php | 59 +-
.../crud/generated/genders/edit.blade.php | 39 +-
.../crud/generated/genders/index.blade.php | 432 ++++-----
.../crud/generated/genders/show.blade.php | 59 +-
.../crud/generated/leaves/edit.blade.php | 17 -
.../crud/generated/leaves/index.blade.php | 271 ------
.../crud/generated/leaves/show.blade.php | 29 -
.../crud/generated/leavetypes/edit.blade.php | 17 -
.../crud/generated/leavetypes/index.blade.php | 268 ------
.../crud/generated/leavetypes/show.blade.php | 29 -
.../generated/nationalities/edit.blade.php | 39 +-
.../generated/nationalities/index.blade.php | 433 ++++-----
.../generated/nationalities/show.blade.php | 59 +-
.../crud/generated/onboardings/edit.blade.php | 139 +--
.../generated/onboardings/index.blade.php | 479 +++++-----
.../crud/generated/onboardings/show.blade.php | 68 +-
.../crud/generated/permissions/edit.blade.php | 18 -
.../generated/permissions/index.blade.php | 272 ------
.../crud/generated/permissions/show.blade.php | 29 -
.../crud/generated/proviences/edit.blade.php | 46 +-
.../crud/generated/proviences/index.blade.php | 577 ++++++------
.../crud/generated/proviences/show.blade.php | 61 +-
.../generated/rolepermissions/edit.blade.php | 16 -
.../generated/rolepermissions/index.blade.php | 189 ----
.../generated/rolepermissions/show.blade.php | 29 -
.../views/crud/generated/roles/edit.blade.php | 25 -
.../crud/generated/roles/index.blade.php | 301 -------
.../views/crud/generated/roles/show.blade.php | 29 -
.../crud/generated/settings/create.blade.php | 109 ++-
.../crud/generated/settings/edit.blade.php | 278 +++---
.../crud/generated/settings/index.blade.php | 436 +++++-----
.../crud/generated/settings/show.blade.php | 82 +-
.../crud/generated/shifts/edit.blade.php | 39 +-
.../crud/generated/shifts/index.blade.php | 432 ++++-----
.../crud/generated/shifts/show.blade.php | 59 +-
.../crud/generated/users/__edit.blade.php | 87 +-
.../crud/generated/users/create.blade.php | 68 +-
.../views/crud/generated/users/edit.blade.php | 122 ++-
.../crud/generated/users/index.blade.php | 551 ++++++------
.../views/crud/generated/users/show.blade.php | 62 +-
.../crud/generated/vendors/edit.blade.php | 46 +-
.../crud/generated/vendors/index.blade.php | 439 +++++-----
.../crud/generated/vendors/show.blade.php | 61 +-
.../crud/generated/vendortypes/edit.blade.php | 43 +-
.../generated/vendortypes/index.blade.php | 433 ++++-----
.../crud/generated/vendortypes/show.blade.php | 60 +-
.../crud/generated/workoptions/edit.blade.php | 39 +-
.../generated/workoptions/index.blade.php | 433 ++++-----
.../crud/generated/workoptions/show.blade.php | 59 +-
.../views/crud/settings/ajax-curd.blade.php | 110 +--
resources/views/crud/template.blade.php | 69 +-
resources/views/layouts/app.blade.php | 24 +-
.../layouts/partials/breadcrumb.blade.php | 15 +
.../views/layouts/partials/header.blade.php | 18 +-
.../views/layouts/partials/sidebar.blade.php | 77 +-
routes/CRUDgenerated/route.users.php | 23 +-
routes/web.php | 18 +-
server.php | 21 +
174 files changed, 9312 insertions(+), 9540 deletions(-)
create mode 100644 .htaccess
create mode 100644 Modules/Attendance/app/Http/Controllers/.gitkeep
create mode 100644 Modules/Attendance/app/Http/Controllers/AttendanceController.php
create mode 100644 Modules/Attendance/app/Http/Requests/.gitkeep
create mode 100644 Modules/Attendance/app/Models/.gitkeep
create mode 100644 Modules/Attendance/app/Providers/.gitkeep
create mode 100644 Modules/Attendance/app/Providers/AttendanceServiceProvider.php
create mode 100644 Modules/Attendance/app/Providers/RouteServiceProvider.php
create mode 100644 Modules/Attendance/app/Repositories/.gitkeep
create mode 100644 Modules/Attendance/composer.json
create mode 100644 Modules/Attendance/config/.gitkeep
create mode 100644 Modules/Attendance/config/config.php
create mode 100644 Modules/Attendance/database/factories/.gitkeep
create mode 100644 Modules/Attendance/database/migrations/.gitkeep
create mode 100644 Modules/Attendance/database/seeders/.gitkeep
create mode 100644 Modules/Attendance/database/seeders/AttendanceDatabaseSeeder.php
create mode 100644 Modules/Attendance/module.json
create mode 100644 Modules/Attendance/package.json
create mode 100644 Modules/Attendance/resources/assets/.gitkeep
create mode 100644 Modules/Attendance/resources/assets/js/app.js
create mode 100644 Modules/Attendance/resources/assets/sass/app.scss
create mode 100644 Modules/Attendance/resources/views/.gitkeep
create mode 100644 Modules/Attendance/resources/views/index.blade.php
create mode 100644 Modules/Attendance/resources/views/layouts/master.blade.php
create mode 100644 Modules/Attendance/routes/.gitkeep
create mode 100644 Modules/Attendance/routes/api.php
create mode 100644 Modules/Attendance/routes/web.php
create mode 100644 Modules/Attendance/vite.config.js
create mode 100644 Modules/Employee/app/Http/Requests/.gitkeep
delete mode 100644 Modules/Employee/app/Models/Employee.php
delete mode 100644 Modules/Employee/app/Repositories/EmployeeInterface.php
delete mode 100644 Modules/Employee/app/Repositories/EmployeeRepository.php
create mode 100644 Modules/Employee/database/factories/.gitkeep
create mode 100644 Modules/User/app/Http/Controllers/.gitkeep
create mode 100644 Modules/User/app/Http/Controllers/UserController.php
create mode 100644 Modules/User/app/Http/Requests/.gitkeep
create mode 100644 Modules/User/app/Models/.gitkeep
create mode 100644 Modules/User/app/Providers/.gitkeep
create mode 100644 Modules/User/app/Providers/RouteServiceProvider.php
create mode 100644 Modules/User/app/Providers/UserServiceProvider.php
create mode 100644 Modules/User/app/Repositories/.gitkeep
create mode 100644 Modules/User/composer.json
create mode 100644 Modules/User/config/.gitkeep
create mode 100644 Modules/User/config/config.php
create mode 100644 Modules/User/database/factories/.gitkeep
create mode 100644 Modules/User/database/migrations/.gitkeep
create mode 100644 Modules/User/database/seeders/.gitkeep
create mode 100644 Modules/User/database/seeders/UserDatabaseSeeder.php
create mode 100644 Modules/User/module.json
create mode 100644 Modules/User/package.json
create mode 100644 Modules/User/resources/assets/.gitkeep
create mode 100644 Modules/User/resources/assets/js/app.js
create mode 100644 Modules/User/resources/assets/sass/app.scss
create mode 100644 Modules/User/resources/views/.gitkeep
create mode 100644 Modules/User/resources/views/create.blade.php
create mode 100644 Modules/User/resources/views/edit.blade.php
create mode 100644 Modules/User/resources/views/index.blade.php
create mode 100644 Modules/User/resources/views/layouts/master.blade.php
create mode 100644 Modules/User/resources/views/partials/action.blade.php
create mode 100644 Modules/User/resources/views/partials/view.blade.php
create mode 100644 Modules/User/routes/.gitkeep
create mode 100644 Modules/User/routes/api.php
create mode 100644 Modules/User/routes/web.php
create mode 100644 Modules/User/vite.config.js
rename app/Http/Controllers/{Usercontroller.php => Usercontroller.php.bak} (100%)
create mode 100644 app/Service/CommonModelService.php
delete mode 100644 resources/views/crud/generated/leaves/edit.blade.php
delete mode 100644 resources/views/crud/generated/leaves/index.blade.php
delete mode 100644 resources/views/crud/generated/leaves/show.blade.php
delete mode 100644 resources/views/crud/generated/leavetypes/edit.blade.php
delete mode 100644 resources/views/crud/generated/leavetypes/index.blade.php
delete mode 100644 resources/views/crud/generated/leavetypes/show.blade.php
delete mode 100644 resources/views/crud/generated/permissions/edit.blade.php
delete mode 100644 resources/views/crud/generated/permissions/index.blade.php
delete mode 100644 resources/views/crud/generated/permissions/show.blade.php
delete mode 100644 resources/views/crud/generated/rolepermissions/edit.blade.php
delete mode 100644 resources/views/crud/generated/rolepermissions/index.blade.php
delete mode 100644 resources/views/crud/generated/rolepermissions/show.blade.php
delete mode 100644 resources/views/crud/generated/roles/edit.blade.php
delete mode 100644 resources/views/crud/generated/roles/index.blade.php
delete mode 100644 resources/views/crud/generated/roles/show.blade.php
create mode 100644 resources/views/layouts/partials/breadcrumb.blade.php
create mode 100644 server.php
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..7735dd1
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,18 @@
+
+
+ Options -MultiViews
+
+
+ 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
+
\ No newline at end of file
diff --git a/Modules/Attendance/app/Http/Controllers/.gitkeep b/Modules/Attendance/app/Http/Controllers/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/app/Http/Controllers/AttendanceController.php b/Modules/Attendance/app/Http/Controllers/AttendanceController.php
new file mode 100644
index 0000000..787a2b0
--- /dev/null
+++ b/Modules/Attendance/app/Http/Controllers/AttendanceController.php
@@ -0,0 +1,67 @@
+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/Attendance/app/Providers/RouteServiceProvider.php b/Modules/Attendance/app/Providers/RouteServiceProvider.php
new file mode 100644
index 0000000..6a6cc87
--- /dev/null
+++ b/Modules/Attendance/app/Providers/RouteServiceProvider.php
@@ -0,0 +1,49 @@
+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'));
+ }
+}
diff --git a/Modules/Attendance/app/Repositories/.gitkeep b/Modules/Attendance/app/Repositories/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/composer.json b/Modules/Attendance/composer.json
new file mode 100644
index 0000000..8556d91
--- /dev/null
+++ b/Modules/Attendance/composer.json
@@ -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/"
+ }
+ }
+}
diff --git a/Modules/Attendance/config/.gitkeep b/Modules/Attendance/config/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/config/config.php b/Modules/Attendance/config/config.php
new file mode 100644
index 0000000..080df77
--- /dev/null
+++ b/Modules/Attendance/config/config.php
@@ -0,0 +1,5 @@
+ 'Attendance',
+];
diff --git a/Modules/Attendance/database/factories/.gitkeep b/Modules/Attendance/database/factories/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/database/migrations/.gitkeep b/Modules/Attendance/database/migrations/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/database/seeders/.gitkeep b/Modules/Attendance/database/seeders/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/database/seeders/AttendanceDatabaseSeeder.php b/Modules/Attendance/database/seeders/AttendanceDatabaseSeeder.php
new file mode 100644
index 0000000..2f8f306
--- /dev/null
+++ b/Modules/Attendance/database/seeders/AttendanceDatabaseSeeder.php
@@ -0,0 +1,16 @@
+call([]);
+ }
+}
diff --git a/Modules/Attendance/module.json b/Modules/Attendance/module.json
new file mode 100644
index 0000000..bfa3a17
--- /dev/null
+++ b/Modules/Attendance/module.json
@@ -0,0 +1,11 @@
+{
+ "name": "Attendance",
+ "alias": "attendance",
+ "description": "",
+ "keywords": [],
+ "priority": 0,
+ "providers": [
+ "Modules\\Attendance\\Providers\\AttendanceServiceProvider"
+ ],
+ "files": []
+}
diff --git a/Modules/Attendance/package.json b/Modules/Attendance/package.json
new file mode 100644
index 0000000..d6fbfc8
--- /dev/null
+++ b/Modules/Attendance/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/Attendance/resources/assets/.gitkeep b/Modules/Attendance/resources/assets/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/resources/assets/js/app.js b/Modules/Attendance/resources/assets/js/app.js
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/resources/assets/sass/app.scss b/Modules/Attendance/resources/assets/sass/app.scss
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/resources/views/.gitkeep b/Modules/Attendance/resources/views/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/resources/views/index.blade.php b/Modules/Attendance/resources/views/index.blade.php
new file mode 100644
index 0000000..7b1a268
--- /dev/null
+++ b/Modules/Attendance/resources/views/index.blade.php
@@ -0,0 +1,7 @@
+@extends('attendance::layouts.master')
+
+@section('content')
+ Hello World
+
+ Module: {!! config('attendance.name') !!}
+@endsection
diff --git a/Modules/Attendance/resources/views/layouts/master.blade.php b/Modules/Attendance/resources/views/layouts/master.blade.php
new file mode 100644
index 0000000..62332e4
--- /dev/null
+++ b/Modules/Attendance/resources/views/layouts/master.blade.php
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+ Attendance Module - {{ config('app.name', 'Laravel') }}
+
+
+
+
+
+
+
+
+
+ {{-- Vite CSS --}}
+ {{-- {{ module_vite('build-attendance', 'resources/assets/sass/app.scss') }} --}}
+
+
+
+ @yield('content')
+
+ {{-- Vite JS --}}
+ {{-- {{ module_vite('build-attendance', 'resources/assets/js/app.js') }} --}}
+
diff --git a/Modules/Attendance/routes/.gitkeep b/Modules/Attendance/routes/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Attendance/routes/api.php b/Modules/Attendance/routes/api.php
new file mode 100644
index 0000000..e349118
--- /dev/null
+++ b/Modules/Attendance/routes/api.php
@@ -0,0 +1,19 @@
+prefix('v1')->group(function () {
+ Route::apiResource('attendance', AttendanceController::class)->names('attendance');
+});
diff --git a/Modules/Attendance/routes/web.php b/Modules/Attendance/routes/web.php
new file mode 100644
index 0000000..3e0eaad
--- /dev/null
+++ b/Modules/Attendance/routes/web.php
@@ -0,0 +1,19 @@
+names('attendance');
+});
diff --git a/Modules/Attendance/vite.config.js b/Modules/Attendance/vite.config.js
new file mode 100644
index 0000000..ae729ea
--- /dev/null
+++ b/Modules/Attendance/vite.config.js
@@ -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',
+//];
\ No newline at end of file
diff --git a/Modules/Employee/app/Http/Requests/.gitkeep b/Modules/Employee/app/Http/Requests/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Employee/app/Models/Employee.php b/Modules/Employee/app/Models/Employee.php
deleted file mode 100644
index 7002cf2..0000000
--- a/Modules/Employee/app/Models/Employee.php
+++ /dev/null
@@ -1,13 +0,0 @@
-app->bind(EmployeeInterface::class, EmployeeRepository::class);
$this->app->register(RouteServiceProvider::class);
}
diff --git a/Modules/Employee/app/Repositories/EmployeeInterface.php b/Modules/Employee/app/Repositories/EmployeeInterface.php
deleted file mode 100644
index 947e916..0000000
--- a/Modules/Employee/app/Repositories/EmployeeInterface.php
+++ /dev/null
@@ -1,12 +0,0 @@
-update($newDetails);
- }
-
-}
diff --git a/Modules/Employee/database/factories/.gitkeep b/Modules/Employee/database/factories/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/Employee/resources/views/index.blade.php b/Modules/Employee/resources/views/index.blade.php
index 8031d3b..d4ef68a 100644
--- a/Modules/Employee/resources/views/index.blade.php
+++ b/Modules/Employee/resources/views/index.blade.php
@@ -5,21 +5,8 @@
-
-
-
-
Team
+ @include('layouts.partials.breadcrumb', ['title' => 'Employee'])
-
-
-
-
-
@@ -37,7 +24,7 @@
+ data-bs-target="#addmemberModal"> Create Employee
@@ -53,6 +40,7 @@
+
@@ -112,6 +100,7 @@
+
@@ -172,6 +161,7 @@
+
-
-
-
-
Sorry! No Result Found
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Nancy Martino
-
Team Leader & HR
-
-
-
-
-
-
-
Personal Details
-
-
Number
-
+(256) 2451 8974
-
-
-
Email
-
nancymartino@email.com
-
-
-
Location
-
Carson City - USA
-
-
-
-
-
-
-
-
View Profile
-
-
-
diff --git a/Modules/Leave/resources/views/create.blade.php b/Modules/Leave/resources/views/create.blade.php
index 92dd147..b757afb 100644
--- a/Modules/Leave/resources/views/create.blade.php
+++ b/Modules/Leave/resources/views/create.blade.php
@@ -4,21 +4,7 @@
-
-
-
-
{{ $title }}
-
-
-
- - Dashboards
- - {{ $title }}
-
-
-
-
-
-
+ @include('layouts.partials.breadcrumb', ['title' => $title])
diff --git a/Modules/Leave/resources/views/index.blade.php b/Modules/Leave/resources/views/index.blade.php
index 0aab2c4..d15471d 100644
--- a/Modules/Leave/resources/views/index.blade.php
+++ b/Modules/Leave/resources/views/index.blade.php
@@ -84,8 +84,9 @@
-
+
@@ -98,48 +99,10 @@
-
+
+
-
+
@include('leave::partials.view')
@endsection
-
-@push('js')
-
-@endpush
diff --git a/Modules/User/app/Http/Controllers/.gitkeep b/Modules/User/app/Http/Controllers/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/app/Http/Controllers/UserController.php b/Modules/User/app/Http/Controllers/UserController.php
new file mode 100644
index 0000000..8d68047
--- /dev/null
+++ b/Modules/User/app/Http/Controllers/UserController.php
@@ -0,0 +1,72 @@
+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)
+ {
+ //
+ }
+}
diff --git a/Modules/User/app/Http/Requests/.gitkeep b/Modules/User/app/Http/Requests/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/app/Models/.gitkeep b/Modules/User/app/Models/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/app/Providers/.gitkeep b/Modules/User/app/Providers/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/app/Providers/RouteServiceProvider.php b/Modules/User/app/Providers/RouteServiceProvider.php
new file mode 100644
index 0000000..9ae8055
--- /dev/null
+++ b/Modules/User/app/Providers/RouteServiceProvider.php
@@ -0,0 +1,49 @@
+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'));
+ }
+}
diff --git a/Modules/User/app/Providers/UserServiceProvider.php b/Modules/User/app/Providers/UserServiceProvider.php
new file mode 100644
index 0000000..a694b09
--- /dev/null
+++ b/Modules/User/app/Providers/UserServiceProvider.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/User/app/Repositories/.gitkeep b/Modules/User/app/Repositories/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/composer.json b/Modules/User/composer.json
new file mode 100644
index 0000000..6a22c82
--- /dev/null
+++ b/Modules/User/composer.json
@@ -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/"
+ }
+ }
+}
diff --git a/Modules/User/config/.gitkeep b/Modules/User/config/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/config/config.php b/Modules/User/config/config.php
new file mode 100644
index 0000000..566de5a
--- /dev/null
+++ b/Modules/User/config/config.php
@@ -0,0 +1,5 @@
+ 'User',
+];
diff --git a/Modules/User/database/factories/.gitkeep b/Modules/User/database/factories/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/database/migrations/.gitkeep b/Modules/User/database/migrations/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/database/seeders/.gitkeep b/Modules/User/database/seeders/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/database/seeders/UserDatabaseSeeder.php b/Modules/User/database/seeders/UserDatabaseSeeder.php
new file mode 100644
index 0000000..9983acc
--- /dev/null
+++ b/Modules/User/database/seeders/UserDatabaseSeeder.php
@@ -0,0 +1,16 @@
+call([]);
+ }
+}
diff --git a/Modules/User/module.json b/Modules/User/module.json
new file mode 100644
index 0000000..09e540d
--- /dev/null
+++ b/Modules/User/module.json
@@ -0,0 +1,11 @@
+{
+ "name": "User",
+ "alias": "user",
+ "description": "",
+ "keywords": [],
+ "priority": 0,
+ "providers": [
+ "Modules\\User\\Providers\\UserServiceProvider"
+ ],
+ "files": []
+}
diff --git a/Modules/User/package.json b/Modules/User/package.json
new file mode 100644
index 0000000..d6fbfc8
--- /dev/null
+++ b/Modules/User/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/User/resources/assets/.gitkeep b/Modules/User/resources/assets/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/resources/assets/js/app.js b/Modules/User/resources/assets/js/app.js
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/resources/assets/sass/app.scss b/Modules/User/resources/assets/sass/app.scss
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/resources/views/.gitkeep b/Modules/User/resources/views/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/resources/views/create.blade.php b/Modules/User/resources/views/create.blade.php
new file mode 100644
index 0000000..166da0d
--- /dev/null
+++ b/Modules/User/resources/views/create.blade.php
@@ -0,0 +1,44 @@
+@extends('layouts.app')
+
+@section('content')
+
+
+
+
+
+
+
{{ $title }}
+
+
+
+ - Dashboards
+ - {{ $title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+@endsection
+
+@push('js')
+
+@endpush
diff --git a/Modules/User/resources/views/edit.blade.php b/Modules/User/resources/views/edit.blade.php
new file mode 100644
index 0000000..166da0d
--- /dev/null
+++ b/Modules/User/resources/views/edit.blade.php
@@ -0,0 +1,44 @@
+@extends('layouts.app')
+
+@section('content')
+
+
+
+
+
+
+
{{ $title }}
+
+
+
+ - Dashboards
+ - {{ $title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+@endsection
+
+@push('js')
+
+@endpush
diff --git a/Modules/User/resources/views/index.blade.php b/Modules/User/resources/views/index.blade.php
new file mode 100644
index 0000000..f279725
--- /dev/null
+++ b/Modules/User/resources/views/index.blade.php
@@ -0,0 +1,73 @@
+@extends('layouts.app')
+@section('content')
+
+ @include('user::partials.view')
+@endsection
diff --git a/Modules/User/resources/views/layouts/master.blade.php b/Modules/User/resources/views/layouts/master.blade.php
new file mode 100644
index 0000000..7b82912
--- /dev/null
+++ b/Modules/User/resources/views/layouts/master.blade.php
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+ User Module - {{ config('app.name', 'Laravel') }}
+
+
+
+
+
+
+
+
+
+ {{-- Vite CSS --}}
+ {{-- {{ module_vite('build-user', 'resources/assets/sass/app.scss') }} --}}
+
+
+
+ @yield('content')
+
+ {{-- Vite JS --}}
+ {{-- {{ module_vite('build-user', 'resources/assets/js/app.js') }} --}}
+
diff --git a/Modules/User/resources/views/partials/action.blade.php b/Modules/User/resources/views/partials/action.blade.php
new file mode 100644
index 0000000..973a5f3
--- /dev/null
+++ b/Modules/User/resources/views/partials/action.blade.php
@@ -0,0 +1,23 @@
+
+
+
+
+ Please enter employee name.
+
+
+
+
+
+
+
+
+
+
+
+
+
+@push('js')
+
+@endpush
diff --git a/Modules/User/resources/views/partials/view.blade.php b/Modules/User/resources/views/partials/view.blade.php
new file mode 100644
index 0000000..00dc733
--- /dev/null
+++ b/Modules/User/resources/views/partials/view.blade.php
@@ -0,0 +1,16 @@
+
diff --git a/Modules/User/routes/.gitkeep b/Modules/User/routes/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Modules/User/routes/api.php b/Modules/User/routes/api.php
new file mode 100644
index 0000000..4b69013
--- /dev/null
+++ b/Modules/User/routes/api.php
@@ -0,0 +1,19 @@
+prefix('v1')->group(function () {
+ Route::apiResource('user', UserController::class)->names('user');
+});
diff --git a/Modules/User/routes/web.php b/Modules/User/routes/web.php
new file mode 100644
index 0000000..c43ce3b
--- /dev/null
+++ b/Modules/User/routes/web.php
@@ -0,0 +1,19 @@
+names('user');
+});
diff --git a/Modules/User/vite.config.js b/Modules/User/vite.config.js
new file mode 100644
index 0000000..3fce796
--- /dev/null
+++ b/Modules/User/vite.config.js
@@ -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',
+//];
\ No newline at end of file
diff --git a/app/Http/Controllers/CountriesController.php b/app/Http/Controllers/CountriesController.php
index 5a66f25..c78a8f2 100644
--- a/app/Http/Controllers/CountriesController.php
+++ b/app/Http/Controllers/CountriesController.php
@@ -1,218 +1,211 @@
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);
}
-
\ No newline at end of file
+ $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);
+ }
+
+}
diff --git a/app/Http/Controllers/GeneralFormController.php b/app/Http/Controllers/GeneralFormController.php
index d70ba25..44b0c51 100644
--- a/app/Http/Controllers/GeneralFormController.php
+++ b/app/Http/Controllers/GeneralFormController.php
@@ -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 .= "Status : $TableCol == 1 ? 'text-success' : 'text-danger'}}\">{{\$data->$TableCol == 1 ? 'Active' : 'Inactive'}}
";
- else
+ class=\"{{\$data->$TableCol == 1 ? 'text-success' : 'text-danger'}}\">{{\$data->$TableCol == 1 ? 'Active' : 'Inactive'}}
";
+ } else {
$showContent .= '' . $TableColLabel . " : {{\$data->$TableCol}}
";
+ }
endforeach;
$showContent .= "
@@ -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 = "
";
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 .= ' ';
$editContent .= "\n";
@@ -333,8 +329,6 @@ class GeneralFormController extends Controller
$editContent .= "
";
$editContent .= " ";
-
-
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')