master crud setup

This commit is contained in:
Ranjan 2024-04-05 11:07:15 +05:45
parent 73b666affc
commit c792d0a7e0
196 changed files with 18017 additions and 0 deletions

View File

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

View File

@ -0,0 +1,218 @@
<?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

@ -0,0 +1,218 @@
<?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

@ -0,0 +1,218 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Companies;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
class CompaniesController extends Controller
{
protected $modelService;
public function __construct(Companies $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
createActivityLog(CompaniesController::class, 'index', ' Companies index');
$data = Companies::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.companies.index", compact('data'));
}
public function create(Request $request)
{
createActivityLog(CompaniesController::class, 'create', ' Companies create');
$TableData = Companies::where('status','<>',-1)->orderBy('display_order')->get();
$editable=false;
return view("crud.generated.companies.edit",compact('TableData','editable'));
}
public function store(Request $request)
{
createActivityLog(CompaniesController::class, 'store', ' Companies 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_companies')]);
$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(CompaniesController::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 Companies Created Successfully.'], 200);
}
return redirect()->route('companies.index')->with('success','The Companies created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Companies::find($id);
$companyArticle->display_order = $index + 1;
$companyArticle->save();
}
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
}
public function updatealias(Request $request)
{
$articleId = $request->input('articleId');
$newAlias = $request->input('newAlias');
$companyArticle = Companies::find($articleId);
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(CompaniesController::class, 'show', ' Companies show');
$data = Companies::findOrFail($id);
return view("crud.generated.companies.show", compact('data'));
}
public function edit(Request $request, $id)
{
createActivityLog(CompaniesController::class, 'edit', ' Companies edit');
$TableData = Companies::where('status','<>',-1)->orderBy('display_order')->get();
$data = Companies::findOrFail($id);
$editable=true;
return view("crud.generated.companies.edit", compact('data','TableData','editable'));
}
public function update(Request $request, $id)
{
createActivityLog(CompaniesController::class, 'update', ' Companies 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('company_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CompaniesController::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 Companies updated Successfully.'], 200);
}
// return redirect()->route('companies.index')->with('success','The Companies updated Successfully.');
return redirect()->back()->with('success', 'The Companies updated successfully.');
}
public function destroy(Request $request,$id)
{
createActivityLog(CompaniesController::class, 'destroy', ' Companies destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CompaniesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Companies Deleted Successfully.'],200);
}
public function toggle(Request $request,$id)
{
createActivityLog(CompaniesController::class, 'destroy', ' Companies destroy');
$data = Companies::findOrFail($id);
$requestData=['status'=>($data->status==1)?0:1];
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CompaniesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Companies Deleted Successfully.'],200);
}
public function clone(Request $request,$id)
{
createActivityLog(CompaniesController::class, 'clone', ' Companies clone');
$data = Companies::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(CompaniesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Companies Clonned Successfully.'],200);
}
}

View File

@ -0,0 +1,218 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Companytypes;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
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();
return view("crud.generated.companytypes.index", compact('data'));
}
public function create(Request $request)
{
createActivityLog(CompanytypesController::class, 'create', ' Companytypes create');
$TableData = Companytypes::where('status','<>',-1)->orderBy('display_order')->get();
$editable=false;
return view("crud.generated.companytypes.edit",compact('TableData','editable'));
}
public function store(Request $request)
{
createActivityLog(CompanytypesController::class, 'store', ' Companytypes 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_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

@ -0,0 +1,218 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Countries;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
class CountriesController extends Controller
{
protected $modelService;
public function __construct(Countries $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
createActivityLog(CountriesController::class, 'index', ' Countries index');
$data = Countries::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.countries.index", compact('data'));
}
public function create(Request $request)
{
createActivityLog(CountriesController::class, 'create', ' Countries create');
$TableData = Countries::where('status','<>',-1)->orderBy('display_order')->get();
$editable=false;
return view("crud.generated.countries.edit",compact('TableData','editable'));
}
public function store(Request $request)
{
createActivityLog(CountriesController::class, 'store', ' Countries 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_countries')]);
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
$requestData=$request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL').'/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$operationNumber = getOperationNumber();
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
} catch (\Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'store', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Countries Created Successfully.'], 200);
}
return redirect()->route('countries.index')->with('success','The Countries created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Countries::find($id);
$companyArticle->display_order = $index + 1;
$companyArticle->save();
}
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
}
public function updatealias(Request $request)
{
$articleId = $request->input('articleId');
$newAlias = $request->input('newAlias');
$companyArticle = Countries::find($articleId);
if (!$companyArticle) {
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
}
$companyArticle->alias = $newAlias;
$companyArticle->save();
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
}
public function show(Request $request, $id)
{
createActivityLog(CountriesController::class, 'show', ' Countries show');
$data = Countries::findOrFail($id);
return view("crud.generated.countries.show", compact('data'));
}
public function edit(Request $request, $id)
{
createActivityLog(CountriesController::class, 'edit', ' Countries edit');
$TableData = Countries::where('status','<>',-1)->orderBy('display_order')->get();
$data = Countries::findOrFail($id);
$editable=true;
return view("crud.generated.countries.edit", compact('data','TableData','editable'));
}
public function update(Request $request, $id)
{
createActivityLog(CountriesController::class, 'update', ' Countries update');
$validator = Validator::make($request->all(), [
//ADD VALIDATION FOR REQIRED FIELDS
]);
if ($validator->fails()) {
return response()->json([
'error' => $validator->errors(),
],500);
}
$requestData=$request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL').'/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('country_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'update', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Countries updated Successfully.'], 200);
}
// return redirect()->route('countries.index')->with('success','The Countries updated Successfully.');
return redirect()->back()->with('success', 'The Countries updated successfully.');
}
public function destroy(Request $request,$id)
{
createActivityLog(CountriesController::class, 'destroy', ' Countries destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Countries Deleted Successfully.'],200);
}
public function toggle(Request $request,$id)
{
createActivityLog(CountriesController::class, 'destroy', ' Countries destroy');
$data = Countries::findOrFail($id);
$requestData=['status'=>($data->status==1)?0:1];
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Countries Deleted Successfully.'],200);
}
public function clone(Request $request,$id)
{
createActivityLog(CountriesController::class, 'clone', ' Countries clone');
$data = Countries::findOrFail($id);
unset($data['updatedby']);
unset($data['createdby']);
$requestData=$data->toArray();
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Countries Clonned Successfully.'],200);
}
}

View File

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

View File

@ -0,0 +1,218 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Departments;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
class DepartmentsController extends Controller
{
protected $modelService;
public function __construct(Departments $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
createActivityLog(DepartmentsController::class, 'index', ' Departments index');
$data = Departments::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.departments.index", compact('data'));
}
public function create(Request $request)
{
createActivityLog(DepartmentsController::class, 'create', ' Departments create');
$TableData = Departments::where('status','<>',-1)->orderBy('display_order')->get();
$editable=false;
return view("crud.generated.departments.edit",compact('TableData','editable'));
}
public function store(Request $request)
{
createActivityLog(DepartmentsController::class, 'store', ' Departments 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_departments')]);
$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(DepartmentsController::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 Departments Created Successfully.'], 200);
}
return redirect()->route('departments.index')->with('success','The Departments created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Departments::find($id);
$companyArticle->display_order = $index + 1;
$companyArticle->save();
}
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
}
public function updatealias(Request $request)
{
$articleId = $request->input('articleId');
$newAlias = $request->input('newAlias');
$companyArticle = Departments::find($articleId);
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(DepartmentsController::class, 'show', ' Departments show');
$data = Departments::findOrFail($id);
return view("crud.generated.departments.show", compact('data'));
}
public function edit(Request $request, $id)
{
createActivityLog(DepartmentsController::class, 'edit', ' Departments edit');
$TableData = Departments::where('status','<>',-1)->orderBy('display_order')->get();
$data = Departments::findOrFail($id);
$editable=true;
return view("crud.generated.departments.edit", compact('data','TableData','editable'));
}
public function update(Request $request, $id)
{
createActivityLog(DepartmentsController::class, 'update', ' Departments 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('department_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(DepartmentsController::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 Departments updated Successfully.'], 200);
}
// return redirect()->route('departments.index')->with('success','The Departments updated Successfully.');
return redirect()->back()->with('success', 'The Departments updated successfully.');
}
public function destroy(Request $request,$id)
{
createActivityLog(DepartmentsController::class, 'destroy', ' Departments destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(DepartmentsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Departments Deleted Successfully.'],200);
}
public function toggle(Request $request,$id)
{
createActivityLog(DepartmentsController::class, 'destroy', ' Departments destroy');
$data = Departments::findOrFail($id);
$requestData=['status'=>($data->status==1)?0:1];
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(DepartmentsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Departments Deleted Successfully.'],200);
}
public function clone(Request $request,$id)
{
createActivityLog(DepartmentsController::class, 'clone', ' Departments clone');
$data = Departments::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(DepartmentsController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Departments Clonned Successfully.'],200);
}
}

View File

@ -0,0 +1,218 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Designations;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
class DesignationsController extends Controller
{
protected $modelService;
public function __construct(Designations $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
createActivityLog(DesignationsController::class, 'index', ' Designations index');
$data = Designations::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.designations.index", compact('data'));
}
public function create(Request $request)
{
createActivityLog(DesignationsController::class, 'create', ' Designations create');
$TableData = Designations::where('status','<>',-1)->orderBy('display_order')->get();
$editable=false;
return view("crud.generated.designations.edit",compact('TableData','editable'));
}
public function store(Request $request)
{
createActivityLog(DesignationsController::class, 'store', ' Designations 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_designations')]);
$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(DesignationsController::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 Designations Created Successfully.'], 200);
}
return redirect()->route('designations.index')->with('success','The Designations created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Designations::find($id);
$companyArticle->display_order = $index + 1;
$companyArticle->save();
}
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
}
public function updatealias(Request $request)
{
$articleId = $request->input('articleId');
$newAlias = $request->input('newAlias');
$companyArticle = Designations::find($articleId);
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(DesignationsController::class, 'show', ' Designations show');
$data = Designations::findOrFail($id);
return view("crud.generated.designations.show", compact('data'));
}
public function edit(Request $request, $id)
{
createActivityLog(DesignationsController::class, 'edit', ' Designations edit');
$TableData = Designations::where('status','<>',-1)->orderBy('display_order')->get();
$data = Designations::findOrFail($id);
$editable=true;
return view("crud.generated.designations.edit", compact('data','TableData','editable'));
}
public function update(Request $request, $id)
{
createActivityLog(DesignationsController::class, 'update', ' Designations 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('designation_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(DesignationsController::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 Designations updated Successfully.'], 200);
}
// return redirect()->route('designations.index')->with('success','The Designations updated Successfully.');
return redirect()->back()->with('success', 'The Designations updated successfully.');
}
public function destroy(Request $request,$id)
{
createActivityLog(DesignationsController::class, 'destroy', ' Designations destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(DesignationsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Designations Deleted Successfully.'],200);
}
public function toggle(Request $request,$id)
{
createActivityLog(DesignationsController::class, 'destroy', ' Designations destroy');
$data = Designations::findOrFail($id);
$requestData=['status'=>($data->status==1)?0:1];
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(DesignationsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Designations Deleted Successfully.'],200);
}
public function clone(Request $request,$id)
{
createActivityLog(DesignationsController::class, 'clone', ' Designations clone');
$data = Designations::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(DesignationsController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Designations Clonned Successfully.'],200);
}
}

View File

@ -0,0 +1,218 @@
<?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

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

View File

@ -0,0 +1,218 @@
<?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);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,218 @@
<?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

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

