diff --git a/Modules/Admin/app/Http/Controllers/.gitkeep b/Modules/Admin/app/Http/Controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/app/Http/Controllers/AdminController.php b/Modules/Admin/app/Http/Controllers/AdminController.php new file mode 100644 index 0000000..06b04fe --- /dev/null +++ b/Modules/Admin/app/Http/Controllers/AdminController.php @@ -0,0 +1,67 @@ +modelService = new CommonModelService($model); + } + public function index(Request $request) + { + // createActivityLog(CastesController::class, 'index', ' Castes index'); + $data = Castes::where('status', '<>', -1)->orderBy('display_order')->get(); + + return view("admin::castes.index", compact('data')); + } + + public function create(Request $request) + { + // createActivityLog(CastesController::class, 'create', ' Castes create'); + $TableData = Castes::where('status', '<>', -1)->orderBy('display_order')->get(); + $editable = false; + return view("admin::castes.edit", compact('TableData', 'editable')); + } + + public function store(Request $request) + { + // createActivityLog(CastesController::class, 'store', ' Castes store'); + $validator = Validator::make($request->all(), [ + //ADD REQUIRED FIELDS FOR VALIDATION + ]); + + if ($validator->fails()) { + return response()->json([ + 'error' => $validator->errors(), + ], 500); + } + $request->request->add(['alias' => slugify($request->title)]); + $request->request->add(['display_order' => getDisplayOrder('tbl_castes')]); + $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(CastesController::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 Castes Created Successfully.'], 200); + } + return redirect()->route('castes.index')->with('success', 'The Castes created Successfully.'); + } + + public function sort(Request $request) + { + $idOrder = $request->input('id_order'); + + foreach ($idOrder as $index => $id) { + $companyArticle = Castes::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 = Castes::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(CastesController::class, 'show', ' Castes show'); + $data = Castes::findOrFail($id); + + return view("admin::castes.show", compact('data')); + } + + + public function edit(Request $request, $id) + { + // createActivityLog(CastesController::class, 'edit', ' Castes edit'); + $TableData = Castes::where('status', '<>', -1)->orderBy('display_order')->get(); + $data = Castes::findOrFail($id); + $editable = true; + return view("admin::castes.edit", compact('data', 'TableData', 'editable')); + } + + + public function update(Request $request, $id) + { + // createActivityLog(CastesController::class, 'update', ' Castes 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('caste_id')); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(CastesController::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 Castes updated Successfully.'], 200); + } + // return redirect()->route('castes.index')->with('success','The Castes updated Successfully.'); + return redirect()->back()->with('success', 'The Castes updated successfully.'); + } + + public function destroy(Request $request, $id) + { + // createActivityLog(CastesController::class, 'destroy', ' Castes destroy'); + DB::beginTransaction(); + try { + $OperationNumber = getOperationNumber(); + $this->modelService->destroy($OperationNumber, $OperationNumber, $id); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(CastesController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Castes Deleted Successfully.'], 200); + } + public function toggle(Request $request, $id) + { + // createActivityLog(CastesController::class, 'destroy', ' Castes destroy'); + $data = Castes::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(CastesController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Castes Deleted Successfully.'], 200); + } + public function clone(Request $request, $id) + { + // createActivityLog(CastesController::class, 'clone', ' Castes clone'); + $data = Castes::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(CastesController::class, 'clone', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Castes Clonned Successfully.'], 200); + } + + + +} diff --git a/Modules/Admin/app/Http/Controllers/CitiesController.php b/Modules/Admin/app/Http/Controllers/CitiesController.php new file mode 100644 index 0000000..630bf09 --- /dev/null +++ b/Modules/Admin/app/Http/Controllers/CitiesController.php @@ -0,0 +1,219 @@ +modelService = new CommonModelService($model); + } + public function index(Request $request) + { + // createActivityLog(CitiesController::class, 'index', ' Cities index'); + $data = Cities::where('status', '<>', -1)->orderBy('display_order')->get(); + + return view("admin::cities.index", compact('data')); + } + + public function create(Request $request) + { + // createActivityLog(CitiesController::class, 'create', ' Cities create'); + $TableData = Cities::where('status', '<>', -1)->orderBy('display_order')->get(); + $editable = false; + return view("admin::cities.edit", compact('TableData', 'editable')); + } + + public function store(Request $request) + { + // createActivityLog(CitiesController::class, 'store', ' Cities store'); + $validator = Validator::make($request->all(), [ + //ADD REQUIRED FIELDS FOR VALIDATION + ]); + + if ($validator->fails()) { + return response()->json([ + 'error' => $validator->errors(), + ], 500); + } + $request->request->add(['alias' => slugify($request->title)]); + $request->request->add(['display_order' => getDisplayOrder('tbl_cities')]); + $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(CitiesController::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 Cities Created Successfully.'], 200); + } + 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); + 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(CitiesController::class, 'show', ' Cities show'); + $data = Cities::findOrFail($id); + + return view("admin::cities.show", compact('data')); + } + + + public function edit(Request $request, $id) + { + // createActivityLog(CitiesController::class, 'edit', ' Cities edit'); + $TableData = Cities::where('status', '<>', -1)->orderBy('display_order')->get(); + $data = Cities::findOrFail($id); + $editable = true; + return view("admin::cities.edit", compact('data', 'TableData', 'editable')); + } + + + public function update(Request $request, $id) + { + // createActivityLog(CitiesController::class, 'update', ' Cities 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('city_id')); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(CitiesController::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 Cities updated Successfully.'], 200); + } + // return redirect()->route('cities.index')->with('success','The Cities updated Successfully.'); + return redirect()->back()->with('success', 'The Cities updated successfully.'); + } + + public function destroy(Request $request, $id) + { + // createActivityLog(CitiesController::class, 'destroy', ' Cities destroy'); + DB::beginTransaction(); + try { + $OperationNumber = getOperationNumber(); + $this->modelService->destroy($OperationNumber, $OperationNumber, $id); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(CitiesController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Cities Deleted Successfully.'], 200); + } + public function toggle(Request $request, $id) + { + // createActivityLog(CitiesController::class, 'destroy', ' Cities destroy'); + $data = Cities::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(CitiesController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Cities Deleted Successfully.'], 200); + } + public function clone(Request $request, $id) + { + // createActivityLog(CitiesController::class, 'clone', ' Cities clone'); + $data = Cities::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(CitiesController::class, 'clone', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Cities Clonned Successfully.'], 200); + } + + + +} diff --git a/app/Http/Controllers/CountriesController.php b/Modules/Admin/app/Http/Controllers/CountriesController.php similarity index 95% rename from app/Http/Controllers/CountriesController.php rename to Modules/Admin/app/Http/Controllers/CountriesController.php index a08eeff..fc3710c 100644 --- a/app/Http/Controllers/CountriesController.php +++ b/Modules/Admin/app/Http/Controllers/CountriesController.php @@ -1,14 +1,15 @@ ', -1)->orderBy('display_order')->get(); - return view("crud.generated.countries.index", compact('data')); + return view("admin::countries.index", compact('data')); } public function create(Request $request) { // createActivityLog(CountriesController::class, 'create', ' Country create'); $editable = false; - return view("crud.generated.countries.edit", compact('editable')); + return view("admin::countries.edit", compact('editable')); } public function store(Request $request) @@ -103,7 +104,7 @@ class CountriesController extends Controller // createActivityLog(CountriesController::class, 'show', ' Country show'); $data = Country::findOrFail($id); - return view("crud.generated.countries.show", compact('data')); + return view("admin::countries.show", compact('data')); } public function edit(Request $request, $id) @@ -112,7 +113,7 @@ class CountriesController extends Controller $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')); + return view("admin::countries.edit", compact('data', 'TableData', 'editable')); } public function update(Request $request, $id) @@ -186,7 +187,7 @@ class CountriesController extends Controller DB::commit(); return response()->json(['status' => true, 'message' => 'The Country Deleted Successfully.'], 200); } - public function clone (Request $request, $id) + public function clone(Request $request, $id) { // createActivityLog(CountriesController::class, 'clone', ' Country clone'); $data = Country::findOrFail($id); diff --git a/Modules/Admin/app/Http/Controllers/DistrictsController.php b/Modules/Admin/app/Http/Controllers/DistrictsController.php new file mode 100644 index 0000000..45c19c1 --- /dev/null +++ b/Modules/Admin/app/Http/Controllers/DistrictsController.php @@ -0,0 +1,218 @@ +modelService = new CommonModelService($model); + } + public function index(Request $request) + { + // createActivityLog(DistrictsController::class, 'index', ' Districts index'); + $data = Districts::where('status', '<>', -1)->orderBy('display_order')->get(); + + return view("admin::districts.index", compact('data')); + } + + public function create(Request $request) + { + // createActivityLog(DistrictsController::class, 'create', ' Districts create'); + $TableData = Districts::where('status', '<>', -1)->orderBy('display_order')->get(); + $editable = false; + return view("admin::districts.edit", compact('TableData', 'editable')); + } + + public function store(Request $request) + { + // createActivityLog(DistrictsController::class, 'store', ' Districts store'); + $validator = Validator::make($request->all(), [ + //ADD REQUIRED FIELDS FOR VALIDATION + ]); + + if ($validator->fails()) { + return response()->json([ + 'error' => $validator->errors(), + ], 500); + } + $request->request->add(['alias' => slugify($request->title)]); + $request->request->add(['display_order' => getDisplayOrder('tbl_districts')]); + $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(DistrictsController::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 Districts Created Successfully.'], 200); + } + 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); + 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(DistrictsController::class, 'show', ' Districts show'); + $data = Districts::findOrFail($id); + + return view("admin::districts.show", compact('data')); + } + + + public function edit(Request $request, $id) + { + // createActivityLog(DistrictsController::class, 'edit', ' Districts edit'); + $TableData = Districts::where('status', '<>', -1)->orderBy('display_order')->get(); + $data = Districts::findOrFail($id); + $editable = true; + return view("admin::districts.edit", compact('data', 'TableData', 'editable')); + } + + + public function update(Request $request, $id) + { + // createActivityLog(DistrictsController::class, 'update', ' Districts 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('district_id')); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(DistrictsController::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 Districts updated Successfully.'], 200); + } + // return redirect()->route('districts.index')->with('success','The Districts updated Successfully.'); + return redirect()->back()->with('success', 'The Districts updated successfully.'); + } + + public function destroy(Request $request, $id) + { + // createActivityLog(DistrictsController::class, 'destroy', ' Districts destroy'); + DB::beginTransaction(); + try { + $OperationNumber = getOperationNumber(); + $this->modelService->destroy($OperationNumber, $OperationNumber, $id); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(DistrictsController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Districts Deleted Successfully.'], 200); + } + public function toggle(Request $request, $id) + { + // createActivityLog(DistrictsController::class, 'destroy', ' Districts destroy'); + $data = Districts::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(DistrictsController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Districts Deleted Successfully.'], 200); + } + public function clone(Request $request, $id) + { + // createActivityLog(DistrictsController::class, 'clone', ' Districts clone'); + $data = Districts::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(DistrictsController::class, 'clone', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Districts Clonned Successfully.'], 200); + } + + + +} diff --git a/Modules/Admin/app/Http/Controllers/GendersController.php b/Modules/Admin/app/Http/Controllers/GendersController.php new file mode 100644 index 0000000..8a6abfb --- /dev/null +++ b/Modules/Admin/app/Http/Controllers/GendersController.php @@ -0,0 +1,218 @@ +modelService = new CommonModelService($model); + } + public function index(Request $request) + { + // createActivityLog(GendersController::class, 'index', ' Genders index'); + $data = Genders::where('status', '<>', -1)->orderBy('display_order')->get(); + + return view("admin::genders.index", compact('data')); + } + + public function create(Request $request) + { + // createActivityLog(GendersController::class, 'create', ' Genders create'); + $TableData = Genders::where('status', '<>', -1)->orderBy('display_order')->get(); + $editable = false; + return view("admin::genders.edit", compact('TableData', 'editable')); + } + + public function store(Request $request) + { + // createActivityLog(GendersController::class, 'store', ' Genders store'); + $validator = Validator::make($request->all(), [ + //ADD REQUIRED FIELDS FOR VALIDATION + ]); + + if ($validator->fails()) { + return response()->json([ + 'error' => $validator->errors(), + ], 500); + } + $request->request->add(['alias' => slugify($request->title)]); + $request->request->add(['display_order' => getDisplayOrder('tbl_genders')]); + $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(GendersController::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 Genders Created Successfully.'], 200); + } + return redirect()->route('genders.index')->with('success', 'The Genders created Successfully.'); + } + + public function sort(Request $request) + { + $idOrder = $request->input('id_order'); + + foreach ($idOrder as $index => $id) { + $companyArticle = Genders::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 = Genders::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(GendersController::class, 'show', ' Genders show'); + $data = Genders::findOrFail($id); + + return view("admin::genders.show", compact('data')); + } + + + public function edit(Request $request, $id) + { + // createActivityLog(GendersController::class, 'edit', ' Genders edit'); + $TableData = Genders::where('status', '<>', -1)->orderBy('display_order')->get(); + $data = Genders::findOrFail($id); + $editable = true; + return view("admin::genders.edit", compact('data', 'TableData', 'editable')); + } + + + public function update(Request $request, $id) + { + // createActivityLog(GendersController::class, 'update', ' Genders 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('gender_id')); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(GendersController::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 Genders updated Successfully.'], 200); + } + // return redirect()->route('genders.index')->with('success','The Genders updated Successfully.'); + return redirect()->back()->with('success', 'The Genders updated successfully.'); + } + + public function destroy(Request $request, $id) + { + // createActivityLog(GendersController::class, 'destroy', ' Genders destroy'); + DB::beginTransaction(); + try { + $OperationNumber = getOperationNumber(); + $this->modelService->destroy($OperationNumber, $OperationNumber, $id); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(GendersController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Genders Deleted Successfully.'], 200); + } + public function toggle(Request $request, $id) + { + // createActivityLog(GendersController::class, 'destroy', ' Genders destroy'); + $data = Genders::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(GendersController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Genders Deleted Successfully.'], 200); + } + public function clone(Request $request, $id) + { + // createActivityLog(GendersController::class, 'clone', ' Genders clone'); + $data = Genders::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(GendersController::class, 'clone', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Genders Clonned Successfully.'], 200); + } + + + +} diff --git a/Modules/Admin/app/Http/Controllers/NationalitiesController.php b/Modules/Admin/app/Http/Controllers/NationalitiesController.php new file mode 100644 index 0000000..53185e8 --- /dev/null +++ b/Modules/Admin/app/Http/Controllers/NationalitiesController.php @@ -0,0 +1,218 @@ +modelService = new CommonModelService($model); + } + public function index(Request $request) + { + // createActivityLog(NationalitiesController::class, 'index', ' Nationalities index'); + $data = Nationalities::where('status', '<>', -1)->orderBy('display_order')->get(); + + return view("admin::nationalities.index", compact('data')); + } + + public function create(Request $request) + { + // createActivityLog(NationalitiesController::class, 'create', ' Nationalities create'); + $TableData = Nationalities::where('status', '<>', -1)->orderBy('display_order')->get(); + $editable = false; + return view("admin::nationalities.edit", compact('TableData', 'editable')); + } + + public function store(Request $request) + { + // createActivityLog(NationalitiesController::class, 'store', ' Nationalities store'); + $validator = Validator::make($request->all(), [ + //ADD REQUIRED FIELDS FOR VALIDATION + ]); + + if ($validator->fails()) { + return response()->json([ + 'error' => $validator->errors(), + ], 500); + } + $request->request->add(['alias' => slugify($request->title)]); + $request->request->add(['display_order' => getDisplayOrder('tbl_nationalities')]); + $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(NationalitiesController::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 Nationalities Created Successfully.'], 200); + } + return redirect()->route('nationalities.index')->with('success', 'The Nationalities created Successfully.'); + } + + public function sort(Request $request) + { + $idOrder = $request->input('id_order'); + + foreach ($idOrder as $index => $id) { + $companyArticle = Nationalities::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 = Nationalities::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(NationalitiesController::class, 'show', ' Nationalities show'); + $data = Nationalities::findOrFail($id); + + return view("admin::nationalities.show", compact('data')); + } + + + public function edit(Request $request, $id) + { + // createActivityLog(NationalitiesController::class, 'edit', ' Nationalities edit'); + $TableData = Nationalities::where('status', '<>', -1)->orderBy('display_order')->get(); + $data = Nationalities::findOrFail($id); + $editable = true; + return view("admin::nationalities.edit", compact('data', 'TableData', 'editable')); + } + + + public function update(Request $request, $id) + { + // createActivityLog(NationalitiesController::class, 'update', ' Nationalities 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('nationality_id')); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(NationalitiesController::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 Nationalities updated Successfully.'], 200); + } + // return redirect()->route('nationalities.index')->with('success','The Nationalities updated Successfully.'); + return redirect()->back()->with('success', 'The Nationalities updated successfully.'); + } + + public function destroy(Request $request, $id) + { + // createActivityLog(NationalitiesController::class, 'destroy', ' Nationalities destroy'); + DB::beginTransaction(); + try { + $OperationNumber = getOperationNumber(); + $this->modelService->destroy($OperationNumber, $OperationNumber, $id); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(NationalitiesController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Nationalities Deleted Successfully.'], 200); + } + public function toggle(Request $request, $id) + { + // createActivityLog(NationalitiesController::class, 'destroy', ' Nationalities destroy'); + $data = Nationalities::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(NationalitiesController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Nationalities Deleted Successfully.'], 200); + } + public function clone(Request $request, $id) + { + // createActivityLog(NationalitiesController::class, 'clone', ' Nationalities clone'); + $data = Nationalities::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(NationalitiesController::class, 'clone', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Nationalities Clonned Successfully.'], 200); + } + + + +} diff --git a/Modules/Admin/app/Http/Controllers/ProvinceController.php b/Modules/Admin/app/Http/Controllers/ProvinceController.php new file mode 100644 index 0000000..4e61b64 --- /dev/null +++ b/Modules/Admin/app/Http/Controllers/ProvinceController.php @@ -0,0 +1,218 @@ +modelService = new CommonModelService($model); + } + public function index(Request $request) + { + // createActivityLog(ProvinceController::class, 'index', ' Province index'); + + $data = Province::where('status', '<>', -1)->orderBy('display_order')->get(); + + return view("admin::provinces.index", compact('data')); + } + + public function create(Request $request) + { + // createActivityLog(ProvinceController::class, 'create', ' Province create'); + + $editable = false; + + return view("admin::provinces.edit", compact('editable')); + } + + public function store(Request $request) + { + // createActivityLog(ProvinceController::class, 'store', ' Province store'); + $validator = Validator::make($request->all(), [ + //ADD REQUIRED FIELDS FOR VALIDATION + ]); + + if ($validator->fails()) { + return response()->json([ + 'error' => $validator->errors(), + ], 500); + } + $request->request->add(['alias' => slugify($request->title)]); + $request->request->add(['display_order' => getDisplayOrder('tbl_province')]); + $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(ProvinceController::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 Province Created Successfully.'], 200); + } + return redirect()->route('provinces.index')->with('success', 'The Province created Successfully.'); + } + + public function sort(Request $request) + { + $idOrder = $request->input('id_order'); + + foreach ($idOrder as $index => $id) { + $companyArticle = Province::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 = Province::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(ProvinceController::class, 'show', ' Province show'); + $data = Province::findOrFail($id); + + return view("admin::provinces.show", compact('data')); + } + + + public function edit(Request $request, $id) + { + // createActivityLog(ProvinceController::class, 'edit', ' Province edit'); + $TableData = Province::where('status', '<>', -1)->orderBy('display_order')->get(); + $data = Province::findOrFail($id); + $editable = true; + return view("admin::provinces.edit", compact('data', 'TableData', 'editable')); + } + + + public function update(Request $request, $id) + { + // createActivityLog(ProvinceController::class, 'update', ' Province 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('provience_id')); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(ProvinceController::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 Province updated Successfully.'], 200); + } + return redirect()->back()->with('success', 'The Province updated successfully.'); + } + + public function destroy(Request $request, $id) + { + // createActivityLog(ProvinceController::class, 'destroy', ' Province destroy'); + DB::beginTransaction(); + try { + $OperationNumber = getOperationNumber(); + $this->modelService->destroy($OperationNumber, $OperationNumber, $id); + } catch (Exception $e) { + DB::rollBack(); + Log::info($e->getMessage()); + createErrorLog(ProvinceController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Province Deleted Successfully.'], 200); + } + public function toggle(Request $request, $id) + { + // createActivityLog(ProvinceController::class, 'destroy', ' Province destroy'); + $data = Province::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(ProvinceController::class, 'destroy', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Province Deleted Successfully.'], 200); + } + public function clone(Request $request, $id) + { + // createActivityLog(ProvinceController::class, 'clone', ' Province clone'); + $data = Province::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(ProvinceController::class, 'clone', $e->getMessage()); + return response()->json(['status' => false, 'message' => $e->getMessage()], 500); + } + DB::commit(); + return response()->json(['status' => true, 'message' => 'The Province Clonned Successfully.'], 200); + } + +} diff --git a/Modules/Admin/app/Http/Requests/.gitkeep b/Modules/Admin/app/Http/Requests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/app/Models/.gitkeep b/Modules/Admin/app/Models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/app/Models/Castes.php b/Modules/Admin/app/Models/Castes.php new file mode 100644 index 0000000..852e581 --- /dev/null +++ b/Modules/Admin/app/Models/Castes.php @@ -0,0 +1,16 @@ +hasMany(Province::class); - } - - public static function getCountries() - { - return self::select('id', 'country_name')->where('status', 'Active')->get(); - } } diff --git a/app/Models/Districts.php b/Modules/Admin/app/Models/Districts.php similarity index 92% rename from app/Models/Districts.php rename to Modules/Admin/app/Models/Districts.php index d4275e3..59d0837 100644 --- a/app/Models/Districts.php +++ b/Modules/Admin/app/Models/Districts.php @@ -1,6 +1,6 @@ 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/Admin/app/Providers/RouteServiceProvider.php b/Modules/Admin/app/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..61813e6 --- /dev/null +++ b/Modules/Admin/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('Admin', '/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('Admin', '/routes/api.php')); + } +} diff --git a/Modules/Admin/app/Repositories/.gitkeep b/Modules/Admin/app/Repositories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/app/Services/AdminService.php b/Modules/Admin/app/Services/AdminService.php new file mode 100644 index 0000000..880ab33 --- /dev/null +++ b/Modules/Admin/app/Services/AdminService.php @@ -0,0 +1,51 @@ + 'Admin', +]; diff --git a/Modules/Admin/database/factories/.gitkeep b/Modules/Admin/database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/database/migrations/.gitkeep b/Modules/Admin/database/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/database/seeders/.gitkeep b/Modules/Admin/database/seeders/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/database/seeders/AdminDatabaseSeeder.php b/Modules/Admin/database/seeders/AdminDatabaseSeeder.php new file mode 100644 index 0000000..1f761d7 --- /dev/null +++ b/Modules/Admin/database/seeders/AdminDatabaseSeeder.php @@ -0,0 +1,16 @@ +call([]); + } +} diff --git a/Modules/Admin/module.json b/Modules/Admin/module.json new file mode 100644 index 0000000..b8e93da --- /dev/null +++ b/Modules/Admin/module.json @@ -0,0 +1,11 @@ +{ + "name": "Admin", + "alias": "admin", + "description": "", + "keywords": [], + "priority": 0, + "providers": [ + "Modules\\Admin\\Providers\\AdminServiceProvider" + ], + "files": [] +} diff --git a/Modules/Admin/package.json b/Modules/Admin/package.json new file mode 100644 index 0000000..d6fbfc8 --- /dev/null +++ b/Modules/Admin/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/Admin/resources/assets/.gitkeep b/Modules/Admin/resources/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/resources/assets/js/app.js b/Modules/Admin/resources/assets/js/app.js new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/resources/assets/sass/app.scss b/Modules/Admin/resources/assets/sass/app.scss new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/resources/views/.gitkeep b/Modules/Admin/resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Admin/resources/views/castes/edit.blade.php b/Modules/Admin/resources/views/castes/edit.blade.php new file mode 100644 index 0000000..dd424b8 --- /dev/null +++ b/Modules/Admin/resources/views/castes/edit.blade.php @@ -0,0 +1,41 @@ +@extends('layouts.app') +@section('content') +
+
+ + + @include('layouts.partials.breadcrumb', ['title' => 'Caste']) + + + +
+ +
+ +
+ + @csrf + + +
+
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }} +
+ +
+ {{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }} +
+ +
+ + + + +
+
+
+
+
+
+
+@endsection diff --git a/resources/views/crud/generated/castes/index.blade.php b/Modules/Admin/resources/views/castes/index.blade.php similarity index 53% rename from resources/views/crud/generated/castes/index.blade.php rename to Modules/Admin/resources/views/castes/index.blade.php index 508c46e..c82e923 100644 --- a/resources/views/crud/generated/castes/index.blade.php +++ b/Modules/Admin/resources/views/castes/index.blade.php @@ -1,101 +1,92 @@ @extends('layouts.app') @section('content') -
-
-

