admin module

This commit is contained in:
Dharmaraj Shrestha 2024-04-11 16:44:09 +05:45
parent 1dbc6cabf8
commit 8d4ae8c598
122 changed files with 3728 additions and 3694 deletions

View 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)
{
//
}
}

View 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);
}
}

View 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);
}
}

View File

@ -1,14 +1,15 @@
<?php <?php
namespace App\Http\Controllers;
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Country;
use App\Service\CommonModelService; use App\Service\CommonModelService;
use Exception; use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Log; use Log;
use Modules\Admin\Models\Country;
class CountriesController extends Controller class CountriesController extends Controller
{ {
@ -22,14 +23,14 @@ class CountriesController extends Controller
// createActivityLog(CountriesController::class, 'index', ' Country index'); // createActivityLog(CountriesController::class, 'index', ' Country index');
$data = Country::where('status', '<>', -1)->orderBy('display_order')->get(); $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) public function create(Request $request)
{ {
// createActivityLog(CountriesController::class, 'create', ' Country create'); // createActivityLog(CountriesController::class, 'create', ' Country create');
$editable = false; $editable = false;
return view("crud.generated.countries.edit", compact('editable')); return view("admin::countries.edit", compact('editable'));
} }
public function store(Request $request) public function store(Request $request)
@ -103,7 +104,7 @@ class CountriesController extends Controller
// createActivityLog(CountriesController::class, 'show', ' Country show'); // createActivityLog(CountriesController::class, 'show', ' Country show');
$data = Country::findOrFail($id); $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) public function edit(Request $request, $id)
@ -112,7 +113,7 @@ class CountriesController extends Controller
$TableData = Country::where('status', '<>', -1)->orderBy('display_order')->get(); $TableData = Country::where('status', '<>', -1)->orderBy('display_order')->get();
$data = Country::findOrFail($id); $data = Country::findOrFail($id);
$editable = true; $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) public function update(Request $request, $id)
@ -186,7 +187,7 @@ class CountriesController extends Controller
DB::commit(); DB::commit();
return response()->json(['status' => true, 'message' => 'The Country Deleted Successfully.'], 200); 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'); // createActivityLog(CountriesController::class, 'clone', ' Country clone');
$data = Country::findOrFail($id); $data = Country::findOrFail($id);

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View File

View File

View 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 = [];
}

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Models; namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Models; namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -15,14 +15,4 @@ class Country extends Model
'country_code', 'country_code',
'status', 'status',
]; ];
public function provinces()
{
return $this->hasMany(Province::class);
}
public static function getCountries()
{
return self::select('id', 'country_name')->where('status', 'Active')->get();
}
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Models; namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;

View 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 = [];
}

View 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 = [];
}

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Models; namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;

View File

View 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;
}
}

View 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'));
}
}

View File

View 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');
}
}

View 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/"
}
}
}

View File

View File

@ -0,0 +1,5 @@
<?php
return [
'name' => 'Admin',
];

View File

View 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
View File

@ -0,0 +1,11 @@
{
"name": "Admin",
"alias": "admin",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Admin\\Providers\\AdminServiceProvider"
],
"files": []
}

View 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"
}
}

View File

View File

View File

View 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

View File

@ -1,101 +1,92 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="page-content">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="container-fluid">
<h2>{{ label('Caste List') }}</h2>
<a href="{{ route('castes.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div>
<div class="card-body">
<table class="dataTable table" id="tbl_castes" data-url="{{ route('castes.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('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->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">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->caste_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->caste_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('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
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"
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> <!-- start page title -->
<li> @include('layouts.partials.breadcrumb', ['title' => 'Caste'])
<a href="{{ route('castes.clone', [$item->caste_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> <!-- end page title -->
<li>
<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> <div class="card">
</ul> <div class="card-header align-items-center d-flex">
</div> <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
</td> class="ri-add-fill me-1 align-bottom"></i> Create Caste</a>
</tr> </div>
@endforeach </div>
<div class="card-body">
</tbody> <table class="dataTable table" id="tbl_castes" data-url="{{ route('castes.sort') }}">
</table> <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('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>
@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">{{ $index + 1 }}</td>
<td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->caste_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->caste_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('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
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"
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('castes.clone', [$item->caste_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('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>
</div> </div>
@endsection @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') @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> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {

View 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 :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p>
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p>
<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
</p>
<p><b>Remarks :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->remarks }}</span></p>
<p><b>Display Order :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->display_order }}</span></p>
<p><b>Createdby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->createdby }}</span></p>
<p><b>Updatedby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->updatedby }}</span></p>
<div class="d-flex justify-content-between">
<div>
<p><b>Created On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->created_at }}</span></p>
<p><b>Created By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->createdBy }}</span></p>
</div>
<div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
</div>
</div>
</div>
</div>
</div>
@endsection

View 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

View File

@ -1,101 +1,92 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="page-content">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="container-fluid">
<h2>{{ label('Genders List') }}</h2>
<a href="{{ route('genders.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div>
<div class="card-body">
<table class="dataTable table" id="tbl_genders" data-url="{{ route('genders.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('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 }}"
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
<td class="tb-col">{{ $i++ }}</td>
<td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<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->gender_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('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('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('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> <!-- start page title -->
<li> @include('layouts.partials.breadcrumb', ['title' => 'Gender'])
<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> <!-- end page title -->
<li> <div class="card">
<a href="{{ route('genders.destroy', [$item->gender_id]) }}" class="dropdown-item remove-item-btn" <div class="card-header align-items-center d-flex">
onclick="confirmDelete(this.href)"> <h5 class="card-title flex-grow-1 mb-0">Gender Lists</h5>
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }} <div class="flex-shrink-0">
</a> <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>
</li> </div>
</ul> </div>
</div> <div class="card-body">
<table class="dataTable table" id="tbl_genders" data-url="{{ route('genders.sort') }}">
<thead class="table-light">
</td> <tr>
</tr> <th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
@endforeach <th class="tb-col"><span class="overline-title">{{ label('title') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
</tbody> <th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
</table> </th>
</tr>
</thead>
<tbody>
@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">{{ $index + 1 }}</td>
<td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<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->gender_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('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('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('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('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>
</li>
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div> </div>
</div> </div>
@endsection @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') @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> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {

View 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 :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p>
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p>
<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
</p>
<p><b>Remarks :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->remarks }}</span></p>
<p><b>Display Order :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->display_order }}</span></p>
<p><b>Createdby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->createdby }}</span></p>
<p><b>Updatedby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->updatedby }}</span></p>
<div class="d-flex justify-content-between">
<div>
<p><b>Created On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->created_at }}</span></p>
<p><b>Created By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->createdBy }}</span></p>
</div>
<div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
@endSection