View File

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

View File

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

View File

@ -0,0 +1,530 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Mail\CustomMailer;
use App\Models\Agents;
use App\Models\Branches;
use App\Models\Campaigns;
use App\Models\Countries;
use App\Models\Leadcategories;
use App\Models\Qrscans;
use Illuminate\Http\Request;
use App\Models\Registrations;
use App\Models\Sources;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail;
use LMS;
use NewRegistrationAdminNotification;
class RegistrationsController extends Controller
{
protected $modelService;
public function __construct(Registrations $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
$data = $this->filterRegistrations($request);
return view("crud.generated.registrations.index", compact('data', 'request'));
}
public function bycampaign(Request $request, $CampaignAlias)
{
$Campaign = Campaigns::where("status", 1)->where("alias", $CampaignAlias)->first();
$title = "Registrations By Campaign : " . $Campaign->title;
$data = $this->filterRegistrations($request, $Campaign);
return view("crud.generated.registrations.index", compact('data', 'title', 'request'));
}
public function bycategory(Request $request, $CategoryAlias)
{
$LeadCategory = Leadcategories::where("alias", $CategoryAlias)->first();
$title = "Registrations By Lead Category : " . $LeadCategory->title;
$data = $this->filterRegistrations($request, null, $LeadCategory);
$reques = $request->all();
return view("crud.generated.registrations.index", compact('data', 'title', 'request'));
}
public function bybranch(Request $request, $BranchAlias)
{
$Branch = Branches::where("alias", $BranchAlias)->first();
$title = "Registrations By Branch : " . $Branch->title;
$data = $this->filterRegistrations($request, null,null,null,null,null, $Branch);
$reques = $request->all();
return view("crud.generated.registrations.index", compact('data', 'title', 'request'));
}
public function bysource(Request $request, $SourceAlias)
{
$Source = Sources::where("alias", $SourceAlias)->first();
$title = "Registrations By Source : " . $Source->title;
$data = $this->filterRegistrations($request, null, null, $Source);
$reques = $request->all();
return view("crud.generated.registrations.index", compact('data', 'title', 'request'));
}
public function bycountry(Request $request, $CountryAlias)
{
$Country = Countries::where("alias", $CountryAlias)->first();
$title = "Registrations By Country : " . $Country->title;
$data = $this->filterRegistrations($request, null, null, null, $Country);
$reques = $request->all();
return view("crud.generated.registrations.index", compact('data', 'title', 'request'));
}
public function byagent(Request $request, $AgentAlias)
{
$Agent = Agents::where("alias", $AgentAlias)->first();
$title = "Registrations By Agency : " . $Agent->title;
$data = $this->filterRegistrations($request, null, null, null, null, $Agent);
$reques = $request->all();
return view("crud.generated.registrations.index", compact('data', 'title', 'request'));
}
private function filterRegistrations($request, $Campaign = null, $LeadCategory = null, $Source = null, $Country = null, $Agent = null, $Branch=null)
{
DB::enableQueryLog();
$requestData = $request->all();
// dd($requestData);
$data = Registrations::where('status', '<>', -1);
if (isset($requestData['from']) && $requestData['from']) {
$data = $data->whereDate("created_at", ">=", $requestData['from']);
}
if (isset($requestData['to'])) {
$data = $data->whereDate("created_at", "<", $requestData['to']);
}
if (isset($requestData['source_id']) && $requestData['source_id'] != 0) {
$data = $data->where("sources_id", "=", $requestData['source_id']);
}
if (isset($requestData['country_id']) && $requestData['country_id'] != 0) {
$data = $data->where("countries_id", "=", $requestData['country_id']);
}
if (isset($requestData['leadcategory_id']) && $requestData['leadcategory_id']) {
$data = $data->where("leadcategories_id", "=", $requestData['leadcategory_id']);
}
if (isset($requestData['branch_id']) && $requestData['branch_id']) {
$data = $data->where("branches_id", "=", $requestData['branch_id']);
}
if ($Campaign !== null) {
$data = $data->where("campaigns_id", $Campaign->campaign_id);
}
if ($LeadCategory !== null) {
$data = $data->where("leadcategories_id", $LeadCategory->leadcategory_id);
}
if ($Source !== null) {
$data = $data->where("sources_id", $Source->source_id);
}
if ($Country !== null) {
$data = $data->where("countries_id", $Country->country_id);
}
if ($Agent !== null) {
$data = $data->where("agents_id", $Agent->agent_id);
}
if ($Branch !== null) {
$data = $data->where("branches_id", $Branch->branch_id);
}
$data = $data->orderBy('display_order');
$sqlQuery = $data->toSql();
$data = $data->get();
$data->RawQuery = DB::getQueryLog();
return $data;
}
public function create(Request $request)
{
createActivityLog(RegistrationsController::class, 'create', ' Registrations create');
$TableData = Registrations::where('status', '<>', -1)->orderBy('display_order')->get();
return view("crud.generated.registrations.create", compact('TableData'));
}
public function store(Request $request)
{
$validator = Validator::make($request->all(), [
// 'mobile' => 'required|numeric|unique:registrations,mobile', // Assuming 'users' is your table name and 'mobile' is the column
'mobile' => 'required|numeric:registrations,mobile', // Assuming 'users' is your table name and 'mobile' is the column
]);
$Campaign = Campaigns::findOrFail($request->campaigns_id);
if ($validator->fails()) {
$existingRegistration = Registrations::where('mobile', $request->mobile)->first();
if ($existingRegistration) {
//$qr_code = LMS::getLeadQR($existingRegistration->registration_id);
return response()->json([
'status' => false,
'message' => 'Mobile number already exists. Returning existing data.',
// 'qr_code' => site_url(str_replace(public_path(), '', $qr_code)),
'registration' => $existingRegistration,
'registration_id' => $existingRegistration->registration_id,
], 200);
}
return response()->json([
'status' => false,
'errors' => $validator->errors(),
'message' => 'Form validation failed.',
], 200); // 422 Unprocessable Entity
}
$request->request->add(['alias' => slugify($request->title)]);
$request->request->add(['display_order' => getDisplayOrder('tbl_registrations')]);
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
$request->request->add(['highest_qualification' => $request->qualification]);
$request->request->add(['highest_year' => ($request->highest_year) ? $request->highest_year : 0]);
$request->request->add(['highest_college' => $request->board]);
$request->request->add(['intrested_for_country' => ($request->preferred_destination) ? $request->preferred_destination : SITEVARS->Countries[0]->country_id]);
$request->request->add(['sources_id' => ($request->sources_id) ? $request->sources_id : 2]);
$request->request->add(['campaigns_id' => ($request->campaigns_id) ? $request->campaigns_id : SITEVARS->Campaigns[0]->campaign_id]);
$request->request->add(['countries_id' => SITEVARS->Countries[0]->country_id]);
$request->request->add(['remarks' => $request->message]);
$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();
$registration = $this->modelService->create($operationNumber, $operationNumber, null, $requestData);
} catch (\Exception $e) {
dd($e->getMessage());
DB::rollBack();
}
DB::commit();
$mailer = new CustomMailer($requestData);
if (env('SEND_EMAIL') == true) {
// Mail::bcc("prajwalbro@hotmail.com")->send($mailer->build());
Mail::to($request['email'])->send($mailer->build());
$notify_emails = isset($Campaign->notify_emails) ? explode(",", $Campaign->notify_emails) : "prajwalbro@hotmail.com";
Mail::cc($notify_emails)->send($mailer->registration_completed());
}
$msg = $Campaign->sms_message;
$success_messsage = $Campaign->success_messsage;
$success_messsage = str_replace('%name%', $request['name'], $success_messsage);
// dd($Campaign);
if (env('SEND_SMS') == true) {
$msg = str_replace('%name%', $request['name'], $msg);
LMS::sendSMSWithCurl($requestData['mobile'], $msg);
}
LMS::SaveInGoogleSheet($requestData);
return response()->json([
'status' => true,
'qr_code' => false,
'message' => ($success_messsage) ? $success_messsage : 'The Registration Created Successfully.',
'registration_id' => $registration->registration_id,
], 200);
}
public function saveform(Request $request)
{
$validator = Validator::make($request->all(), [
'mobile' => 'required|numeric|unique:registrations,mobile', // Assuming 'users' is your table name and 'mobile' is the column
]);
$Campaign = Campaigns::findOrFail($request->campaigns_id);
if ($validator->fails()) {
$existingRegistration = Registrations::where('mobile', $request->mobile)->first();
if ($existingRegistration) {
return response()->json([
'status' => false,
'message' => 'Mobile number already exists',
'registration' => $existingRegistration,
'registration_id' => $existingRegistration->registration_id,
], 200);
}
return response()->json([
'status' => false,
'errors' => $validator->errors(),
'message' => 'Form validation failed.',
], 200); // 422 Unprocessable Entity
}
$request->request->add(['alias' => slugify($request->title)]);
$request->request->add(['display_order' => getDisplayOrder('tbl_registrations')]);
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
$request->request->add(['highest_qualification' => $request->qualification]);
$request->request->add(['highest_year' => ($request->highest_year) ? $request->highest_year : 0]);
$request->request->add(['highest_college' => $request->board]);
$request->request->add(['intrested_for_country' => $request->preferred_destination]);
$request->request->add(['sources_id' => ($request->sources_id) ? $request->sources_id : 2]);
$request->request->add(['campaigns_id' => ($request->campaigns_id) ? $request->campaigns_id : SITEVARS->Campaigns[0]->campaign_id]);
$request->request->add(['countries_id' => SITEVARS->Countries[0]->country_id]);
$request->request->add(['remarks' => $request->message]);
$requestData = $request->all();
DB::beginTransaction();
try {
$operationNumber = getOperationNumber();
$registration = $this->modelService->create($operationNumber, $operationNumber, null, $requestData);
if (env('SEND_EMAIL') == true) {
$notify_emails = (isset($Campaign->notify_emails) && ($Campaign->notify_emails != "")) ? explode(",", $Campaign->notify_emails) : "prajwalbro@hotmail.com";
$mailer = new CustomMailer($requestData);
Mail::to($request['email'])->send($mailer->build());
Mail::cc($notify_emails)->send($mailer->build());
Mail::bcc("prajwalbro@hotmail.com")->send($mailer->build());
}
$success_messsage = $Campaign->success_messsage;
if (isset($Campaign->sms_message) && ($Campaign->sms_message != "")) {
$msg = $Campaign->sms_message;
$success_messsage = str_replace('%name%', $request['name'], $success_messsage);
$msg = str_replace('%name%', $request['name'], $msg);
if (env('SEND_SMS') == true) LMS::sendSMSWithCurl($requestData['mobile'], $msg);
}
} catch (\Exception $e) {
dd($e->getMessage());
DB::rollBack();
}
DB::commit();
return response()->json([
'status' => true,
'message' => ($success_messsage) ? $success_messsage : 'The Registration Created Successfully.',
'registration_id' => $registration->registration_id,
], 200);
}
function sendbulksms(Request $request)
{
$validator = Validator::make($request->all(), [
'message' => 'required', // Assuming 'users' is your table name and 'mobile' is the column
]);
if ($validator->fails()) {
return response()->json([
'status' => false,
'errors' => $validator->errors(),
'message' => 'Form validation failed.',
], 200); // 422 Unprocessable Entity
}
$mobile_nos = explode(",", $request->mobile);
//dd($mobile_nos);
$msg = $request->message;
foreach ($mobile_nos as $mobile) {
LMS::sendSMSWithCurl($mobile, $msg);
}
}
public function home(Request $request, $campaign_alias = null)
{
$alias = str_replace("_", "-", $campaign_alias);
$Campaign = Campaigns::where("status", "1")->where("alias", $alias)->first();
if ($Campaign) {
$viewPath = env("CLIENT_PATH") . ".landing.$campaign_alias";
// echo $viewPath;die;
if (view()->exists($viewPath))
return view($viewPath, compact("Campaign"));
else
return view(env("CLIENT_PATH") . '.home', compact("Campaign"));
}
switch ($campaign_alias) {
case 'office': // Student/Visitor office visit gareko bela, MOBILE bata QR Scan garera fill garne
return view("access.office-visits");
case 'spin_the_wheel': // Student/Visitor office visit gareko bela, MOBILE bata QR Scan garera fill garne
return view("games.spin_the_wheel.game");
case 'direct': //Office ko Reception Bata directly fill-in garne form
return view("backend.reception");
case 'online': //Adv etc run garda online default landing bata fill-in garne form
return view(env("CLIENT_PATH") . ".home");
default:
$Campaign = LMS::getActiveCampaign();
if ($Campaign) {
$viewPath = env("CLIENT_PATH") . ".landing.$Campaign->alias";
// echo $viewPath;die;
if (view()->exists($viewPath))
return view($viewPath, compact("Campaign"));
else
return view(env("CLIENT_PATH") . '.home', compact("Campaign"));
}
// $viewPath = env("CLIENT_PATH") . ".landing";
// if (view()->exists($viewPath))
// return view($viewPath, compact("Campaign"));
// else
// return view(env("CLIENT_PATH") . '.home', compact("Campaign"));
}
}
public function zapierrequest(Request $request)
{
//Office ko Reception Bata directly fill-in garne form
//return view("backend.reception");
$requiredFields = ['name', 'email', 'phone', 'qualification', 'passed', 'interest', 'source'];
if ($this->checkFieldsPresence($request, $requiredFields)) {
$campaign = Campaigns::orderBy("display_order", "ASC")->first();
$source = Sources::orderBy("display_order", "ASC")->first();
$data = [
'name' => $request->query('name'),
'email' => $request->query('email'),
'phone' => $request->query('phone'),
'mobile' => $request->query('phone'),
'highest_qualification' => $request->query('qualification'),
'highest_year' => $request->query('passed'),
'intrested_course' => $request->query('interest'),
// 'intrested_country' => $request->query('interest'),
'leadcategories_id' => 0,
'campaigns_id' => $campaign ? $campaign->campaign_id : null,
'sourcess_id' => $source ? $source->source_id : null,
'remarks' => $request->query('source')
];
Registrations::create($data);
return response()->json(['message' => 'Registration successful'], Response::HTTP_OK);
} else {
return response()->json(['message' => 'Registration Failed. Missing required fields.'], Response::HTTP_BAD_REQUEST);
}
}
private function checkFieldsPresence(Request $request, array $fields)
{
foreach ($fields as $field) {
if (!$request->query($field)) {
return false;
}
}
return true;
}
public function reception(Request $request)
{
//Office ko Reception Bata directly fill-in garne form
return view("backend.reception");
}
public function reception_registrations(Request $request)
{
$data = $this->filterRegistrations($request);
//Office ko Reception Bata directly fill-in garne form
return view("backend.reception.registrations", compact('data'));
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Registrations::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 = Registrations::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 view(Request $request, $id)
{
// $data = '';
if (Auth::check()) {
$data = Registrations::where(DB::raw('md5(registration_id)'), $id)->firstOrFail();
if ($data) {
$qrdata = [
'registrations_id' => $data->registration_id,
'qrscan_type' => ($request->qrscan_type) ? $request->qrscan_type : 'mannual scan',
'qrscan_location' => ($request->qrscan_type) ? $request->qrscan_type : 'office visit',
// Add other columns as needed
];
Qrscans::create($qrdata);
return view("access.steps.scanqr", compact('data'));
}
return "Sorry!!! It seems QR is INVALID";
} else {
// Redirect the user to the login page or handle the case where the user is not logged in
return redirect()->route('login'); // Adjust 'login' to the actual login route in your application
}
}
public function confirmation($id)
{
$data = '';
$data = Registrations::where(DB::raw('md5(registration_id)'), $id)->firstOrFail();
return view("lms.confirmation", compact('data'));
}
public function show(Request $request, $id)
{
createActivityLog(RegistrationsController::class, 'show', ' Registrations show');
$data = Registrations::findOrFail($id);
return view("crud.generated.registrations.show", compact('data'));
}
public function edit(Request $request, $id)
{
createActivityLog(RegistrationsController::class, 'edit', ' Registrations edit');
$TableData = Registrations::where('status', '<>', -1)->orderBy('display_order')->get();
$data = Registrations::findOrFail($id);
if ($request->ajax()) {
$html = view("crud.generated.registrations.ajax.edit", compact('data'))->render();
return response()->json(['status' => true, 'content' => $html], 200);
}
return view("crud.generated.registrations.edit", compact('data', 'TableData'));
}
public function ajaxedit(Request $request, $id)
{
createActivityLog(RegistrationsController::class, 'edit', ' Registrations edit');
$TableData = Registrations::where('status', '<>', -1)->orderBy('display_order')->get();
$data = Registrations::findOrFail($id);
return view("crud.generated.registrations.ajaxedit", compact('data', 'TableData'));
}
public function update(Request $request, $id)
{
createActivityLog(RegistrationsController::class, 'update', ' Registrations 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('registration_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(RegistrationsController::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 Registrations updated Successfully.'], 200);
}
// return redirect()->route('registrations.index')->with('success','The Registrations updated Successfully.');
return redirect()->back()->with('success', 'The Registrations updated successfully.');
}
public function destroy(Request $request, $id)
{
createActivityLog(RegistrationsController::class, 'destroy', ' Registrations destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(RegistrationsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Registrations Deleted Successfully.'], 200);
}
public function toggle(Request $request, $id)
{
createActivityLog(RegistrationsController::class, 'destroy', ' Registrations destroy');
$data = Registrations::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(RegistrationsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Registrations Deleted Successfully.'], 200);
}
}

View File

@ -0,0 +1,226 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Rolepermissions;
use App\Models\Permissions;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
class RolepermissionsController extends Controller
{
protected $modelService;
public function __construct(Rolepermissions $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
createActivityLog(RolepermissionsController::class, 'index', ' Rolepermissions index');
$data = Rolepermissions::where('status', '<>', -1)->orderBy('display_order')->get();
$PermissionGroups = Permissions::select('modal')
->where('status', '<>', -1)
->groupBy('modal')
->get();
foreach ($PermissionGroups as $Group) {
$Group->Commands = Permissions::where('status', '<>', -1)->where("modal", $Group->modal)->orderBy('command')->get();
}
// $Permissions = Permissions::where('status', '<>', -1)->orderBy('modal')->orderBy('command')->get();
return view("crud.generated.rolepermissions.index", compact('data', 'PermissionGroups'));
}
public function create(Request $request)
{
createActivityLog(RolepermissionsController::class, 'create', ' Rolepermissions create');
$TableData = Rolepermissions::where('status', '<>', -1)->orderBy('display_order')->get();
$editable = false;
return view("crud.generated.rolepermissions.edit", compact('TableData', 'editable'));
}
public function store(Request $request)
{
createActivityLog(RolepermissionsController::class, 'store', ' Rolepermissions 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_rolepermissions')]);
$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(RolepermissionsController::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 Rolepermissions Created Successfully.'], 200);
}
return redirect()->route('rolepermissions.index')->with('success', 'The Rolepermissions created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Rolepermissions::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 = Rolepermissions::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(RolepermissionsController::class, 'show', ' Rolepermissions show');
$data = Rolepermissions::findOrFail($id);
return view("crud.generated.rolepermissions.show", compact('data'));
}
public function edit(Request $request, $id)
{
createActivityLog(RolepermissionsController::class, 'edit', ' Rolepermissions edit');
$TableData = Rolepermissions::where('status', '<>', -1)->orderBy('display_order')->get();
$data = Rolepermissions::findOrFail($id);
$editable = true;
return view("crud.generated.rolepermissions.edit", compact('data', 'TableData', 'editable'));
}
public function update(Request $request, $id)
{
createActivityLog(RolepermissionsController::class, 'update', ' Rolepermissions 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('rolepermission_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(RolepermissionsController::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 Rolepermissions updated Successfully.'], 200);
}
// return redirect()->route('rolepermissions.index')->with('success','The Rolepermissions updated Successfully.');
return redirect()->back()->with('success', 'The Rolepermissions updated successfully.');
}
public function destroy(Request $request, $id)
{
createActivityLog(RolepermissionsController::class, 'destroy', ' Rolepermissions destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(RolepermissionsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Rolepermissions Deleted Successfully.'], 200);
}
public function toggle(Request $request, $id)
{
createActivityLog(RolepermissionsController::class, 'destroy', ' Rolepermissions destroy');
$data = Rolepermissions::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(RolepermissionsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Rolepermissions Deleted Successfully.'], 200);
}
public function clone (Request $request, $id)
{
createActivityLog(RolepermissionsController::class, 'clone', ' Rolepermissions clone');
$data = Rolepermissions::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(RolepermissionsController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Rolepermissions Clonned Successfully.'], 200);
}
}

View File

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

View File

@ -0,0 +1,198 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Settings;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
class SettingsController extends Controller
{
protected $modelService;
public function __construct(Settings $model)
{
$this->modelService = new CommonModelService($model);
}
public function index(Request $request)
{
createActivityLog(SettingsController::class, 'index', ' Settings index');
$data = Settings::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.settings.index", compact('data'));
}
public function create(Request $request)
{
createActivityLog(SettingsController::class, 'create', ' Settings create');
$TableData = Settings::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.settings.create",compact('TableData'));
}
public function store(Request $request)
{
createActivityLog(SettingsController::class, 'store', ' Settings 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_settings')]);
$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(SettingsController::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 Settings Created Successfully.'], 200);
}
return redirect()->route('settings.index')->with('success','The Settings created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Settings::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 = Settings::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(SettingsController::class, 'show', ' Settings show');
$data = Settings::findOrFail($id);
return view("crud.generated.settings.show", compact('data'));
}
public function edit(Request $request, $id)
{
createActivityLog(SettingsController::class, 'edit', ' Settings edit');
$TableData = Settings::where('status','<>',-1)->orderBy('display_order')->get();
$data = Settings::findOrFail($id);
if ($request->ajax()) {
$html = view("crud.generated.settings.ajax.edit", compact('data'))->render();
return response()->json(['status' => true, 'content' => $html], 200);
}
return view("crud.generated.settings.edit", compact('data','TableData'));
}
public function update(Request $request, $id)
{
createActivityLog(SettingsController::class, 'update', ' Settings 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('setting_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(SettingsController::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 Settings updated Successfully.'], 200);
}
// return redirect()->route('settings.index')->with('success','The Settings updated Successfully.');
return redirect()->back()->with('success', 'The Settings updated successfully.');
}
public function destroy(Request $request,$id)
{
createActivityLog(SettingsController::class, 'destroy', ' Settings destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(SettingsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Settings Deleted Successfully.'],200);
}
public function toggle(Request $request,$id)
{
createActivityLog(SettingsController::class, 'destroy', ' Settings destroy');
$data = Settings::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(SettingsController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Settings Deleted Successfully.'],200);
}
}

View File

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

View File

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

View File

@ -0,0 +1,218 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Vendortypes;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
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();
return view("crud.generated.vendortypes.index", compact('data'));
}
public function create(Request $request)
{
createActivityLog(VendortypesController::class, 'create', ' Vendortypes create');
$TableData = Vendortypes::where('status','<>',-1)->orderBy('display_order')->get();
$editable=false;
return view("crud.generated.vendortypes.edit",compact('TableData','editable'));
}
public function store(Request $request)
{
createActivityLog(VendortypesController::class, 'store', ' Vendortypes 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_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);
}
}

View File

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

View File

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

View File

@ -0,0 +1,37 @@
<?php
namespace App\Modules\Models\District;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class District extends Model
{
use HasFactory;
protected $fillable = [
'district_name',
'country_id',
'province_id',
'status',
];
public static function getDistricts()
{
return self::select('id', 'district_name')->where('status', 'Active')->get();
}
public static function getDistrictsByProvinceId($province_id)
{
return self::select('id', 'district_name')->where('status', 'Active')->where('state_id',$province_id)->get();
}
public static function getPermDistrictsByProvinceId($province_id)
{
return self::select('id', 'district_name')->where('status', 'Active')->where('state_id',$province_id)->get();
}
public static function getTempDistrictsByProvinceId($province_id)
{
return self::select('id', 'district_name')->where('status', 'Active')->where('state_id',$province_id)->get();
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Modules\Models\Eligibility;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Eligibility extends Model
{
protected $table = 'tbl_eligibilities';
use HasFactory;
protected $fillable = [
'stream',
'program_id',
'level',
'grade',
'display_order',
'remarks',
'status',
'created_by',
'created_on',
];
}

25
app/Models/Fee/Fee.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\Modules\Models\Fee;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Fee extends Model
{
protected $table = 'tbl_fees';
use HasFactory;
protected $fillable = [
'title',
'program_id',
'type',
'amount',
'display_order',
'remarks',
'status',
'created_by',
'created_on',
];
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Modules\Models\FollowUp;
use App\Modules\Models\LeadCategory\LeadCategory;
use App\Modules\Models\Registration\Registration;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class FollowUp extends Model
{
use HasFactory;
protected $table = 'tbl_follow_ups';
protected $fillable = [
'refrence_id',
'follow_up_type',
'next_schedule',
'follow_up_name',
'follow_up_by',
'remarks',
'leadcategory_id',
'status',
'created_by',
'last_updated_by'
];
public static function registration($id)
{
$query = DB::select("SELECT f.id,r.name,r.email,r.phone,f.next_schedule,f.follow_up_by,f.remarks FROM tbl_registrations r INNER JOIN tbl_follow_ups f ON f.refrence_id = r.id AND f.follow_up_type = 'registration' AND f.id = $id");
if(!empty($query)) {
return $query[0];
}
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Modules\Models\Intake;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Intake extends Model
{
protected $table = 'tbl_intakes';
use HasFactory;
protected $fillable = [
'title',
'program_id',
'intake_date',
'class_commencement',
'deadline_date',
'display_order',
'remarks',
'status',
'created_by',
'created_on',
];
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Modules\Models\LeadCategory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LeadCategory extends Model
{
use HasFactory;
protected $table = 'tbl_leadcategories';
protected $fillable = [
'name',
'color_code',
'status',
];
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Modules\Models\Location;
use App\Modules\Models\Registration\Registration;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Location extends Model
{
use HasFactory;
protected $table = 'tbl_locations';
protected $fillable = [
'name',
'slug',
'email',
'password',
'description',
'status',
'user_id',
];
public function registrations()
{
return $this->hasMany(Registration::class,'preffered_location','slug');
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Modules\Models\Municipality;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Municipality extends Model
{
use HasFactory;
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Modules\Models\Permission;
use App\Modules\Models\User;
use App\Modules\Models\Role;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Permission extends Model
{
use HasFactory;
protected $fillable= [
'name', 'slug', 'visibility','status', 'availability','is_deleted','group_name',
'deleted_at','created_by','last_updated_by','last_deleted_by'
];
protected $appends = [
'visibility_text', 'status_text', 'availability_text', 'thumbnail_path', 'image_path'
];
function getVisibilityTextAttribute(){
return ucwords(str_replace('_', ' ', $this->visibility));
}
function getStatusTextAttribute(){
return ucwords(str_replace('_', ' ', $this->status));
}
function getAvailabilityTextAttribute(){
return ucwords(str_replace('_', ' ', $this->availability));
}
function creator(){
return $this->belongsTo(User::class,'created_by');
}
function getImagePathAttribute(){
return $this->path.'/'. $this->image;
}
function getThumbnailPathAttribute(){
return $this->path.'/thumb/'. $this->image;
}
public function roles(){
return $this->belongsToMany(Role::class,'role_has_permissions');
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Modules\Models\Program;
use App\Modules\Models\Criteria\Criteria;
use App\Modules\Models\Eligibility\Eligibility;
use App\Modules\Models\Fee\Fee;
use App\Modules\Models\Intake\Intake;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Program extends Model
{
protected $table = 'tbl_programs';
use HasFactory;
protected $fillable = [
'title',
'description',
'checklist_documents',
'image',
'contact_person',
'contact_email',
'contact_number',
'special_instruction',
'display_order',
'remarks',
'status',
'created_by',
'created_on',
];
public function intakes()
{
return $this->hasMany(Intake::class,'program_id','id');
}
public function fees()
{
return $this->hasMany(Fee::class,'program_id','id');
}
public function eligibilities()
{
return $this->hasMany(Eligibility::class,'program_id','id');
}
public function criterias()
{
return $this->hasMany(Criteria::class,'program_id','id');
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Modules\Models\Province;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Province extends Model
{
use HasFactory;
protected $fillable = [
'province_name',
'country_id',
'status',
];
public function country()
{
return $this->belongsTo(Country::class);
}
public static function getProvinces()
{
return self::select('id','province_name')->where('status','Active')->get();
}
public static function getProvincesByCountryId($country_id)
{
return self::select('id','province_name')->where('status','Active')->where('country_id',$country_id)->get();
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Modules\Models\Qualification;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Qualification extends Model
{
protected $table = 'tbl_qualifications';
use HasFactory;
protected $fillable = [
'name',
'description',
'status',
];
}

View File

@ -0,0 +1,94 @@
<?php
namespace App\Modules\Models\Registration;
use App\Modules\Models\Campaign\Campaign;
use App\Modules\Models\FollowUp\FollowUp;
use App\Modules\Models\LeadCategory\LeadCategory;
use App\Modules\Models\Student\Student;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Registration extends Model
{
protected $table = 'tbl_registrations';
use HasFactory;
protected $fillable = [
'campaign_id',
'name',
'email',
'phone',
'address',
'city',
'state',
'zone',
'nearest_landmark',
'preffered_location',
'see_year',
'see_grade',
'headers',
'country_id',
'state_id',
'district_id',
'municipality_name',
'ward_no',
'village_name',
'full_address',
'user_agent',
'see_stream',
'see_school',
'plus2_year',
'plus2_grade',
'plus2_stream',
'plus2_college',
'bachelors_year',
'bachelors_grade',
'bachelors_stream',
'bachelors_college',
'highest_qualification',
'highest_grade',
'highest_stream',
'highest_college',
'preparation_class',
'preparation_score',
'preparation_bandscore',
'preparation_date',
'test_name',
'coupen_code',
'test_score',
'intrested_for_country',
'intrested_course',
'source',
'display_order',
'remarks',
'status',
'created_by',
'created_on',
];
public static function getFollowUp($id)
{
return FollowUp::select('id','next_schedule','follow_up_name','follow_up_by','remarks')->where('follow_up_type','registration')->where('refrence_id',$id)->latest()->first();
}
public static function getFollowUpCount($id)
{
return FollowUp::select('id','next_schedule','follow_up_name','follow_up_by','remarks')->where('follow_up_type','registration')->where('refrence_id',$id)->latest()->get();
}
public function leadcategory()
{
return $this->belongsTo(LeadCategory::class);
}
public function campaign()
{
return $this->belongsTo(Campaign::class);
}
public function enroll($id) {
return Student::select('id')->where('source_ref','registration')->where('ref_id',$id)->latest()->first();
}
}

49
app/Models/Role/Role.php Normal file
View File

@ -0,0 +1,49 @@
<?php
namespace App\Modules\Models\Role;
use App\Modules\Models\Permission\Permission;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
protected $fillable= [
'name', 'slug', 'visibility','status', 'availability','is_deleted',
'deleted_at','created_by','last_updated_by','last_deleted_by'
];
protected $appends = [
'visibility_text', 'status_text', 'availability_text', 'thumbnail_path', 'image_path'
];
public function permissions(){
return $this->belongsToMany(Permission::class,'role_has_permissions');
}
function getVisibilityTextAttribute(){
return ucwords(str_replace('_', ' ', $this->visibility));
}
function getStatusTextAttribute(){
return ucwords(str_replace('_', ' ', $this->status));
}
function getAvailabilityTextAttribute(){
return ucwords(str_replace('_', ' ', $this->availability));
}
function creator(){
return $this->belongsTo(User::class,'created_by');
}
function getImagePathAttribute(){
return $this->path.'/'. $this->image;
}
function getThumbnailPathAttribute(){
return $this->path.'/thumb/'. $this->image;
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Modules\Models\Setting;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
use HasFactory;
protected $table = 'tbl_settings';
protected $fillable = [
'slug','title', 'value', 'is_active'
];
protected $casts = [
'is_active' => 'boolean'
];
public function scopeFetch($query, $slug)
{
return $query->whereSlug($slug);
}
public function scopeActive($query, $type = true)
{
return $query->whereIsActive($type);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Modules\Models\State;
use App\Modules\Models\Country\Country;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class State extends Model
{
use HasFactory;
protected $fillable = [
'state_name',
'country_id',
'status',
];
public function country()
{
return $this->belongsTo(Country::class);
}
public static function getStates()
{
return self::select('id','state_name')->where('status','Active')->get();
}
public static function getStatesByCountryId($country_id)
{
return self::select('id','state_name')->where('status','Active')->where('country_id',$country_id)->get();
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Modules\Models\Student;
use App\Modules\Models\Admission\Admission;
use App\Modules\Models\Agent\Agent;
use App\Modules\Models\Country\Country;
use App\Modules\Models\District\District;
use App\Modules\Models\Location\Location;
use App\Modules\Models\State\State;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Student extends Model
{
protected $table = 'tbl_students';
use HasFactory;
protected $fillable = [
'applicant',
'first_name',
'middle_name',
'last_name',
'gender',
'material_status',
'spouse_name',
'father_name',
'mother_name',
'mobile_no',
'alternate_mobile_no',
'email',
'dob',
'country_id',
'state_id',
'source_ref',
'ref_id',
'district_id',
'municipality_name',
'ward_no',
'intake_year',
'intake_month',
'village_name',
'full_address',
'preffered_location',
'intrested_for_country',
'intrested_course',
'status',
'created_by',
'updated_by',
];
public function admission(){
return $this->belongsTo(Admission::class,'id','student_id');
}
public function educations()
{
return $this->hasMany(StudentEducation::class,'student_id','id');
}
public function languages()
{
return $this->hasMany(StudentLanguage::class,'student_id','id');
}
public function fields()
{
return $this->hasMany(StudentField::class,'student_id','id');
}
public function agent(){
return $this->belongsTo(Agent::class,'ref_id','id');
}
public function location(){
return $this->belongsTo(Location::class,'ref_id','id');
}
public function student_country(){
return $this->belongsTo(Country::class,'country_id','id');
}
public function student_state(){
return $this->belongsTo(State::class,'state_id','id');
}
public function student_district(){
return $this->belongsTo(District::class,'district_id','id');
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Modules\Models\Student;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class StudentEducation extends Model
{
use HasFactory;
protected $table = 'tbl_student_education';
protected $fillable = [
'student_id',
'level',
'university',
'percentage',
'documents',
];
public static function getStudents()
{
// $records = DB::table('candidates')->select('id','first_name','middle_name','last_name','gender','material_status','spouse_name','father_name','mother_name','mobile_no','alternate_mobile_no','email','dob','full_address','status','is_active')->get()->toArray();
$records = DB::table('candidates')
->join('candidate_passports','candidate_passports.candidate_id','candidates.id')
->join('countries','countries.id','candidates.country_id')
->join('provinces','provinces.id','candidates.province_id')
->join('districts','districts.id','candidates.district_id')
->join('districts AS cid','cid.id','candidate_passports.citizenship_issue_district')
->select('candidates.id','candidates.first_name','candidates.middle_name','candidates.last_name','candidates.gender','candidates.spouse_name','candidates.father_name','candidates.mother_name','candidates.mobile_no','candidates.alternate_mobile_no','candidates.email','candidates.dob','countries.country_name','provinces.province_name','districts.district_name','candidates.municipality_name','candidates.ward_no','candidates.full_address','candidate_passports.passport_number','candidate_passports.passport_issue_date','candidate_passports.passport_expiry_date','candidate_passports.citizenship_number','candidate_passports.citizenship_issue_date','cid.district_name AS cid_name')
->get()
->toArray();
return $records;
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Modules\Models\Student;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class StudentField extends Model
{
use HasFactory;
protected $fillable = [
'student_id',
'name',
];
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Modules\Models\Student;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class StudentLanguage extends Model
{
use HasFactory;
protected $table = 'tbl_student_languages';
protected $fillable = [
'student_id',
'language',
'score',
'language_documents',
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Modules\Models\TestPreparation;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TestPreparation extends Model
{
protected $table = 'tbl_testpreparations';
use HasFactory;
protected $fillable = [
'name',
'description',
'status',
];
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Traits;
trait CreatedUpdatedBy
{
public static function bootCreatedUpdatedBy()
{
// updating created_by and updated_by when model is created
static::creating(function ($model) {
if (!$model->isDirty('createdBy')) {
$model->createdBy = auth()->user() ? auth()->user()->id : null;
}
if (!$model->isDirty('updatedBy')) {
$model->updatedBy = auth()->user() ? auth()->user()->id : null;
}
if ($model->isDirty('createdOn') && !$model->isDirty('createdOn')) {
$model->createdOn = now();
}
if (!$model->isDirty('status')) {
$model->status = 1;
}
});
// updating updated_by when model is updated
static::updating(function ($model) {
if (!$model->isDirty('updatedBy')) {
$model->updatedBy = auth()->user() ? auth()->user()->id : 1;
}
});
}
}

View File

@ -0,0 +1,39 @@
@extends('backend.template')
@section('content')
<div class="nk-content">
<div class="container-fluid">
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="nk-content-inner">
<form method="get" action="{{ route('form.store') }}" enctype="multipart/form-data">
{{Label('Operation')}}
{{ customCreateSelect('type', 'type', '', '', ['ajax-curd' => 'Ajax CURD']) }}
{{Label('Table Name')}}
{{ customCreateSelect('tableName', 'tableName', 'form-control custom-select2', '', $allTables) }}
{{Label('Write To')}}
{{ createText('directoryName', 'directoryName', 'Directory Name') }}
<?php createButton('mt-3 btn-primary', '', 'Submit'); ?>
</form>
</div>
</div>
</div>
@endsection
@push('js')
<script>
$(document).ready(function() {
$('.custom-select2').select2();
});
</script>
@endpush

View File

@ -0,0 +1,65 @@
@extends('backend.template')
@section('content')
<div class="nk-content">
<div class="container">
<div class="nk-content-inner">
<div class="nk-content-body">
<div class="nk-block-head">
<div class="nk-block-head-between flex-wrap gap g-2">
<div class="nk-block-head-content">
<h2 class="nk-block-title">Tables in Database</h1>
</div>
</div>
</div>
<div class="nk-block">
<div class="card">
<div class="accordion" id="accordionTables">
<?php $a = 0; ?>
@foreach ($allTables as $Table)
<?php $a++; ?>
<div class="accordion-item">
<h2 class="accordion-header"> <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapse{{$a}}"> {{$a}}: {{$Table->tablename}} </button> </h2>
<div id="collapse{{$a}}" class="accordion-collapse collapse" data-bs-parent="#accordionTables">
<div class="accordion-body">
<table class="datatable-init table" data-nk-container="table-responsive">
<thead class="table-dark">
<tr>
<th class="tb-col"><span class="overline-title">S.N.</span></th>
<th class="tb-col"><span class="overline-title">{{__('lang.Column')}}</span></th>
<th class="tb-col"><span class="overline-title">{{label("Datatype")}}</span></th>
</tr>
</thead>
<tbody>
<?php $sn = 0; ?>
@foreach($Table->tablecolumns as $column)
<tr>
<?php $sn++; ?>
<td class="tb-col"><span >{{$sn}}</span></td>
<td class="tb-col"><span > {{$column->COLUMN_NAME}}</span></td>
<td class="tb-col"><span > {{$column->COLUMN_TYPE}}</span></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('js')
<script>
$(document).ready(function() {
$('.custom-select2').select2();
});
</script>
@endpush

BIN
resources/views/crud/generated/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,26 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Branche') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('branches.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('branches.update',[$data->branch_id]):route('branches.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='branch_id' value='{{$editable?$data->branch_id:''}}'/>
<div class="row"><div class="col-lg-6">{{createCustomSelect('tbl_companies', 'title', 'company_id', $editable?$data->companies_id:'', 'Companies Id','companies_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}}
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}}
</div><div class="col-lg-6">{{createText("email","email","Email",'',$editable?$data->email:'')}}
</div><div class="col-lg-6">{{createText("telephone","telephone","Telephone",'',$editable?$data->telephone:'')}}
</div><div class="col-lg-6">{{createText("phone1","phone1","Phone1",'',$editable?$data->phone1:'')}}
</div><div class="col-lg-6">{{createText("phone2","phone2","Phone2",'',$editable?$data->phone2:'')}}
</div><div class="col-lg-6">{{createText("address","address","Address",'',$editable?$data->address:'')}}
</div><div class="col-lg-6">{{createText("company_reg","company_reg","Company Reg",'',$editable?$data->company_reg:'')}}
</div><div class="col-lg-6">{{createText("company_pan","company_pan","Company Pan",'',$editable?$data->company_pan:'')}}
</div><div class="col-lg-12 pb-2">{{createImageInput("logo","Logo",'',$editable?$data->logo:'')}}
</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('branches.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,26 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Edit Branches') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('branches.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('branches.update',[$data->branch_id]):route('branches.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='branch_id' value='{{$editable?$data->branch_id:''}}'/>
<div class="row"><div class="col-lg-6">{{createCustomSelect('tbl_companies', 'title', 'company_id', $editable?$data->companies_id:'', 'Companies Id','companies_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}}
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}}
</div><div class="col-lg-6">{{createText("email","email","Email",'',$editable?$data->email:'')}}
</div><div class="col-lg-6">{{createText("telephone","telephone","Telephone",'',$editable?$data->telephone:'')}}
</div><div class="col-lg-6">{{createText("phone1","phone1","Phone1",'',$editable?$data->phone1:'')}}
</div><div class="col-lg-6">{{createText("phone2","phone2","Phone2",'',$editable?$data->phone2:'')}}
</div><div class="col-lg-6">{{createText("address","address","Address",'',$editable?$data->address:'')}}
</div><div class="col-lg-6">{{createText("company_reg","company_reg","Company Reg",'',$editable?$data->company_reg:'')}}
</div><div class="col-lg-6">{{createText("company_pan","company_pan","Company Pan",'',$editable?$data->company_pan:'')}}
</div><div class="col-lg-12 pb-2">{{createImageInput("logo","Logo",'',$editable?$data->logo:'')}}
</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('branches.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,289 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Branches List") }}</h2>
<a href="{{ route('branches.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_branches" data-url="{{ route('branches.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("companies") }}</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("email") }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("telephone") }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("phone1") }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("phone2") }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("address") }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("company_reg") }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("company_pan") }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("logo") }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("is_main") }}</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->branch_id}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>">
<td class="tb-col">{{ $i++ }}</td><td class="tb-col">
{!! getFieldData("tbl_companies", "title", "company_id", $item->companies_id) !!}
</td><td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{$item->branch_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->branch_id}}" />
</div>
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
</td>
<td class="tb-col">{{ $item->email }}</td>
<td class="tb-col">{{ $item->telephone }}</td>
<td class="tb-col">{{ $item->phone1 }}</td>
<td class="tb-col">{{ $item->phone2 }}</td>
<td class="tb-col">{{ $item->address }}</td>
<td class="tb-col">{{ $item->company_reg }}</td>
<td class="tb-col">{{ $item->company_pan }}</td>
<td class="tb-col">{{ showImageThumb($item->logo) }}</td>
<td class="tb-col">{{ $item->is_main }}</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('branches.show',[$item->branch_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('branches.edit',[$item->branch_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('branches.toggle',[$item->branch_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('branches.clone',[$item->branch_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{route('branches.destroy',[$item->branch_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></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('branches.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('branches.index')); ?>
</div>
<div class='card-body'>
<p><b>Companies Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->companies_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>Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->description}}</span></p><p><b>Email :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->email}}</span></p><p><b>Telephone :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->telephone}}</span></p><p><b>Phone1 :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->phone1}}</span></p><p><b>Phone2 :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->phone2}}</span></p><p><b>Address :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->address}}</span></p><p><b>Company Reg :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->company_reg}}</span></p><p><b>Company Pan :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->company_pan}}</span></p><p><b>Logo :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->logo}}</span></p><p><b>Is Main :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->is_main}}</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>
@endSection

View File

@ -0,0 +1,17 @@
@extends('backend.template')
@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

@ -0,0 +1,268 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Caste List") }}</h2>
<a href="{{ route('castes.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" 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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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('castes.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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

@ -0,0 +1,18 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Cities') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('cities.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('cities.update',[$data->city_id]):route('cities.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='city_id' value='{{$editable?$data->city_id:''}}'/>
<div class="row"><div class="col-lg-6">{{createCustomSelect('tbl_districts', 'title', 'district_id', $editable?$data->districts_id:'', 'Districts Id','districts_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}}
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}}
</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}}
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?>
<?php createButton("btn-primary btn-cancel","","Cancel",route('cities.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,271 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Cities List") }}</h2>
<a href="{{ route('cities.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_cities" data-url="{{ route('cities.sort') }}">
<thead class="table-light">
<tr>
<th class="tb-col"><span class="overline-title">{{label("Sn.")}}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("districts") }}</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->city_id}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>">
<td class="tb-col">{{ $i++ }}</td><td class="tb-col">
{!! getFieldData("tbl_districts", "title", "district_id", $item->districts_id) !!}
</td><td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{$item->city_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->city_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('cities.show',[$item->city_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('cities.edit',[$item->city_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('cities.toggle',[$item->city_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('cities.clone',[$item->city_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{route('cities.destroy',[$item->city_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></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('cities.updatealias') }}";
var data = {
articleId: articleId,
newAlias: newAlias
};
$.ajax({
url: ajaxUrl,
type: 'POST',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: data,
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error(error);
}
});
} else {
// Switch to editing state
aliasSpan.hide();
aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias');
}
});
var mytable = $(".dataTable").DataTable({
ordering: true,
rowReorder: {
//selector: 'tr'
},
});
var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true;
});
mytable.on('draw', function() {
if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id');
}).toArray();
console.log(ids);
$.ajax({
url: url,
type: "POST",
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
},
data: {
id_order: ids
},
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error(error);
}
});
isRowReorderComplete=false;
}
});
});
function confirmDelete(url) {
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'You will not be able to recover this item!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Delete',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'DELETE',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload();
},
error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
}
});
}
});
}
function confirmToggle(url) {
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'GET',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(response) {
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
location.reload();
},
error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error');
}
});
}
});
}
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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('cities.index')); ?>
</div>
<div class='card-body'>
<p><b>Districts Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->districts_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>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>
@endSection

View File

@ -0,0 +1,19 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Company') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('companies.index')); ?>
</div>
<div class='card-body'>
<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">{{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-6">{{createText("address","address","Address",'',$editable?$data->address:'')}}
</div><div class="col-lg-6">{{createCustomSelect('tbl_cities', 'title', 'city_id', $editable?$data->cities_id:'', 'Cities Id','cities_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-6">{{createCustomSelect('tbl_companytypes', 'title', 'companytype_id', $editable?$data->companytypes_id:'', 'Companytypes Id','companytypes_id', 'form-control select2','status<>-1')}}</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('companies.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,276 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<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="table dataTable" 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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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('companies.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('companies.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>Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->description}}</span></p><p><b>Address :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->address}}</span></p><p><b>Cities Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->cities_id}}</span></p><p><b>Companytypes Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->companytypes_id}}</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>
@endSection

View File

@ -0,0 +1,18 @@
@extends('backend.template')
@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>
<div class='card-body'>
<form action="{{$editable?route('companytypes.update',[$data->companytype_id]):route('companytypes.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='companytype_id' value='{{$editable?$data->companytype_id:''}}'/>
<div class="row"><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}}
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}}
</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}}
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?>
<?php createButton("btn-primary btn-cancel","","Cancel",route('companytypes.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,268 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Company Type List") }}</h2>
<a href="{{ route('companytypes.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" 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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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('companytypes.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('companytypes.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>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>
@endSection

View File

@ -0,0 +1,34 @@
@extends('backend.template')
@section('content')
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">Add Country</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">Add Country</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<form action="{{route('countries.store')}}" id="storeCustomForm" method="POST">
@csrf
<div class='card'>
<div class='card-body'>
<div class="row">
<div class="col-lg-12">{{createText("title","title","Title")}}</div>
<div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description")}}</div>
<div class="col-lg-12 pb-2">{{createPlainTextArea("remarks","remarks ","Remarks")}}</div>
</div>
</div>
</div>
<div class="col-md-12">
<?php createButton("btn-primary btn-store","","Submit"); ?>
<?php createButton("btn-danger btn-cancel","","Cancel",route('countries.index')); ?>
</div>
</form>
@endsection

View File

@ -0,0 +1,39 @@
@extends('backend.template')
@section('content')
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">Edit Country </h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">Edit Country </li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<form action="{{route('countries.update',[$data->country_id])}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='country_id' value='{{$data->country_id}}'/>
<div class='card'>
<div class='card-body'>
<div class="row">
<div class="col-lg-12">{{createText("title","title","Title",'',$data->title)}}</div>
<div class="col-lg-12 pb-4">{{createTextarea("description","description ckeditor-classic","Description",$data->description)}}</div>
<div class="border border-dashed"></div>
<div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$data->remarks)}}</div>
</div>
</div>
<div class="card-footer">
<div class="col-md-12"><?php createButton("btn-primary btn-update","","Update"); ?>
<?php createButton("btn-danger btn-cancel","","Cancel",route('countries.index')); ?>
</div>
</div>
</div>
</form>
@endsection