{{ label('Caste List') }}

- {{ label('Create New') }} -
-
- - - - - - - - - - - @php - $i = 1; - @endphp - @foreach ($data as $item) - - - - - - - @endforeach - - -
{{ label('Sn.') }}{{ label('title') }}{{ label('alias') }}{{ label('Action') }} -
{{ $i++ }}{{ $item->title }} -
- {{ $item->alias }} - -
- change alias -
- - - -
+
+
+
Caste Lists
+ +
+
+ + + + + + + + + + + @foreach ($data as $index => $item) + + + + + + + @endforeach + +
{{ label('Sn.') }}{{ label('title') }}{{ label('alias') }}{{ label('Action') }} +
{{ $index + 1 }}{{ $item->title }} +
+ {{ $item->alias }} + +
+ change alias +
+ +
+
+
@endsection - -@push('css') - - -@endpush @push('js') - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@endpush diff --git a/resources/views/crud/generated/employees/show.blade.php b/resources/views/crud/generated/employees/show.blade.php deleted file mode 100644 index 410f0e2..0000000 --- a/resources/views/crud/generated/employees/show.blade.php +++ /dev/null @@ -1,67 +0,0 @@ -@extends('layouts.app') -@section('content') -
-
-

- - -
-
- - - -

First Name :     {{ $data->first_name }}

