From c1a81191fad20648fc48c065440713301a82c83a Mon Sep 17 00:00:00 2001 From: Dharma Date: Wed, 10 Apr 2024 12:02:46 +0545 Subject: [PATCH 1/4] sidebar active --- resources/views/layouts/partials/sidebar.blade.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index 52663e4..d954689 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -34,8 +34,8 @@ Dashboard - From 3267e212f706c884e42d3619cc30dc311496f210 Mon Sep 17 00:00:00 2001 From: Dharma Date: Wed, 10 Apr 2024 15:21:30 +0545 Subject: [PATCH 2/4] module updated --- app/Helpers/OMIS.php | 11 +- app/Http/Controllers/CitiesController.php | 43 ++- app/Http/Controllers/CompaniesController.php | 52 ++- app/Http/Controllers/CountriesController.php | 3 +- .../Controllers/DepartmentsController.php | 45 ++- .../Controllers/DesignationsController.php | 36 +- app/Http/Controllers/DistrictsController.php | 43 ++- app/Http/Controllers/ProvinceController.php | 35 +- app/Models/Cities.php | 16 + app/Models/Companies.php | 17 + app/Models/Departments.php | 16 + app/Models/Designations.php | 16 + app/Models/District.php | 37 -- app/Models/Districts.php | 20 ++ .../{Permission.php => Permission.php.bak} | 0 app/Models/Province.php | 13 +- app/Models/{Role.php => Role.php.bak} | 0 public/assets/js/custom.js | 192 +++++------ .../crud/generated/countries/create.blade.php | 35 -- .../crud/generated/countries/edit.blade.php | 78 +++-- .../crud/generated/countries/index.blade.php | 179 +++++----- .../crud/generated/countries/show.blade.php | 71 ++-- .../crud/generated/departments/edit.blade.php | 76 +++-- .../generated/departments/index.blade.php | 187 +++++------ .../crud/generated/departments/show.blade.php | 57 ++-- .../generated/designations/edit.blade.php | 73 ++-- .../generated/designations/index.blade.php | 181 +++++----- .../crud/generated/districts/edit.blade.php | 64 ++-- .../crud/generated/districts/index.blade.php | 176 +++++----- .../crud/generated/districts/show.blade.php | 57 ++-- .../crud/generated/proviences/edit.blade.php | 30 -- .../crud/generated/proviences/index.blade.php | 315 ------------------ .../crud/generated/proviences/show.blade.php | 38 --- .../crud/generated/provinces/edit.blade.php | 37 ++ .../crud/generated/provinces/index.blade.php | 283 ++++++++++++++++ .../crud/generated/provinces/show.blade.php | 45 +++ .../views/layouts/partials/sidebar.blade.php | 19 +- .../route.admittedpplications.php | 16 - routes/CRUDgenerated/route.agents.php | 15 - .../CRUDgenerated/route.campaignarticles.php | 15 - .../CRUDgenerated/route.campaignlocations.php | 16 - routes/CRUDgenerated/route.campaigns.php | 15 - routes/CRUDgenerated/route.cities.php | 26 +- routes/CRUDgenerated/route.coops.php | 16 - routes/CRUDgenerated/route.countries.php | 24 +- routes/CRUDgenerated/route.departments.php | 26 +- routes/CRUDgenerated/route.designations.php | 26 +- routes/CRUDgenerated/route.documentsets.php | 17 - routes/CRUDgenerated/route.employees.php | 16 - routes/CRUDgenerated/route.eventlocations.php | 16 - routes/CRUDgenerated/route.followups.php | 15 - routes/CRUDgenerated/route.intakes.php | 16 - routes/CRUDgenerated/route.leadcategories.php | 15 - .../CRUDgenerated/route.offerapplications.php | 22 -- routes/CRUDgenerated/route.options.php | 19 -- routes/CRUDgenerated/route.permissions.php | 16 - .../route.preparationclasses.php | 15 - routes/CRUDgenerated/route.programs.php | 20 -- routes/CRUDgenerated/route.progressstatus.php | 16 - .../CRUDgenerated/route.progressstatuses.php | 16 - routes/CRUDgenerated/route.proviences.php | 16 - routes/CRUDgenerated/route.provinces.php | 27 +- routes/CRUDgenerated/route.qrscans.php | 15 - routes/CRUDgenerated/route.qualifications.php | 15 - routes/CRUDgenerated/route.registrations.php | 25 -- .../CRUDgenerated/route.requireddocuments.php | 16 - routes/CRUDgenerated/route.sources.php | 15 - .../route.spinthewheelwinners.php | 15 - routes/CRUDgenerated/route.staffs.php | 16 - routes/CRUDgenerated/route.students.php | 21 -- routes/web.php | 11 +- 71 files changed, 1390 insertions(+), 1812 deletions(-) create mode 100644 app/Models/Cities.php create mode 100644 app/Models/Companies.php create mode 100644 app/Models/Departments.php create mode 100644 app/Models/Designations.php delete mode 100644 app/Models/District.php create mode 100644 app/Models/Districts.php rename app/Models/{Permission.php => Permission.php.bak} (100%) rename app/Models/{Role.php => Role.php.bak} (100%) delete mode 100644 resources/views/crud/generated/countries/create.blade.php delete mode 100644 resources/views/crud/generated/proviences/edit.blade.php delete mode 100644 resources/views/crud/generated/proviences/index.blade.php delete mode 100644 resources/views/crud/generated/proviences/show.blade.php create mode 100644 resources/views/crud/generated/provinces/edit.blade.php create mode 100644 resources/views/crud/generated/provinces/index.blade.php create mode 100644 resources/views/crud/generated/provinces/show.blade.php delete mode 100644 routes/CRUDgenerated/route.admittedpplications.php delete mode 100644 routes/CRUDgenerated/route.agents.php delete mode 100644 routes/CRUDgenerated/route.campaignarticles.php delete mode 100644 routes/CRUDgenerated/route.campaignlocations.php delete mode 100644 routes/CRUDgenerated/route.campaigns.php delete mode 100644 routes/CRUDgenerated/route.coops.php delete mode 100644 routes/CRUDgenerated/route.documentsets.php delete mode 100644 routes/CRUDgenerated/route.employees.php delete mode 100644 routes/CRUDgenerated/route.eventlocations.php delete mode 100644 routes/CRUDgenerated/route.followups.php delete mode 100644 routes/CRUDgenerated/route.intakes.php delete mode 100644 routes/CRUDgenerated/route.leadcategories.php delete mode 100644 routes/CRUDgenerated/route.offerapplications.php delete mode 100644 routes/CRUDgenerated/route.options.php delete mode 100644 routes/CRUDgenerated/route.permissions.php delete mode 100644 routes/CRUDgenerated/route.preparationclasses.php delete mode 100644 routes/CRUDgenerated/route.programs.php delete mode 100644 routes/CRUDgenerated/route.progressstatus.php delete mode 100644 routes/CRUDgenerated/route.progressstatuses.php delete mode 100644 routes/CRUDgenerated/route.proviences.php delete mode 100644 routes/CRUDgenerated/route.qrscans.php delete mode 100644 routes/CRUDgenerated/route.qualifications.php delete mode 100644 routes/CRUDgenerated/route.registrations.php delete mode 100644 routes/CRUDgenerated/route.requireddocuments.php delete mode 100644 routes/CRUDgenerated/route.sources.php delete mode 100644 routes/CRUDgenerated/route.spinthewheelwinners.php delete mode 100644 routes/CRUDgenerated/route.staffs.php delete mode 100644 routes/CRUDgenerated/route.students.php diff --git a/app/Helpers/OMIS.php b/app/Helpers/OMIS.php index f25a4bc..751ade3 100644 --- a/app/Helpers/OMIS.php +++ b/app/Helpers/OMIS.php @@ -362,8 +362,9 @@ class OMIS `updatedby` INT(11) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; "); - DB::statement("CREATE TABLE IF NOT EXISTS `tbl_proviences` ( - `provience_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_provinces` ( + `province_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `countries_id` INT(11) NULL, `title` VARCHAR(255), `alias` VARCHAR(255), @@ -380,7 +381,7 @@ class OMIS DB::statement("CREATE TABLE IF NOT EXISTS `tbl_districts` ( `district_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, - `proviences_id` INT(11), + `provinces_id` INT(11), `title` VARCHAR(255), `alias` VARCHAR(255), `description` TEXT, @@ -727,8 +728,8 @@ class OMIS // if (!(DB::table('countries')->first())) { // DB::statement("INSERT INTO `tbl_countries` (`title`,`alias`,`status`) VALUES ('Nepal','nepal', '1');"); // } - // if (!(DB::table('proviences')->first())) { - // DB::statement("INSERT INTO `tbl_proviences` (`title`,`alias`,`status`) VALUES ('Bagmati','bagmati', '1');"); + // if (!(DB::table('provinces')->first())) { + // DB::statement("INSERT INTO `tbl_provinces` (`title`,`alias`,`status`) VALUES ('Bagmati','bagmati', '1');"); // } // if (!(DB::table('roles')->first())) { diff --git a/app/Http/Controllers/CitiesController.php b/app/Http/Controllers/CitiesController.php index 87a743f..3d4a24d 100644 --- a/app/Http/Controllers/CitiesController.php +++ b/app/Http/Controllers/CitiesController.php @@ -18,15 +18,15 @@ } public function index(Request $request) { - createActivityLog(CitiesController::class, 'index', ' Cities index'); + // createActivityLog(CitiesController::class, 'index', ' Cities index'); $data = Cities::where('status','<>',-1)->orderBy('display_order')->get(); - + return view("crud.generated.cities.index", compact('data')); } public function create(Request $request) { - createActivityLog(CitiesController::class, 'create', ' Cities create'); + // createActivityLog(CitiesController::class, 'create', ' Cities create'); $TableData = Cities::where('status','<>',-1)->orderBy('display_order')->get(); $editable=false; return view("crud.generated.cities.edit",compact('TableData','editable')); @@ -34,7 +34,7 @@ public function store(Request $request) { - createActivityLog(CitiesController::class, 'store', ' Cities store'); + // createActivityLog(CitiesController::class, 'store', ' Cities store'); $validator = Validator::make($request->all(), [ //ADD REQUIRED FIELDS FOR VALIDATION ]); @@ -54,7 +54,7 @@ }); array_walk_recursive($requestData, function (&$value) { $value = str_replace(env('APP_URL'), '', $value); - }); + }); DB::beginTransaction(); try { $operationNumber = getOperationNumber(); @@ -71,22 +71,22 @@ } return redirect()->route('cities.index')->with('success','The Cities created Successfully.'); } - + public function sort(Request $request) { $idOrder = $request->input('id_order'); - + foreach ($idOrder as $index => $id) { $companyArticle = Cities::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 = Cities::find($articleId); @@ -97,22 +97,22 @@ $companyArticle->save(); return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200); } - - - + + + public function show(Request $request, $id) { - createActivityLog(CitiesController::class, 'show', ' Cities show'); + // createActivityLog(CitiesController::class, 'show', ' Cities show'); $data = Cities::findOrFail($id); - + return view("crud.generated.cities.show", compact('data')); } public function edit(Request $request, $id) { - createActivityLog(CitiesController::class, 'edit', ' Cities edit'); + // createActivityLog(CitiesController::class, 'edit', ' Cities edit'); $TableData = Cities::where('status','<>',-1)->orderBy('display_order')->get(); $data = Cities::findOrFail($id); $editable=true; @@ -122,7 +122,7 @@ public function update(Request $request, $id) { - createActivityLog(CitiesController::class, 'update', ' Cities update'); + // createActivityLog(CitiesController::class, 'update', ' Cities update'); $validator = Validator::make($request->all(), [ //ADD VALIDATION FOR REQIRED FIELDS ]); @@ -159,7 +159,7 @@ public function destroy(Request $request,$id) { - createActivityLog(CitiesController::class, 'destroy', ' Cities destroy'); + // createActivityLog(CitiesController::class, 'destroy', ' Cities destroy'); DB::beginTransaction(); try { $OperationNumber = getOperationNumber(); @@ -175,7 +175,7 @@ } public function toggle(Request $request,$id) { - createActivityLog(CitiesController::class, 'destroy', ' Cities destroy'); + // createActivityLog(CitiesController::class, 'destroy', ' Cities destroy'); $data = Cities::findOrFail($id); $requestData=['status'=>($data->status==1)?0:1]; DB::beginTransaction(); @@ -193,7 +193,7 @@ } public function clone(Request $request,$id) { - createActivityLog(CitiesController::class, 'clone', ' Cities clone'); + // createActivityLog(CitiesController::class, 'clone', ' Cities clone'); $data = Cities::findOrFail($id); unset($data['updatedby']); unset($data['createdby']); @@ -211,8 +211,7 @@ DB::commit(); return response()->json(['status'=>true,'message'=>'The Cities Clonned Successfully.'],200); } - - + + } - \ No newline at end of file diff --git a/app/Http/Controllers/CompaniesController.php b/app/Http/Controllers/CompaniesController.php index 4ed27cf..4e8ebcf 100644 --- a/app/Http/Controllers/CompaniesController.php +++ b/app/Http/Controllers/CompaniesController.php @@ -18,24 +18,21 @@ } public function index(Request $request) { - createActivityLog(CompaniesController::class, 'index', ' Companies index'); - $data = Companies::where('status','<>',-1)->orderBy('display_order')->get(); - + $data = Companies::where('status','<>',-1)->orderBy('display_order')->get(); + return view("crud.generated.companies.index", compact('data')); } public function create(Request $request) { - createActivityLog(CompaniesController::class, 'create', ' Companies create'); - $TableData = Companies::where('status','<>',-1)->orderBy('display_order')->get(); + $TableData = Companies::where('status','<>',-1)->orderBy('display_order')->get(); $editable=false; return view("crud.generated.companies.edit",compact('TableData','editable')); } public function store(Request $request) { - createActivityLog(CompaniesController::class, 'store', ' Companies store'); - $validator = Validator::make($request->all(), [ + $validator = Validator::make($request->all(), [ //ADD REQUIRED FIELDS FOR VALIDATION ]); @@ -54,7 +51,7 @@ }); array_walk_recursive($requestData, function (&$value) { $value = str_replace(env('APP_URL'), '', $value); - }); + }); DB::beginTransaction(); try { $operationNumber = getOperationNumber(); @@ -71,22 +68,22 @@ } return redirect()->route('companies.index')->with('success','The Companies created Successfully.'); } - + public function sort(Request $request) { $idOrder = $request->input('id_order'); - + foreach ($idOrder as $index => $id) { $companyArticle = Companies::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 = Companies::find($articleId); @@ -97,23 +94,21 @@ $companyArticle->save(); return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200); } - - - + + + public function show(Request $request, $id) { - createActivityLog(CompaniesController::class, 'show', ' Companies show'); - $data = Companies::findOrFail($id); - + $data = Companies::findOrFail($id); + return view("crud.generated.companies.show", compact('data')); } public function edit(Request $request, $id) { - createActivityLog(CompaniesController::class, 'edit', ' Companies edit'); - $TableData = Companies::where('status','<>',-1)->orderBy('display_order')->get(); + $TableData = Companies::where('status','<>',-1)->orderBy('display_order')->get(); $data = Companies::findOrFail($id); $editable=true; return view("crud.generated.companies.edit", compact('data','TableData','editable')); @@ -122,8 +117,7 @@ public function update(Request $request, $id) { - createActivityLog(CompaniesController::class, 'update', ' Companies update'); - $validator = Validator::make($request->all(), [ + $validator = Validator::make($request->all(), [ //ADD VALIDATION FOR REQIRED FIELDS ]); @@ -159,8 +153,7 @@ public function destroy(Request $request,$id) { - createActivityLog(CompaniesController::class, 'destroy', ' Companies destroy'); - DB::beginTransaction(); + DB::beginTransaction(); try { $OperationNumber = getOperationNumber(); $this->modelService->destroy($OperationNumber, $OperationNumber, $id); @@ -175,8 +168,7 @@ } public function toggle(Request $request,$id) { - createActivityLog(CompaniesController::class, 'destroy', ' Companies destroy'); - $data = Companies::findOrFail($id); + $data = Companies::findOrFail($id); $requestData=['status'=>($data->status==1)?0:1]; DB::beginTransaction(); try { @@ -193,8 +185,7 @@ } public function clone(Request $request,$id) { - createActivityLog(CompaniesController::class, 'clone', ' Companies clone'); - $data = Companies::findOrFail($id); + $data = Companies::findOrFail($id); unset($data['updatedby']); unset($data['createdby']); $requestData=$data->toArray(); @@ -211,8 +202,7 @@ DB::commit(); return response()->json(['status'=>true,'message'=>'The Companies Clonned Successfully.'],200); } - - + + } - \ No newline at end of file diff --git a/app/Http/Controllers/CountriesController.php b/app/Http/Controllers/CountriesController.php index 0a99ab2..a08eeff 100644 --- a/app/Http/Controllers/CountriesController.php +++ b/app/Http/Controllers/CountriesController.php @@ -28,9 +28,8 @@ class CountriesController extends Controller 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')); + return view("crud.generated.countries.edit", compact('editable')); } public function store(Request $request) diff --git a/app/Http/Controllers/DepartmentsController.php b/app/Http/Controllers/DepartmentsController.php index 4c42e42..bf62f70 100644 --- a/app/Http/Controllers/DepartmentsController.php +++ b/app/Http/Controllers/DepartmentsController.php @@ -18,15 +18,15 @@ } public function index(Request $request) { - createActivityLog(DepartmentsController::class, 'index', ' Departments index'); + $data = Departments::where('status','<>',-1)->orderBy('display_order')->get(); - + return view("crud.generated.departments.index", compact('data')); } public function create(Request $request) { - createActivityLog(DepartmentsController::class, 'create', ' Departments create'); + $TableData = Departments::where('status','<>',-1)->orderBy('display_order')->get(); $editable=false; return view("crud.generated.departments.edit",compact('TableData','editable')); @@ -34,7 +34,7 @@ public function store(Request $request) { - createActivityLog(DepartmentsController::class, 'store', ' Departments store'); + $validator = Validator::make($request->all(), [ //ADD REQUIRED FIELDS FOR VALIDATION ]); @@ -54,7 +54,7 @@ }); array_walk_recursive($requestData, function (&$value) { $value = str_replace(env('APP_URL'), '', $value); - }); + }); DB::beginTransaction(); try { $operationNumber = getOperationNumber(); @@ -69,24 +69,24 @@ if ($request->ajax()) { return response()->json(['status' => true, 'message' => 'The Departments Created Successfully.'], 200); } - return redirect()->route('departments.index')->with('success','The Departments created Successfully.'); + return redirect()->route('department.index')->with('success','The Departments created Successfully.'); } - + public function sort(Request $request) { $idOrder = $request->input('id_order'); - + foreach ($idOrder as $index => $id) { $companyArticle = Departments::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 = Departments::find($articleId); @@ -97,22 +97,22 @@ $companyArticle->save(); return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200); } - - - + + + public function show(Request $request, $id) { - createActivityLog(DepartmentsController::class, 'show', ' Departments show'); - $data = Departments::findOrFail($id); + $data = Departments::findOrFail($id); + return view("crud.generated.departments.show", compact('data')); } public function edit(Request $request, $id) { - createActivityLog(DepartmentsController::class, 'edit', ' Departments edit'); + $TableData = Departments::where('status','<>',-1)->orderBy('display_order')->get(); $data = Departments::findOrFail($id); $editable=true; @@ -122,7 +122,7 @@ public function update(Request $request, $id) { - createActivityLog(DepartmentsController::class, 'update', ' Departments update'); + $validator = Validator::make($request->all(), [ //ADD VALIDATION FOR REQIRED FIELDS ]); @@ -159,7 +159,7 @@ public function destroy(Request $request,$id) { - createActivityLog(DepartmentsController::class, 'destroy', ' Departments destroy'); + DB::beginTransaction(); try { $OperationNumber = getOperationNumber(); @@ -175,7 +175,7 @@ } public function toggle(Request $request,$id) { - createActivityLog(DepartmentsController::class, 'destroy', ' Departments destroy'); + $data = Departments::findOrFail($id); $requestData=['status'=>($data->status==1)?0:1]; DB::beginTransaction(); @@ -193,7 +193,7 @@ } public function clone(Request $request,$id) { - createActivityLog(DepartmentsController::class, 'clone', ' Departments clone'); + $data = Departments::findOrFail($id); unset($data['updatedby']); unset($data['createdby']); @@ -211,8 +211,7 @@ DB::commit(); return response()->json(['status'=>true,'message'=>'The Departments Clonned Successfully.'],200); } - - + + } - \ No newline at end of file diff --git a/app/Http/Controllers/DesignationsController.php b/app/Http/Controllers/DesignationsController.php index 7add074..9ba6dff 100644 --- a/app/Http/Controllers/DesignationsController.php +++ b/app/Http/Controllers/DesignationsController.php @@ -18,15 +18,13 @@ } public function index(Request $request) { - createActivityLog(DesignationsController::class, 'index', ' Designations index'); $data = Designations::where('status','<>',-1)->orderBy('display_order')->get(); - + return view("crud.generated.designations.index", compact('data')); } public function create(Request $request) { - createActivityLog(DesignationsController::class, 'create', ' Designations create'); $TableData = Designations::where('status','<>',-1)->orderBy('display_order')->get(); $editable=false; return view("crud.generated.designations.edit",compact('TableData','editable')); @@ -34,7 +32,6 @@ public function store(Request $request) { - createActivityLog(DesignationsController::class, 'store', ' Designations store'); $validator = Validator::make($request->all(), [ //ADD REQUIRED FIELDS FOR VALIDATION ]); @@ -54,7 +51,7 @@ }); array_walk_recursive($requestData, function (&$value) { $value = str_replace(env('APP_URL'), '', $value); - }); + }); DB::beginTransaction(); try { $operationNumber = getOperationNumber(); @@ -69,24 +66,24 @@ if ($request->ajax()) { return response()->json(['status' => true, 'message' => 'The Designations Created Successfully.'], 200); } - return redirect()->route('designations.index')->with('success','The Designations created Successfully.'); + return redirect()->route('designation.index')->with('success','The Designations created Successfully.'); } - + public function sort(Request $request) { $idOrder = $request->input('id_order'); - + foreach ($idOrder as $index => $id) { $companyArticle = Designations::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 = Designations::find($articleId); @@ -97,22 +94,20 @@ $companyArticle->save(); return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200); } - - - + + + public function show(Request $request, $id) { - createActivityLog(DesignationsController::class, 'show', ' Designations show'); $data = Designations::findOrFail($id); - + return view("crud.generated.designations.show", compact('data')); } public function edit(Request $request, $id) { - createActivityLog(DesignationsController::class, 'edit', ' Designations edit'); $TableData = Designations::where('status','<>',-1)->orderBy('display_order')->get(); $data = Designations::findOrFail($id); $editable=true; @@ -122,7 +117,6 @@ public function update(Request $request, $id) { - createActivityLog(DesignationsController::class, 'update', ' Designations update'); $validator = Validator::make($request->all(), [ //ADD VALIDATION FOR REQIRED FIELDS ]); @@ -159,7 +153,6 @@ public function destroy(Request $request,$id) { - createActivityLog(DesignationsController::class, 'destroy', ' Designations destroy'); DB::beginTransaction(); try { $OperationNumber = getOperationNumber(); @@ -175,7 +168,6 @@ } public function toggle(Request $request,$id) { - createActivityLog(DesignationsController::class, 'destroy', ' Designations destroy'); $data = Designations::findOrFail($id); $requestData=['status'=>($data->status==1)?0:1]; DB::beginTransaction(); @@ -193,7 +185,6 @@ } public function clone(Request $request,$id) { - createActivityLog(DesignationsController::class, 'clone', ' Designations clone'); $data = Designations::findOrFail($id); unset($data['updatedby']); unset($data['createdby']); @@ -211,8 +202,7 @@ DB::commit(); return response()->json(['status'=>true,'message'=>'The Designations Clonned Successfully.'],200); } - - + + } - \ No newline at end of file diff --git a/app/Http/Controllers/DistrictsController.php b/app/Http/Controllers/DistrictsController.php index 14ecb3b..3b5fb8f 100644 --- a/app/Http/Controllers/DistrictsController.php +++ b/app/Http/Controllers/DistrictsController.php @@ -18,15 +18,15 @@ } public function index(Request $request) { - createActivityLog(DistrictsController::class, 'index', ' Districts index'); + // createActivityLog(DistrictsController::class, 'index', ' Districts index'); $data = Districts::where('status','<>',-1)->orderBy('display_order')->get(); - + return view("crud.generated.districts.index", compact('data')); } public function create(Request $request) { - createActivityLog(DistrictsController::class, 'create', ' Districts create'); + // createActivityLog(DistrictsController::class, 'create', ' Districts create'); $TableData = Districts::where('status','<>',-1)->orderBy('display_order')->get(); $editable=false; return view("crud.generated.districts.edit",compact('TableData','editable')); @@ -34,7 +34,7 @@ public function store(Request $request) { - createActivityLog(DistrictsController::class, 'store', ' Districts store'); + // createActivityLog(DistrictsController::class, 'store', ' Districts store'); $validator = Validator::make($request->all(), [ //ADD REQUIRED FIELDS FOR VALIDATION ]); @@ -54,7 +54,7 @@ }); array_walk_recursive($requestData, function (&$value) { $value = str_replace(env('APP_URL'), '', $value); - }); + }); DB::beginTransaction(); try { $operationNumber = getOperationNumber(); @@ -71,22 +71,22 @@ } return redirect()->route('districts.index')->with('success','The Districts created Successfully.'); } - + public function sort(Request $request) { $idOrder = $request->input('id_order'); - + foreach ($idOrder as $index => $id) { $companyArticle = Districts::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 = Districts::find($articleId); @@ -97,22 +97,22 @@ $companyArticle->save(); return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200); } - - - + + + public function show(Request $request, $id) { - createActivityLog(DistrictsController::class, 'show', ' Districts show'); + // createActivityLog(DistrictsController::class, 'show', ' Districts show'); $data = Districts::findOrFail($id); - + return view("crud.generated.districts.show", compact('data')); } public function edit(Request $request, $id) { - createActivityLog(DistrictsController::class, 'edit', ' Districts edit'); + // createActivityLog(DistrictsController::class, 'edit', ' Districts edit'); $TableData = Districts::where('status','<>',-1)->orderBy('display_order')->get(); $data = Districts::findOrFail($id); $editable=true; @@ -122,7 +122,7 @@ public function update(Request $request, $id) { - createActivityLog(DistrictsController::class, 'update', ' Districts update'); + // createActivityLog(DistrictsController::class, 'update', ' Districts update'); $validator = Validator::make($request->all(), [ //ADD VALIDATION FOR REQIRED FIELDS ]); @@ -159,7 +159,7 @@ public function destroy(Request $request,$id) { - createActivityLog(DistrictsController::class, 'destroy', ' Districts destroy'); + // createActivityLog(DistrictsController::class, 'destroy', ' Districts destroy'); DB::beginTransaction(); try { $OperationNumber = getOperationNumber(); @@ -175,7 +175,7 @@ } public function toggle(Request $request,$id) { - createActivityLog(DistrictsController::class, 'destroy', ' Districts destroy'); + // createActivityLog(DistrictsController::class, 'destroy', ' Districts destroy'); $data = Districts::findOrFail($id); $requestData=['status'=>($data->status==1)?0:1]; DB::beginTransaction(); @@ -193,7 +193,7 @@ } public function clone(Request $request,$id) { - createActivityLog(DistrictsController::class, 'clone', ' Districts clone'); + // createActivityLog(DistrictsController::class, 'clone', ' Districts clone'); $data = Districts::findOrFail($id); unset($data['updatedby']); unset($data['createdby']); @@ -211,8 +211,7 @@ DB::commit(); return response()->json(['status'=>true,'message'=>'The Districts Clonned Successfully.'],200); } - - + + } - \ No newline at end of file diff --git a/app/Http/Controllers/ProvinceController.php b/app/Http/Controllers/ProvinceController.php index c4a68c8..2a20d95 100644 --- a/app/Http/Controllers/ProvinceController.php +++ b/app/Http/Controllers/ProvinceController.php @@ -18,23 +18,25 @@ } public function index(Request $request) { - createActivityLog(ProvinceController::class, 'index', ' Province index'); + // createActivityLog(ProvinceController::class, 'index', ' Province index'); + $data = Province::where('status','<>',-1)->orderBy('display_order')->get(); - return view("crud.generated.province.index", compact('data')); + return view("crud.generated.provinces.index", compact('data')); } public function create(Request $request) { - createActivityLog(ProvinceController::class, 'create', ' Province create'); - $TableData = Province::where('status','<>',-1)->orderBy('display_order')->get(); + // createActivityLog(ProvinceController::class, 'create', ' Province create'); + $editable=false; - return view("crud.generated.province.edit",compact('TableData','editable')); + + return view("crud.generated.provinces.edit",compact('editable')); } public function store(Request $request) { - createActivityLog(ProvinceController::class, 'store', ' Province store'); + // createActivityLog(ProvinceController::class, 'store', ' Province store'); $validator = Validator::make($request->all(), [ //ADD REQUIRED FIELDS FOR VALIDATION ]); @@ -69,7 +71,7 @@ if ($request->ajax()) { return response()->json(['status' => true, 'message' => 'The Province Created Successfully.'], 200); } - return redirect()->route('province.index')->with('success','The Province created Successfully.'); + return redirect()->route('provinces.index')->with('success','The Province created Successfully.'); } public function sort(Request $request) @@ -103,26 +105,26 @@ public function show(Request $request, $id) { - createActivityLog(ProvinceController::class, 'show', ' Province show'); + // createActivityLog(ProvinceController::class, 'show', ' Province show'); $data = Province::findOrFail($id); - return view("crud.generated.province.show", compact('data')); + return view("crud.generated.provinces.show", compact('data')); } public function edit(Request $request, $id) { - createActivityLog(ProvinceController::class, 'edit', ' Province edit'); + // createActivityLog(ProvinceController::class, 'edit', ' Province edit'); $TableData = Province::where('status','<>',-1)->orderBy('display_order')->get(); $data = Province::findOrFail($id); $editable=true; - return view("crud.generated.province.edit", compact('data','TableData','editable')); + return view("crud.generated.provinces.edit", compact('data','TableData','editable')); } public function update(Request $request, $id) { - createActivityLog(ProvinceController::class, 'update', ' Province update'); + // createActivityLog(ProvinceController::class, 'update', ' Province update'); $validator = Validator::make($request->all(), [ //ADD VALIDATION FOR REQIRED FIELDS ]); @@ -153,13 +155,12 @@ if ($request->ajax()) { return response()->json(['status' => true, 'message' => 'The Province updated Successfully.'], 200); } - // return redirect()->route('province.index')->with('success','The Province updated Successfully.'); return redirect()->back()->with('success', 'The Province updated successfully.'); } public function destroy(Request $request,$id) { - createActivityLog(ProvinceController::class, 'destroy', ' Province destroy'); + // createActivityLog(ProvinceController::class, 'destroy', ' Province destroy'); DB::beginTransaction(); try { $OperationNumber = getOperationNumber(); @@ -175,7 +176,7 @@ } public function toggle(Request $request,$id) { - createActivityLog(ProvinceController::class, 'destroy', ' Province destroy'); + // createActivityLog(ProvinceController::class, 'destroy', ' Province destroy'); $data = Province::findOrFail($id); $requestData=['status'=>($data->status==1)?0:1]; DB::beginTransaction(); @@ -193,7 +194,7 @@ } public function clone(Request $request,$id) { - createActivityLog(ProvinceController::class, 'clone', ' Province clone'); + // createActivityLog(ProvinceController::class, 'clone', ' Province clone'); $data = Province::findOrFail($id); unset($data['updatedby']); unset($data['createdby']); @@ -212,6 +213,4 @@ return response()->json(['status'=>true,'message'=>'The Province Clonned Successfully.'],200); } - - } diff --git a/app/Models/Cities.php b/app/Models/Cities.php new file mode 100644 index 0000000..3d4a44a --- /dev/null +++ b/app/Models/Cities.php @@ -0,0 +1,16 @@ +where('status', 'Active')->get(); - } - - public static function getDistrictsByProvinceId($province_id) - { - return self::select('id', 'district_name')->where('status', 'Active')->where('state_id',$province_id)->get(); - } - - public static function getPermDistrictsByProvinceId($province_id) - { - return self::select('id', 'district_name')->where('status', 'Active')->where('state_id',$province_id)->get(); - } - - public static function getTempDistrictsByProvinceId($province_id) - { - return self::select('id', 'district_name')->where('status', 'Active')->where('state_id',$province_id)->get(); - } -} diff --git a/app/Models/Districts.php b/app/Models/Districts.php new file mode 100644 index 0000000..d4275e3 --- /dev/null +++ b/app/Models/Districts.php @@ -0,0 +1,20 @@ +belongsTo(Country::class); } - - public static function getProvinces() - { - return self::select('id','province_name')->where('status','Active')->get(); - } - - public static function getProvincesByCountryId($country_id) - { - return self::select('id','province_name')->where('status','Active')->where('country_id',$country_id)->get(); - } } diff --git a/app/Models/Role.php b/app/Models/Role.php.bak similarity index 100% rename from app/Models/Role.php rename to app/Models/Role.php.bak diff --git a/public/assets/js/custom.js b/public/assets/js/custom.js index bf466f0..6da0927 100644 --- a/public/assets/js/custom.js +++ b/public/assets/js/custom.js @@ -1,54 +1,54 @@ $('body').on('click', '.remove-item-btn', function (e) { - e.preventDefault(); - let url = $(this).data('href'); - let id = $(this).data('id'); + e.preventDefault(); + let url = $(this).data('link'); + let id = $(this).data('id'); - Swal.fire({ - title: 'Are you sure?', - text: "You won't be able to revert this!", - icon: 'warning', - showCancelButton: true, - confirmButtonColor: '#3085d6', - cancelButtonColor: '#d33', - confirmButtonText: 'Yes, delete it!' - }).then((result) => { - if (result.isConfirmed) { - $.ajax({ - url: url, - type: 'DELETE', - headers: { - 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') - }, - data: { - id: id - }, - success: function (response) { - location.reload(); - }, - error: function (xhr, status, error) { - console.error(xhr.responseText); + Swal.fire({ + title: 'Are you sure?', + text: "You won't be able to revert this!", + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: 'Yes, delete it!' + }).then((result) => { + if (result.isConfirmed) { + $.ajax({ + url: url, + type: 'DELETE', + headers: { + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') + }, + data: { + id: id + }, + success: function (response) { + location.reload(); + }, + error: function (xhr, status, error) { + console.error(xhr.responseText); + } + }); } - }); - } - }); + }); }); //initialize ckeditor document.querySelectorAll('.ckeditor-classic').forEach(editor => { - console.log(editor); - ClassicEditor - .create(editor) - .catch(error => { - console.error(error); - }); + console.log(editor); + ClassicEditor + .create(editor) + .catch(error => { + console.error(error); + }); }); $('.date-picker').nepaliDatePicker({ - // dateFormat: '%D, %M %d, %y', - dateFormat: '%y-%m-%d', - closeOnDateSelect: true, + // dateFormat: '%D, %M %d, %y', + dateFormat: '%y-%m-%d', + closeOnDateSelect: true, }); // initialize filepond @@ -57,77 +57,77 @@ console.log(inputElement); FilePond.registerPlugin(FilePondPluginImagePreview); const pond = FilePond.create(inputElement); FilePond.setOptions({ - server: { - process: "/filepond/upload", - revert: '/delete', - headers: { - 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'), - }, - } + server: { + process: "/filepond/upload", + revert: '/delete', + headers: { + 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'), + }, + } }); //ajax form submit document.addEventListener('DOMContentLoaded', function () { - let form = document.getElementById('storeUpdateForm'); + let form = document.getElementById('storeUpdateForm'); - let action = form.getAttribute('action'); + let action = form.getAttribute('action'); - let method = form.getAttribute('method'); + let method = form.getAttribute('method'); - toastr.options = { - 'closeButton': true, - 'debug': false, - 'newestOnTop': true, - 'progressBar': true, - 'positionClass': 'toast-top-right', - 'preventDuplicates': true, - 'showDuration': '1000', - 'hideDuration': '1000', - 'timeOut': '5000', - 'extendedTimeOut': '1000', - 'showEasing': 'swing', - 'hideEasing': 'linear', - 'showMethod': 'fadeIn', - 'hideMethod': 'fadeOut', - } + toastr.options = { + 'closeButton': true, + 'debug': false, + 'newestOnTop': true, + 'progressBar': true, + 'positionClass': 'toast-top-right', + 'preventDuplicates': true, + 'showDuration': '1000', + 'hideDuration': '1000', + 'timeOut': '5000', + 'extendedTimeOut': '1000', + 'showEasing': 'swing', + 'hideEasing': 'linear', + 'showMethod': 'fadeIn', + 'hideMethod': 'fadeOut', + } - form.addEventListener('submit', function (e) { - e.preventDefault(); + form.addEventListener('submit', function (e) { + e.preventDefault(); - let formData = new FormData(form); + let formData = new FormData(form); - fetch(action, { - method: method, - body: formData, - headers: { - 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content') - } - }) - .then(response => { - if (response.ok) { - response.json().then(data => { - toastr['success'](data.message); - }) - } else { - response.json().then(data => { - if (data.errors) { - for (const [key, message] of Object.entries(data.errors)) { - let errorDiv = document.createElement('div'); - errorDiv.innerHTML = `${message}`; - document.getElementById(key).parentNode.appendChild(errorDiv); - } + fetch(action, { + method: method, + body: formData, + headers: { + 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content') } - }) + }) + .then(response => { + if (response.ok) { + response.json().then(data => { + toastr['success'](data.message); + }) + } else { + response.json().then(data => { + if (data.errors) { + for (const [key, message] of Object.entries(data.errors)) { + let errorDiv = document.createElement('div'); + errorDiv.innerHTML = `${message}`; + document.getElementById(key).parentNode.appendChild(errorDiv); + } + } + }) + .catch(error => { + console.error('Error parsing JSON:', error); + }); + } + }) .catch(error => { - console.error('Error parsing JSON:', error); + console.error('Error during fetch:', error); }); - } - }) - .catch(error => { - console.error('Error during fetch:', error); - }); - }); + }); }); diff --git a/resources/views/crud/generated/countries/create.blade.php b/resources/views/crud/generated/countries/create.blade.php deleted file mode 100644 index f30927b..0000000 --- a/resources/views/crud/generated/countries/create.blade.php +++ /dev/null @@ -1,35 +0,0 @@ -@extends('layouts.app') -@section('content') - -
-
-
-

Add Country

-
- -
-
-
-
- -
- @csrf -
-
-
-
{{ createText('title', 'title', 'Title') }}
-
{{ createTextarea('description', 'description ckeditor-classic', 'Description') }} -
-
{{ createPlainTextArea('remarks', 'remarks ', 'Remarks') }}
-
-
-
-
- - -
-
-@endsection diff --git a/resources/views/crud/generated/countries/edit.blade.php b/resources/views/crud/generated/countries/edit.blade.php index c161ecc..e7f4cc7 100644 --- a/resources/views/crud/generated/countries/edit.blade.php +++ b/resources/views/crud/generated/countries/edit.blade.php @@ -1,40 +1,50 @@ @extends('layouts.app') @section('content') - -
-
-
-

Edit Country

-
- +
+
+ + + @include('layouts.partials.breadcrumb', ['title' => 'Country']) + + + +
+ @csrf + + + +
+ +
+ +
+ +
+ {{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }} +
+ + {{--
+ {{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }} +
--}} + +
+ +
+ {{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }} +
+ +
+
+
-
+
- -
- @csrf -
- -
- -
-
{{ createText('title', 'title', 'Title', '', $data->title) }}
-
- {{ createTextarea('description', 'description ckeditor-classic', 'Description', $data->description) }}
-
-
{{ createPlainTextArea('remarks', '', 'Remarks', $data->remarks) }}
- -
-
- -
-
@endsection diff --git a/resources/views/crud/generated/countries/index.blade.php b/resources/views/crud/generated/countries/index.blade.php index d8cd3c3..bc394ac 100644 --- a/resources/views/crud/generated/countries/index.blade.php +++ b/resources/views/crud/generated/countries/index.blade.php @@ -1,115 +1,92 @@ @extends('layouts.app') @section('content') -
-
-
- @csrf -
-
-

Add Country

-
-
-
-
{{ createText('title', 'title', 'Title') }}
-
-
{{ createTextarea('description', 'description ', 'Description') }}
-
-
{{ createPlainTextArea('remarks', 'remarks ', 'Remarks') }}
-
-
+
+
-