Merge branch 'omis_dharma' of ssh://bibgit.com:22022/dharmaraj/New-OMIS
This commit is contained in:
commit
7e345ef4e3
0
Modules/Admin/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Admin/app/Http/Controllers/.gitkeep
Normal file
67
Modules/Admin/app/Http/Controllers/AdminController.php
Normal file
67
Modules/Admin/app/Http/Controllers/AdminController.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('admin::index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('admin::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
218
Modules/Admin/app/Http/Controllers/CastesController.php
Normal file
218
Modules/Admin/app/Http/Controllers/CastesController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Castes;
|
||||
|
||||
class CastesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Castes $model)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
219
Modules/Admin/app/Http/Controllers/CitiesController.php
Normal file
219
Modules/Admin/app/Http/Controllers/CitiesController.php
Normal file
@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Cities;
|
||||
|
||||
class CitiesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Cities $model)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Country;
|
||||
use App\Service\CommonModelService;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Log;
|
||||
use Modules\Admin\Models\Country;
|
||||
|
||||
class CountriesController extends Controller
|
||||
{
|
||||
@ -22,15 +23,14 @@ class CountriesController extends Controller
|
||||
// createActivityLog(CountriesController::class, 'index', ' Country index');
|
||||
$data = Country::where('status', '<>', -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');
|
||||
$TableData = Country::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("crud.generated.countries.edit", compact('TableData', 'editable'));
|
||||
return view("admin::countries.edit", compact('editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
@ -104,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)
|
||||
@ -113,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)
|
||||
@ -187,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);
|
218
Modules/Admin/app/Http/Controllers/DistrictsController.php
Normal file
218
Modules/Admin/app/Http/Controllers/DistrictsController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Districts;
|
||||
|
||||
class DistrictsController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Districts $model)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
218
Modules/Admin/app/Http/Controllers/GendersController.php
Normal file
218
Modules/Admin/app/Http/Controllers/GendersController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Genders;
|
||||
|
||||
class GendersController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Genders $model)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
218
Modules/Admin/app/Http/Controllers/NationalitiesController.php
Normal file
218
Modules/Admin/app/Http/Controllers/NationalitiesController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Nationalities;
|
||||
|
||||
class NationalitiesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Nationalities $model)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
218
Modules/Admin/app/Http/Controllers/ProvinceController.php
Normal file
218
Modules/Admin/app/Http/Controllers/ProvinceController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Province;
|
||||
|
||||
class ProvinceController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Province $model)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
0
Modules/Admin/app/Http/Requests/.gitkeep
Normal file
0
Modules/Admin/app/Http/Requests/.gitkeep
Normal file
0
Modules/Admin/app/Models/.gitkeep
Normal file
0
Modules/Admin/app/Models/.gitkeep
Normal file
16
Modules/Admin/app/Models/Castes.php
Normal file
16
Modules/Admin/app/Models/Castes.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Castes extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_castes';
|
||||
protected $primaryKey = 'caste_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
16
Modules/Admin/app/Models/Cities.php
Normal file
16
Modules/Admin/app/Models/Cities.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Cities extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_cities';
|
||||
protected $primaryKey = 'city_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@ -15,14 +15,4 @@ class Country extends Model
|
||||
'country_code',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function provinces()
|
||||
{
|
||||
return $this->hasMany(Province::class);
|
||||
}
|
||||
|
||||
public static function getCountries()
|
||||
{
|
||||
return self::select('id', 'country_name')->where('status', 'Active')->get();
|
||||
}
|
||||
}
|
20
Modules/Admin/app/Models/Districts.php
Normal file
20
Modules/Admin/app/Models/Districts.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Districts extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_districts';
|
||||
protected $primaryKey = 'district_id';
|
||||
protected $fillable = [
|
||||
'district_name',
|
||||
'countries_id',
|
||||
'provinces_id',
|
||||
'status',
|
||||
];
|
||||
}
|
16
Modules/Admin/app/Models/Genders.php
Normal file
16
Modules/Admin/app/Models/Genders.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Genders extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_genders';
|
||||
protected $primaryKey = 'gender_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
16
Modules/Admin/app/Models/Nationalities.php
Normal file
16
Modules/Admin/app/Models/Nationalities.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Nationalities extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_nationalities';
|
||||
protected $primaryKey = 'nationality_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
23
Modules/Admin/app/Models/Province.php
Normal file
23
Modules/Admin/app/Models/Province.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Province extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_provinces';
|
||||
protected $primaryKey = 'province_id';
|
||||
protected $fillable = [
|
||||
'province_name',
|
||||
'country_id',
|
||||
'status',
|
||||
];
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class);
|
||||
}
|
||||
}
|
0
Modules/Admin/app/Providers/.gitkeep
Normal file
0
Modules/Admin/app/Providers/.gitkeep
Normal file
114
Modules/Admin/app/Providers/AdminServiceProvider.php
Normal file
114
Modules/Admin/app/Providers/AdminServiceProvider.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AdminServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Admin';
|
||||
|
||||
protected string $moduleNameLower = 'admin';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder','')));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
|
||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
49
Modules/Admin/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Admin/app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
Route::middleware('web')->group(module_path('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'));
|
||||
}
|
||||
}
|
0
Modules/Admin/app/Repositories/.gitkeep
Normal file
0
Modules/Admin/app/Repositories/.gitkeep
Normal file
51
Modules/Admin/app/Services/AdminService.php
Normal file
51
Modules/Admin/app/Services/AdminService.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Services;
|
||||
|
||||
use Modules\Admin\Models\Castes;
|
||||
use Modules\Admin\Models\Cities;
|
||||
use Modules\Admin\Models\Country;
|
||||
use Modules\Admin\Models\Districts;
|
||||
use Modules\Admin\Models\Genders;
|
||||
use Modules\Admin\Models\Nationalities;
|
||||
use Modules\Admin\Models\Province;
|
||||
|
||||
final class AdminService
|
||||
{
|
||||
function pluckCountries()
|
||||
{
|
||||
return Country::pluck('title', 'country_id');
|
||||
}
|
||||
|
||||
function pluckProvinces()
|
||||
{
|
||||
return Province::pluck('title', 'province_id');
|
||||
}
|
||||
|
||||
function pluckDistricts()
|
||||
{
|
||||
return Districts::pluck('title', 'district_id');
|
||||
|
||||
}
|
||||
|
||||
function pluckCities()
|
||||
{
|
||||
return Cities::pluck('title', 'city_id');
|
||||
}
|
||||
|
||||
function pluckCastes()
|
||||
{
|
||||
return Castes::pluck('title', 'caste_id');
|
||||
}
|
||||
|
||||
function pluckGenders()
|
||||
{
|
||||
return Genders::pluck('title', 'gender_id');
|
||||
}
|
||||
|
||||
function pluckNationalities()
|
||||
{
|
||||
return Nationalities::pluck('title', 'nationality_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
30
Modules/Admin/composer.json
Normal file
30
Modules/Admin/composer.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "nwidart/admin",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Admin\\": "app/",
|
||||
"Modules\\Admin\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Admin\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Admin\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Admin/config/.gitkeep
Normal file
0
Modules/Admin/config/.gitkeep
Normal file
5
Modules/Admin/config/config.php
Normal file
5
Modules/Admin/config/config.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Admin',
|
||||
];
|
0
Modules/Admin/database/factories/.gitkeep
Normal file
0
Modules/Admin/database/factories/.gitkeep
Normal file
0
Modules/Admin/database/migrations/.gitkeep
Normal file
0
Modules/Admin/database/migrations/.gitkeep
Normal file
0
Modules/Admin/database/seeders/.gitkeep
Normal file
0
Modules/Admin/database/seeders/.gitkeep
Normal file
16
Modules/Admin/database/seeders/AdminDatabaseSeeder.php
Normal file
16
Modules/Admin/database/seeders/AdminDatabaseSeeder.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\database\seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AdminDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
11
Modules/Admin/module.json
Normal file
11
Modules/Admin/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Admin",
|
||||
"alias": "admin",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Admin\\Providers\\AdminServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Admin/package.json
Normal file
15
Modules/Admin/package.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^1.1.2",
|
||||
"laravel-vite-plugin": "^0.7.5",
|
||||
"sass": "^1.69.5",
|
||||
"postcss": "^8.3.7",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
0
Modules/Admin/resources/assets/.gitkeep
Normal file
0
Modules/Admin/resources/assets/.gitkeep
Normal file
0
Modules/Admin/resources/assets/js/app.js
Normal file
0
Modules/Admin/resources/assets/js/app.js
Normal file
0
Modules/Admin/resources/assets/sass/app.scss
Normal file
0
Modules/Admin/resources/assets/sass/app.scss
Normal file
0
Modules/Admin/resources/views/.gitkeep
Normal file
0
Modules/Admin/resources/views/.gitkeep
Normal file
41
Modules/Admin/resources/views/castes/edit.blade.php
Normal file
41
Modules/Admin/resources/views/castes/edit.blade.php
Normal file
@ -0,0 +1,41 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Caste'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
|
||||
<div class='card-body'>
|
||||
|
||||
<form action="{{ $editable ? route('castes.update', [$data->caste_id]) : route('castes.store') }}"
|
||||
id="updateCustomForm" method="POST">
|
||||
|
||||
@csrf
|
||||
<input type=hidden name='caste_id' value='{{ $editable ? $data->caste_id : '' }}' />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mt-2">
|
||||
|
||||
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('castes.index')); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -1,9 +1,20 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Caste'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>{{ label('Caste List') }}</h2>
|
||||
<a href="{{ route('castes.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">Caste Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('castes.index') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create Caste</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="dataTable table" id="tbl_castes" data-url="{{ route('castes.sort') }}">
|
||||
@ -17,13 +28,10 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach ($data as $item)
|
||||
@foreach ($data as $index => $item)
|
||||
<tr data-id="{{ $item->caste_id }}" data-display_order="{{ $item->display_order }}"
|
||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||
<td class="tb-col">{{ $i++ }}</td>
|
||||
<td class="tb-col">{{ $index + 1 }}</td>
|
||||
<td class="tb-col">{{ $item->title }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="alias-wrapper" data-id="{{ $item->caste_id }}">
|
||||
@ -42,7 +50,8 @@
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a href="{{ route('castes.show', [$item->caste_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
|
||||
<li><a href="{{ route('castes.edit', [$item->caste_id]) }}" class="dropdown-item edit-item-btn"><i
|
||||
<li><a href="{{ route('castes.edit', [$item->caste_id]) }}"
|
||||
class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
|
||||
<li>
|
||||
<a href="{{ route('castes.toggle', [$item->caste_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
@ -60,42 +69,24 @@
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('castes.destroy', [$item->caste_id]) }}" class="dropdown-item remove-item-btn"
|
||||
onclick="confirmDelete(this.href)">
|
||||
<a href="{{ route('castes.destroy', [$item->caste_id]) }}"
|
||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
||||
@endpush
|
||||
@push('js')
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(e) {
|
||||
$('.change-alias-badge').on('click', function() {
|
43
Modules/Admin/resources/views/castes/show.blade.php
Normal file
43
Modules/Admin/resources/views/castes/show.blade.php
Normal file
@ -0,0 +1,43 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Caste'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class='card'>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">View Detail</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('castes.index') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Back to List</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='card-body'>
|
||||
<p><b>Title : </b> <span>{{ $data->title }}</span></p>
|
||||
<p><b>Alias : </b> <span>{{ $data->alias }}</span></p>
|
||||
<p><b>Status : </b> <span
|
||||
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
|
||||
</p>
|
||||
<p><b>Remarks : </b> <span>{{ $data->remarks }}</span></p>
|
||||
<p><b>Display Order : </b> <span>{{ $data->display_order }}</span></p>
|
||||
<p><b>Createdby : </b> <span>{{ $data->createdby }}</span></p>
|
||||
<p><b>Updatedby : </b> <span>{{ $data->updatedby }}</span></p>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<p><b>Created On :</b> <span>{{ $data->created_at }}</span></p>
|
||||
<p><b>Created By :</b> <span>{{ $data->createdBy }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Updated On :</b> <span>{{ $data->updated_at }}</span></p>
|
||||
<p><b>Updated By :</b> <span>{{ $data->updatedBy }}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
47
Modules/Admin/resources/views/cities/edit.blade.php
Normal file
47
Modules/Admin/resources/views/cities/edit.blade.php
Normal file
@ -0,0 +1,47 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'City'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class='card'>
|
||||
<div class='card-body'>
|
||||
<form action="{{ $editable ? route('cities.update', [$data->city_id]) : route('cities.store') }}"
|
||||
id="updateCustomForm" method="POST">
|
||||
|
||||
@csrf
|
||||
<input type=hidden name='city_id' value='{{ $editable ? $data->city_id : '' }}' />
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-6">
|
||||
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
{{ createCustomSelect('tbl_districts', 'title', 'district_id', $editable ? $data->districts_id : '', 'District', 'districts_id', 'form-control select2', 'status<>-1') }}
|
||||
</div>
|
||||
|
||||
|
||||
{{-- <div class="col-lg-12 pb-2">
|
||||
{{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
|
||||
</div> --}}
|
||||
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mt-2">
|
||||
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('cities.index')); ?>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -1,35 +1,48 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'City'])
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>{{ label('Genders List') }}</h2>
|
||||
<a href="{{ route('genders.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">City Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('cities.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create City</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<table class="dataTable table" id="tbl_genders" data-url="{{ route('genders.sort') }}">
|
||||
<table class="dataTable table" id="tbl_cities" data-url="{{ route('cities.sort') }}">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('District') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('title') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
|
||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@php
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach ($data as $item)
|
||||
<tr data-id="{{ $item->gender_id }}" data-display_order="{{ $item->display_order }}"
|
||||
<tr data-id="{{ $item->city_id }}" data-display_order="{{ $item->display_order }}"
|
||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||
<td class="tb-col">{{ $i++ }}</td>
|
||||
<td class="tb-col">{{ $index + 1 }}</td>
|
||||
<td class="tb-col">
|
||||
{!! getFieldData('tbl_districts', 'title', 'district_id', $item->districts_id) !!}
|
||||
</td>
|
||||
<td class="tb-col">{{ $item->title }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="alias-wrapper" data-id="{{ $item->gender_id }}">
|
||||
<div class="alias-wrapper" data-id="{{ $item->city_id }}">
|
||||
<span class="alias">{{ $item->alias }}</span>
|
||||
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
|
||||
id="alias_{{ $item->gender_id }}" />
|
||||
id="alias_{{ $item->city_id }}" />
|
||||
</div>
|
||||
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
|
||||
</td>
|
||||
@ -40,62 +53,45 @@
|
||||
<i class="ri-more-fill align-middle"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a href="{{ route('genders.show', [$item->gender_id]) }}" class="dropdown-item"><i
|
||||
<li><a href="{{ route('cities.show', [$item->city_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
|
||||
<li><a href="{{ route('genders.edit', [$item->gender_id]) }}" class="dropdown-item edit-item-btn"><i
|
||||
<li><a href="{{ route('cities.edit', [$item->city_id]) }}" class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
|
||||
<li>
|
||||
<a href="{{ route('genders.toggle', [$item->gender_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
<a href="{{ route('cities.toggle', [$item->city_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
onclick="confirmToggle(this.href)">
|
||||
<i class="ri-article-fill text-muted me-2 align-bottom"></i>
|
||||
{{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('genders.clone', [$item->gender_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
<a href="{{ route('cities.clone', [$item->city_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
onclick="confirmClone(this.href)">
|
||||
<i class="ri-file-copy-line text-muted me-2 align-bottom"></i> {{ label('Clone') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('genders.destroy', [$item->gender_id]) }}" class="dropdown-item remove-item-btn"
|
||||
<a href="{{ route('cities.destroy', [$item->city_id]) }}" class="dropdown-item remove-item-btn"
|
||||
onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
||||
@endpush
|
||||
|
||||
@push('js')
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(e) {
|
||||
$('.change-alias-badge').on('click', function() {
|
||||
@ -112,7 +108,7 @@
|
||||
aliasInput.hide();
|
||||
$(this).removeClass('editing').text('Change Alias');
|
||||
var articleId = $(aliasWrapper).data('id');
|
||||
var ajaxUrl = "{{ route('genders.updatealias') }}";
|
||||
var ajaxUrl = "{{ route('cities.updatealias') }}";
|
||||
var data = {
|
||||
articleId: articleId,
|
||||
newAlias: newAlias
|
||||
@ -195,7 +191,7 @@
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
type: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
50
Modules/Admin/resources/views/countries/edit.blade.php
Normal file
50
Modules/Admin/resources/views/countries/edit.blade.php
Normal file
@ -0,0 +1,50 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Country'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<form action="{{ $editable ? route('countries.update', [$data->country_id]) : route('countries.store') }}"
|
||||
id="updateCustomForm" method="POST">
|
||||
@csrf
|
||||
|
||||
<input type=hidden name='country_id' value='{{ $editable ? $data->country_id : '' }}' />
|
||||
|
||||
<div class='card'>
|
||||
|
||||
<div class='card-body'>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-12">
|
||||
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-lg-12 pb-4">
|
||||
{{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
|
||||
</div> --}}
|
||||
|
||||
<div class="border border-dashed"></div>
|
||||
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="col-md-12">
|
||||
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('countries.index')); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
230
Modules/Admin/resources/views/countries/index.blade.php
Normal file
230
Modules/Admin/resources/views/countries/index.blade.php
Normal file
@ -0,0 +1,230 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Country'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">Country Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('countries.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create Country</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<table class="dataTable table" id="tbl_countries" data-url="{{ route('countries.sort') }}">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="tb-col text-uppercase"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||
<th class="tb-col text-uppercase"><span class="overline-title">{{ label('title') }}</span></th>
|
||||
<th class="tb-col text-uppercase"><span class="overline-title">{{ label('alias') }}</span></th>
|
||||
<th class="tb-col text-uppercase" data-sortable="false"><span
|
||||
class="overline-title">{{ label('Action') }}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@foreach ($data as $index => $item)
|
||||
<tr data-id="{{ $item->country_id }}" data-display_order="{{ $item->display_order }}"
|
||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||
<td class="tb-col">{{ $index + 1 }}</td>
|
||||
<td class="tb-col">{{ $item->title }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="alias-wrapper" data-id="{{ $item->country_id }}">
|
||||
<span class="alias">{{ $item->alias }}</span>
|
||||
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
|
||||
id="alias_{{ $item->country_id }}" />
|
||||
</div>
|
||||
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
|
||||
</td>
|
||||
<td class="tb-col">
|
||||
<div class="dropdown d-inline-block">
|
||||
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown"
|
||||
aria-expanded="false">
|
||||
<i class="ri-more-fill align-middle"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a href="{{ route('countries.show', [$item->country_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
|
||||
<li><a href="{{ route('countries.edit', [$item->country_id]) }}"
|
||||
class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
|
||||
<li>
|
||||
<a href="{{ route('countries.toggle', [$item->country_id]) }}"
|
||||
class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
|
||||
<i class="ri-article-fill text-muted me-2 align-bottom"></i>
|
||||
{{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('countries.destroy', [$item->country_id]) }}"
|
||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$(document).ready(function(e) {
|
||||
$('.change-alias-badge').on('click', function() {
|
||||
var aliasWrapper = $(this).prev('.alias-wrapper');
|
||||
var aliasSpan = aliasWrapper.find('.alias');
|
||||
var aliasInput = aliasWrapper.find('.alias-input');
|
||||
var isEditing = $(this).hasClass('editing');
|
||||
aliasInput.toggleClass("d-none");
|
||||
if (isEditing) {
|
||||
// Update alias text and switch to non-editing state
|
||||
var newAlias = aliasInput.val();
|
||||
aliasSpan.text(newAlias);
|
||||
aliasSpan.show();
|
||||
aliasInput.hide();
|
||||
$(this).removeClass('editing').text('Change Alias');
|
||||
var articleId = $(aliasWrapper).data('id');
|
||||
var ajaxUrl = "{{ route('countries.updatealias') }}";
|
||||
var data = {
|
||||
articleId: articleId,
|
||||
newAlias: newAlias
|
||||
};
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
type: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
data: data,
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Switch to editing state
|
||||
aliasSpan.hide();
|
||||
aliasInput.show().focus();
|
||||
$(this).addClass('editing').text('Save Alias');
|
||||
}
|
||||
});
|
||||
var mytable = $(".dataTable").DataTable({
|
||||
ordering: true,
|
||||
rowReorder: {
|
||||
//selector: 'tr'
|
||||
},
|
||||
});
|
||||
var isRowReorderComplete = false;
|
||||
mytable.on('row-reorder', function(e, diff, edit) {
|
||||
isRowReorderComplete = true;
|
||||
});
|
||||
mytable.on('draw', function() {
|
||||
if (isRowReorderComplete) {
|
||||
var url = mytable.table().node().getAttribute('data-url');
|
||||
var ids = mytable.rows().nodes().map(function(node) {
|
||||
return $(node).data('id');
|
||||
}).toArray();
|
||||
console.log(ids);
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
headers: {
|
||||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
data: {
|
||||
id_order: ids
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
isRowReorderComplete = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function confirmDelete(url) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: 'You will not be able to recover this item!',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Delete',
|
||||
cancelButtonText: 'Cancel',
|
||||
reverseButtons: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(response) {
|
||||
Swal.fire('Deleted!', 'The item has been deleted.', 'success');
|
||||
location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function confirmToggle(url) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Proceed',
|
||||
cancelButtonText: 'Cancel',
|
||||
reverseButtons: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(response) {
|
||||
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
|
||||
location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
Swal.fire('Error!', 'An error occurred.', 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
52
Modules/Admin/resources/views/countries/show.blade.php
Normal file
52
Modules/Admin/resources/views/countries/show.blade.php
Normal file
@ -0,0 +1,52 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Employee'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Employee'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class='card'>
|
||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||
<h2><?php echo label('View Detail'); ?></h2>
|
||||
<?php createButton('btn-primary btn-cancel', '', 'Back to List', route('countries.index')); ?>
|
||||
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<p><b>Title : </b> <span>{{ $data->title }}</span></p>
|
||||
<p><b>Alias : </b> <span>{{ $data->alias }}</span></p>
|
||||
<p><b>Description : </b> <span>{{ $data->description }}</span></p>
|
||||
<p><b>Display Order : </b> <span>{{ $data->display_order }}</span></p>
|
||||
<p><b>Status : </b> <span
|
||||
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
|
||||
</p>
|
||||
<p><b>Remarks : </b> <span>{{ $data->remarks }}</span></p>
|
||||
<p><b>Createdby : </b> <span>{{ $data->createdby }}</span></p>
|
||||
<p><b>Updatedby : </b> <span>{{ $data->updatedby }}</span></p>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<p><b>Created On :</b> <span>{{ $data->created_at }}</span></p>
|
||||
<p><b>Created By :</b> <span>{{ $data->createdBy }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Updated On :</b> <span>{{ $data->updated_at }}</span></p>
|
||||
<p><b>Updated By :</b> <span>{{ $data->updatedBy }}</span></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endSection
|
46
Modules/Admin/resources/views/districts/edit.blade.php
Normal file
46
Modules/Admin/resources/views/districts/edit.blade.php
Normal file
@ -0,0 +1,46 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'District'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
<div class='card-body'>
|
||||
<form action="{{ $editable ? route('districts.update', [$data->district_id]) : route('districts.store') }}"
|
||||
id="updateCustomForm" method="POST">
|
||||
|
||||
@csrf
|
||||
|
||||
<input type=hidden name='district_id' value='{{ $editable ? $data->district_id : '' }}' />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{{ createCustomSelect('tbl_provinces', 'title', 'province_id', $editable ? $data->provinces_id : '', 'Province', 'provinces_id', 'form-control select2', 'status<>-1') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-lg-12 pb-2">
|
||||
{{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
|
||||
</div> --}}
|
||||
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('districts.index')); ?>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -1,50 +1,27 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-xl-4">
|
||||
<form action="{{ route('proviences.store') }}" id="storeCustomForm" method="POST">
|
||||
@csrf
|
||||
<div class='card'>
|
||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||
<h2 class="">{{ label('Add Proviences') }}</h2>
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'District'])
|
||||
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{{ createCustomSelect('tbl_countries', 'title', 'country_id', 'Countries Id', 'countries_id', 'form-control select2', 'status<>-1') }}
|
||||
</div>
|
||||
<div class="col-lg-6">{{ createText('title', 'title', 'Title') }}
|
||||
</div>
|
||||
<div class="col-lg-12 pb-2">{{ createTextarea('description', 'description ', 'Description') }}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('proviences.index')); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="col-xl-8">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>{{ label('Proviences List') }}</h2>
|
||||
<a href="{{ route('proviences.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">District Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('districts.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create District</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="dataTable table" id="tbl_proviences" data-url="{{ route('proviences.sort') }}">
|
||||
<table class="dataTable table" id="tbl_districts" data-url="{{ route('districts.sort') }}">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('countries') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('provinces') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('title') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
|
||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
|
||||
@ -56,18 +33,18 @@
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach ($data as $item)
|
||||
<tr data-id="{{ $item->provience_id }}" data-display_order="{{ $item->display_order }}"
|
||||
<tr data-id="{{ $item->district_id }}" data-display_order="{{ $item->display_order }}"
|
||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||
<td class="tb-col">{{ $i++ }}</td>
|
||||
<td class="tb-col">
|
||||
{!! getFieldData('tbl_countries', 'title', 'country_id', $item->countries_id) !!}
|
||||
{!! getFieldData('tbl_provinces', 'title', 'province_id', $item->provinces_id) !!}
|
||||
</td>
|
||||
<td class="tb-col">{{ $item->title }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="alias-wrapper" data-id="{{ $item->provience_id }}">
|
||||
<div class="alias-wrapper" data-id="{{ $item->district_id }}">
|
||||
<span class="alias">{{ $item->alias }}</span>
|
||||
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
|
||||
id="alias_{{ $item->provience_id }}" />
|
||||
id="alias_{{ $item->district_id }}" />
|
||||
</div>
|
||||
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
|
||||
</td>
|
||||
@ -78,13 +55,14 @@
|
||||
<i class="ri-more-fill align-middle"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a href="{{ route('proviences.show', [$item->provience_id]) }}" class="dropdown-item"><i
|
||||
<li><a href="{{ route('districts.show', [$item->district_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
|
||||
<li><a href="{{ route('proviences.edit', [$item->provience_id]) }}"
|
||||
<li><a href="{{ route('districts.edit', [$item->district_id]) }}"
|
||||
class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i>
|
||||
{{ label('Edit') }}</a></li>
|
||||
<li>
|
||||
<a href="{{ route('proviences.toggle', [$item->provience_id]) }}"
|
||||
<a href="{{ route('districts.toggle', [$item->district_id]) }}"
|
||||
class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
|
||||
<i class="ri-article-fill text-muted me-2 align-bottom"></i>
|
||||
{{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
|
||||
@ -92,14 +70,14 @@
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('proviences.clone', [$item->provience_id]) }}"
|
||||
<a href="{{ route('districts.clone', [$item->district_id]) }}"
|
||||
class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
|
||||
<i class="ri-file-copy-line text-muted me-2 align-bottom"></i> {{ label('Clone') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('proviences.destroy', [$item->provience_id]) }}"
|
||||
<a href="{{ route('districts.destroy', [$item->district_id]) }}"
|
||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
|
||||
</a>
|
||||
@ -107,36 +85,18 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
||||
@endpush
|
||||
@push('js')
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(e) {
|
||||
$('.change-alias-badge').on('click', function() {
|
||||
@ -153,7 +113,7 @@
|
||||
aliasInput.hide();
|
||||
$(this).removeClass('editing').text('Change Alias');
|
||||
var articleId = $(aliasWrapper).data('id');
|
||||
var ajaxUrl = "{{ route('proviences.updatealias') }}";
|
||||
var ajaxUrl = "{{ route('districts.updatealias') }}";
|
||||
var data = {
|
||||
articleId: articleId,
|
||||
newAlias: newAlias
|
||||
@ -236,7 +196,7 @@
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
type: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
45
Modules/Admin/resources/views/districts/show.blade.php
Normal file
45
Modules/Admin/resources/views/districts/show.blade.php
Normal file
@ -0,0 +1,45 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Province'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||
<h2><?php echo label('View Detail'); ?></h2>
|
||||
<?php createButton('btn-primary btn-cancel', '', 'Back to List', route('districts.index')); ?>
|
||||
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<p><b>Province: </b> <span>{{ $data->proviences_id }}</span></p>
|
||||
<p><b>Title : </b> <span>{{ $data->title }}</span></p>
|
||||
<p><b>Alias : </b> <span>{{ $data->alias }}</span></p>
|
||||
<p><b>Description : </b> <span>{{ $data->description }}</span></p>
|
||||
<p><b>Display Order : </b> <span>{{ $data->display_order }}</span></p>
|
||||
<p><b>Status : </b> <span
|
||||
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
|
||||
</p>
|
||||
<p><b>Remarks : </b> <span>{{ $data->remarks }}</span></p>
|
||||
<p><b>Createdby : </b> <span>{{ $data->createdby }}</span></p>
|
||||
<p><b>Updatedby : </b> <span>{{ $data->updatedby }}</span></p>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<p><b>Created On :</b> <span>{{ $data->created_at }}</span></p>
|
||||
<p><b>Created By :</b> <span>{{ $data->createdBy }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Updated On :</b> <span>{{ $data->updated_at }}</span></p>
|
||||
<p><b>Updated By :</b> <span>{{ $data->updatedBy }}</span></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endSection
|
39
Modules/Admin/resources/views/genders/edit.blade.php
Normal file
39
Modules/Admin/resources/views/genders/edit.blade.php
Normal file
@ -0,0 +1,39 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
\<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Gender'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class='card'>
|
||||
<div class='card-body'>
|
||||
|
||||
<form action="{{ $editable ? route('genders.update', [$data->gender_id]) : route('genders.store') }}"
|
||||
id="updateCustomForm" method="POST">
|
||||
|
||||
@csrf
|
||||
<input type=hidden name='gender_id' value='{{ $editable ? $data->gender_id : '' }}' />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mt-2">
|
||||
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('genders.index')); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -1,63 +1,42 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<form action="{{ route('countries.store') }}" id="storeCustomForm" method="POST">
|
||||
@csrf
|
||||
<div class='card'>
|
||||
<div class="card-header">
|
||||
<h2 class="card-title mb-0">Add Country</h2>
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">{{ createText('title', 'title', 'Title') }}</div>
|
||||
<div class="border border-dashed"></div>
|
||||
<div class="col-lg-12 pb-3">{{ createTextarea('description', 'description ', 'Description') }}</div>
|
||||
<div class="border border-dashed"></div>
|
||||
<div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', 'remarks ', 'Remarks') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="card-footer">
|
||||
<div class="col-md-12">
|
||||
<?php createButton('btn-primary btn-store', '', 'Submit'); ?>
|
||||
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('countries.index')); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-lg-8">
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Gender'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2 class="card-title mb-0">{{ label('Countries List') }}</h2>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">Gender Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('genders.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create Gender</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="dataTable table" id="tbl_countries" data-url="{{ route('countries.sort') }}">
|
||||
<table class="dataTable table" id="tbl_genders" data-url="{{ route('genders.sort') }}">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="tb-col text-uppercase"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||
<th class="tb-col text-uppercase"><span class="overline-title">{{ label('title') }}</span></th>
|
||||
<th class="tb-col text-uppercase"><span class="overline-title">{{ label('alias') }}</span></th>
|
||||
<th class="tb-col text-uppercase" data-sortable="false"><span
|
||||
class="overline-title">{{ label('Action') }}</span>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('title') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
|
||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach ($data as $item)
|
||||
<tr data-id="{{ $item->country_id }}" data-display_order="{{ $item->display_order }}"
|
||||
@foreach ($data as $index => $item)
|
||||
<tr data-id="{{ $item->gender_id }}" data-display_order="{{ $item->display_order }}"
|
||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||
<td class="tb-col">{{ $i++ }}</td>
|
||||
<td class="tb-col">{{ $index + 1 }}</td>
|
||||
<td class="tb-col">{{ $item->title }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="alias-wrapper" data-id="{{ $item->country_id }}">
|
||||
<div class="alias-wrapper" data-id="{{ $item->gender_id }}">
|
||||
<span class="alias">{{ $item->alias }}</span>
|
||||
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
|
||||
id="alias_{{ $item->country_id }}" />
|
||||
id="alias_{{ $item->gender_id }}" />
|
||||
</div>
|
||||
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
|
||||
</td>
|
||||
@ -68,20 +47,28 @@
|
||||
<i class="ri-more-fill align-middle"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a href="{{ route('countries.show', [$item->country_id]) }}" class="dropdown-item"><i
|
||||
<li><a href="{{ route('genders.show', [$item->gender_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
|
||||
<li><a href="{{ route('countries.edit', [$item->country_id]) }}"
|
||||
<li><a href="{{ route('genders.edit', [$item->gender_id]) }}"
|
||||
class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
|
||||
<li>
|
||||
<a href="{{ route('countries.toggle', [$item->country_id]) }}"
|
||||
<a href="{{ route('genders.toggle', [$item->gender_id]) }}"
|
||||
class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
|
||||
<i class="ri-article-fill text-muted me-2 align-bottom"></i>
|
||||
{{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('countries.destroy', [$item->country_id]) }}"
|
||||
<a href="{{ route('genders.clone', [$item->gender_id]) }}"
|
||||
class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
|
||||
<i class="ri-file-copy-line text-muted me-2 align-bottom"></i> {{ label('Clone') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('genders.destroy', [$item->gender_id]) }}"
|
||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
|
||||
</a>
|
||||
@ -98,18 +85,8 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
||||
@endpush
|
||||
|
||||
@push('js')
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script>
|
||||
$(document).ready(function(e) {
|
||||
$('.change-alias-badge').on('click', function() {
|
||||
@ -126,11 +103,12 @@
|
||||
aliasInput.hide();
|
||||
$(this).removeClass('editing').text('Change Alias');
|
||||
var articleId = $(aliasWrapper).data('id');
|
||||
var ajaxUrl = "{{ route('countries.updatealias') }}";
|
||||
var ajaxUrl = "{{ route('genders.updatealias') }}";
|
||||
var data = {
|
||||
articleId: articleId,
|
||||
newAlias: newAlias
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
type: 'POST',
|
||||
@ -158,16 +136,20 @@
|
||||
//selector: 'tr'
|
||||
},
|
||||
});
|
||||
|
||||
var isRowReorderComplete = false;
|
||||
|
||||
mytable.on('row-reorder', function(e, diff, edit) {
|
||||
isRowReorderComplete = true;
|
||||
});
|
||||
|
||||
mytable.on('draw', function() {
|
||||
if (isRowReorderComplete) {
|
||||
var url = mytable.table().node().getAttribute('data-url');
|
||||
var ids = mytable.rows().nodes().map(function(node) {
|
||||
return $(node).data('id');
|
||||
}).toArray();
|
||||
|
||||
console.log(ids);
|
||||
$.ajax({
|
||||
url: url,
|
||||
@ -204,7 +186,7 @@
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'DELETE',
|
||||
type: 'GET',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
@ -249,5 +231,35 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function confirmClone(url) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: 'Clonning will create replica of current row. No any linked data will be updated!',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Proceed',
|
||||
cancelButtonText: 'Cancel',
|
||||
reverseButtons: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(response) {
|
||||
Swal.fire('Updated!', 'Clonning Completed', 'success');
|
||||
location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
Swal.fire('Error!', 'An error occurred.', 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
42
Modules/Admin/resources/views/genders/show.blade.php
Normal file
42
Modules/Admin/resources/views/genders/show.blade.php
Normal file
@ -0,0 +1,42 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Nationality'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class='card'>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">View Detail</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('nationalities.index') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Back to List</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<p><b>Title : </b> <span>{{ $data->title }}</span></p>
|
||||
<p><b>Alias : </b> <span>{{ $data->alias }}</span></p>
|
||||
<p><b>Status : </b> <span
|
||||
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
|
||||
</p>
|
||||
<p><b>Remarks : </b> <span>{{ $data->remarks }}</span></p>
|
||||
<p><b>Display Order : </b> <span>{{ $data->display_order }}</span></p>
|
||||
<p><b>Createdby : </b> <span>{{ $data->createdby }}</span></p>
|
||||
<p><b>Updatedby : </b> <span>{{ $data->updatedby }}</span></p>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<p><b>Created On :</b> <span>{{ $data->created_at }}</span></p>
|
||||
<p><b>Created By :</b> <span>{{ $data->createdBy }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Updated On :</b> <span>{{ $data->updated_at }}</span></p>
|
||||
<p><b>Updated By :</b> <span>{{ $data->updatedBy }}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endSection
|
7
Modules/Admin/resources/views/index.blade.php
Normal file
7
Modules/Admin/resources/views/index.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>Module: {!! config('admin.name') !!}</p>
|
||||
@endsection
|
29
Modules/Admin/resources/views/layouts/master.blade.php
Normal file
29
Modules/Admin/resources/views/layouts/master.blade.php
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>Admin Module - {{ config('app.name', 'Laravel') }}</title>
|
||||
|
||||
<meta name="description" content="{{ $description ?? '' }}">
|
||||
<meta name="keywords" content="{{ $keywords ?? '' }}">
|
||||
<meta name="author" content="{{ $author ?? '' }}">
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
||||
|
||||
{{-- Vite CSS --}}
|
||||
{{-- {{ module_vite('build-admin', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-admin', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
40
Modules/Admin/resources/views/nationalities/edit.blade.php
Normal file
40
Modules/Admin/resources/views/nationalities/edit.blade.php
Normal file
@ -0,0 +1,40 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Nationality'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
<div class='card-body'>
|
||||
<form
|
||||
action="{{ $editable ? route('nationalities.update', [$data->nationality_id]) : route('nationalities.store') }}"
|
||||
id="updateCustomForm" method="POST">
|
||||
|
||||
@csrf
|
||||
|
||||
<input type=hidden name='nationality_id' value='{{ $editable ? $data->nationality_id : '' }}' />
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-12">
|
||||
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mt-2">
|
||||
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('nationalities.index')); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -1,9 +1,20 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Nationality'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>{{ label('Nationalities List') }}</h2>
|
||||
<a href="{{ route('nationalities.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
|
||||
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">Nationality Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('nationalities.index') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i>Create Nationality</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="dataTable table" id="tbl_nationalities" data-url="{{ route('nationalities.sort') }}">
|
||||
@ -17,13 +28,10 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach ($data as $item)
|
||||
@foreach ($data as $index => $item)
|
||||
<tr data-id="{{ $item->nationality_id }}" data-display_order="{{ $item->display_order }}"
|
||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||
<td class="tb-col">{{ $i++ }}</td>
|
||||
<td class="tb-col">{{ $index + 1 }}</td>
|
||||
<td class="tb-col">{{ $item->title }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="alias-wrapper" data-id="{{ $item->nationality_id }}">
|
||||
@ -43,7 +51,8 @@
|
||||
<li><a href="{{ route('nationalities.show', [$item->nationality_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
|
||||
<li><a href="{{ route('nationalities.edit', [$item->nationality_id]) }}"
|
||||
class="dropdown-item edit-item-btn"><i class="ri-pencil-fill text-muted me-2 align-bottom"></i>
|
||||
class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i>
|
||||
{{ label('Edit') }}</a></li>
|
||||
<li>
|
||||
<a href="{{ route('nationalities.toggle', [$item->nationality_id]) }}"
|
||||
@ -65,38 +74,21 @@
|
||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
||||
@endpush
|
||||
@push('js')
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(e) {
|
||||
$('.change-alias-badge').on('click', function() {
|
42
Modules/Admin/resources/views/nationalities/show.blade.php
Normal file
42
Modules/Admin/resources/views/nationalities/show.blade.php
Normal file
@ -0,0 +1,42 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Nationality'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class='card'>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">View Detail</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('nationalities.index') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Back to List</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<p><b>Title : </b> <span>{{ $data->title }}</span></p>
|
||||
<p><b>Alias : </b> <span>{{ $data->alias }}</span></p>
|
||||
<p><b>Status : </b> <span
|
||||
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
|
||||
</p>
|
||||
<p><b>Remarks : </b> <span>{{ $data->remarks }}</span></p>
|
||||
<p><b>Display Order : </b> <span>{{ $data->display_order }}</span></p>
|
||||
<p><b>Createdby : </b> <span>{{ $data->createdby }}</span></p>
|
||||
<p><b>Updatedby : </b> <span>{{ $data->updatedby }}</span></p>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<p><b>Created On :</b> <span>{{ $data->created_at }}</span></p>
|
||||
<p><b>Created By :</b> <span>{{ $data->createdBy }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Updated On :</b> <span>{{ $data->updated_at }}</span></p>
|
||||
<p><b>Updated By :</b> <span>{{ $data->updatedBy }}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endSection
|
37
Modules/Admin/resources/views/provinces/edit.blade.php
Normal file
37
Modules/Admin/resources/views/provinces/edit.blade.php
Normal file
@ -0,0 +1,37 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Province'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
<div class='card-body'>
|
||||
<form action="{{ $editable ? route('provinces.update', [$data->province_id]) : route('provinces.store') }}"
|
||||
id="updateCustomForm" method="POST">
|
||||
@csrf <input type=hidden name='province_id' value='{{ $editable ? $data->province_id : '' }}' />
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{{ createCustomSelect('tbl_countries', 'title', 'country_id', $editable ? $data->countries_id : '', 'Countries Id', 'countries_id', 'form-control select2', 'status<>-1') }}
|
||||
</div>
|
||||
<div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
|
||||
</div>
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
|
||||
</div>
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
|
||||
</div>
|
||||
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('provinces.index')); ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -1,16 +1,29 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Province'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>{{ label('Cities List') }}</h2>
|
||||
<a href="{{ route('cities.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">Province Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('provinces.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create Province</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="dataTable table" id="tbl_cities" data-url="{{ route('cities.sort') }}">
|
||||
<table class="dataTable table" id="tbl_provinces" data-url="{{ route('provinces.sort') }}">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('districts') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('countries') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('title') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
|
||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
|
||||
@ -22,18 +35,18 @@
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach ($data as $item)
|
||||
<tr data-id="{{ $item->city_id }}" data-display_order="{{ $item->display_order }}"
|
||||
<tr data-id="{{ $item->province_id }}" data-display_order="{{ $item->display_order }}"
|
||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||
<td class="tb-col">{{ $i++ }}</td>
|
||||
<td class="tb-col">
|
||||
{!! getFieldData('tbl_districts', 'title', 'district_id', $item->districts_id) !!}
|
||||
{!! getFieldData('tbl_countries', 'title', 'country_id', $item->countries_id) !!}
|
||||
</td>
|
||||
<td class="tb-col">{{ $item->title }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="alias-wrapper" data-id="{{ $item->city_id }}">
|
||||
<div class="alias-wrapper" data-id="{{ $item->province_id }}">
|
||||
<span class="alias">{{ $item->alias }}</span>
|
||||
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
|
||||
id="alias_{{ $item->city_id }}" />
|
||||
id="alias_{{ $item->province_id }}" />
|
||||
</div>
|
||||
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
|
||||
</td>
|
||||
@ -44,28 +57,29 @@
|
||||
<i class="ri-more-fill align-middle"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a href="{{ route('cities.show', [$item->city_id]) }}" class="dropdown-item"><i
|
||||
<li><a href="{{ route('provinces.show', [$item->province_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
|
||||
<li><a href="{{ route('cities.edit', [$item->city_id]) }}" class="dropdown-item edit-item-btn"><i
|
||||
<li><a href="{{ route('provinces.edit', [$item->province_id]) }}"
|
||||
class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
|
||||
<li>
|
||||
<a href="{{ route('cities.toggle', [$item->city_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
onclick="confirmToggle(this.href)">
|
||||
<a href="{{ route('provinces.toggle', [$item->province_id]) }}"
|
||||
class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
|
||||
<i class="ri-article-fill text-muted me-2 align-bottom"></i>
|
||||
{{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('cities.clone', [$item->city_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
onclick="confirmClone(this.href)">
|
||||
<a href="{{ route('provinces.clone', [$item->province_id]) }}"
|
||||
class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
|
||||
<i class="ri-file-copy-line text-muted me-2 align-bottom"></i> {{ label('Clone') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('cities.destroy', [$item->city_id]) }}" class="dropdown-item remove-item-btn"
|
||||
onclick="confirmDelete(this.href)">
|
||||
<a href="{{ route('provinces.destroy', [$item->province_id]) }}"
|
||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
|
||||
</a>
|
||||
|
||||
@ -82,24 +96,15 @@
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
||||
@endpush
|
||||
@push('js')
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(e) {
|
||||
$('.change-alias-badge').on('click', function() {
|
||||
@ -116,7 +121,7 @@
|
||||
aliasInput.hide();
|
||||
$(this).removeClass('editing').text('Change Alias');
|
||||
var articleId = $(aliasWrapper).data('id');
|
||||
var ajaxUrl = "{{ route('cities.updatealias') }}";
|
||||
var ajaxUrl = "{{ route('provinces.updatealias') }}";
|
||||
var data = {
|
||||
articleId: articleId,
|
||||
newAlias: newAlias
|
||||
@ -199,7 +204,7 @@
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'DELETE',
|
||||
type: 'GET',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
45
Modules/Admin/resources/views/provinces/show.blade.php
Normal file
45
Modules/Admin/resources/views/provinces/show.blade.php
Normal file
@ -0,0 +1,45 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Province'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||
<h2><?php echo label('View Detail'); ?></h2>
|
||||
<?php createButton('btn-primary btn-cancel', '', 'Back to List', route('provinces.index')); ?>
|
||||
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<p><b>Countries Id : </b> <span>{{ $data->countries_id }}</span></p>
|
||||
<p><b>Title : </b> <span>{{ $data->title }}</span></p>
|
||||
<p><b>Alias : </b> <span>{{ $data->alias }}</span></p>
|
||||
<p><b>Description : </b> <span>{{ $data->description }}</span></p>
|
||||
<p><b>Display Order : </b> <span>{{ $data->display_order }}</span></p>
|
||||
<p><b>Status : </b> <span
|
||||
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
|
||||
</p>
|
||||
<p><b>Remarks : </b> <span>{{ $data->remarks }}</span></p>
|
||||
<p><b>Createdby : </b> <span>{{ $data->createdby }}</span></p>
|
||||
<p><b>Updatedby : </b> <span>{{ $data->updatedby }}</span></p>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<p><b>Created On :</b> <span>{{ $data->created_at }}</span></p>
|
||||
<p><b>Created By :</b> <span>{{ $data->createdBy }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Updated On :</b> <span>{{ $data->updated_at }}</span></p>
|
||||
<p><b>Updated By :</b> <span>{{ $data->updatedBy }}</span></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endSection
|
0
Modules/Admin/routes/.gitkeep
Normal file
0
Modules/Admin/routes/.gitkeep
Normal file
19
Modules/Admin/routes/api.php
Normal file
19
Modules/Admin/routes/api.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Admin\Http\Controllers\AdminController;
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------------------
|
||||
* API Routes
|
||||
*--------------------------------------------------------------------------
|
||||
*
|
||||
* Here is where you can register API routes for your application. These
|
||||
* routes are loaded by the RouteServiceProvider within a group which
|
||||
* is assigned the "api" middleware group. Enjoy building your API!
|
||||
*
|
||||
*/
|
||||
|
||||
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
|
||||
Route::apiResource('admin', AdminController::class)->names('admin');
|
||||
});
|
17
Modules/Admin/routes/route.castes.php
Normal file
17
Modules/Admin/routes/route.castes.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Admin\Http\Controllers\CastesController;
|
||||
|
||||
Route::prefix("caste")->as('castes.')->group(function () {
|
||||
Route::get('/', [CastesController::class, 'index'])->name('index');
|
||||
Route::get('/create', [CastesController::class, 'create'])->name('create');
|
||||
Route::post('/store', [CastesController::class, 'store'])->name('store');
|
||||
Route::post('/sort', [CastesController::class, 'sort'])->name('sort');
|
||||
Route::post('/updatealias', [CastesController::class, 'updatealias'])->name('updatealias');
|
||||
Route::get('/show/{id}', [CastesController::class, 'show'])->name('show');
|
||||
Route::get('/edit/{id}', [CastesController::class, 'edit'])->name('edit');
|
||||
Route::post('/update/{id}', [CastesController::class, 'update'])->name('update');
|
||||
Route::get('/destroy/{id}', [CastesController::class, 'destroy'])->name('destroy');
|
||||
Route::get('/toggle/{id}', [CastesController::class, 'toggle'])->name('toggle');
|
||||
Route::get('/clone/{id}', [CastesController::class, 'clone'])->name('clone');
|
||||
});
|
17
Modules/Admin/routes/route.cities.php
Normal file
17
Modules/Admin/routes/route.cities.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Admin\Http\Controllers\CitiesController;
|
||||
|
||||
Route::prefix("city")->as('cities.')->group(function () {
|
||||
Route::get('/', [CitiesController::class, 'index'])->name('index');
|
||||
Route::get('/create', [CitiesController::class, 'create'])->name('create');
|
||||
Route::post('/store', [CitiesController::class, 'store'])->name('store');
|
||||
Route::post('/sort', [CitiesController::class, 'sort'])->name('sort');
|
||||
Route::post('/updatealias', [CitiesController::class, 'updatealias'])->name('updatealias');
|
||||
Route::get('/show/{id}', [CitiesController::class, 'show'])->name('show');
|
||||
Route::get('/edit/{id}', [CitiesController::class, 'edit'])->name('edit');
|
||||
Route::post('/update/{id}', [CitiesController::class, 'update'])->name('update');
|
||||
Route::delete('/destroy/{id}', [CitiesController::class, 'destroy'])->name('destroy');
|
||||
Route::get('/clone/{id}', [CitiesController::class, 'clone'])->name('clone');
|
||||
Route::get('/toggle/{id}', [CitiesController::class, 'toggle'])->name('toggle');
|
||||
});
|
16
Modules/Admin/routes/route.countries.php
Normal file
16
Modules/Admin/routes/route.countries.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Admin\Http\Controllers\CountriesController;
|
||||
|
||||
Route::prefix("country")->as('countries.')->group(function () {
|
||||
Route::get('/', [CountriesController::class, 'index'])->name('index');
|
||||
Route::get('/create', [CountriesController::class, 'create'])->name('create');
|
||||
Route::post('/store', [CountriesController::class, 'store'])->name('store');
|
||||
Route::post('/sort', [CountriesController::class, 'sort'])->name('sort');
|
||||
Route::post('/updatealias', [CountriesController::class, 'updatealias'])->name('updatealias');
|
||||
Route::get('/show/{id}', [CountriesController::class, 'show'])->name('show');
|
||||
Route::get('/edit/{id}', [CountriesController::class, 'edit'])->name('edit');
|
||||
Route::post('/update/{id}', [CountriesController::class, 'update'])->name('update');
|
||||
Route::delete('/destroy/{id}', [CountriesController::class, 'destroy'])->name('destroy');
|
||||
Route::get('/toggle/{id}', [CountriesController::class, 'toggle'])->name('toggle');
|
||||
});
|
18
Modules/Admin/routes/route.districts.php
Normal file
18
Modules/Admin/routes/route.districts.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Admin\Http\Controllers\DistrictsController;
|
||||
|
||||
Route::prefix("district")->as('districts.')->group(function () {
|
||||
Route::get('/', [DistrictsController::class, 'index'])->name('index');
|
||||
Route::get('/create', [DistrictsController::class, 'create'])->name('create');
|
||||
Route::post('/store', [DistrictsController::class, 'store'])->name('store');
|
||||
Route::post('/sort', [DistrictsController::class, 'sort'])->name('sort');
|
||||
Route::post('/updatealias', [DistrictsController::class, 'updatealias'])->name('updatealias');
|
||||
Route::get('/show/{id}', [DistrictsController::class, 'show'])->name('show');
|
||||
Route::get('/edit/{id}', [DistrictsController::class, 'edit'])->name('edit');
|
||||
Route::post('/update/{id}', [DistrictsController::class, 'update'])->name('update');
|
||||
Route::delete('/destroy/{id}', [DistrictsController::class, 'destroy'])->name('destroy');
|
||||
Route::get('/toggle/{id}', [DistrictsController::class, 'toggle'])->name('toggle');
|
||||
Route::get('/clone/{id}', [DistrictsController::class, 'clone'])->name('clone');
|
||||
|
||||
});
|
17
Modules/Admin/routes/route.genders.php
Normal file
17
Modules/Admin/routes/route.genders.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Admin\Http\Controllers\GendersController;
|
||||
|
||||
Route::prefix("gender")->as('genders.')->group(function () {
|
||||
Route::get('/', [GendersController::class, 'index'])->name('index');
|
||||
Route::get('/create', [GendersController::class, 'create'])->name('create');
|
||||
Route::post('/store', [GendersController::class, 'store'])->name('store');
|
||||
Route::post('/sort', [GendersController::class, 'sort'])->name('sort');
|
||||
Route::post('/updatealias', [GendersController::class, 'updatealias'])->name('updatealias');
|
||||
Route::get('/show/{id}', [GendersController::class, 'show'])->name('show');
|
||||
Route::get('/edit/{id}', [GendersController::class, 'edit'])->name('edit');
|
||||
Route::post('/update/{id}', [GendersController::class, 'update'])->name('update');
|
||||
Route::get('/destroy/{id}', [GendersController::class, 'destroy'])->name('destroy');
|
||||
Route::get('/toggle/{id}', [GendersController::class, 'toggle'])->name('toggle');
|
||||
Route::get('/clone/{id}', [GendersController::class, 'clone'])->name('clone');
|
||||
});
|
17
Modules/Admin/routes/route.nationalities.php
Normal file
17
Modules/Admin/routes/route.nationalities.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Admin\Http\Controllers\NationalitiesController;
|
||||
|
||||
Route::prefix("nationality")->as('nationalities.')->group(function () {
|
||||
Route::get('/', [NationalitiesController::class, 'index'])->name('index');
|
||||
Route::get('/create', [NationalitiesController::class, 'create'])->name('create');
|
||||
Route::post('/store', [NationalitiesController::class, 'store'])->name('store');
|
||||
Route::post('/sort', [NationalitiesController::class, 'sort'])->name('sort');
|
||||
Route::post('/updatealias', [NationalitiesController::class, 'updatealias'])->name('updatealias');
|
||||
Route::get('/show/{id}', [NationalitiesController::class, 'show'])->name('show');
|
||||
Route::get('/edit/{id}', [NationalitiesController::class, 'edit'])->name('edit');
|
||||
Route::post('/update/{id}', [NationalitiesController::class, 'update'])->name('update');
|
||||
Route::get('/destroy/{id}', [NationalitiesController::class, 'destroy'])->name('destroy');
|
||||
Route::get('/toggle/{id}', [NationalitiesController::class, 'toggle'])->name('toggle');
|
||||
Route::get('/clone/{id}', [NationalitiesController::class, 'clone'])->name('clone');
|
||||
});
|
17
Modules/Admin/routes/route.provinces.php
Normal file
17
Modules/Admin/routes/route.provinces.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Admin\Http\Controllers\ProvinceController;
|
||||
|
||||
Route::prefix("province")->as('provinces.')->group(function () {
|
||||
Route::get('/', [ProvinceController::class, 'index'])->name('index');
|
||||
Route::get('/create', [ProvinceController::class, 'create'])->name('create');
|
||||
Route::post('/store', [ProvinceController::class, 'store'])->name('store');
|
||||
Route::post('/sort', [ProvinceController::class, 'sort'])->name('sort');
|
||||
Route::post('/updatealias', [ProvinceController::class, 'updatealias'])->name('updatealias');
|
||||
Route::get('/show/{id}', [ProvinceController::class, 'show'])->name('show');
|
||||
Route::get('/edit/{id}', [ProvinceController::class, 'edit'])->name('edit');
|
||||
Route::post('/update/{id}', [ProvinceController::class, 'update'])->name('update');
|
||||
Route::get('/destroy/{id}', [ProvinceController::class, 'destroy'])->name('destroy');
|
||||
Route::get('/toggle/{id}', [ProvinceController::class, 'toggle'])->name('toggle');
|
||||
Route::get('/clone/{id}', [ProvinceController::class, 'clone'])->name('clone');
|
||||
});
|
27
Modules/Admin/routes/web.php
Normal file
27
Modules/Admin/routes/web.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Admin\Http\Controllers\AdminController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group([], function () {
|
||||
Route::resource('admin', AdminController::class)->names('admin');
|
||||
});
|
||||
|
||||
require __DIR__ . '/route.countries.php';
|
||||
require __DIR__ . '/route.provinces.php';
|
||||
require __DIR__ . '/route.districts.php';
|
||||
require __DIR__ . '/route.cities.php';
|
||||
require __DIR__ . '/route.genders.php';
|
||||
require __DIR__ . '/route.castes.php';
|
||||
require __DIR__ . '/route.nationalities.php';
|
26
Modules/Admin/vite.config.js
Normal file
26
Modules/Admin/vite.config.js
Normal file
@ -0,0 +1,26 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: '../../public/build-admin',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-admin',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/Admin/resources/assets/sass/app.scss',
|
||||
// 'Modules/Admin/resources/assets/js/app.js',
|
||||
//];
|
@ -3,13 +3,15 @@
|
||||
namespace Modules\Employee\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Role;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Modules\Admin\Services\AdminService;
|
||||
use Modules\Employee\Repositories\EmployeeInterface;
|
||||
use Modules\User\Repositories\UserInterface;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class EmployeeController extends Controller
|
||||
{
|
||||
@ -17,10 +19,13 @@ class EmployeeController extends Controller
|
||||
private $employeeRepository;
|
||||
private $userRepository;
|
||||
|
||||
public function __construct(EmployeeInterface $employeeRepository, UserInterface $userRepository)
|
||||
private $adminService;
|
||||
|
||||
public function __construct(EmployeeInterface $employeeRepository, UserInterface $userRepository, AdminService $adminService)
|
||||
{
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->adminService = $adminService;
|
||||
|
||||
}
|
||||
/**
|
||||
@ -42,8 +47,10 @@ class EmployeeController extends Controller
|
||||
$data['title'] = 'Create Employee';
|
||||
$data['departmentList'] = [];
|
||||
$data['designationList'] = [];
|
||||
$data['genderList'] = [];
|
||||
$data['nationalityList'] = [];
|
||||
$data['nationalityList'] = $this->adminService->pluckNationalities();
|
||||
$data['genderList'] = $this->adminService->pluckGenders();
|
||||
$data['casteList'] = $this->adminService->pluckCastes();
|
||||
$data['cityList'] = $this->adminService->pluckCities();
|
||||
|
||||
return view('employee::create', $data);
|
||||
}
|
||||
@ -56,15 +63,19 @@ class EmployeeController extends Controller
|
||||
$inputData = $request->all();
|
||||
try {
|
||||
|
||||
if ($request->hasFile('profile_pic')) {
|
||||
$fileName = time() . '_' . $request->profile_pic->getClientOriginalName();
|
||||
$filePath = $request->file('profile_pic')->storeAs('uploads', $fileName, 'public');
|
||||
$inputData['profile_picture'] = time() . '_' . $request->profile_pic->getClientOriginalName();
|
||||
if ($request->hasFile('profile_picture')) {
|
||||
$image = $request->profile_picture;
|
||||
$fileName = time() . '_' . $image->getClientOriginalName();
|
||||
$filePath = Storage::disk('public')->putFileAs('uploads', $image, $fileName);
|
||||
$inputData['profile_picture'] = 'storage/' . $filePath;
|
||||
}
|
||||
|
||||
$this->employeeRepository->create($inputData);
|
||||
|
||||
toastr()->success('Employee Created Succesfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
echo $th->getMessage();
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('employee.index');
|
||||
@ -95,17 +106,22 @@ class EmployeeController extends Controller
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
|
||||
try {
|
||||
|
||||
if ($request->hasFile('profile_pic')) {
|
||||
$fileName = time() . '_' . $request->profile_pic->getClientOriginalName();
|
||||
$filePath = $request->file('profile_pic')->storeAs('uploads', $fileName, 'public');
|
||||
$inputData['profile_picture'] = time() . '_' . $request->profile_pic->getClientOriginalName();
|
||||
if ($request->hasFile('profile_picture')) {
|
||||
$image = $request->profile_picture;
|
||||
$fileName = time() . '_' . $image->getClientOriginalName();
|
||||
$filePath = Storage::disk('public')->putFileAs('uploads', $image, $fileName);
|
||||
$inputData['profile_picture'] = 'storage/' . $filePath;
|
||||
}
|
||||
|
||||
$this->employeeRepository->update($id, $inputData);
|
||||
|
||||
toastr()->success('Employee Created Succesfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('employee.index');
|
||||
@ -114,19 +130,25 @@ class EmployeeController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
try {
|
||||
$employeeModel = $this->employeeRepository->getEmployeeById($id);
|
||||
$employeeModel->user->roles()->detach();
|
||||
$employeeModel->user->delete();
|
||||
$employeeModel->delete();
|
||||
|
||||
$employeeModel = $this->employeeRepository->getEmployeeById($request->id);
|
||||
|
||||
optional($employeeModel)->user?->roles()?->detach();
|
||||
|
||||
optional($employeeModel)->user?->delete();
|
||||
|
||||
optional($employeeModel)->delete();
|
||||
|
||||
toastr()->success('Employee Delete Succesfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('employee.index');
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Employee Delete Succesfully']);
|
||||
|
||||
}
|
||||
|
||||
@ -153,4 +175,14 @@ class EmployeeController extends Controller
|
||||
return redirect()->route('employee.index');
|
||||
}
|
||||
|
||||
public function changePassword(Request $request)
|
||||
{
|
||||
dd($request->all());
|
||||
try {
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,8 @@
|
||||
@forelse ($employees as $employee)
|
||||
<div class="col">
|
||||
<div class="card team-box ribbon-box mb-lg-0 material-shadow border shadow-none">
|
||||
<div class="team-cover"> <img src="assets/images/small/img-9.jpg" alt="" class="img-fluid">
|
||||
<div class="team-cover">
|
||||
<img src="{{ asset('assets/images/small/img-9.jpg') }}" alt="" class="img-fluid">
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
@if ($employee->user)
|
||||
@ -69,9 +70,11 @@
|
||||
|
||||
<div class="col-lg-4 col">
|
||||
<div class="team-profile-img">
|
||||
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0"><img
|
||||
src="{{ asset('app/public/uploads/' . $employee->profile_picture) }}" alt=""
|
||||
class="member-img img-fluid d-block rounded-circle"></div>
|
||||
<div class="img-thumbnail rounded-circle flex-shrink-0">
|
||||
<img style="height: 90px; width:90px; object-fit:cover"
|
||||
src="{{ asset($employee->profile_picture) }}" alt=""
|
||||
class="img-fluid rounded-circle">
|
||||
</div>
|
||||
<div class="team-content"> <a class="member-name"
|
||||
href="{{ route('employee.show', $employee->id) }}">
|
||||
<h5 class="fs-16 mb-1">{{ $employee->first_name }}</h5>
|
||||
|
@ -54,8 +54,8 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Upload Profile Pic')->class('form-label') }}
|
||||
{{ html()->file('profile_pic')->class('form-control') }}
|
||||
{{ html()->label('Upload Profile Picture')->class('form-label') }}
|
||||
{{ html()->file('profile_picture')->class('form-control') }}
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -14,12 +14,16 @@ use Modules\Employee\Http\Controllers\EmployeeController;
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group(['middleware' => 'auth'], function () {
|
||||
Route::post('assignRole', [EmployeeController::class, 'assignRole'])->name('employee.assignRole');
|
||||
Route::resource('employee', EmployeeController::class)->names('employee');
|
||||
Route::group(['prefix' => 'employee'], function () {
|
||||
Route::middleware('auth')->group(
|
||||
function () {
|
||||
|
||||
Route::prefix('employee')->as('employee.')->group(function () {
|
||||
|
||||
Route::post('assignRole', [EmployeeController::class, 'assignRole'])->name('assignRole');
|
||||
Route::post('changePassword', [EmployeeController::class, 'changePassword'])->name('assignRole');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Route::resource('employee', EmployeeController::class)->names('employee');
|
||||
|
||||
}
|
||||
);
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Repositories;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
use App\Models\Role;
|
||||
|
||||
class RoleRepository implements RoleInterface
|
||||
{
|
||||
|
@ -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())) {
|
||||
|
@ -1,218 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Castes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class CastesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Castes $model)
|
||||
{
|
||||
$this->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("crud.generated.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("crud.generated.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("crud.generated.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("crud.generated.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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,218 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Cities;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class CitiesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Cities $model)
|
||||
{
|
||||
$this->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("crud.generated.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("crud.generated.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("crud.generated.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("crud.generated.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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
createActivityLog(CompaniesController::class, 'index', ' Companies index');
|
||||
$data = Companies::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
|
||||
return view("crud.generated.companies.index", compact('data'));
|
||||
@ -26,7 +25,6 @@
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
createActivityLog(CompaniesController::class, 'create', ' Companies create');
|
||||
$TableData = Companies::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$editable=false;
|
||||
return view("crud.generated.companies.edit",compact('TableData','editable'));
|
||||
@ -34,7 +32,6 @@
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
createActivityLog(CompaniesController::class, 'store', ' Companies store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
@ -103,7 +100,6 @@
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(CompaniesController::class, 'show', ' Companies show');
|
||||
$data = Companies::findOrFail($id);
|
||||
|
||||
return view("crud.generated.companies.show", compact('data'));
|
||||
@ -112,7 +108,6 @@
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
createActivityLog(CompaniesController::class, 'edit', ' Companies edit');
|
||||
$TableData = Companies::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$data = Companies::findOrFail($id);
|
||||
$editable=true;
|
||||
@ -122,7 +117,6 @@
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
createActivityLog(CompaniesController::class, 'update', ' Companies update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
@ -159,7 +153,6 @@
|
||||
|
||||
public function destroy(Request $request,$id)
|
||||
{
|
||||
createActivityLog(CompaniesController::class, 'destroy', ' Companies destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -175,7 +168,6 @@
|
||||
}
|
||||
public function toggle(Request $request,$id)
|
||||
{
|
||||
createActivityLog(CompaniesController::class, 'destroy', ' Companies destroy');
|
||||
$data = Companies::findOrFail($id);
|
||||
$requestData=['status'=>($data->status==1)?0:1];
|
||||
DB::beginTransaction();
|
||||
@ -193,7 +185,6 @@
|
||||
}
|
||||
public function clone(Request $request,$id)
|
||||
{
|
||||
createActivityLog(CompaniesController::class, 'clone', ' Companies clone');
|
||||
$data = Companies::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
@ -215,4 +206,3 @@
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,17 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Companytypes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class CompanytypesController extends Controller
|
||||
{
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Companytypes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class CompanytypesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Companytypes $model)
|
||||
{
|
||||
@ -18,23 +19,23 @@
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
createActivityLog(CompanytypesController::class, 'index', ' Companytypes index');
|
||||
$data = Companytypes::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
// createActivityLog(CompanytypesController::class, 'index', ' Companytypes index');
|
||||
$data = Companytypes::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("crud.generated.companytypes.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
createActivityLog(CompanytypesController::class, 'create', ' Companytypes create');
|
||||
$TableData = Companytypes::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$editable=false;
|
||||
return view("crud.generated.companytypes.edit",compact('TableData','editable'));
|
||||
// createActivityLog(CompanytypesController::class, 'create', ' Companytypes create');
|
||||
$TableData = Companytypes::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("crud.generated.companytypes.edit", compact('TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
createActivityLog(CompanytypesController::class, 'store', ' Companytypes store');
|
||||
// createActivityLog(CompanytypesController::class, 'store', ' Companytypes store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
@ -42,15 +43,15 @@
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
],500);
|
||||
], 500);
|
||||
}
|
||||
$request->request->add(['alias' => slugify($request->title)]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_companytypes')]);
|
||||
$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();
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
@ -69,7 +70,7 @@
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Companytypes Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('companytypes.index')->with('success','The Companytypes created Successfully.');
|
||||
return redirect()->route('companytypes.index')->with('success', 'The Companytypes created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
@ -103,7 +104,7 @@
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(CompanytypesController::class, 'show', ' Companytypes show');
|
||||
// createActivityLog(CompanytypesController::class, 'show', ' Companytypes show');
|
||||
$data = Companytypes::findOrFail($id);
|
||||
|
||||
return view("crud.generated.companytypes.show", compact('data'));
|
||||
@ -112,17 +113,17 @@
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
createActivityLog(CompanytypesController::class, 'edit', ' Companytypes edit');
|
||||
$TableData = Companytypes::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
// createActivityLog(CompanytypesController::class, 'edit', ' Companytypes edit');
|
||||
$TableData = Companytypes::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Companytypes::findOrFail($id);
|
||||
$editable=true;
|
||||
return view("crud.generated.companytypes.edit", compact('data','TableData','editable'));
|
||||
$editable = true;
|
||||
return view("crud.generated.companytypes.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
createActivityLog(CompanytypesController::class, 'update', ' Companytypes update');
|
||||
// createActivityLog(CompanytypesController::class, 'update', ' Companytypes update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
@ -130,11 +131,11 @@
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
],500);
|
||||
], 500);
|
||||
}
|
||||
$requestData=$request->all();
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
@ -157,9 +158,9 @@
|
||||
return redirect()->back()->with('success', 'The Companytypes updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request,$id)
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
createActivityLog(CompanytypesController::class, 'destroy', ' Companytypes destroy');
|
||||
// createActivityLog(CompanytypesController::class, 'destroy', ' Companytypes destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -171,13 +172,13 @@
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Companytypes Deleted Successfully.'],200);
|
||||
return response()->json(['status' => true, 'message' => 'The Companytypes Deleted Successfully.'], 200);
|
||||
}
|
||||
public function toggle(Request $request,$id)
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
createActivityLog(CompanytypesController::class, 'destroy', ' Companytypes destroy');
|
||||
// createActivityLog(CompanytypesController::class, 'destroy', ' Companytypes destroy');
|
||||
$data = Companytypes::findOrFail($id);
|
||||
$requestData=['status'=>($data->status==1)?0:1];
|
||||
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -189,15 +190,15 @@
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Companytypes Deleted Successfully.'],200);
|
||||
return response()->json(['status' => true, 'message' => 'The Companytypes Deleted Successfully.'], 200);
|
||||
}
|
||||
public function clone(Request $request,$id)
|
||||
public function clone(Request $request, $id)
|
||||
{
|
||||
createActivityLog(CompanytypesController::class, 'clone', ' Companytypes clone');
|
||||
// createActivityLog(CompanytypesController::class, 'clone', ' Companytypes clone');
|
||||
$data = Companytypes::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
$requestData=$data->toArray();
|
||||
$requestData = $data->toArray();
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -209,10 +210,9 @@
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Companytypes Clonned Successfully.'],200);
|
||||
return response()->json(['status' => true, 'message' => 'The Companytypes Clonned Successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
}
|
||||
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'));
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
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
|
||||
]);
|
||||
@ -69,7 +69,7 @@
|
||||
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)
|
||||
@ -103,7 +103,7 @@
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(DepartmentsController::class, 'show', ' Departments show');
|
||||
|
||||
$data = Departments::findOrFail($id);
|
||||
|
||||
return view("crud.generated.departments.show", compact('data'));
|
||||
@ -112,7 +112,7 @@
|
||||
|
||||
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']);
|
||||
@ -215,4 +215,3 @@
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
}
|
||||
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'));
|
||||
@ -26,7 +25,6 @@
|
||||
|
||||
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
|
||||
]);
|
||||
@ -69,7 +66,7 @@
|
||||
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)
|
||||
@ -103,7 +100,6 @@
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(DesignationsController::class, 'show', ' Designations show');
|
||||
$data = Designations::findOrFail($id);
|
||||
|
||||
return view("crud.generated.designations.show", compact('data'));
|
||||
@ -112,7 +108,6 @@
|
||||
|
||||
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']);
|
||||
@ -215,4 +206,3 @@
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,218 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Districts;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class DistrictsController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Districts $model)
|
||||
{
|
||||
$this->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("crud.generated.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("crud.generated.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("crud.generated.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("crud.generated.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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,218 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Genders;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class GendersController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Genders $model)
|
||||
{
|
||||
$this->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("crud.generated.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("crud.generated.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("crud.generated.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("crud.generated.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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,218 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Nationalities;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class NationalitiesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Nationalities $model)
|
||||
{
|
||||
$this->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("crud.generated.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("crud.generated.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("crud.generated.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("crud.generated.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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,217 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Province;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class ProvinceController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Province $model)
|
||||
{
|
||||
$this->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("crud.generated.province.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
createActivityLog(ProvinceController::class, 'create', ' Province create');
|
||||
$TableData = Province::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$editable=false;
|
||||
return view("crud.generated.province.edit",compact('TableData','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('province.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("crud.generated.province.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("crud.generated.province.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()->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');
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -18,15 +18,14 @@
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
createActivityLog(VendorsController::class, 'index', ' Vendors index');
|
||||
// createActivityLog(VendorsController::class, 'index', ' Vendors index');
|
||||
$data = Vendors::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
|
||||
return view("crud.generated.vendors.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
createActivityLog(VendorsController::class, 'create', ' Vendors create');
|
||||
// createActivityLog(VendorsController::class, 'create', ' Vendors create');
|
||||
$TableData = Vendors::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$editable=false;
|
||||
return view("crud.generated.vendors.edit",compact('TableData','editable'));
|
||||
@ -34,7 +33,7 @@
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
createActivityLog(VendorsController::class, 'store', ' Vendors store');
|
||||
// createActivityLog(VendorsController::class, 'store', ' Vendors store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
@ -103,7 +102,7 @@
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(VendorsController::class, 'show', ' Vendors show');
|
||||
// createActivityLog(VendorsController::class, 'show', ' Vendors show');
|
||||
$data = Vendors::findOrFail($id);
|
||||
|
||||
return view("crud.generated.vendors.show", compact('data'));
|
||||
@ -112,7 +111,7 @@
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
createActivityLog(VendorsController::class, 'edit', ' Vendors edit');
|
||||
// createActivityLog(VendorsController::class, 'edit', ' Vendors edit');
|
||||
$TableData = Vendors::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$data = Vendors::findOrFail($id);
|
||||
$editable=true;
|
||||
@ -122,7 +121,7 @@
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
createActivityLog(VendorsController::class, 'update', ' Vendors update');
|
||||
// createActivityLog(VendorsController::class, 'update', ' Vendors update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
@ -159,7 +158,7 @@
|
||||
|
||||
public function destroy(Request $request,$id)
|
||||
{
|
||||
createActivityLog(VendorsController::class, 'destroy', ' Vendors destroy');
|
||||
// createActivityLog(VendorsController::class, 'destroy', ' Vendors destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -175,7 +174,7 @@
|
||||
}
|
||||
public function toggle(Request $request,$id)
|
||||
{
|
||||
createActivityLog(VendorsController::class, 'destroy', ' Vendors destroy');
|
||||
// createActivityLog(VendorsController::class, 'destroy', ' Vendors destroy');
|
||||
$data = Vendors::findOrFail($id);
|
||||
$requestData=['status'=>($data->status==1)?0:1];
|
||||
DB::beginTransaction();
|
||||
@ -193,7 +192,7 @@
|
||||
}
|
||||
public function clone(Request $request,$id)
|
||||
{
|
||||
createActivityLog(VendorsController::class, 'clone', ' Vendors clone');
|
||||
// createActivityLog(VendorsController::class, 'clone', ' Vendors clone');
|
||||
$data = Vendors::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
@ -215,4 +214,3 @@
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,17 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Vendortypes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class VendortypesController extends Controller
|
||||
{
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Vendortypes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
class VendortypesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Vendortypes $model)
|
||||
{
|
||||
@ -18,23 +19,23 @@
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
createActivityLog(VendortypesController::class, 'index', ' Vendortypes index');
|
||||
$data = Vendortypes::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
// createActivityLog(VendortypesController::class, 'index', ' Vendortypes index');
|
||||
$data = Vendortypes::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("crud.generated.vendortypes.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
createActivityLog(VendortypesController::class, 'create', ' Vendortypes create');
|
||||
$TableData = Vendortypes::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
$editable=false;
|
||||
return view("crud.generated.vendortypes.edit",compact('TableData','editable'));
|
||||
// createActivityLog(VendortypesController::class, 'create', ' Vendortypes create');
|
||||
$TableData = Vendortypes::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("crud.generated.vendortypes.edit", compact('TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
createActivityLog(VendortypesController::class, 'store', ' Vendortypes store');
|
||||
// createActivityLog(VendortypesController::class, 'store', ' Vendortypes store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
@ -42,15 +43,15 @@
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
],500);
|
||||
], 500);
|
||||
}
|
||||
$request->request->add(['alias' => slugify($request->title)]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_vendortypes')]);
|
||||
$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();
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
@ -69,7 +70,7 @@
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Vendortypes Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('vendortypes.index')->with('success','The Vendortypes created Successfully.');
|
||||
return redirect()->route('vendortypes.index')->with('success', 'The Vendortypes created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
@ -103,7 +104,7 @@
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
createActivityLog(VendortypesController::class, 'show', ' Vendortypes show');
|
||||
// createActivityLog(VendortypesController::class, 'show', ' Vendortypes show');
|
||||
$data = Vendortypes::findOrFail($id);
|
||||
|
||||
return view("crud.generated.vendortypes.show", compact('data'));
|
||||
@ -112,17 +113,17 @@
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
createActivityLog(VendortypesController::class, 'edit', ' Vendortypes edit');
|
||||
$TableData = Vendortypes::where('status','<>',-1)->orderBy('display_order')->get();
|
||||
// createActivityLog(VendortypesController::class, 'edit', ' Vendortypes edit');
|
||||
$TableData = Vendortypes::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Vendortypes::findOrFail($id);
|
||||
$editable=true;
|
||||
return view("crud.generated.vendortypes.edit", compact('data','TableData','editable'));
|
||||
$editable = true;
|
||||
return view("crud.generated.vendortypes.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
createActivityLog(VendortypesController::class, 'update', ' Vendortypes update');
|
||||
// createActivityLog(VendortypesController::class, 'update', ' Vendortypes update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
@ -130,11 +131,11 @@
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
],500);
|
||||
], 500);
|
||||
}
|
||||
$requestData=$request->all();
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
@ -157,9 +158,9 @@
|
||||
return redirect()->back()->with('success', 'The Vendortypes updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request,$id)
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
createActivityLog(VendortypesController::class, 'destroy', ' Vendortypes destroy');
|
||||
// createActivityLog(VendortypesController::class, 'destroy', ' Vendortypes destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -171,13 +172,13 @@
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Vendortypes Deleted Successfully.'],200);
|
||||
return response()->json(['status' => true, 'message' => 'The Vendortypes Deleted Successfully.'], 200);
|
||||
}
|
||||
public function toggle(Request $request,$id)
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
createActivityLog(VendortypesController::class, 'destroy', ' Vendortypes destroy');
|
||||
// createActivityLog(VendortypesController::class, 'destroy', ' Vendortypes destroy');
|
||||
$data = Vendortypes::findOrFail($id);
|
||||
$requestData=['status'=>($data->status==1)?0:1];
|
||||
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -189,15 +190,15 @@
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Vendortypes Deleted Successfully.'],200);
|
||||
return response()->json(['status' => true, 'message' => 'The Vendortypes Deleted Successfully.'], 200);
|
||||
}
|
||||
public function clone(Request $request,$id)
|
||||
public function clone(Request $request, $id)
|
||||
{
|
||||
createActivityLog(VendortypesController::class, 'clone', ' Vendortypes clone');
|
||||
// createActivityLog(VendortypesController::class, 'clone', ' Vendortypes clone');
|
||||
$data = Vendortypes::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
$requestData=$data->toArray();
|
||||
$requestData = $data->toArray();
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
@ -209,10 +210,9 @@
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status'=>true,'message'=>'The Vendortypes Clonned Successfully.'],200);
|
||||
return response()->json(['status' => true, 'message' => 'The Vendortypes Clonned Successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
16
app/Models/Branches.php
Normal file
16
app/Models/Branches.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Branches extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "tbl_branches";
|
||||
protected $primaryKey = "branch_id";
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
16
app/Models/Castes.php
Normal file
16
app/Models/Castes.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Castes extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_castes';
|
||||
protected $primaryKey = 'caste_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
17
app/Models/Companies.php
Normal file
17
app/Models/Companies.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Companies extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_companies';
|
||||
|
||||
protected $primaryKey = 'company_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
16
app/Models/Departments.php
Normal file
16
app/Models/Departments.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Departments extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_departments';
|
||||
protected $primaryKey = 'department_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
16
app/Models/Designations.php
Normal file
16
app/Models/Designations.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Designations extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_designations';
|
||||
protected $primaryKey = 'designation_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class District extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'district_name',
|
||||
'country_id',
|
||||
'province_id',
|
||||
'status',
|
||||
];
|
||||
|
||||
public static function getDistricts()
|
||||
{
|
||||
return self::select('id', 'district_name')->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();
|
||||
}
|
||||
}
|
16
app/Models/Genders.php
Normal file
16
app/Models/Genders.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Genders extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_genders';
|
||||
protected $primaryKey = 'gender_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
16
app/Models/Nationalities.php
Normal file
16
app/Models/Nationalities.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Nationalities extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_nationalities';
|
||||
protected $primaryKey = 'nationality_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Province extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'province_name',
|
||||
'country_id',
|
||||
'status',
|
||||
];
|
||||
public function country()
|
||||
{
|
||||
return $this->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();
|
||||
}
|
||||
}
|
16
app/Models/Vendors.php
Normal file
16
app/Models/Vendors.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Vendors extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_vendors';
|
||||
protected $primaryKey = 'vendor_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user