-

Middle Name :     {{ $data->middle_name }}

-

Last Name :     {{ $data->last_name }}

-

Email :     {{ $data->email }}

-

Genders Id :     {{ $data->genders_id }}

-

Nepali Dob :     {{ $data->nepali_dob }}

-

Dob :     {{ $data->dob }}

-

Nationalities Id :     {{ $data->nationalities_id }}

-

About Me :     {{ $data->about_me }}

-

Signature :     {{ $data->signature }}

-

Father Name :     {{ $data->father_name }}

-

Mother Name :     {{ $data->mother_name }}

-

Grand Father Name :     {{ $data->grand_father_name }}

-

Grand Mother Name :     {{ $data->grand_mother_name }}

-

Spouse :     {{ $data->spouse }}

-

Contact :     {{ $data->contact }}

-

Alt Contact :     {{ $data->alt_contact }}

-

Profile Picture :     {{ $data->profile_picture }}

-

Users Id :     {{ $data->users_id }}

-

Is Login Required :     {{ $data->is_login_required }}

-

Skills :     {{ $data->skills }}

-

Experience :     {{ $data->experience }}

-

Permanent Address :     {{ $data->permanent_address }}

-

Permanent City :     {{ $data->permanent_city }}

-

Temporary Address :     {{ $data->temporary_address }}