View File

@ -0,0 +1,241 @@
@extends('backend.template')
@section('content')
<div class="row">
<div class="col-lg-4">
<form action="{{route('countries.store')}}" id="storeCustomForm" method="POST">
@csrf
<div class='card'>
<div class="card-header">
<h2 class="card-title mb-0">Add Country</h2>
</div>
<div class='card-body'>
<div class="row">
<div class="col-lg-12">{{createText("title","title","Title")}}</div>
<div class="border border-dashed"></div>
<div class="col-lg-12 pb-3">{{createTextarea("description","description ","Description")}}</div>
<div class="border border-dashed"></div>
<div class="col-lg-12 pb-2">{{createPlainTextArea("remarks","remarks ","Remarks")}}</div>
</div>
</div>
<div class="card-footer">
<div class="col-md-12">
<?php createButton("btn-primary btn-store", "", "Submit");?>
<?php createButton("btn-danger btn-cancel", "", "Cancel", route('countries.index'));?>
</div>
</div>
</div>
</form>
</div>
<div class="col-lg-8">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2 class="card-title mb-0">{{ label("Countries List") }}</h2>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_countries" data-url="{{ route('countries.sort') }}">
<thead class="table-light">
<tr>
<th class="tb-col text-uppercase"><span class="overline-title">{{label("Sn.")}}</span></th>
<th class="tb-col text-uppercase"><span class="overline-title">{{ label("title") }}</span></th>
<th class="tb-col text-uppercase"><span class="overline-title">{{ label("alias") }}</span></th>
<th class="tb-col text-uppercase" data-sortable="false"><span
class="overline-title">{{ label("Action") }}</span>
</th>
</tr>
</thead>
<tbody>
@php
$i = 1;
@endphp
@foreach ($data as $item)
<tr data-id="{{$item->country_id}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status == 0) ? "bg-light bg-danger" : ""; ?>">
<td class="tb-col">{{ $i++ }}</td><td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{$item->country_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->country_id}}" />
</div>
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
</td>
<td class="tb-col">
<div class="dropdown d-inline-block">
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-fill align-middle"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a href="{{route('countries.show',[$item->country_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('countries.edit',[$item->country_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('countries.toggle',[$item->country_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('countries.destroy',[$item->country_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> {{ label('Delete') }}
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push("css")
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@endpush
@push("js")
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
$(document).ready(function(e) {
$('.change-alias-badge').on('click', function() {
var aliasWrapper = $(this).prev('.alias-wrapper');
var aliasSpan = aliasWrapper.find('.alias');
var aliasInput = aliasWrapper.find('.alias-input');
var isEditing = $(this).hasClass('editing');
aliasInput.toggleClass("d-none");
if (isEditing) {
// Update alias text and switch to non-editing state
var newAlias = aliasInput.val();
aliasSpan.text(newAlias);
aliasSpan.show();
aliasInput.hide();
$(this).removeClass('editing').text('Change Alias');
var articleId = $(aliasWrapper).data('id');
var ajaxUrl = "{{ route('countries.updatealias') }}";
var data = {
articleId: articleId,
newAlias: newAlias
};
$.ajax({
url: ajaxUrl,
type: 'POST',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: data,
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error(error);
}
});
} else {
// Switch to editing state
aliasSpan.hide();
aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias');
}
});
var mytable = $(".dataTable").DataTable({
ordering: true,
rowReorder: {
//selector: 'tr'
},
});
var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true;
});
mytable.on('draw', function() {
if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id');
}).toArray();
console.log(ids);
$.ajax({
url: url,
type: "POST",
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
},
data: {
id_order: ids
},
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error(error);
}
});
isRowReorderComplete=false;
}
});
});
function confirmDelete(url) {
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'You will not be able to recover this item!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Delete',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'DELETE',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload();
},
error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
}
});
}
});
}
function confirmToggle(url) {
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'GET',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(response) {
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
location.reload();
},
error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error');
}
});
}
});
}
</script>
@endpush