View File

@ -0,0 +1,7 @@
@extends('admin::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>Module: {!! config('admin.name') !!}</p>
@endsection

View 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>

View 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

View File

@ -1,102 +1,94 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="page-content">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="container-fluid">
<h2>{{ label('Nationalities List') }}</h2>
<a href="{{ route('nationalities.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div>
<div class="card-body">
<table class="dataTable table" id="tbl_nationalities" data-url="{{ route('nationalities.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('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->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">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->nationality_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->nationality_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('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>
{{ label('Edit') }}</a></li>
<li>
<a href="{{ route('nationalities.toggle', [$item->nationality_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> <!-- start page title -->
<li> @include('layouts.partials.breadcrumb', ['title' => 'Nationality'])
<a href="{{ route('nationalities.clone', [$item->nationality_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> <!-- end page title -->
<li> <div class="card">
<a href="{{ route('nationalities.destroy', [$item->nationality_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> <div class="card-header align-items-center d-flex">
</ul> <h5 class="card-title flex-grow-1 mb-0">Nationality Lists</h5>
</div> <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>
</td> </div>
</tr> </div>
@endforeach <div class="card-body">
<table class="dataTable table" id="tbl_nationalities" data-url="{{ route('nationalities.sort') }}">
</tbody> <thead class="table-light">
</table> <tr>
<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>
@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">{{ $index + 1 }}</td>
<td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->nationality_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->nationality_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('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>
{{ label('Edit') }}</a></li>
<li>
<a href="{{ route('nationalities.toggle', [$item->nationality_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('nationalities.clone', [$item->nationality_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('nationalities.destroy', [$item->nationality_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 @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') @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> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {

View 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 :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p>
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p>
<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
</p>
<p><b>Remarks :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->remarks }}</span></p>
<p><b>Display Order :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->display_order }}</span></p>
<p><b>Createdby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->createdby }}</span></p>
<p><b>Updatedby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->updatedby }}</span></p>
<div class="d-flex justify-content-between">
<div>
<p><b>Created On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->created_at }}</span></p>
<p><b>Created By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->createdBy }}</span></p>
</div>
<div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
@endSection

View File

View 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');
});

View 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');
});

View 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');
});

View 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');
});

View 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');
});

View 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');
});

View 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');
});

View 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');
});

View 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';

View 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',
//];

View File