-

Temporary City :     {{ $data->temporary_city }}

-

Old System Address :     {{ $data->old_system_address }}

-

Education :     {{ $data->education }}

-

Castes Id :     {{ $data->castes_id }}

-

Ethnicities Id :     {{ $data->ethnicities_id }}

-

Dags Id :     {{ $data->dags_id }}

-

Title :     {{ $data->title }}

-

Alias :     {{ $data->alias }}

-

Status :     {{ $data->status == 1 ? 'Active' : 'Inactive' }} -

-

Display Order :     {{ $data->display_order }}

-

Createdby :     {{ $data->createdby }}

-

Updatedby :     {{ $data->updatedby }}

-

Remarks :     {{ $data->remarks }}

-
-
-

Created On :   {{ $data->created_at }}

-

Created By :   {{ $data->createdBy }}

-
-
-

Updated On :   {{ $data->updated_at }}

-

Updated By :   {{ $data->updatedBy }}

- -
-
- -
-
-@endSection diff --git a/resources/views/crud/generated/genders/edit.blade.php b/resources/views/crud/generated/genders/edit.blade.php deleted file mode 100644 index c8e0e0d..0000000 --- a/resources/views/crud/generated/genders/edit.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -@extends('layouts.app') -@section('content') -
-
-

{{ label('Add Genders') }}