View File

@ -0,0 +1,29 @@
@extends('backend.template')
@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('countries.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>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>
@endSection

View File

@ -0,0 +1,17 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Dags') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('dags.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('dags.update',[$data->dag_id]):route('dags.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='dag_id' value='{{$editable?$data->dag_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('dags.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,268 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Dags List") }}</h2>
<a href="{{ route('dags.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_dags" data-url="{{ route('dags.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->dag_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->dag_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->dag_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('dags.show',[$item->dag_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('dags.edit',[$item->dag_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('dags.toggle',[$item->dag_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('dags.clone',[$item->dag_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{route('dags.destroy',[$item->dag_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></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('dags.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('dags.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

@ -0,0 +1,18 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Department') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('departments.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('departments.update',[$data->department_id]):route('departments.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='department_id' value='{{$editable?$data->department_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-lg-6">{{createCustomSelect('tbl_branches', 'title', 'branch_id', $editable?$data->branches_id:'', 'Branches Id','branches_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}}
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?>
<?php createButton("btn-primary btn-cancel","","Cancel",route('departments.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,271 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Departments List") }}</h2>
<a href="{{ route('departments.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_departments" data-url="{{ route('departments.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("branches") }}</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->department_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->department_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->department_id}}" />
</div>
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
</td>
<td class="tb-col">
{!! getFieldData("tbl_branches", "title", "branch_id", $item->branches_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('departments.show',[$item->department_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('departments.edit',[$item->department_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('departments.toggle',[$item->department_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('departments.clone',[$item->department_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{route('departments.destroy',[$item->department_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></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('departments.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('departments.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><p><b>Branches Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->branches_id}}</span></p><p><b>Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->description}}</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

@ -0,0 +1,18 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Designations') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('designations.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('designations.update',[$data->designation_id]):route('designations.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='designation_id' value='{{$editable?$data->designation_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-lg-6">{{createText("job_description","job_description","Job Description",'',$editable?$data->job_description:'')}}
</div><div class="col-lg-6">{{createCustomSelect('tbl_departments', 'title', 'department_id', $editable?$data->departments_id:'', 'Departments Id','departments_id', 'form-control select2','status<>-1')}}</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?>
<?php createButton("btn-primary btn-cancel","","Cancel",route('designations.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,273 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Designations List") }}</h2>
<a href="{{ route('designations.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_designations" data-url="{{ route('designations.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("job_description") }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("departments") }}</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->designation_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->designation_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->designation_id}}" />
</div>
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
</td>
<td class="tb-col">{{ $item->job_description }}</td>
<td class="tb-col">
{!! getFieldData("tbl_departments", "title", "department_id", $item->departments_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('designations.show',[$item->designation_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('designations.edit',[$item->designation_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('designations.toggle',[$item->designation_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('designations.clone',[$item->designation_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{route('designations.destroy',[$item->designation_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></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('designations.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('designations.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><p><b>Job Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->job_description}}</span></p><p><b>Departments Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->departments_id}}</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

@ -0,0 +1,18 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Districts') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('districts.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('districts.update',[$data->district_id]):route('districts.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='district_id' value='{{$editable?$data->district_id:''}}'/>
<div class="row"><div class="col-lg-6">{{createCustomSelect('tbl_proviences', 'title', 'provience_id', $editable?$data->proviences_id:'', 'Proviences Id','proviences_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}}
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}}
</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}}
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?>
<?php createButton("btn-primary btn-cancel","","Cancel",route('districts.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,271 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Districts List") }}</h2>
<a href="{{ route('districts.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_districts" data-url="{{ route('districts.sort') }}">
<thead class="table-light">
<tr>
<th class="tb-col"><span class="overline-title">{{label("Sn.")}}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("proviences") }}</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->district_id}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>">
<td class="tb-col">{{ $i++ }}</td><td class="tb-col">
{!! getFieldData("tbl_proviences", "title", "provience_id", $item->proviences_id) !!}
</td><td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{$item->district_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->district_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('districts.show',[$item->district_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('districts.edit',[$item->district_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('districts.toggle',[$item->district_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('districts.clone',[$item->district_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{route('districts.destroy',[$item->district_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></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('districts.updatealias') }}";
var data = {
articleId: articleId,
newAlias: newAlias
};
$.ajax({
url: ajaxUrl,
type: 'POST',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: data,
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error(error);
}
});
} else {
// Switch to editing state
aliasSpan.hide();
aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias');
}
});
var mytable = $(".dataTable").DataTable({
ordering: true,
rowReorder: {
//selector: 'tr'
},
});
var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true;
});
mytable.on('draw', function() {
if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id');
}).toArray();
console.log(ids);
$.ajax({
url: url,
type: "POST",
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
},
data: {
id_order: ids
},
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error(error);
}
});
isRowReorderComplete=false;
}
});
});
function confirmDelete(url) {
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'You will not be able to recover this item!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Delete',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'DELETE',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload();
},
error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
}
});
}
});
}
function confirmToggle(url) {
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'GET',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(response) {
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
location.reload();
},
error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error');
}
});
}
});
}
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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('districts.index')); ?>
</div>
<div class='card-body'>
<p><b>Proviences Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->proviences_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>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>
@endSection

View File

@ -0,0 +1,129 @@
@extends('backend.template')
@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

@ -0,0 +1,336 @@
@extends('backend.template')
@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="table dataTable" 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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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

@ -0,0 +1,29 @@
@extends('backend.template')
@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

@ -0,0 +1,17 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Ethnicities') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('ethnicities.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('ethnicities.update',[$data->ethnicity_id]):route('ethnicities.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='ethnicity_id' value='{{$editable?$data->ethnicity_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('ethnicities.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,268 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Ethnicities List") }}</h2>
<a href="{{ route('ethnicities.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_ethnicities" data-url="{{ route('ethnicities.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->ethnicity_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->ethnicity_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->ethnicity_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('ethnicities.show',[$item->ethnicity_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('ethnicities.edit',[$item->ethnicity_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('ethnicities.toggle',[$item->ethnicity_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('ethnicities.clone',[$item->ethnicity_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{route('ethnicities.destroy',[$item->ethnicity_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></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('ethnicities.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('ethnicities.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

@ -0,0 +1,17 @@
@extends('backend.template')
@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

View File

@ -0,0 +1,268 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Genders List") }}</h2>
<a href="{{ route('genders.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" 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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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('genders.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('genders.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

@ -0,0 +1,17 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Leaves') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('leaves.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('leaves.update',[$data->leave_id]):route('leaves.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='leave_id' value='{{$editable?$data->leave_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-lg-6">{{createCustomSelect('tbl_leavetypes', 'title', 'leavetype_id', $editable?$data->leavetypes_id:'', 'Leavetypes Id','leavetypes_id', 'form-control select2','status<>-1')}}</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?>
<?php createButton("btn-primary btn-cancel","","Cancel",route('leaves.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,271 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Leaves List") }}</h2>
<a href="{{ route('leaves.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_leaves" data-url="{{ route('leaves.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("leavetypes") }}</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->leave_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->leave_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->leave_id}}" />
</div>
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
</td>
<td class="tb-col">
{!! getFieldData("tbl_leavetypes", "title", "leavetype_id", $item->leavetypes_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('leaves.show',[$item->leave_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('leaves.edit',[$item->leave_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('leaves.toggle',[$item->leave_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('leaves.clone',[$item->leave_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{route('leaves.destroy',[$item->leave_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></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('leaves.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('leaves.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><p><b>Leavetypes Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->leavetypes_id}}</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

@ -0,0 +1,17 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Leavetypes') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('leavetypes.index')); ?>
</div>
<div class='card-body'>
<form action="{{$editable?route('leavetypes.update',[$data->leavetype_id]):route('leavetypes.store')}}" id="updateCustomForm" method="POST" >
@csrf <input type=hidden name='leavetype_id' value='{{$editable?$data->leavetype_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('leavetypes.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,268 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Leavetypes List") }}</h2>
<a href="{{ route('leavetypes.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_leavetypes" data-url="{{ route('leavetypes.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->leavetype_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->leavetype_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->leavetype_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('leavetypes.show',[$item->leavetype_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('leavetypes.edit',[$item->leavetype_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('leavetypes.toggle',[$item->leavetype_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('leavetypes.clone',[$item->leavetype_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{route('leavetypes.destroy',[$item->leavetype_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></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('leavetypes.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

@ -0,0 +1,29 @@
@extends('backend.template')
@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('leavetypes.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

@ -0,0 +1,17 @@
@extends('backend.template')
@section('content')
<div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Nationalities') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('nationalities.index')); ?>
</div>
<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-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('nationalities.index')); ?>
</div> </form></div></div>
@endsection

View File

@ -0,0 +1,268 @@
@extends('backend.template')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Nationalities List") }}</h2>
<a href="{{ route('nationalities.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a>
</div>
<div class="card-body">
<table class="table dataTable" 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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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 align-bottom me-2 text-muted"></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('nationalities.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

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