@ -7,6 +7,8 @@ use Carbon\Carbon;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
use Modules\Admin\Services\AdminService;
use Modules\Employee\Repositories\EmployeeInterface; use Modules\Employee\Repositories\EmployeeInterface;
use Modules\User\Repositories\UserInterface; use Modules\User\Repositories\UserInterface;
use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Role;
@ -17,10 +19,13 @@ class EmployeeController extends Controller
private $employeeRepository; private $employeeRepository;
private $userRepository; private $userRepository;
public function __construct(EmployeeInterface $employeeRepository, UserInterface $userRepository) private $adminService;
public function __construct(EmployeeInterface $employeeRepository, UserInterface $userRepository, AdminService $adminService)
{ {
$this->employeeRepository = $employeeRepository; $this->employeeRepository = $employeeRepository;
$this->userRepository = $userRepository; $this->userRepository = $userRepository;
$this->adminService = $adminService;
} }
/** /**
@ -42,8 +47,10 @@ class EmployeeController extends Controller
$data['title'] = 'Create Employee'; $data['title'] = 'Create Employee';
$data['departmentList'] = []; $data['departmentList'] = [];
$data['designationList'] = []; $data['designationList'] = [];
$data['genderList'] = []; $data['nationalityList'] = $this->adminService->pluckNationalities();
$data['nationalityList'] = []; $data['genderList'] = $this->adminService->pluckGenders();
$data['casteList'] = $this->adminService->pluckCastes();
$data['cityList'] = $this->adminService->pluckCities();
return view('employee::create', $data); return view('employee::create', $data);
} }
@ -53,14 +60,14 @@ class EmployeeController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
dd($request->all());
$inputData = $request->all(); $inputData = $request->all();
try { try {
if ($request->hasFile('profile_pic')) { if ($request->hasFile('profile_picture')) {
$fileName = time() . '_' . $request->profile_pic->getClientOriginalName(); $image = $request->profile_picture;
$filePath = $request->file('profile_pic')->storeAs('uploads', $fileName, 'public'); $fileName = time() . '_' . $image->getClientOriginalName();
$inputData['profile_picture'] = time() . '_' . $request->profile_pic->getClientOriginalName(); $filePath = Storage::disk('public')->putFileAs('uploads', $image, $fileName);
$inputData['profile_picture'] = 'storage/' . $filePath;
} }
$this->employeeRepository->create($inputData); $this->employeeRepository->create($inputData);
@ -99,17 +106,22 @@ class EmployeeController extends Controller
public function update(Request $request, $id): RedirectResponse public function update(Request $request, $id): RedirectResponse
{ {
$inputData = $request->except(['_method', '_token']); $inputData = $request->except(['_method', '_token']);
try { try {
if ($request->hasFile('profile_pic')) { if ($request->hasFile('profile_picture')) {
$fileName = time() . '_' . $request->profile_pic->getClientOriginalName(); $image = $request->profile_picture;
$filePath = $request->file('profile_pic')->storeAs('uploads', $fileName, 'public'); $fileName = time() . '_' . $image->getClientOriginalName();
$inputData['profile_picture'] = time() . '_' . $request->profile_pic->getClientOriginalName(); $filePath = Storage::disk('public')->putFileAs('uploads', $image, $fileName);
$inputData['profile_picture'] = 'storage/' . $filePath;
} }
$this->employeeRepository->update($id, $inputData); $this->employeeRepository->update($id, $inputData);
toastr()->success('Employee Created Succesfully'); toastr()->success('Employee Created Succesfully');
} catch (\Throwable $th) { } catch (\Throwable $th) {
toastr()->error($th->getMessage()); toastr()->error($th->getMessage());
} }
return redirect()->route('employee.index'); return redirect()->route('employee.index');

View File

@ -54,8 +54,8 @@
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
{{ html()->label('Upload Profile Pic')->class('form-label') }} {{ html()->label('Upload Profile Picture')->class('form-label') }}
{{ html()->file('profile_pic')->class('form-control') }} {{ html()->file('profile_picture')->class('form-control') }}
</div> </div>

View File

@ -1,8 +1,8 @@
<?php <?php
namespace Modules\User\Repositories; namespace Modules\User\Repositories;
use Spatie\Permission\Models\Role;
use App\Models\Role;
class RoleRepository implements RoleInterface class RoleRepository implements RoleInterface
{ {

View File

@ -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);
}
}

View File

@ -1,217 +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);
}
}

View File

@ -1,218 +1,218 @@
<?php <?php
namespace App\Http\Controllers; 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;
class CompanytypesController extends Controller use App\Http\Controllers\Controller;
{ use Illuminate\Http\Request;
protected $modelService; use App\Models\Companytypes;
public function __construct(Companytypes $model) use Illuminate\Support\Facades\DB;
{ use Illuminate\Support\Facades\Validator;
$this->modelService = new CommonModelService($model); use App\Service\CommonModelService;
} use Log;
public function index(Request $request) use Exception;
{
createActivityLog(CompanytypesController::class, 'index', ' Companytypes index');
$data = Companytypes::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.companytypes.index", compact('data')); class CompanytypesController extends Controller
} {
protected $modelService;
public function __construct(Companytypes $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
// createActivityLog(CompanytypesController::class, 'index', ' Companytypes index');
$data = Companytypes::where('status', '<>', -1)->orderBy('display_order')->get();
public function create(Request $request) return view("crud.generated.companytypes.index", compact('data'));
{ }
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) public function create(Request $request)
{ {
createActivityLog(CompanytypesController::class, 'store', ' Companytypes store'); // createActivityLog(CompanytypesController::class, 'create', ' Companytypes create');
$validator = Validator::make($request->all(), [ $TableData = Companytypes::where('status', '<>', -1)->orderBy('display_order')->get();
//ADD REQUIRED FIELDS FOR VALIDATION $editable = false;
]); return view("crud.generated.companytypes.edit", compact('TableData', 'editable'));
}
if ($validator->fails()) { public function store(Request $request)
return response()->json([ {
'error' => $validator->errors(), // createActivityLog(CompanytypesController::class, 'store', ' Companytypes store');
],500); $validator = Validator::make($request->all(), [
} //ADD REQUIRED FIELDS FOR VALIDATION
$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();
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(CompanytypesController::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 Companytypes Created Successfully.'], 200);
}
return redirect()->route('companytypes.index')->with('success','The Companytypes created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Companytypes::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 = Companytypes::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(CompanytypesController::class, 'show', ' Companytypes show');
$data = Companytypes::findOrFail($id);
return view("crud.generated.companytypes.show", compact('data'));
}
public function edit(Request $request, $id)
{
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'));
}
public function update(Request $request, $id)
{
createActivityLog(CompanytypesController::class, 'update', ' Companytypes 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('companytype_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CompanytypesController::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 Companytypes updated Successfully.'], 200);
}
// return redirect()->route('companytypes.index')->with('success','The Companytypes updated Successfully.');
return redirect()->back()->with('success', 'The Companytypes updated successfully.');
}
public function destroy(Request $request,$id)
{
createActivityLog(CompanytypesController::class, 'destroy', ' Companytypes destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CompanytypesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Companytypes Deleted Successfully.'],200);
}
public function toggle(Request $request,$id)
{
createActivityLog(CompanytypesController::class, 'destroy', ' Companytypes destroy');
$data = Companytypes::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(CompanytypesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Companytypes Deleted Successfully.'],200);
}
public function clone(Request $request,$id)
{
createActivityLog(CompanytypesController::class, 'clone', ' Companytypes clone');
$data = Companytypes::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(CompanytypesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Companytypes Clonned Successfully.'],200);
}
if ($validator->fails()) {
return response()->json([
'error' => $validator->errors(),
], 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();
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(CompanytypesController::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 Companytypes Created Successfully.'], 200);
}
return redirect()->route('companytypes.index')->with('success', 'The Companytypes created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Companytypes::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 = Companytypes::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(CompanytypesController::class, 'show', ' Companytypes show');
$data = Companytypes::findOrFail($id);
return view("crud.generated.companytypes.show", compact('data'));
}
public function edit(Request $request, $id)
{
// 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'));
}
public function update(Request $request, $id)
{
// createActivityLog(CompanytypesController::class, 'update', ' Companytypes 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('companytype_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CompanytypesController::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 Companytypes updated Successfully.'], 200);
}
// return redirect()->route('companytypes.index')->with('success','The Companytypes updated Successfully.');
return redirect()->back()->with('success', 'The Companytypes updated successfully.');
}
public function destroy(Request $request, $id)
{
// createActivityLog(CompanytypesController::class, 'destroy', ' Companytypes destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CompanytypesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Companytypes Deleted Successfully.'], 200);
}
public function toggle(Request $request, $id)
{
// createActivityLog(CompanytypesController::class, 'destroy', ' Companytypes destroy');
$data = Companytypes::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(CompanytypesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Companytypes Deleted Successfully.'], 200);
}
public function clone(Request $request, $id)
{
// createActivityLog(CompanytypesController::class, 'clone', ' Companytypes clone');
$data = Companytypes::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(CompanytypesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Companytypes Clonned Successfully.'], 200);
}
}

View File

@ -1,217 +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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -1,216 +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.provinces.index", compact('data'));
}
public function create(Request $request)
{
// createActivityLog(ProvinceController::class, 'create', ' Province create');
$editable=false;
return view("crud.generated.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("crud.generated.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("crud.generated.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);
}
}

View File

@ -18,15 +18,14 @@
} }
public function index(Request $request) 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(); $data = Vendors::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.vendors.index", compact('data')); return view("crud.generated.vendors.index", compact('data'));
} }
public function create(Request $request) 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(); $TableData = Vendors::where('status','<>',-1)->orderBy('display_order')->get();
$editable=false; $editable=false;
return view("crud.generated.vendors.edit",compact('TableData','editable')); return view("crud.generated.vendors.edit",compact('TableData','editable'));
@ -34,7 +33,7 @@
public function store(Request $request) public function store(Request $request)
{ {
createActivityLog(VendorsController::class, 'store', ' Vendors store'); // createActivityLog(VendorsController::class, 'store', ' Vendors store');
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
//ADD REQUIRED FIELDS FOR VALIDATION //ADD REQUIRED FIELDS FOR VALIDATION
]); ]);
@ -103,7 +102,7 @@
public function show(Request $request, $id) public function show(Request $request, $id)
{ {
createActivityLog(VendorsController::class, 'show', ' Vendors show'); // createActivityLog(VendorsController::class, 'show', ' Vendors show');
$data = Vendors::findOrFail($id); $data = Vendors::findOrFail($id);
return view("crud.generated.vendors.show", compact('data')); return view("crud.generated.vendors.show", compact('data'));
@ -112,7 +111,7 @@
public function edit(Request $request, $id) 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(); $TableData = Vendors::where('status','<>',-1)->orderBy('display_order')->get();
$data = Vendors::findOrFail($id); $data = Vendors::findOrFail($id);
$editable=true; $editable=true;
@ -122,7 +121,7 @@
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
createActivityLog(VendorsController::class, 'update', ' Vendors update'); // createActivityLog(VendorsController::class, 'update', ' Vendors update');
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
//ADD VALIDATION FOR REQIRED FIELDS //ADD VALIDATION FOR REQIRED FIELDS
]); ]);
@ -159,7 +158,7 @@
public function destroy(Request $request,$id) public function destroy(Request $request,$id)
{ {
createActivityLog(VendorsController::class, 'destroy', ' Vendors destroy'); // createActivityLog(VendorsController::class, 'destroy', ' Vendors destroy');
DB::beginTransaction(); DB::beginTransaction();
try { try {
$OperationNumber = getOperationNumber(); $OperationNumber = getOperationNumber();
@ -175,7 +174,7 @@
} }
public function toggle(Request $request,$id) public function toggle(Request $request,$id)
{ {
createActivityLog(VendorsController::class, 'destroy', ' Vendors destroy'); // createActivityLog(VendorsController::class, 'destroy', ' Vendors destroy');
$data = Vendors::findOrFail($id); $data = Vendors::findOrFail($id);
$requestData=['status'=>($data->status==1)?0:1]; $requestData=['status'=>($data->status==1)?0:1];
DB::beginTransaction(); DB::beginTransaction();
@ -193,7 +192,7 @@
} }
public function clone(Request $request,$id) public function clone(Request $request,$id)
{ {
createActivityLog(VendorsController::class, 'clone', ' Vendors clone'); // createActivityLog(VendorsController::class, 'clone', ' Vendors clone');
$data = Vendors::findOrFail($id); $data = Vendors::findOrFail($id);
unset($data['updatedby']); unset($data['updatedby']);
unset($data['createdby']); unset($data['createdby']);
@ -215,4 +214,3 @@
} }

View File

@ -1,218 +1,218 @@
<?php <?php
namespace App\Http\Controllers; 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;
class VendortypesController extends Controller use App\Http\Controllers\Controller;
{ use Illuminate\Http\Request;
protected $modelService; use App\Models\Vendortypes;
public function __construct(Vendortypes $model) use Illuminate\Support\Facades\DB;
{ use Illuminate\Support\Facades\Validator;
$this->modelService = new CommonModelService($model); use App\Service\CommonModelService;
} use Log;
public function index(Request $request) use Exception;
{
createActivityLog(VendortypesController::class, 'index', ' Vendortypes index');
$data = Vendortypes::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.vendortypes.index", compact('data')); class VendortypesController extends Controller
} {
protected $modelService;
public function __construct(Vendortypes $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
// createActivityLog(VendortypesController::class, 'index', ' Vendortypes index');
$data = Vendortypes::where('status', '<>', -1)->orderBy('display_order')->get();
public function create(Request $request) return view("crud.generated.vendortypes.index", compact('data'));
{ }
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) public function create(Request $request)
{ {
createActivityLog(VendortypesController::class, 'store', ' Vendortypes store'); // createActivityLog(VendortypesController::class, 'create', ' Vendortypes create');
$validator = Validator::make($request->all(), [ $TableData = Vendortypes::where('status', '<>', -1)->orderBy('display_order')->get();
//ADD REQUIRED FIELDS FOR VALIDATION $editable = false;
]); return view("crud.generated.vendortypes.edit", compact('TableData', 'editable'));
}
if ($validator->fails()) { public function store(Request $request)
return response()->json([ {
'error' => $validator->errors(), // createActivityLog(VendortypesController::class, 'store', ' Vendortypes store');
],500); $validator = Validator::make($request->all(), [
} //ADD REQUIRED FIELDS FOR VALIDATION
$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();
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(VendortypesController::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 Vendortypes Created Successfully.'], 200);
}
return redirect()->route('vendortypes.index')->with('success','The Vendortypes created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Vendortypes::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 = Vendortypes::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(VendortypesController::class, 'show', ' Vendortypes show');
$data = Vendortypes::findOrFail($id);
return view("crud.generated.vendortypes.show", compact('data'));
}
public function edit(Request $request, $id)
{
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'));
}
public function update(Request $request, $id)
{
createActivityLog(VendortypesController::class, 'update', ' Vendortypes 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('vendortypes_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(VendortypesController::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 Vendortypes updated Successfully.'], 200);
}
// return redirect()->route('vendortypes.index')->with('success','The Vendortypes updated Successfully.');
return redirect()->back()->with('success', 'The Vendortypes updated successfully.');
}
public function destroy(Request $request,$id)
{
createActivityLog(VendortypesController::class, 'destroy', ' Vendortypes destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(VendortypesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Vendortypes Deleted Successfully.'],200);
}
public function toggle(Request $request,$id)
{
createActivityLog(VendortypesController::class, 'destroy', ' Vendortypes destroy');
$data = Vendortypes::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(VendortypesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Vendortypes Deleted Successfully.'],200);
}
public function clone(Request $request,$id)
{
createActivityLog(VendortypesController::class, 'clone', ' Vendortypes clone');
$data = Vendortypes::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(VendortypesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Vendortypes Clonned Successfully.'],200);
}
if ($validator->fails()) {
return response()->json([
'error' => $validator->errors(),
], 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();
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(VendortypesController::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 Vendortypes Created Successfully.'], 200);
}
return redirect()->route('vendortypes.index')->with('success', 'The Vendortypes created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Vendortypes::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 = Vendortypes::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(VendortypesController::class, 'show', ' Vendortypes show');
$data = Vendortypes::findOrFail($id);
return view("crud.generated.vendortypes.show", compact('data'));
}
public function edit(Request $request, $id)
{
// 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'));
}
public function update(Request $request, $id)
{
// createActivityLog(VendortypesController::class, 'update', ' Vendortypes 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('vendortypes_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(VendortypesController::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 Vendortypes updated Successfully.'], 200);
}
// return redirect()->route('vendortypes.index')->with('success','The Vendortypes updated Successfully.');
return redirect()->back()->with('success', 'The Vendortypes updated successfully.');
}
public function destroy(Request $request, $id)
{
// createActivityLog(VendortypesController::class, 'destroy', ' Vendortypes destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(VendortypesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Vendortypes Deleted Successfully.'], 200);
}
public function toggle(Request $request, $id)
{
// createActivityLog(VendortypesController::class, 'destroy', ' Vendortypes destroy');
$data = Vendortypes::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(VendortypesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Vendortypes Deleted Successfully.'], 200);
}
public function clone(Request $request, $id)
{
// createActivityLog(VendortypesController::class, 'clone', ' Vendortypes clone');
$data = Vendortypes::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(VendortypesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Vendortypes Clonned Successfully.'], 200);
}
}

16
app/Models/Castes.php Normal file
View 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 = [];
}

16
app/Models/Genders.php Normal file
View 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 = [];
}

View 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 = [];
}

16
app/Models/Vendors.php Normal file
View 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 = [];
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Vendortypes extends Model
{
use HasFactory;
protected $table = 'tbl_vendortypes';
protected $primaryKey = 'vendortype_id';
protected $guarded = [];
}

View File

@ -2,5 +2,6 @@
"Leave": true, "Leave": true,
"Employee": true, "Employee": true,
"Attendance": true, "Attendance": true,
"User": true "User": true,
"Admin": true
} }

View File

@ -1,24 +0,0 @@
@extends('layouts.app')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Caste') }}</h2>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('castes.index')); ?>
</div>
<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-6">{{ 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"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('castes.index')); ?>
</div>
</form>
</div>
</div>
@endsection

View File

@ -1,36 +0,0 @@
@extends('layouts.app')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2><?php echo label('View Details'); ?></h2>
<?php createButton('btn-primary btn-cancel', '', 'Back to List', route('castes.index')); ?>
</div>
<div class='card-body'>
<p><b>Title :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p>
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p>
<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
</p>
<p><b>Remarks :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->remarks }}</span></p>
<p><b>Display Order :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->display_order }}</span></p>
<p><b>Createdby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->createdby }}</span></p>
<p><b>Updatedby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->updatedby }}</span></p>
<div class="d-flex justify-content-between">
<div>
<p><b>Created On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->created_at }}</span></p>
<p><b>Created By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->createdBy }}</span></p>
</div>
<div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
</div>
</div>
</div>
</div>
@endSection

View File

@ -1,35 +1,56 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class="page-content">
<div class='card-header d-flex justify-content-between align-items-center'> <div class="container-fluid">
<h2 class="">{{ label('Add Company') }}</h2>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('companies.index')); ?>
</div> <!-- start page title -->
<div class='card-body'> @include('layouts.partials.breadcrumb', ['title' => 'Company'])
<form action="{{ $editable ? route('companies.update', [$data->company_id]) : route('companies.store') }}"
id="updateCustomForm" method="POST"> <!-- end page title -->
@csrf <input type=hidden name='company_id' value='{{ $editable ? $data->company_id : '' }}' /> <div class='card'>
<div class="row">
<div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }} <div class='card-body'>
</div>
<div class="col-lg-12 pb-2"> <form action="{{ $editable ? route('companies.update', [$data->company_id]) : route('companies.store') }}"
id="updateCustomForm" method="POST">
@csrf <input type=hidden name='company_id' value='{{ $editable ? $data->company_id : '' }}' />
<div class="row">
<div class="col-lg-6">
{{ createCustomSelect('tbl_companytypes', 'title', 'companytype_id', $editable ? $data->companytypes_id : '', 'Company Type', 'companytypes_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 : '') }} {{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
</div> </div> --}}
<div class="col-lg-6">{{ createText('address', 'address', 'Address', '', $editable ? $data->address : '') }}
</div> <div class="col-lg-6">
<div class="col-lg-6"> {{ createCustomSelect('tbl_cities', 'title', 'city_id', $editable ? $data->cities_id : '', 'City', 'cities_id', 'form-control select2', 'status<>-1') }}
{{ createCustomSelect('tbl_cities', 'title', 'city_id', $editable ? $data->cities_id : '', 'Cities Id', 'cities_id', 'form-control select2', 'status<>-1') }} </div>
</div>
<div class="col-lg-6"> <div class="col-lg-6">
{{ createCustomSelect('tbl_companytypes', 'title', 'companytype_id', $editable ? $data->companytypes_id : '', 'Companytypes Id', 'companytypes_id', 'form-control select2', 'status<>-1') }} {{ createText('address', 'address', 'Address', '', $editable ? $data->address : '') }}
</div> </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'); ?> <div class="col-lg-12 pb-2">
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('companies.index')); ?> {{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
</div> </div>
</form>
<div class="col-md-12 mt-2">
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('companies.index')); ?>
</div>
</form>
</div>
</div>
</div> </div>
</div> </div>
@endsection @endsection

View File

@ -1,112 +1,112 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="page-content">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="container-fluid">
<h2>{{ label('Companies List') }}</h2>
<a href="{{ route('companies.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div>
<div class="card-body">
<table class="dataTable table" id="tbl_companies" data-url="{{ route('companies.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('title') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('address') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('cities') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('companytypes') }}</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->company_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">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->company_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->company_id }}" />
</div>
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
</td>
<td class="tb-col">{{ $item->address }}</td>
<td class="tb-col">
{!! getFieldData('tbl_cities', 'title', 'city_id', $item->cities_id) !!}
</td>
<td class="tb-col">
{!! getFieldData('tbl_companytypes', 'title', 'companytype_id', $item->companytypes_id) !!}
</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('companies.show', [$item->company_id]) }}" class="dropdown-item"><i
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<li><a href="{{ route('companies.edit', [$item->company_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('companies.toggle', [$item->company_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> <!-- start page title -->
<li> @include('layouts.partials.breadcrumb', ['title' => 'Company'])
<a href="{{ route('companies.clone', [$item->company_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> <!-- end page title -->
<li> <div class="card">
<a href="{{ route('companies.destroy', [$item->company_id]) }}" <div class="card-header align-items-center d-flex">
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)"> <h5 class="card-title flex-grow-1 mb-0">Company Lists</h5>
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }} <div class="flex-shrink-0">
</a> <a href="{{ route('companies.create') }}" class="btn btn-success waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Create Company</a>
</div>
</div>
<div class="card-body">
<table class="dataTable table" id="tbl_companies" data-url="{{ route('companies.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('title') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('address') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('cities') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('companytypes') }}</span></th>
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
</th>
</tr>
</thead>
<tbody>
@foreach ($data as $index => $item)
<tr data-id="{{ $item->company_id }}" data-display_order="{{ $item->display_order }}"
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
</li> <td class="tb-col">{{ $index + 1 }}</td>
</ul> <td class="tb-col">{{ $item->title }}</td>
</div>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->company_id }}">
</td> <span class="alias">{{ $item->alias }}</span>
</tr> <input type="text" class="alias-input d-none" value="{{ $item->alias }}"
@endforeach id="alias_{{ $item->company_id }}" />
</div>
</tbody> <span class="badge badge-soft-primary change-alias-badge">change alias</span>
</table> </td>
<td class="tb-col">{{ $item->address }}</td>
<td class="tb-col">
{!! getFieldData('tbl_cities', 'title', 'city_id', $item->cities_id) !!}
</td>
<td class="tb-col">
{!! getFieldData('tbl_companytypes', 'title', 'companytype_id', $item->companytypes_id) !!}
</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('companies.show', [$item->company_id]) }}" class="dropdown-item"><i
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<li><a href="{{ route('companies.edit', [$item->company_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('companies.toggle', [$item->company_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('companies.clone', [$item->company_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('companies.destroy', [$item->company_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 @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') @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> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {

View File

@ -1,15 +1,14 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class="card-header align-items-center d-flex">
<h2><?php echo label('View Details'); ?></h2> <h5 class="card-title flex-grow-1 mb-0">View Detail</h5>
<?php createButton('btn-primary btn-cancel', '', 'Back to List', route('companies.index')); ?> <div class="flex-shrink-0">
<a href="{{ route('companies.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'> <div class='card-body'>
<p><b>Title :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p> <p><b>Title :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p>
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p> <p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p>
<p><b>Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->description }}</span></p> <p><b>Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->description }}</span></p>
@ -31,10 +30,8 @@
<div> <div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p> <p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p> <p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@endSection @endSection

View File

@ -1,27 +1,45 @@
@extends('layouts.app') @extends('layouts.app')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Company Type') }}</h2>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('companytypes.index')); ?>
</div> @section('content')
<div class='card-body'> <div class="page-content">
<form action="{{ $editable ? route('companytypes.update', [$data->companytype_id]) : route('companytypes.store') }}" <div class="container-fluid">
id="updateCustomForm" method="POST">
@csrf <input type=hidden name='companytype_id' value='{{ $editable ? $data->companytype_id : '' }}' /> <!-- start page title -->
<div class="row"> @include('layouts.partials.breadcrumb', ['title' => 'Company Type'])
<div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
</div> <!-- end page title -->
<div class="col-lg-12 pb-2"> <div class='card'>
{{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }} <div class='card-body'>
</div>
<div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }} <form
</div> action="{{ $editable ? route('companytypes.update', [$data->companytype_id]) : route('companytypes.store') }}"
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?> id="updateCustomForm" method="POST">
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('companytypes.index')); ?>
</div> @csrf
</form>
<input type=hidden name='companytype_id' value='{{ $editable ? $data->companytype_id : '' }}' />
<div class="row">
<div class="col-lg-12">
{{ 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 mt-2">
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('companytypes.index')); ?>
</div>
</form>
</div>
</div>
</div> </div>
</div> </div>
@endsection @endsection

View File

@ -1,102 +1,92 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="page-content">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="container-fluid">
<h2>{{ label('Company Type List') }}</h2> <!-- start page title -->
<a href="{{ route('companytypes.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a> @include('layouts.partials.breadcrumb', ['title' => 'Company Type'])
</div> <!-- end page title -->
<div class="card-body">
<table class="dataTable table" id="tbl_companytypes" data-url="{{ route('companytypes.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('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->companytype_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">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->companytype_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->companytype_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('companytypes.show', [$item->companytype_id]) }}" class="dropdown-item"><i
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<li><a href="{{ route('companytypes.edit', [$item->companytype_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('companytypes.toggle', [$item->companytype_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> <div class="card">
<li> <div class="card-header align-items-center d-flex">
<a href="{{ route('companytypes.clone', [$item->companytype_id]) }}" <h5 class="card-title flex-grow-1 mb-0">Company Type Lists</h5>
class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)"> <div class="flex-shrink-0">
<i class="ri-file-copy-line text-muted me-2 align-bottom"></i> {{ label('Clone') }} <a href="{{ route('companytypes.create') }}" class="btn btn-success waves-effect waves-light"><i
</a> class="ri-add-fill me-1 align-bottom"></i> Create Company Type</a>
</div>
</li> </div>
<li>
<a href="{{ route('companytypes.destroy', [$item->companytype_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 class="card-body">
<table class="dataTable table" id="tbl_companytypes" data-url="{{ route('companytypes.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('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>
@foreach ($data as $index => $item)
<tr data-id="{{ $item->companytype_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->companytype_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->companytype_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('companytypes.show', [$item->companytype_id]) }}" class="dropdown-item"><i
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<li><a href="{{ route('companytypes.edit', [$item->companytype_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('companytypes.toggle', [$item->companytype_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('companytypes.clone', [$item->companytype_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('companytypes.destroy', [$item->companytype_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 @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') @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> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {

View File

@ -1,37 +1,44 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class="page-content">
<div class='card-header d-flex justify-content-between align-items-center'> <div class="container-fluid">
<h2><?php echo label('View Details'); ?></h2>
<?php createButton('btn-primary btn-cancel', '', 'Back to List', route('companytypes.index')); ?>
</div> <!-- start page title -->
<div class='card-body'> @include('layouts.partials.breadcrumb', ['title' => 'Company Type'])
<!-- end page title -->
<div class='card'>
<p><b>Title :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p> <div class="card-header align-items-center d-flex">
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p> <h5 class="card-title flex-grow-1 mb-0">View Detail</h5>
<p><b>Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->description }}</span></p> <div class="flex-shrink-0">
<p><b>Display Order :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->display_order }}</span></p> <a href="{{ route('companytypes.index') }}" class="btn btn-success waves-effect waves-light"><i
<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span class="ri-add-fill me-1 align-bottom"></i> Back to List</a>
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span> </div>
</p>
<p><b>Remarks :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->remarks }}</span></p>
<p><b>Createdby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->createdby }}</span></p>
<p><b>Updatedby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->updatedby }}</span></p>
<div class="d-flex justify-content-between">
<div>
<p><b>Created On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->created_at }}</span></p>
<p><b>Created By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->createdBy }}</span></p>
</div> </div>
<div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
<div class='card-body'>
<p><b>Title :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p>
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p>
<p><b>Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->description }}</span></p>
<p><b>Display Order :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->display_order }}</span></p>
<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
</p>
<p><b>Remarks :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->remarks }}</span></p>
<p><b>Createdby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->createdby }}</span></p>
<p><b>Updatedby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->updatedby }}</span></p>
<div class="d-flex justify-content-between">
<div>
<p><b>Created On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->created_at }}</span></p>
<p><b>Created By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->createdBy }}</span></p>
</div>
<div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@endSection @endSection

View File

@ -1,316 +0,0 @@
@extends('layouts.app')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Employees') }}</h2>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('employees.index')); ?>
</div>
<div class='card-body'>
<form action="{{ $editable ? route('employees.update', [$data->employee_id]) : route('employees.store') }}"
id="updateCustomForm" method="POST">
@csrf <input type=hidden name='employee_id' value='{{ $editable ? $data->employee_id : '' }}' />
<div class="row">
<div class="col-lg-6">
{{ createText(
'first_name',
'first_name',
"First
Name",
'',
$editable ? $data->first_name : '',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'middle_name',
'middle_name',
"Middle
Name",
'',
$editable ? $data->middle_name : '',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'last_name',
'last_name',
"Last
Name",
'',
$editable ? $data->last_name : '',
) }}
</div>
<div class="col-lg-6">
{{ createText('email', 'email', 'Email', '', $editable ? $data->email : '') }}
</div>
<div class="col-lg-6">
{{ createCustomSelect(
'tbl_genders',
'title',
'gender_id',
$editable ? $data->genders_id : '',
'Genders Id',
'genders_id',
'form-control
select2',
'status<>-1',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'nepali_dob',
'nepali_dob',
"Nepali
Dob",
'',
$editable ? $data->nepali_dob : '',
) }}
</div>
<div class="col-lg-6 pb-2">{{ createDate('dob', 'Dob', '', $editable ? $data->dob : '') }}
</div>
<div class="col-lg-6">
{{ createCustomSelect(
'tbl_nationalities',
'title',
'nationality_id',
$editable ? $data->nationalities_id : '',
'Nationalities
Id',
'nationalities_id',
'form-control select2',
'status<>-1',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'about_me',
'about_me',
"About
Me",
'',
$editable ? $data->about_me : '',
) }}
</div>
<div class="col-lg-12 pb-2">
{{ createImageInput('signature', 'Signature', '', $editable ? $data->signature : '') }}
</div>
<div class="col-lg-6">
{{ createText(
'father_name',
'father_name',
"Father
Name",
'',
$editable ? $data->father_name : '',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'mother_name',
'mother_name',
"Mother
Name",
'',
$editable ? $data->mother_name : '',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'grand_father_name',
'grand_father_name',
"Grand Father
Name",
'',
$editable ? $data->grand_father_name : '',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'grand_mother_name',
'grand_mother_name',
"Grand Mother
Name",
'',
$editable ? $data->grand_mother_name : '',
) }}
</div>
<div class="col-lg-6">
{{ createText('spouse', 'spouse', 'Spouse', '', $editable ? $data->spouse : '') }}
</div>
<div class="col-lg-6">
{{ createText('contact', 'contact', 'Contact', '', $editable ? $data->contact : '') }}
</div>
<div class="col-lg-6">
{{ createText(
'alt_contact',
'alt_contact',
"Alt
Contact",
'',
$editable ? $data->alt_contact : '',
) }}
</div>
<div class="col-lg-6 pb-2">
{{ createImageInput(
'profile_picture',
"Profile
Picture",
'',
$editable ? $data->profile_picture : '',
) }}
</div>
<div class="col-lg-6">
{{ createCustomSelect(
'tbl_users',
'name',
'id',
$editable ? $data->users_id : '',
'Users Id',
'users_id',
'form-control
select2',
'status<>-1',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'is_login_required',
'is_login_required',
"Is Login
Required",
'',
$editable ? $data->is_login_required : '',
) }}
</div>
<div class="col-lg-6">
{{ createText('skills', 'skills', 'Skills', '', $editable ? $data->skills : '') }}
</div>
<div class="col-lg-12 pb-2">
{{ createTextarea(
'experience',
"experience
ckeditor-classic",
'Experience',
$editable ? $data->experience : '',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'permanent_address',
'permanent_address',
"Permanent
Address",
'',
$editable ? $data->permanent_address : '',
) }}
</div>
<div class="col-lg-6">
{{ createCustomSelect(
'tbl_cities',
'title',
'city_id',
$editable ? $data->permanent_city : '',
'Permanent
City',
'permanent_city',
'form-control
select2',
'status<>-1',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'temporary_address',
'temporary_address',
"Temporary
Address",
'',
$editable ? $data->temporary_address : '',
) }}
</div>
<div class="col-lg-6">
{{ createCustomSelect(
'tbl_cities',
'title',
'city_id',
$editable ? $data->temporary_city : '',
'Temporary
City',
'temporary_city',
'form-control
select2',
'status<>-1',
) }}
</div>
<div class="col-lg-6">
{{ createText(
'old_system_address',
'old_system_address',
"Old System
Address",
'',
$editable ? $data->old_system_address : '',
) }}
</div>
<div class="col-lg-6">
{{ createText('education', 'education', 'Education', '', $editable ? $data->education : '') }}
</div>
<div class="col-lg-6">
{{ createCustomSelect(
'tbl_castes',
'title',
'caste_id',
$editable ? $data->castes_id : '',
'Castes Id',
'castes_id',
'form-control
select2',
'status<>-1',
) }}
</div>
<div class="col-lg-6">
{{ createCustomSelect(
'tbl_ethnicities',
'title',
'ethnicity_id',
$editable ? $data->ethnicities_id : '',
'Ethnicities Id',
'ethnicities_id',
'form-control select2',
'status<>-1',
) }}
</div>
<div class="col-lg-6">
{{ createCustomSelect(
'tbl_dags',
'title',
'dag_id',
$editable ? $data->dags_id : '',
'Dags Id',
'dags_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">
{{ 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('employees.index')); ?>
</div>
</form>
</div>
</div>
@endsection

View File

@ -1,349 +0,0 @@
@extends('layouts.app')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label('Employees List') }}</h2>
<a href="{{ route('employees.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div>
<div class="card-body">
<table class="dataTable table" id="tbl_employees" data-url="{{ route('employees.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('first_name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('middle_name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('last_name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('email') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('genders') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('nepali_dob') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('dob') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('nationalities') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('about_me') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('signature') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('father_name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('mother_name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('grand_father_name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('grand_mother_name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('spouse') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('contact') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('alt_contact') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('profile_picture') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('users') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('is_login_required') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('skills') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('experience') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('permanent_address') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('permanent_city') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('temporary_address') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('temporary_city') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('old_system_address') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('education') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('castes') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('ethnicities') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('dags') }}</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->employee_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">{{ $item->first_name }}</td>
<td class="tb-col">{{ $item->middle_name }}</td>
<td class="tb-col">{{ $item->last_name }}</td>
<td class="tb-col">{{ $item->email }}</td>
<td class="tb-col">
{!! getFieldData('tbl_genders', 'title', 'gender_id', $item->genders_id) !!}
</td>
<td class="tb-col">{{ $item->nepali_dob }}</td>
<td class="tb-col">{{ myDate($item->dob) }}</td>
<td class="tb-col">
{!! getFieldData('tbl_nationalities', 'title', 'nationality_id', $item->nationalities_id) !!}
</td>
<td class="tb-col">{{ $item->about_me }}</td>
<td class="tb-col">{{ showImageThumb($item->signature) }}</td>
<td class="tb-col">{{ $item->father_name }}</td>
<td class="tb-col">{{ $item->mother_name }}</td>
<td class="tb-col">{{ $item->grand_father_name }}</td>
<td class="tb-col">{{ $item->grand_mother_name }}</td>
<td class="tb-col">{{ $item->spouse }}</td>
<td class="tb-col">{{ $item->contact }}</td>
<td class="tb-col">{{ $item->alt_contact }}</td>
<td class="tb-col">{{ showImageThumb($item->profile_picture) }}</td>
<td class="tb-col">
{!! getFieldData('tbl_users', 'name', 'id', $item->users_id) !!}
</td>
<td class="tb-col">{{ $item->is_login_required }}</td>
<td class="tb-col">{{ $item->skills }}</td>
<td class="tb-col">{{ $item->experience }}</td>
<td class="tb-col">{{ $item->permanent_address }}</td>
<td class="tb-col">{{ $item->permanent_city }}</td>
<td class="tb-col">{{ $item->temporary_address }}</td>
<td class="tb-col">{{ $item->temporary_city }}</td>
<td class="tb-col">{{ $item->old_system_address }}</td>
<td class="tb-col">{{ $item->education }}</td>
<td class="tb-col">
{!! getFieldData('tbl_castes', 'title', 'caste_id', $item->castes_id) !!}
</td>
<td class="tb-col">
{!! getFieldData('tbl_ethnicities', 'title', 'ethnicity_id', $item->ethnicities_id) !!}
</td>
<td class="tb-col">
{!! getFieldData('tbl_dags', 'title', 'dag_id', $item->dags_id) !!}
</td>
<td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->employee_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->employee_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('employees.show', [$item->employee_id]) }}" class="dropdown-item"><i
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<li><a href="{{ route('employees.edit', [$item->employee_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('employees.toggle', [$item->employee_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('employees.clone', [$item->employee_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('employees.destroy', [$item->employee_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>
@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() {
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('employees.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: 'GET',
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');
}
});
}
});
}
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

View File

@ -1,67 +0,0 @@
@extends('layouts.app')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2><?php echo label('View Details'); ?></h2>
<?php createButton('btn-primary btn-cancel', '', 'Back to List', route('employees.index')); ?>
</div>
<div class='card-body'>
<p><b>First Name :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->first_name }}</span></p>
<p><b>Middle Name :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->middle_name }}</span></p>
<p><b>Last Name :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->last_name }}</span></p>
<p><b>Email :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->email }}</span></p>
<p><b>Genders Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->genders_id }}</span></p>
<p><b>Nepali Dob :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->nepali_dob }}</span></p>
<p><b>Dob :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->dob }}</span></p>
<p><b>Nationalities Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->nationalities_id }}</span></p>
<p><b>About Me :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->about_me }}</span></p>
<p><b>Signature :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->signature }}</span></p>
<p><b>Father Name :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->father_name }}</span></p>
<p><b>Mother Name :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->mother_name }}</span></p>
<p><b>Grand Father Name :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->grand_father_name }}</span></p>
<p><b>Grand Mother Name :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->grand_mother_name }}</span></p>
<p><b>Spouse :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->spouse }}</span></p>
<p><b>Contact :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->contact }}</span></p>
<p><b>Alt Contact :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alt_contact }}</span></p>
<p><b>Profile Picture :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->profile_picture }}</span></p>
<p><b>Users Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->users_id }}</span></p>
<p><b>Is Login Required :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->is_login_required }}</span></p>
<p><b>Skills :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->skills }}</span></p>
<p><b>Experience :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->experience }}</span></p>
<p><b>Permanent Address :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->permanent_address }}</span></p>
<p><b>Permanent City :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->permanent_city }}</span></p>
<p><b>Temporary Address :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->temporary_address }}</span></p>
<p><b>Temporary City :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->temporary_city }}</span></p>
<p><b>Old System Address :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->old_system_address }}</span></p>
<p><b>Education :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->education }}</span></p>
<p><b>Castes Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->castes_id }}</span></p>
<p><b>Ethnicities Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->ethnicities_id }}</span></p>
<p><b>Dags Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->dags_id }}</span></p>
<p><b>Title :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p>
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p>
<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
</p>
<p><b>Display Order :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->display_order }}</span></p>
<p><b>Createdby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->createdby }}</span></p>
<p><b>Updatedby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->updatedby }}</span></p>
<p><b>Remarks :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->remarks }}</span></p>
<div class="d-flex justify-content-between">
<div>
<p><b>Created On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->created_at }}</span></p>
<p><b>Created By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->createdBy }}</span></p>
</div>
<div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
</div>
</div>
</div>
</div>
@endSection

View File

@ -1,24 +0,0 @@
@extends('layouts.app')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Genders') }}</h2>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('genders.index')); ?>
</div>
<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-6">{{ 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"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('genders.index')); ?>
</div>
</form>
</div>
</div>
@endsection

Some files were not shown because too many files have changed in this diff Show More