- - -
-
-
- @csrf -
-
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }} -
-
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }} -
-
- -
- -
-
-@endsection diff --git a/resources/views/crud/generated/genders/show.blade.php b/resources/views/crud/generated/genders/show.blade.php deleted file mode 100644 index b73f7dd..0000000 --- a/resources/views/crud/generated/genders/show.blade.php +++ /dev/null @@ -1,36 +0,0 @@ -@extends('layouts.app') -@section('content') -
-
-

- - -
-
- - - -

Title :     {{ $data->title }}

-

Alias :     {{ $data->alias }}

-

Status :     {{ $data->status == 1 ? 'Active' : 'Inactive' }} -

-

Remarks :     {{ $data->remarks }}

-

Display Order :     {{ $data->display_order }}

-

Createdby :     {{ $data->createdby }}

-

Updatedby :     {{ $data->updatedby }}

-
-
-

Created On :   {{ $data->created_at }}

-

Created By :   {{ $data->createdBy }}

-
-
-

Updated On :   {{ $data->updated_at }}

-

Updated By :   {{ $data->updatedBy }}

- -
-
- -
-
-@endSection diff --git a/resources/views/crud/generated/nationalities/edit.blade.php b/resources/views/crud/generated/nationalities/edit.blade.php deleted file mode 100644 index cc23489..0000000 --- a/resources/views/crud/generated/nationalities/edit.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -@extends('layouts.app') -@section('content') -
-
-

{{ label('Add Nationalities') }}

- - -
-
-
- @csrf -
-
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }} -
-
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }} -
-
- -
- -
-
-@endsection diff --git a/resources/views/crud/generated/nationalities/show.blade.php b/resources/views/crud/generated/nationalities/show.blade.php deleted file mode 100644 index 03d0e61..0000000 --- a/resources/views/crud/generated/nationalities/show.blade.php +++ /dev/null @@ -1,36 +0,0 @@ -@extends('layouts.app') -@section('content') -
-
-

- - -
-
- - - -

Title :     {{ $data->title }}

-

Alias :     {{ $data->alias }}

-

Status :     {{ $data->status == 1 ? 'Active' : 'Inactive' }} -

-

Remarks :     {{ $data->remarks }}

-

Display Order :     {{ $data->display_order }}

-

Createdby :     {{ $data->createdby }}

-

Updatedby :     {{ $data->updatedby }}

-
-
-

Created On :   {{ $data->created_at }}

-

Created By :   {{ $data->createdBy }}

-
-
-

Updated On :   {{ $data->updated_at }}

-

Updated By :   {{ $data->updatedBy }}

- -
-
- -
-
-@endSection diff --git a/resources/views/crud/generated/vendors/edit.blade.php b/resources/views/crud/generated/vendors/edit.blade.php index 32b5f60..8379dc2 100644 --- a/resources/views/crud/generated/vendors/edit.blade.php +++ b/resources/views/crud/generated/vendors/edit.blade.php @@ -1,30 +1,48 @@ @extends('layouts.app') @section('content') -
-
-

{{ label('Add Vendors') }}

- +
+
-
-
-
- @csrf -
-
- {{ createCustomSelect('tbl_vendortypes', 'title', 'vendortypes_id', $editable ? $data->vendortypes_id : '', 'Vendortypes Id', 'vendortypes_id', 'form-control select2', 'status<>-1') }} -
-
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }} -
-
- {{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }} -
-
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }} -
-
- -
- + + @include('layouts.partials.breadcrumb', ['title' => 'Vendor']) + + + +
+
+
+ + @csrf + + +
+ +
+ {{ createCustomSelect('tbl_vendortypes', 'title', 'vendortypes_id', $editable ? $data->vendortypes_id : '', 'Vendor Type', 'vendortypes_id', 'form-control select2', 'status<>-1') }} +
+ +
+ {{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }} +
+ + {{--
+ {{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }} +
--}} + +
+ {{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }} +
+ +
+ + +
+ +
+
+
+
@endsection diff --git a/resources/views/crud/generated/vendors/index.blade.php b/resources/views/crud/generated/vendors/index.blade.php index d727efc..bf0f6d4 100644 --- a/resources/views/crud/generated/vendors/index.blade.php +++ b/resources/views/crud/generated/vendors/index.blade.php @@ -1,105 +1,99 @@ @extends('layouts.app') @section('content') -
-
-

{{ label('Vendors List') }}

- {{ label('Create New') }} -
-
- - - - - - - - - - - - @php - $i = 1; - @endphp - @foreach ($data as $item) - - - - - - + + @endforeach + +
{{ label('Sn.') }}{{ label('vendortypes') }}{{ label('title') }}{{ label('alias') }}{{ label('Action') }} -
{{ $i++ }} - {!! getFieldData('tbl_vendortypes', 'title', 'vendortypes_id', $item->vendortypes_id) !!} - {{ $item->title }} -
- {{ $item->alias }} - -
- change alias -
- +
+
+
Vendor Lists
+ +
+
+ + + + + + + + + + + + @foreach ($data as $index => $item) + + + + + + - - @endforeach - - -
{{ label('Sn.') }}{{ label('vendortypes') }}{{ label('title') }}{{ label('alias') }}{{ label('Action') }} +
{{ $index + 1 }} + {!! getFieldData('tbl_vendortypes', 'title', 'vendortypes_id', $item->vendortypes_id) !!} + {{ $item->title }} +
+ {{ $item->alias }} + +
+ change alias +
+
+ +
  • + + {{ label('Clone') }} + +
  • +
  • + + {{ label('Delete') }} + +
  • + +
    +
    +
    +
    @endsection -@push('css') - - -@endpush @push('js') - - - - - - - - - - - - - - - - -