Compare commits
23 Commits
6b6696ded4
...
hr
Author | SHA1 | Date | |
---|---|---|---|
bf44886663 | |||
2c2526ef72 | |||
9a50f296fe | |||
d1851922ec | |||
e9c62209d4 | |||
158765a250 | |||
6ae0143005 | |||
efe174e3b3 | |||
c7c79e69a5 | |||
d80b1aa0e9 | |||
c378522598 | |||
7e345ef4e3 | |||
8d4ae8c598 | |||
91e7943546 | |||
1dbc6cabf8 | |||
e0fe321cb7 | |||
3267e212f7 | |||
b5c603ceec | |||
c1a81191fa | |||
d92366b1f4 | |||
c019fcb02d | |||
4eace5b650 | |||
09222c8a3a |
67
Modules/Admin/app/Http/Controllers/AdminController.php
Normal file
67
Modules/Admin/app/Http/Controllers/AdminController.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('admin::index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('admin::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\AppreciationRepository;
|
||||
|
||||
class AppreciationController extends Controller
|
||||
{
|
||||
private $appreciationRepository;
|
||||
|
||||
public function __construct(AppreciationRepository $appreciationRepository)
|
||||
{
|
||||
$this->appreciationRepository = $appreciationRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = "Appreciation Lists";
|
||||
$data['appreciationLists'] = $this->appreciationRepository->findAll();
|
||||
return view('admin::appreciations.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = "Create Appreciation";
|
||||
$data['editable'] = false;
|
||||
return view('admin::appreciations.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->appreciationRepository->create($request->all());
|
||||
toastr()->success('Appreciation Created Successfully.');
|
||||
return redirect()->route('appreciation.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::appreciations.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = "Edit Appreciation";
|
||||
$data['editable'] = true;
|
||||
$data['appreciation'] = $this->appreciationRepository->getAppreciationById($id);
|
||||
return view('admin::appreciations.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->appreciationRepository->update($id, $request->all());
|
||||
toastr()->success('Appreciation Updated Successfully.');
|
||||
return redirect()->route('appreciation.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
68
Modules/Admin/app/Http/Controllers/CalendarController.php
Normal file
68
Modules/Admin/app/Http/Controllers/CalendarController.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class CalendarController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Calendar';
|
||||
return view('admin::calendars.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin::calendars.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::calendars.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('admin::calendars.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
218
Modules/Admin/app/Http/Controllers/CastesController.php
Normal file
218
Modules/Admin/app/Http/Controllers/CastesController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Castes;
|
||||
|
||||
class CastesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Castes $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
// createActivityLog(CastesController::class, 'index', ' Castes index');
|
||||
$data = Castes::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("admin::castes.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
// createActivityLog(CastesController::class, 'create', ' Castes create');
|
||||
$TableData = Castes::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("admin::castes.edit", compact('TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
// createActivityLog(CastesController::class, 'store', ' Castes store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$request->request->add(['alias' => slugify($request->title)]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_castes')]);
|
||||
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
|
||||
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$operationNumber = getOperationNumber();
|
||||
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CastesController::class, 'store', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Castes Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('castes.index')->with('success', 'The Castes created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Castes::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Castes::find($articleId);
|
||||
if (!$companyArticle) {
|
||||
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||
}
|
||||
$companyArticle->alias = $newAlias;
|
||||
$companyArticle->save();
|
||||
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CastesController::class, 'show', ' Castes show');
|
||||
$data = Castes::findOrFail($id);
|
||||
|
||||
return view("admin::castes.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CastesController::class, 'edit', ' Castes edit');
|
||||
$TableData = Castes::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Castes::findOrFail($id);
|
||||
$editable = true;
|
||||
return view("admin::castes.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CastesController::class, 'update', ' Castes update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('caste_id'));
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CastesController::class, 'update', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Castes updated Successfully.'], 200);
|
||||
}
|
||||
// return redirect()->route('castes.index')->with('success','The Castes updated Successfully.');
|
||||
return redirect()->back()->with('success', 'The Castes updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CastesController::class, 'destroy', ' Castes destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CastesController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Castes Deleted Successfully.'], 200);
|
||||
}
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CastesController::class, 'destroy', ' Castes destroy');
|
||||
$data = Castes::findOrFail($id);
|
||||
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CastesController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Castes Deleted Successfully.'], 200);
|
||||
}
|
||||
public function clone(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CastesController::class, 'clone', ' Castes clone');
|
||||
$data = Castes::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
$requestData = $data->toArray();
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CastesController::class, 'clone', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Castes Clonned Successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
219
Modules/Admin/app/Http/Controllers/CitiesController.php
Normal file
219
Modules/Admin/app/Http/Controllers/CitiesController.php
Normal file
@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Cities;
|
||||
|
||||
class CitiesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Cities $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
// createActivityLog(CitiesController::class, 'index', ' Cities index');
|
||||
$data = Cities::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("admin::cities.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
// createActivityLog(CitiesController::class, 'create', ' Cities create');
|
||||
$TableData = Cities::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("admin::cities.edit", compact('TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
// createActivityLog(CitiesController::class, 'store', ' Cities store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$request->request->add(['alias' => slugify($request->title)]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_cities')]);
|
||||
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
|
||||
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$operationNumber = getOperationNumber();
|
||||
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CitiesController::class, 'store', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Cities Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('cities.index')->with('success', 'The Cities created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Cities::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Cities::find($articleId);
|
||||
if (!$companyArticle) {
|
||||
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||
}
|
||||
$companyArticle->alias = $newAlias;
|
||||
$companyArticle->save();
|
||||
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CitiesController::class, 'show', ' Cities show');
|
||||
$data = Cities::findOrFail($id);
|
||||
|
||||
return view("admin::cities.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CitiesController::class, 'edit', ' Cities edit');
|
||||
$TableData = Cities::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Cities::findOrFail($id);
|
||||
$editable = true;
|
||||
return view("admin::cities.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CitiesController::class, 'update', ' Cities update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('city_id'));
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CitiesController::class, 'update', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Cities updated Successfully.'], 200);
|
||||
}
|
||||
// return redirect()->route('cities.index')->with('success','The Cities updated Successfully.');
|
||||
return redirect()->back()->with('success', 'The Cities updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CitiesController::class, 'destroy', ' Cities destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CitiesController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Cities Deleted Successfully.'], 200);
|
||||
}
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CitiesController::class, 'destroy', ' Cities destroy');
|
||||
$data = Cities::findOrFail($id);
|
||||
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CitiesController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Cities Deleted Successfully.'], 200);
|
||||
}
|
||||
public function clone(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CitiesController::class, 'clone', ' Cities clone');
|
||||
$data = Cities::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
$requestData = $data->toArray();
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(CitiesController::class, 'clone', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Cities Clonned Successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
114
Modules/Admin/app/Http/Controllers/CompanyController.php
Normal file
114
Modules/Admin/app/Http/Controllers/CompanyController.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\CompanyRepository;
|
||||
use Modules\Admin\Services\AdminService;
|
||||
|
||||
class CompanyController extends Controller
|
||||
{
|
||||
private $companyRepository;
|
||||
private $adminService;
|
||||
|
||||
public function __construct(CompanyRepository $companyRepository, AdminService $adminService)
|
||||
{
|
||||
$this->companyRepository = $companyRepository;
|
||||
$this->adminService = $adminService;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Company Lists';
|
||||
$data['companyLists'] = $this->companyRepository->findAll();
|
||||
return view('admin::companies.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Company';
|
||||
$data['editable'] = false;
|
||||
$data['companyTypeLists'] = $this->adminService->pluckCompanyTypes();
|
||||
return view('admin::companies.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->companyRepository->create($request->all());
|
||||
toastr()->success('Company Created Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('company.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::companies.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
try {
|
||||
$data['title'] = 'Edit Company';
|
||||
$data['editable'] = true;
|
||||
$data['companyTypeLists'] = $this->adminService->pluckCompanyTypes();
|
||||
$data['company'] = $this->companyRepository->getCompanyById($id);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return view('admin::companies.edit', $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->companyRepository->update($id, $request->all());
|
||||
toastr()->success('Company Updated Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('company.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->companyRepository->delete($id);
|
||||
toastr()->success('Company Deleted Successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('company.index');
|
||||
}
|
||||
}
|
109
Modules/Admin/app/Http/Controllers/CompanyTypeController.php
Normal file
109
Modules/Admin/app/Http/Controllers/CompanyTypeController.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\CompanyTypeRepository;
|
||||
|
||||
class CompanyTypeController extends Controller
|
||||
{
|
||||
private $companyTypeRepository;
|
||||
|
||||
public function __construct(CompanyTypeRepository $companyTypeRepository)
|
||||
{
|
||||
$this->companyTypeRepository = $companyTypeRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Company Type Lists';
|
||||
$data['companyTypeLists'] = $this->companyTypeRepository->findAll();
|
||||
return view('admin::companytypes.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Company Type';
|
||||
$data['editable'] = false;
|
||||
return view('admin::companytypes.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->companyTypeRepository->create($request->all());
|
||||
toastr()->success('Company Type Created Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('companyType.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::companytypes.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
try {
|
||||
$data['title'] = 'Edit Company Type';
|
||||
$data['editable'] = true;
|
||||
$data['companyType'] = $this->companyTypeRepository->getCompanyById($id);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return view('admin::companytypes.edit', $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->companyTypeRepository->update($id, $request->all());
|
||||
toastr()->success('Company Updated Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('company.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->companyTypeRepository->delete($id);
|
||||
toastr()->success('Company Type Deleted Successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('companyType.index');
|
||||
}
|
||||
}
|
109
Modules/Admin/app/Http/Controllers/ComplaintController.php
Normal file
109
Modules/Admin/app/Http/Controllers/ComplaintController.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\ComplaintRepository;
|
||||
|
||||
class ComplaintController extends Controller
|
||||
{
|
||||
private $complaintRepository;
|
||||
|
||||
public function __construct(ComplaintRepository $complaintRepository)
|
||||
{
|
||||
$this->complaintRepository = $complaintRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Complaint Lists';
|
||||
$data['complaintLists'] = $this->complaintRepository->findAll();
|
||||
return view('admin::complaints.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Complaint';
|
||||
$data['editable'] = false;
|
||||
return view('admin::complaints.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->complaintRepository->create($request->all());
|
||||
toastr()->success('Complaint Created Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('complaint.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::complaints.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
try {
|
||||
$data['title'] = 'Edit Complaint';
|
||||
$data['editable'] = true;
|
||||
$data['complaint'] = $this->complaintRepository->getComplaintById($id);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return view('admin::complaints.edit', $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->complaintRepository->update($id, $request->all());
|
||||
toastr()->success('Complaint Updated Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('complaint.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->complaintRepository->delete($id);
|
||||
toastr()->success('Complaint Deleted Successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('complaint.index');
|
||||
}
|
||||
}
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Country\Country;
|
||||
use App\Service\CommonModelService;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Log;
|
||||
use Modules\Admin\Models\Country;
|
||||
|
||||
class CountriesController extends Controller
|
||||
{
|
||||
@ -22,15 +23,14 @@ class CountriesController extends Controller
|
||||
// createActivityLog(CountriesController::class, 'index', ' Country index');
|
||||
$data = Country::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("crud.generated.countries.index", compact('data'));
|
||||
return view("admin::countries.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
// createActivityLog(CountriesController::class, 'create', ' Country create');
|
||||
$TableData = Country::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("crud.generated.countries.edit", compact('TableData', 'editable'));
|
||||
return view("admin::countries.edit", compact('editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
@ -104,7 +104,7 @@ class CountriesController extends Controller
|
||||
// createActivityLog(CountriesController::class, 'show', ' Country show');
|
||||
$data = Country::findOrFail($id);
|
||||
|
||||
return view("crud.generated.countries.show", compact('data'));
|
||||
return view("admin::countries.show", compact('data'));
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
@ -113,7 +113,7 @@ class CountriesController extends Controller
|
||||
$TableData = Country::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Country::findOrFail($id);
|
||||
$editable = true;
|
||||
return view("crud.generated.countries.edit", compact('data', 'TableData', 'editable'));
|
||||
return view("admin::countries.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
@ -187,7 +187,7 @@ class CountriesController extends Controller
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Country Deleted Successfully.'], 200);
|
||||
}
|
||||
public function clone (Request $request, $id)
|
||||
public function clone(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(CountriesController::class, 'clone', ' Country clone');
|
||||
$data = Country::findOrFail($id);
|
218
Modules/Admin/app/Http/Controllers/DepartmentsController.php
Normal file
218
Modules/Admin/app/Http/Controllers/DepartmentsController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Departments;
|
||||
|
||||
class DepartmentsController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Departments $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
||||
$data = Departments::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("admin::departments.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
|
||||
$TableData = Departments::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("admin::departments.edit", compact('TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
||||
$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('department.index')->with('success', 'The Departments created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Departments::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Departments::find($articleId);
|
||||
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)
|
||||
{
|
||||
|
||||
$data = Departments::findOrFail($id);
|
||||
|
||||
return view("admin::departments.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
|
||||
$TableData = Departments::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Departments::findOrFail($id);
|
||||
$editable = true;
|
||||
return view("admin::departments.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
||||
$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)
|
||||
{
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
$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)
|
||||
{
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
209
Modules/Admin/app/Http/Controllers/DesignationsController.php
Normal file
209
Modules/Admin/app/Http/Controllers/DesignationsController.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Designations;
|
||||
|
||||
class DesignationsController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Designations $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data = Designations::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("admin::designations.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
$TableData = Designations::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("admin::designations.edit", compact('TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$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('designation.index')->with('success', 'The Designations created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Designations::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Designations::find($articleId);
|
||||
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)
|
||||
{
|
||||
$data = Designations::findOrFail($id);
|
||||
|
||||
return view("admin::designations.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
$TableData = Designations::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Designations::findOrFail($id);
|
||||
$editable = true;
|
||||
return view("admin::designations.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
$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)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
218
Modules/Admin/app/Http/Controllers/DistrictsController.php
Normal file
218
Modules/Admin/app/Http/Controllers/DistrictsController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Districts;
|
||||
|
||||
class DistrictsController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Districts $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
// createActivityLog(DistrictsController::class, 'index', ' Districts index');
|
||||
$data = Districts::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("admin::districts.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
// createActivityLog(DistrictsController::class, 'create', ' Districts create');
|
||||
$TableData = Districts::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("admin::districts.edit", compact('TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
// createActivityLog(DistrictsController::class, 'store', ' Districts store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$request->request->add(['alias' => slugify($request->title)]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_districts')]);
|
||||
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
|
||||
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$operationNumber = getOperationNumber();
|
||||
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(DistrictsController::class, 'store', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Districts Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('districts.index')->with('success', 'The Districts created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Districts::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Districts::find($articleId);
|
||||
if (!$companyArticle) {
|
||||
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||
}
|
||||
$companyArticle->alias = $newAlias;
|
||||
$companyArticle->save();
|
||||
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(DistrictsController::class, 'show', ' Districts show');
|
||||
$data = Districts::findOrFail($id);
|
||||
|
||||
return view("admin::districts.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(DistrictsController::class, 'edit', ' Districts edit');
|
||||
$TableData = Districts::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Districts::findOrFail($id);
|
||||
$editable = true;
|
||||
return view("admin::districts.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(DistrictsController::class, 'update', ' Districts update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('district_id'));
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(DistrictsController::class, 'update', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Districts updated Successfully.'], 200);
|
||||
}
|
||||
// return redirect()->route('districts.index')->with('success','The Districts updated Successfully.');
|
||||
return redirect()->back()->with('success', 'The Districts updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(DistrictsController::class, 'destroy', ' Districts destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(DistrictsController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Districts Deleted Successfully.'], 200);
|
||||
}
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(DistrictsController::class, 'destroy', ' Districts destroy');
|
||||
$data = Districts::findOrFail($id);
|
||||
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(DistrictsController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Districts Deleted Successfully.'], 200);
|
||||
}
|
||||
public function clone(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(DistrictsController::class, 'clone', ' Districts clone');
|
||||
$data = Districts::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
$requestData = $data->toArray();
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(DistrictsController::class, 'clone', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Districts Clonned Successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
109
Modules/Admin/app/Http/Controllers/EventController.php
Normal file
109
Modules/Admin/app/Http/Controllers/EventController.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\EventRepository;
|
||||
|
||||
class EventController extends Controller
|
||||
{
|
||||
private $eventRepository;
|
||||
|
||||
public function __construct(EventRepository $eventRepository)
|
||||
{
|
||||
$this->eventRepository = $eventRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Event Lists';
|
||||
$data['eventLists'] = $this->eventRepository->findAll();
|
||||
return view('admin::events.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Event';
|
||||
$data['editable'] = false;
|
||||
return view('admin::events.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->eventRepository->create($request->all());
|
||||
toastr()->success('Event Created Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('event.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::events.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
try {
|
||||
$data['title'] = 'Edit Event';
|
||||
$data['editable'] = true;
|
||||
$data['event'] = $this->eventRepository->getEventById($id);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return view('admin::events.edit', $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->eventRepository->update($id, $request->all());
|
||||
toastr()->success('Event Updated Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('event.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->eventRepository->delete($id);
|
||||
toastr()->success('Event Deleted Successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('event.index');
|
||||
}
|
||||
}
|
218
Modules/Admin/app/Http/Controllers/GendersController.php
Normal file
218
Modules/Admin/app/Http/Controllers/GendersController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Genders;
|
||||
|
||||
class GendersController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Genders $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
// createActivityLog(GendersController::class, 'index', ' Genders index');
|
||||
$data = Genders::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("admin::genders.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
// createActivityLog(GendersController::class, 'create', ' Genders create');
|
||||
$TableData = Genders::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("admin::genders.edit", compact('TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
// createActivityLog(GendersController::class, 'store', ' Genders store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$request->request->add(['alias' => slugify($request->title)]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_genders')]);
|
||||
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
|
||||
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$operationNumber = getOperationNumber();
|
||||
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(GendersController::class, 'store', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Genders Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('genders.index')->with('success', 'The Genders created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Genders::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Genders::find($articleId);
|
||||
if (!$companyArticle) {
|
||||
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||
}
|
||||
$companyArticle->alias = $newAlias;
|
||||
$companyArticle->save();
|
||||
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(GendersController::class, 'show', ' Genders show');
|
||||
$data = Genders::findOrFail($id);
|
||||
|
||||
return view("admin::genders.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(GendersController::class, 'edit', ' Genders edit');
|
||||
$TableData = Genders::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Genders::findOrFail($id);
|
||||
$editable = true;
|
||||
return view("admin::genders.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(GendersController::class, 'update', ' Genders update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('gender_id'));
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(GendersController::class, 'update', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Genders updated Successfully.'], 200);
|
||||
}
|
||||
// return redirect()->route('genders.index')->with('success','The Genders updated Successfully.');
|
||||
return redirect()->back()->with('success', 'The Genders updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(GendersController::class, 'destroy', ' Genders destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(GendersController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Genders Deleted Successfully.'], 200);
|
||||
}
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(GendersController::class, 'destroy', ' Genders destroy');
|
||||
$data = Genders::findOrFail($id);
|
||||
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(GendersController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Genders Deleted Successfully.'], 200);
|
||||
}
|
||||
public function clone(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(GendersController::class, 'clone', ' Genders clone');
|
||||
$data = Genders::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
$requestData = $data->toArray();
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(GendersController::class, 'clone', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Genders Clonned Successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
109
Modules/Admin/app/Http/Controllers/HolidayController.php
Normal file
109
Modules/Admin/app/Http/Controllers/HolidayController.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\HolidayRepository;
|
||||
|
||||
class HolidayController extends Controller
|
||||
{
|
||||
private $holidayRepository;
|
||||
|
||||
public function __construct(HolidayRepository $holidayRepository)
|
||||
{
|
||||
$this->holidayRepository = $holidayRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Holiday Lists';
|
||||
$data['holidayLists'] = $this->holidayRepository->findAll();
|
||||
return view('admin::holidays.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Holiday';
|
||||
$data['editable'] = false;
|
||||
return view('admin::holidays.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->holidayRepository->create($request->all());
|
||||
toastr()->success('Holiday Created Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('holiday.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::holidays.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
try {
|
||||
$data['title'] = 'Edit Holiday';
|
||||
$data['editable'] = true;
|
||||
$data['holiday'] = $this->holidayRepository->getHolidayById($id);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return view('admin::holidays.edit', $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->holidayRepository->update($id, $request->all());
|
||||
toastr()->success('Holiday Updated Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('holiday.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->holidayRepository->delete($id);
|
||||
toastr()->success('Holiday Deleted Successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('holiday.index');
|
||||
}
|
||||
}
|
218
Modules/Admin/app/Http/Controllers/NationalitiesController.php
Normal file
218
Modules/Admin/app/Http/Controllers/NationalitiesController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Nationalities;
|
||||
|
||||
class NationalitiesController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Nationalities $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
// createActivityLog(NationalitiesController::class, 'index', ' Nationalities index');
|
||||
$data = Nationalities::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("admin::nationalities.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
// createActivityLog(NationalitiesController::class, 'create', ' Nationalities create');
|
||||
$TableData = Nationalities::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$editable = false;
|
||||
return view("admin::nationalities.edit", compact('TableData', 'editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
// createActivityLog(NationalitiesController::class, 'store', ' Nationalities store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$request->request->add(['alias' => slugify($request->title)]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_nationalities')]);
|
||||
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
|
||||
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$operationNumber = getOperationNumber();
|
||||
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(NationalitiesController::class, 'store', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Nationalities Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('nationalities.index')->with('success', 'The Nationalities created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Nationalities::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Nationalities::find($articleId);
|
||||
if (!$companyArticle) {
|
||||
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||
}
|
||||
$companyArticle->alias = $newAlias;
|
||||
$companyArticle->save();
|
||||
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(NationalitiesController::class, 'show', ' Nationalities show');
|
||||
$data = Nationalities::findOrFail($id);
|
||||
|
||||
return view("admin::nationalities.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(NationalitiesController::class, 'edit', ' Nationalities edit');
|
||||
$TableData = Nationalities::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Nationalities::findOrFail($id);
|
||||
$editable = true;
|
||||
return view("admin::nationalities.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(NationalitiesController::class, 'update', ' Nationalities update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('nationality_id'));
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(NationalitiesController::class, 'update', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Nationalities updated Successfully.'], 200);
|
||||
}
|
||||
// return redirect()->route('nationalities.index')->with('success','The Nationalities updated Successfully.');
|
||||
return redirect()->back()->with('success', 'The Nationalities updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(NationalitiesController::class, 'destroy', ' Nationalities destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(NationalitiesController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Nationalities Deleted Successfully.'], 200);
|
||||
}
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(NationalitiesController::class, 'destroy', ' Nationalities destroy');
|
||||
$data = Nationalities::findOrFail($id);
|
||||
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(NationalitiesController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Nationalities Deleted Successfully.'], 200);
|
||||
}
|
||||
public function clone(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(NationalitiesController::class, 'clone', ' Nationalities clone');
|
||||
$data = Nationalities::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
$requestData = $data->toArray();
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(NationalitiesController::class, 'clone', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Nationalities Clonned Successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\PromotionDemotionRepository;
|
||||
|
||||
class PromotionDemotionController extends Controller
|
||||
{
|
||||
private $promotionDemotionRepository;
|
||||
public function __construct(PromotionDemotionRepository $promotionDemotionRepository)
|
||||
{
|
||||
$this->promotionDemotionRepository = $promotionDemotionRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = "Promotion/ Demotion Lists";
|
||||
$data['promotionDemotionLists'] = $this->promotionDemotionRepository->findAll();
|
||||
return view('admin::promotiondemotions.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['editable'] = false;
|
||||
$data['title'] = "Create Promotion/ Demotion";
|
||||
return view('admin::promotiondemotions.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->promotionDemotionRepository->create($request->all());
|
||||
toastr()->success('Promotion/ Demotion Created Successfully');
|
||||
return redirect()->route('promotionDemotion.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::promotiondemotions.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['editable'] = false;
|
||||
$data['title'] = "Edit Promotion/ Demotion";
|
||||
$data['promotionDemotion'] = $this->promotionDemotionRepository->getPromotionDemotionById($id);
|
||||
return view('admin::promotiondemotions.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->promotionDemotionRepository->update($id, $request->all());
|
||||
toastr()->success('Promotion/ Demotion Updated Successfully');
|
||||
return redirect()->route('promotionDemotion.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->promotionDemotionRepository->delete($id);
|
||||
toastr()->success('Promotion/ Demotion Deleted Successfully');
|
||||
return redirect()->route('promotionDemotion.index');
|
||||
}
|
||||
}
|
218
Modules/Admin/app/Http/Controllers/ProvinceController.php
Normal file
218
Modules/Admin/app/Http/Controllers/ProvinceController.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Service\CommonModelService;
|
||||
use Log;
|
||||
use Exception;
|
||||
use Modules\Admin\Models\Province;
|
||||
|
||||
class ProvinceController extends Controller
|
||||
{
|
||||
protected $modelService;
|
||||
public function __construct(Province $model)
|
||||
{
|
||||
$this->modelService = new CommonModelService($model);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
// createActivityLog(ProvinceController::class, 'index', ' Province index');
|
||||
|
||||
$data = Province::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
|
||||
return view("admin::provinces.index", compact('data'));
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
// createActivityLog(ProvinceController::class, 'create', ' Province create');
|
||||
|
||||
$editable = false;
|
||||
|
||||
return view("admin::provinces.edit", compact('editable'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
// createActivityLog(ProvinceController::class, 'store', ' Province store');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$request->request->add(['alias' => slugify($request->title)]);
|
||||
$request->request->add(['display_order' => getDisplayOrder('tbl_province')]);
|
||||
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
|
||||
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$operationNumber = getOperationNumber();
|
||||
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'store', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Province Created Successfully.'], 200);
|
||||
}
|
||||
return redirect()->route('provinces.index')->with('success', 'The Province created Successfully.');
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$idOrder = $request->input('id_order');
|
||||
|
||||
foreach ($idOrder as $index => $id) {
|
||||
$companyArticle = Province::find($id);
|
||||
$companyArticle->display_order = $index + 1;
|
||||
$companyArticle->save();
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||
}
|
||||
public function updatealias(Request $request)
|
||||
{
|
||||
|
||||
$articleId = $request->input('articleId');
|
||||
$newAlias = $request->input('newAlias');
|
||||
$companyArticle = Province::find($articleId);
|
||||
if (!$companyArticle) {
|
||||
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||
}
|
||||
$companyArticle->alias = $newAlias;
|
||||
$companyArticle->save();
|
||||
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(ProvinceController::class, 'show', ' Province show');
|
||||
$data = Province::findOrFail($id);
|
||||
|
||||
return view("admin::provinces.show", compact('data'));
|
||||
}
|
||||
|
||||
|
||||
public function edit(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(ProvinceController::class, 'edit', ' Province edit');
|
||||
$TableData = Province::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||
$data = Province::findOrFail($id);
|
||||
$editable = true;
|
||||
return view("admin::provinces.edit", compact('data', 'TableData', 'editable'));
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(ProvinceController::class, 'update', ' Province update');
|
||||
$validator = Validator::make($request->all(), [
|
||||
//ADD VALIDATION FOR REQIRED FIELDS
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'error' => $validator->errors(),
|
||||
], 500);
|
||||
}
|
||||
$requestData = $request->all();
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||
});
|
||||
array_walk_recursive($requestData, function (&$value) {
|
||||
$value = str_replace(env('APP_URL'), '', $value);
|
||||
});
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('provience_id'));
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'update', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['status' => true, 'message' => 'The Province updated Successfully.'], 200);
|
||||
}
|
||||
return redirect()->back()->with('success', 'The Province updated successfully.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(ProvinceController::class, 'destroy', ' Province destroy');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Province Deleted Successfully.'], 200);
|
||||
}
|
||||
public function toggle(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(ProvinceController::class, 'destroy', ' Province destroy');
|
||||
$data = Province::findOrFail($id);
|
||||
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'destroy', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Province Deleted Successfully.'], 200);
|
||||
}
|
||||
public function clone(Request $request, $id)
|
||||
{
|
||||
// createActivityLog(ProvinceController::class, 'clone', ' Province clone');
|
||||
$data = Province::findOrFail($id);
|
||||
unset($data['updatedby']);
|
||||
unset($data['createdby']);
|
||||
$requestData = $data->toArray();
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$OperationNumber = getOperationNumber();
|
||||
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::info($e->getMessage());
|
||||
createErrorLog(ProvinceController::class, 'clone', $e->getMessage());
|
||||
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json(['status' => true, 'message' => 'The Province Clonned Successfully.'], 200);
|
||||
}
|
||||
|
||||
}
|
83
Modules/Admin/app/Http/Controllers/ResignationController.php
Normal file
83
Modules/Admin/app/Http/Controllers/ResignationController.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\ResignationRepository;
|
||||
|
||||
class ResignationController extends Controller
|
||||
{
|
||||
private $resignationRepository;
|
||||
|
||||
public function __construct(ResignationRepository $resignationRepository)
|
||||
{
|
||||
$this->resignationRepository = $resignationRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Resignation List';
|
||||
$data['resignationLists'] = $this->resignationRepository->findAll();
|
||||
return view('admin::resignations.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Resignation';
|
||||
$data['editable'] = false;
|
||||
return view('admin::resignations.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->resignationRepository->create($request->all());
|
||||
return redirect()->route('resignation.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::resignations.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Resignation';
|
||||
$data['editable'] = true;
|
||||
$data['resignation'] = $this->resignationRepository->getResignationById($id);
|
||||
return view('admin::resignations.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->resignationRepository->update($id, $request->all());
|
||||
return redirect()->route('resignation.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
109
Modules/Admin/app/Http/Controllers/TransferController.php
Normal file
109
Modules/Admin/app/Http/Controllers/TransferController.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\TransferRepository;
|
||||
|
||||
class TransferController extends Controller
|
||||
{
|
||||
private $transferRepository;
|
||||
|
||||
public function __construct(TransferRepository $transferRepository)
|
||||
{
|
||||
$this->transferRepository = $transferRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Transfer Lists';
|
||||
$data['transferLists'] = $this->transferRepository->findAll();
|
||||
return view('admin::transfers.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Transfer';
|
||||
$data['editable'] = false;
|
||||
return view('admin::transfers.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->transferRepository->create($request->all());
|
||||
toastr()->success('Transfer Created Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('transfer.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::transfers.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
try {
|
||||
$data['title'] = 'Edit Transfer';
|
||||
$data['editable'] = true;
|
||||
$data['transfer'] = $this->transferRepository->getTransferById($id);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return view('admin::transfers.edit', $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->transferRepository->update($id, $request->all());
|
||||
toastr()->success('Transfer Updated Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('transfer.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->transferRepository->delete($id);
|
||||
toastr()->success('Transfer Deleted Successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('transfer.index');
|
||||
}
|
||||
}
|
109
Modules/Admin/app/Http/Controllers/WarningController.php
Normal file
109
Modules/Admin/app/Http/Controllers/WarningController.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Admin\Repositories\WarningRepository;
|
||||
|
||||
class WarningController extends Controller
|
||||
{
|
||||
private $warningRepository;
|
||||
|
||||
public function __construct(WarningRepository $warningRepository)
|
||||
{
|
||||
$this->warningRepository = $warningRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Warning Lists';
|
||||
$data['warningLists'] = $this->warningRepository->findAll();
|
||||
return view('admin::warnings.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Warning';
|
||||
$data['editable'] = false;
|
||||
return view('admin::warnings.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->warningRepository->create($request->all());
|
||||
toastr()->success('Warning Created Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('warning.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::warnings.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
try {
|
||||
$data['title'] = 'Edit Warning';
|
||||
$data['editable'] = true;
|
||||
$data['warning'] = $this->warningRepository->getWarningById($id);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return view('admin::warnings.edit', $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->warningRepository->update($id, $request->all());
|
||||
toastr()->success('Warning Updated Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('warning.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->warningRepository->delete($id);
|
||||
toastr()->success('Warning Deleted Successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('warning.index');
|
||||
}
|
||||
}
|
0
Modules/Admin/app/Http/Requests/.gitkeep
Normal file
0
Modules/Admin/app/Http/Requests/.gitkeep
Normal file
0
Modules/Admin/app/Models/.gitkeep
Normal file
0
Modules/Admin/app/Models/.gitkeep
Normal file
30
Modules/Admin/app/Models/Appreciation.php
Normal file
30
Modules/Admin/app/Models/Appreciation.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\AppreciationFactory;
|
||||
|
||||
class Appreciation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_appreciations';
|
||||
protected $primaryKey = 'appreciation_id';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'alias',
|
||||
'type',
|
||||
'employee_id',
|
||||
'appreciated_by',
|
||||
'appreciated_date',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
];
|
||||
|
||||
}
|
16
Modules/Admin/app/Models/Castes.php
Normal file
16
Modules/Admin/app/Models/Castes.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Castes extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_castes';
|
||||
protected $primaryKey = 'caste_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
16
Modules/Admin/app/Models/Cities.php
Normal file
16
Modules/Admin/app/Models/Cities.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Cities extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_cities';
|
||||
protected $primaryKey = 'city_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
32
Modules/Admin/app/Models/Company.php
Normal file
32
Modules/Admin/app/Models/Company.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\CompanyFactory;
|
||||
|
||||
class Company extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_companies';
|
||||
protected $primaryKey = 'company_id';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'alias',
|
||||
'company_type_id',
|
||||
'address',
|
||||
'bank_name',
|
||||
'bank_acc_no',
|
||||
'bank_acc_branch',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
}
|
28
Modules/Admin/app/Models/CompanyType.php
Normal file
28
Modules/Admin/app/Models/CompanyType.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\CompanyTypeFactory;
|
||||
|
||||
class CompanyType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_company_types';
|
||||
protected $primaryKey = 'company_type_id';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'alias',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
|
||||
}
|
31
Modules/Admin/app/Models/Complaint.php
Normal file
31
Modules/Admin/app/Models/Complaint.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\ComplaintFactory;
|
||||
|
||||
class Complaint extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_complaints';
|
||||
protected $primaryKey = 'complaint_id';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'complaint_id',
|
||||
'employee_id',
|
||||
'complaint_date',
|
||||
'complaint_by',
|
||||
'description',
|
||||
'remarks',
|
||||
'status',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Country;
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@ -15,14 +15,4 @@ class Country extends Model
|
||||
'country_code',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function provinces()
|
||||
{
|
||||
return $this->hasMany(Province::class);
|
||||
}
|
||||
|
||||
public static function getCountries()
|
||||
{
|
||||
return self::select('id', 'country_name')->where('status', 'Active')->get();
|
||||
}
|
||||
}
|
16
Modules/Admin/app/Models/Departments.php
Normal file
16
Modules/Admin/app/Models/Departments.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Departments extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_departments';
|
||||
protected $primaryKey = 'department_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
16
Modules/Admin/app/Models/Designations.php
Normal file
16
Modules/Admin/app/Models/Designations.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Designations extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_designations';
|
||||
protected $primaryKey = 'designation_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
20
Modules/Admin/app/Models/Districts.php
Normal file
20
Modules/Admin/app/Models/Districts.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Districts extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_districts';
|
||||
protected $primaryKey = 'district_id';
|
||||
protected $fillable = [
|
||||
'district_name',
|
||||
'countries_id',
|
||||
'provinces_id',
|
||||
'status',
|
||||
];
|
||||
}
|
33
Modules/Admin/app/Models/Event.php
Normal file
33
Modules/Admin/app/Models/Event.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\EventFactory;
|
||||
|
||||
class Event extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_events';
|
||||
protected $primaryKey = "event_id";
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'alias',
|
||||
'type',
|
||||
'date',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'location',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
}
|
16
Modules/Admin/app/Models/Genders.php
Normal file
16
Modules/Admin/app/Models/Genders.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Genders extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_genders';
|
||||
protected $primaryKey = 'gender_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
30
Modules/Admin/app/Models/Holiday.php
Normal file
30
Modules/Admin/app/Models/Holiday.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\HolidayFactory;
|
||||
|
||||
class Holiday extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_holidays';
|
||||
|
||||
protected $primaryKey = "holiday_id";
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'alias',
|
||||
'date',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
'createdBy',
|
||||
'updatedBy'
|
||||
];
|
||||
}
|
16
Modules/Admin/app/Models/Nationalities.php
Normal file
16
Modules/Admin/app/Models/Nationalities.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Nationalities extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_nationalities';
|
||||
protected $primaryKey = 'nationality_id';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
31
Modules/Admin/app/Models/PromotionDemotion.php
Normal file
31
Modules/Admin/app/Models/PromotionDemotion.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\PromotionDemotionFactory;
|
||||
|
||||
class PromotionDemotion extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "tbl_promotion_demotions";
|
||||
protected $primaryKey = "promotion_demotion_id";
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'employee_id',
|
||||
'title',
|
||||
'employee_id',
|
||||
'old_designation_id',
|
||||
'new_designation_id',
|
||||
'type',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
];
|
||||
|
||||
|
||||
}
|
23
Modules/Admin/app/Models/Province.php
Normal file
23
Modules/Admin/app/Models/Province.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Province extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_provinces';
|
||||
protected $primaryKey = 'province_id';
|
||||
protected $fillable = [
|
||||
'province_name',
|
||||
'country_id',
|
||||
'status',
|
||||
];
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class);
|
||||
}
|
||||
}
|
31
Modules/Admin/app/Models/Resignation.php
Normal file
31
Modules/Admin/app/Models/Resignation.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\ResignationFactory;
|
||||
|
||||
class Resignation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_resignations';
|
||||
|
||||
protected $primaryKey = 'resignation_id';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'employee_id',
|
||||
'resignation_date',
|
||||
'approved_date',
|
||||
'approved_by',
|
||||
'description',
|
||||
'remarks',
|
||||
'status',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
}
|
29
Modules/Admin/app/Models/Transfer.php
Normal file
29
Modules/Admin/app/Models/Transfer.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\TransferFactory;
|
||||
|
||||
class Transfer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_transfers';
|
||||
protected $primaryKey = 'transfer_id';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'employee_id',
|
||||
'old_department_id',
|
||||
'new_department_id',
|
||||
'status',
|
||||
'transfer_date',
|
||||
'description',
|
||||
'remarks',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
}
|
28
Modules/Admin/app/Models/Warning.php
Normal file
28
Modules/Admin/app/Models/Warning.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Admin\Database\factories\WarningFactory;
|
||||
|
||||
class Warning extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_warnings';
|
||||
protected $primaryKey = 'warning_id';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'employee_id',
|
||||
'subject',
|
||||
'warning_date',
|
||||
'description',
|
||||
'remarks',
|
||||
'status',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
}
|
0
Modules/Admin/app/Providers/.gitkeep
Normal file
0
Modules/Admin/app/Providers/.gitkeep
Normal file
114
Modules/Admin/app/Providers/AdminServiceProvider.php
Normal file
114
Modules/Admin/app/Providers/AdminServiceProvider.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AdminServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Admin';
|
||||
|
||||
protected string $moduleNameLower = 'admin';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder','')));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
|
||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
49
Modules/Admin/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Admin/app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
Route::middleware('web')->group(module_path('Admin', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Admin', '/routes/api.php'));
|
||||
}
|
||||
}
|
0
Modules/Admin/app/Repositories/.gitkeep
Normal file
0
Modules/Admin/app/Repositories/.gitkeep
Normal file
12
Modules/Admin/app/Repositories/AppreciationInterface.php
Normal file
12
Modules/Admin/app/Repositories/AppreciationInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface AppreciationInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getAppreciationById($appreciationId);
|
||||
public function delete($appreciationId);
|
||||
public function create(array $appreciationDetails);
|
||||
public function update($appreciationId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/AppreciationRepository.php
Normal file
35
Modules/Admin/app/Repositories/AppreciationRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Appreciation;
|
||||
|
||||
|
||||
class AppreciationRepository implements AppreciationInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Appreciation::get();
|
||||
}
|
||||
|
||||
public function getAppreciationById($appreciationId)
|
||||
{
|
||||
return Appreciation::findOrFail($appreciationId);
|
||||
}
|
||||
|
||||
public function delete($appreciationId)
|
||||
{
|
||||
Appreciation::destroy($appreciationId);
|
||||
}
|
||||
|
||||
public function create(array $appreciationDetails)
|
||||
{
|
||||
return Appreciation::create($appreciationDetails);
|
||||
}
|
||||
|
||||
public function update($appreciationId, array $newDetails)
|
||||
{
|
||||
return Appreciation::where('appreciation_id', $appreciationId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/CompanyInterface.php
Normal file
12
Modules/Admin/app/Repositories/CompanyInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface CompanyInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getCompanyById($companyId);
|
||||
public function delete($companyId);
|
||||
public function create(array $companyDetails);
|
||||
public function update($companyId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/CompanyRepository.php
Normal file
35
Modules/Admin/app/Repositories/CompanyRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Company;
|
||||
|
||||
|
||||
class CompanyRepository implements CompanyInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Company::get();
|
||||
}
|
||||
|
||||
public function getCompanyById($companyId)
|
||||
{
|
||||
return Company::findOrFail($companyId);
|
||||
}
|
||||
|
||||
public function delete($companyId)
|
||||
{
|
||||
Company::destroy($companyId);
|
||||
}
|
||||
|
||||
public function create(array $companyDetails)
|
||||
{
|
||||
return Company::create($companyDetails);
|
||||
}
|
||||
|
||||
public function update($companyId, array $newDetails)
|
||||
{
|
||||
return Company::where('company_id', $companyId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/CompanyTypeInterface.php
Normal file
12
Modules/Admin/app/Repositories/CompanyTypeInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface CompanyTypeInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getCompanyTypeById($companyTypeId);
|
||||
public function delete($companyTypeId);
|
||||
public function create(array $companyTypeDetails);
|
||||
public function update($companyTypeId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/CompanyTypeRepository.php
Normal file
35
Modules/Admin/app/Repositories/CompanyTypeRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\CompanyType;
|
||||
|
||||
|
||||
class CompanyTypeRepository implements CompanyTypeInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return CompanyType::get();
|
||||
}
|
||||
|
||||
public function getCompanyTypeById($companyTypeId)
|
||||
{
|
||||
return CompanyType::findOrFail($companyTypeId);
|
||||
}
|
||||
|
||||
public function delete($companyTypeId)
|
||||
{
|
||||
CompanyType::destroy($companyTypeId);
|
||||
}
|
||||
|
||||
public function create(array $companyTypeDetails)
|
||||
{
|
||||
return CompanyType::create($companyTypeDetails);
|
||||
}
|
||||
|
||||
public function update($companyTypeId, array $newDetails)
|
||||
{
|
||||
return CompanyType::where('companyType_id', $companyTypeId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/ComplaintInterface.php
Normal file
12
Modules/Admin/app/Repositories/ComplaintInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface ComplaintInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getComplaintById($complaintId);
|
||||
public function delete($complaintId);
|
||||
public function create(array $complaintDetails);
|
||||
public function update($complaintId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/ComplaintRepository.php
Normal file
35
Modules/Admin/app/Repositories/ComplaintRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Complaint;
|
||||
|
||||
|
||||
class ComplaintRepository implements ComplaintInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Complaint::get();
|
||||
}
|
||||
|
||||
public function getComplaintById($complaintId)
|
||||
{
|
||||
return Complaint::findOrFail($complaintId);
|
||||
}
|
||||
|
||||
public function delete($complaintId)
|
||||
{
|
||||
Complaint::destroy($complaintId);
|
||||
}
|
||||
|
||||
public function create(array $complaintDetails)
|
||||
{
|
||||
return Complaint::create($complaintDetails);
|
||||
}
|
||||
|
||||
public function update($complaintId, array $newDetails)
|
||||
{
|
||||
return Complaint::where('complaint_id', $complaintId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/EventInterface.php
Normal file
12
Modules/Admin/app/Repositories/EventInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface EventInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getEventById($eventId);
|
||||
public function delete($eventId);
|
||||
public function create(array $eventDetails);
|
||||
public function update($eventId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/EventRepository.php
Normal file
35
Modules/Admin/app/Repositories/EventRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Event;
|
||||
|
||||
|
||||
class EventRepository implements EventInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Event::get();
|
||||
}
|
||||
|
||||
public function getEventById($eventId)
|
||||
{
|
||||
return Event::findOrFail($eventId);
|
||||
}
|
||||
|
||||
public function delete($eventId)
|
||||
{
|
||||
Event::destroy($eventId);
|
||||
}
|
||||
|
||||
public function create(array $eventDetails)
|
||||
{
|
||||
return Event::create($eventDetails);
|
||||
}
|
||||
|
||||
public function update($eventId, array $newDetails)
|
||||
{
|
||||
return Event::where('event_id', $eventId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/HolidayInterface.php
Normal file
12
Modules/Admin/app/Repositories/HolidayInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface HolidayInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getHolidayById($holidayId);
|
||||
public function delete($holidayId);
|
||||
public function create(array $holidayDetails);
|
||||
public function update($holidayId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/HolidayRepository.php
Normal file
35
Modules/Admin/app/Repositories/HolidayRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Holiday;
|
||||
|
||||
|
||||
class HolidayRepository implements HolidayInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Holiday::get();
|
||||
}
|
||||
|
||||
public function getHolidayById($holidayId)
|
||||
{
|
||||
return Holiday::findOrFail($holidayId);
|
||||
}
|
||||
|
||||
public function delete($holidayId)
|
||||
{
|
||||
Holiday::destroy($holidayId);
|
||||
}
|
||||
|
||||
public function create(array $holidayDetails)
|
||||
{
|
||||
return Holiday::create($holidayDetails);
|
||||
}
|
||||
|
||||
public function update($holidayId, array $newDetails)
|
||||
{
|
||||
return Holiday::where('holiday_id', $holidayId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface PromotionDemotionInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getPromotionDemotionById($promotionDemotionId);
|
||||
public function delete($promotionDemotionId);
|
||||
public function create(array $promotionDemotionDetails);
|
||||
public function update($promotionDemotionId, array $newDetails);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\PromotionDemotion;
|
||||
|
||||
|
||||
class PromotionDemotionRepository implements PromotionDemotionInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return PromotionDemotion::get();
|
||||
}
|
||||
|
||||
public function getPromotionDemotionById($promotionDemotionId)
|
||||
{
|
||||
return PromotionDemotion::findOrFail($promotionDemotionId);
|
||||
}
|
||||
|
||||
public function delete($promotionDemotionId)
|
||||
{
|
||||
PromotionDemotion::destroy($promotionDemotionId);
|
||||
}
|
||||
|
||||
public function create(array $promotionDemotionDetails)
|
||||
{
|
||||
return PromotionDemotion::create($promotionDemotionDetails);
|
||||
}
|
||||
|
||||
public function update($promotionDemotionId, array $newDetails)
|
||||
{
|
||||
return PromotionDemotion::where('promotion_demotion_id', $promotionDemotionId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/ResignationInterface.php
Normal file
12
Modules/Admin/app/Repositories/ResignationInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface ResignationInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getResignationById($resignationId);
|
||||
public function delete($resignationId);
|
||||
public function create(array $resignationDetails);
|
||||
public function update($resignationId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/ResignationRepository.php
Normal file
35
Modules/Admin/app/Repositories/ResignationRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Resignation;
|
||||
|
||||
|
||||
class ResignationRepository implements ResignationInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Resignation::get();
|
||||
}
|
||||
|
||||
public function getResignationById($resignationId)
|
||||
{
|
||||
return Resignation::findOrFail($resignationId);
|
||||
}
|
||||
|
||||
public function delete($resignationId)
|
||||
{
|
||||
Resignation::destroy($resignationId);
|
||||
}
|
||||
|
||||
public function create(array $resignationDetails)
|
||||
{
|
||||
return Resignation::create($resignationDetails);
|
||||
}
|
||||
|
||||
public function update($resignationId, array $newDetails)
|
||||
{
|
||||
return Resignation::where('resignation_id', $resignationId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/TransferInterface.php
Normal file
12
Modules/Admin/app/Repositories/TransferInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface TransferInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getTransferById($transferId);
|
||||
public function delete($transferId);
|
||||
public function create(array $transferDetails);
|
||||
public function update($transferId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/TransferRepository.php
Normal file
35
Modules/Admin/app/Repositories/TransferRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Transfer;
|
||||
|
||||
|
||||
class TransferRepository implements TransferInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Transfer::get();
|
||||
}
|
||||
|
||||
public function getTransferById($transferId)
|
||||
{
|
||||
return Transfer::findOrFail($transferId);
|
||||
}
|
||||
|
||||
public function delete($transferId)
|
||||
{
|
||||
Transfer::destroy($transferId);
|
||||
}
|
||||
|
||||
public function create(array $transferDetails)
|
||||
{
|
||||
return Transfer::create($transferDetails);
|
||||
}
|
||||
|
||||
public function update($transferId, array $newDetails)
|
||||
{
|
||||
return Transfer::where('transfer_id', $transferId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/WarningInterface.php
Normal file
12
Modules/Admin/app/Repositories/WarningInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface WarningInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getWarningById($warningId);
|
||||
public function delete($warningId);
|
||||
public function create(array $warningDetails);
|
||||
public function update($warningId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/WarningRepository.php
Normal file
35
Modules/Admin/app/Repositories/WarningRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Warning;
|
||||
|
||||
|
||||
class WarningRepository implements WarningInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Warning::get();
|
||||
}
|
||||
|
||||
public function getWarningById($warningId)
|
||||
{
|
||||
return Warning::findOrFail($warningId);
|
||||
}
|
||||
|
||||
public function delete($warningId)
|
||||
{
|
||||
Warning::destroy($warningId);
|
||||
}
|
||||
|
||||
public function create(array $warningDetails)
|
||||
{
|
||||
return Warning::create($warningDetails);
|
||||
}
|
||||
|
||||
public function update($warningId, array $newDetails)
|
||||
{
|
||||
return Warning::where('warning_id', $warningId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
68
Modules/Admin/app/Services/AdminService.php
Normal file
68
Modules/Admin/app/Services/AdminService.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace Modules\Admin\Services;
|
||||
|
||||
use Modules\Admin\Models\Castes;
|
||||
use Modules\Admin\Models\Cities;
|
||||
use Modules\Admin\Models\CompanyType;
|
||||
use Modules\Admin\Models\Country;
|
||||
use Modules\Admin\Models\Departments;
|
||||
use Modules\Admin\Models\Designations;
|
||||
use Modules\Admin\Models\Districts;
|
||||
use Modules\Admin\Models\Genders;
|
||||
use Modules\Admin\Models\Nationalities;
|
||||
use Modules\Admin\Models\Province;
|
||||
|
||||
final class AdminService
|
||||
{
|
||||
function pluckCountries()
|
||||
{
|
||||
return Country::pluck('title', 'country_id');
|
||||
}
|
||||
|
||||
function pluckCompanyTypes()
|
||||
{
|
||||
return CompanyType::pluck('title', 'company_type_id');
|
||||
}
|
||||
|
||||
function pluckProvinces()
|
||||
{
|
||||
return Province::pluck('title', 'province_id');
|
||||
}
|
||||
|
||||
function pluckDistricts()
|
||||
{
|
||||
return Districts::pluck('title', 'district_id');
|
||||
|
||||
}
|
||||
|
||||
function pluckCities()
|
||||
{
|
||||
return Cities::pluck('title', 'city_id');
|
||||
}
|
||||
|
||||
function pluckCastes()
|
||||
{
|
||||
return Castes::pluck('title', 'caste_id');
|
||||
}
|
||||
|
||||
function pluckGenders()
|
||||
{
|
||||
return Genders::pluck('title', 'gender_id');
|
||||
}
|
||||
|
||||
function pluckNationalities()
|
||||
{
|
||||
return Nationalities::pluck('title', 'nationality_id');
|
||||
}
|
||||
|
||||
function pluckDepartments()
|
||||
{
|
||||
return Departments::pluck('title', 'department_id');
|
||||
}
|
||||
|
||||
function pluckDesignations()
|
||||
{
|
||||
return Designations::pluck('title', 'designation_id');
|
||||
}
|
||||
}
|
||||
|
30
Modules/Admin/composer.json
Normal file
30
Modules/Admin/composer.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "nwidart/admin",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Admin\\": "app/",
|
||||
"Modules\\Admin\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Admin\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Admin\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Admin/config/.gitkeep
Normal file
0
Modules/Admin/config/.gitkeep
Normal file
5
Modules/Admin/config/config.php
Normal file
5
Modules/Admin/config/config.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Admin',
|
||||
];
|
0
Modules/Admin/database/factories/.gitkeep
Normal file
0
Modules/Admin/database/factories/.gitkeep
Normal file
0
Modules/Admin/database/migrations/.gitkeep
Normal file
0
Modules/Admin/database/migrations/.gitkeep
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_promotion_demotions', function (Blueprint $table) {
|
||||
$table->tinyInteger('promotion_demotion_id')->unsigned()->autoIncrement();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('alias')->nullable();
|
||||
$table->unsignedBigInteger('employee_id')->nullable();
|
||||
$table->unsignedBigInteger('old_designation_id')->nullable();
|
||||
$table->unsignedBigInteger('new_designation_id')->nullable();
|
||||
$table->unsignedBigInteger('type')->nullable();
|
||||
$table->date('date')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_promotion_demotions');
|
||||
}
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_appreciations', function (Blueprint $table) {
|
||||
$table->tinyInteger('appreciation_id')->unsigned()->autoIncrement();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('alias')->nullable();
|
||||
$table->string('type')->nullable();
|
||||
$table->unsignedBigInteger('employee_id')->nullable();
|
||||
$table->unsignedBigInteger('appreciated_by')->nullable();
|
||||
$table->date('appreciated_date')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_appreciations');
|
||||
}
|
||||
};
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_resignations', function (Blueprint $table) {
|
||||
$table->tinyInteger('resignation_id')->unsigned()->autoIncrement();
|
||||
$table->unsignedBigInteger('employee_id')->nullable();
|
||||
$table->date('resignation_date')->nullable();
|
||||
$table->date('approved_date')->nullable();
|
||||
$table->unsignedBigInteger('approved_by')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_resignations');
|
||||
}
|
||||
};
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_complaints', function (Blueprint $table) {
|
||||
$table->tinyInteger('complaint_id')->unsigned()->autoIncrement();
|
||||
$table->unsignedBigInteger('employee_id')->nullable();
|
||||
$table->date('complaint_date')->nullable();
|
||||
$table->unsignedBigInteger('complaint_by')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_complaints');
|
||||
}
|
||||
};
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_transfers', function (Blueprint $table) {
|
||||
$table->tinyInteger('transfer_id')->unsigned()->autoIncrement();
|
||||
$table->unsignedBigInteger('employee_id')->nullable();
|
||||
$table->unsignedBigInteger('old_department_id')->nullable();
|
||||
$table->unsignedBigInteger('new_department_id')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->date('transfer_date')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_transfers');
|
||||
}
|
||||
};
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_warnings', function (Blueprint $table) {
|
||||
$table->tinyInteger('warning_id')->unsigned()->autoIncrement();
|
||||
$table->unsignedBigInteger('employee_id')->nullable();
|
||||
$table->mediumText('subject')->nullable();
|
||||
$table->string('type')->nullable();
|
||||
$table->date('warning_date')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_warnings');
|
||||
}
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_companies', function (Blueprint $table) {
|
||||
$table->tinyInteger('company_id')->unsigned()->autoIncrement();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('alias')->nullable();
|
||||
$table->unsignedBigInteger('company_type_id')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->string('bank_name')->nullable();
|
||||
$table->string('bank_acc_no')->nullable();
|
||||
$table->string('bank_acc_branch')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_companies');
|
||||
}
|
||||
};
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_company_types', function (Blueprint $table) {
|
||||
$table->tinyInteger('company_type_id')->unsigned()->autoIncrement();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('alias')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_company_types');
|
||||
}
|
||||
};
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_events', function (Blueprint $table) {
|
||||
$table->unsignedTinyInteger('event_id')->autoIncrement();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('alias')->nullable();
|
||||
$table->string('type')->nullable();
|
||||
$table->string('date')->nullable();
|
||||
$table->time('start_time')->nullable();
|
||||
$table->time('end_time')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->string('location')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_events');
|
||||
}
|
||||
};
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_holidays', function (Blueprint $table) {
|
||||
$table->unsignedTinyInteger('holiday_id')->autoIncrement();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('alias')->nullable();
|
||||
$table->string('date')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->mediumText('remarks')->nullable();
|
||||
$table->unsignedBigInteger('createdBy')->nullable();
|
||||
$table->unsignedBigInteger('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_holidays');
|
||||
}
|
||||
};
|
0
Modules/Admin/database/seeders/.gitkeep
Normal file
0
Modules/Admin/database/seeders/.gitkeep
Normal file
16
Modules/Admin/database/seeders/AdminDatabaseSeeder.php
Normal file
16
Modules/Admin/database/seeders/AdminDatabaseSeeder.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\database\seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AdminDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
11
Modules/Admin/module.json
Normal file
11
Modules/Admin/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Admin",
|
||||
"alias": "admin",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Admin\\Providers\\AdminServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Admin/package.json
Normal file
15
Modules/Admin/package.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^1.1.2",
|
||||
"laravel-vite-plugin": "^0.7.5",
|
||||
"sass": "^1.69.5",
|
||||
"postcss": "^8.3.7",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
0
Modules/Admin/resources/assets/.gitkeep
Normal file
0
Modules/Admin/resources/assets/.gitkeep
Normal file
0
Modules/Admin/resources/assets/js/app.js
Normal file
0
Modules/Admin/resources/assets/js/app.js
Normal file
0
Modules/Admin/resources/assets/sass/app.scss
Normal file
0
Modules/Admin/resources/assets/sass/app.scss
Normal file
0
Modules/Admin/resources/views/.gitkeep
Normal file
0
Modules/Admin/resources/views/.gitkeep
Normal file
23
Modules/Admin/resources/views/appreciations/create.blade.php
Normal file
23
Modules/Admin/resources/views/appreciations/create.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
<div class='card-body'>
|
||||
|
||||
{{ html()->form('POST')->route('appreciation.store')->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||
|
||||
@include('admin::partials.appreciations.action')
|
||||
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
23
Modules/Admin/resources/views/appreciations/edit.blade.php
Normal file
23
Modules/Admin/resources/views/appreciations/edit.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
<div class='card-body'>
|
||||
|
||||
{{ html()->modelForm($appreciation, 'PUT')->route('appreciation.update', $appreciation->appreciation_id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||
|
||||
@include('admin::partials.appreciations.action')
|
||||
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
75
Modules/Admin/resources/views/appreciations/index.blade.php
Normal file
75
Modules/Admin/resources/views/appreciations/index.blade.php
Normal file
@ -0,0 +1,75 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">{{ $title }}</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('appreciation.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create Appreciation</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="buttons-datatables" class="display table-sm table-bordered table">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="tb-col"><span class="overline-title">S.N</span></th>
|
||||
<th class="tb-col"><span class="overline-title">Employee</span></th>
|
||||
<th class="tb-col"><span class="overline-title">Appreciated Type</span></th>
|
||||
<th class="tb-col"><span class="overline-title">Appreciated By</span></th>
|
||||
<th class="tb-col"><span class="overline-title">Appreciated Date</span></th>
|
||||
<th class="tb-col" data-sortable="false"><span class="overline-title">Action</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@foreach ($appreciationLists as $index => $item)
|
||||
<tr>
|
||||
<td class="tb-col">{{ $index + 1 }}</td>
|
||||
<td class="tb-col">{{ $item->employee_id }}</td>
|
||||
<td class="tb-col">{{ $item->type }}</td>
|
||||
<td class="tb-col">{{ $item->appreciated_by }}</td>
|
||||
<td class="tb-col">{{ $item->appreciated_date }}</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('appreciation.show', [$item->appreciation_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> View</a>
|
||||
</li>
|
||||
|
||||
<li><a href="{{ route('appreciation.edit', [$item->appreciation_id]) }}"
|
||||
class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i>
|
||||
Edit</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="{{ route('appreciation.destroy', [$item->appreciation_id]) }}"
|
||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> Delete
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
48
Modules/Admin/resources/views/appreciations/show.blade.php
Normal file
48
Modules/Admin/resources/views/appreciations/show.blade.php
Normal file
@ -0,0 +1,48 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">View Detail</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('designations.index') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Back to List</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='card-body'>
|
||||
<p><b>Title : </b> <span>{{ $data->title }}</span></p>
|
||||
<p><b>Alias : </b> <span>{{ $data->alias }}</span></p>
|
||||
<p><b>Status : </b> <span
|
||||
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
|
||||
</p>
|
||||
<p><b>Remarks : </b> <span>{{ $data->remarks }}</span></p>
|
||||
<p><b>Display Order : </b> <span>{{ $data->display_order }}</span></p>
|
||||
<p><b>Createdby : </b> <span>{{ $data->createdby }}</span></p>
|
||||
<p><b>Updatedby : </b> <span>{{ $data->updatedby }}</span></p>
|
||||
<p><b>Job Description : </b> <span>{{ $data->job_description }}</span></p>
|
||||
<p><b>Departments Id : </b> <span>{{ $data->departments_id }}</span></p>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<p><b>Created On :</b> <span>{{ $data->created_at }}</span></p>
|
||||
<p><b>Created By :</b> <span>{{ $data->createdBy }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Updated On :</b> <span>{{ $data->updated_at }}</span></p>
|
||||
<p><b>Updated By :</b> <span>{{ $data->updatedBy }}</span></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endSection
|
224
Modules/Admin/resources/views/calendars/index.blade.php
Normal file
224
Modules/Admin/resources/views/calendars/index.blade.php
Normal file
@ -0,0 +1,224 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-xl-3">
|
||||
<div class="card card-h-100">
|
||||
<div class="card-body">
|
||||
<button class="btn btn-primary w-100" id="btn-new-event"><i class="mdi mdi-plus"></i> Create New
|
||||
Event</button>
|
||||
|
||||
<div id="external-events">
|
||||
<br>
|
||||
<p class="text-muted">Drag and drop your event or click in the calendar</p>
|
||||
<div class="external-event fc-event bg-success-subtle text-success" data-class="bg-success-subtle">
|
||||
<i class="mdi mdi-checkbox-blank-circle me-2"></i>New Event Planning
|
||||
</div>
|
||||
<div class="external-event fc-event bg-info-subtle text-info" data-class="bg-info-subtle">
|
||||
<i class="mdi mdi-checkbox-blank-circle me-2"></i>Meeting
|
||||
</div>
|
||||
<div class="external-event fc-event bg-warning-subtle text-warning" data-class="bg-warning-subtle">
|
||||
<i class="mdi mdi-checkbox-blank-circle me-2"></i>Generating Reports
|
||||
</div>
|
||||
<div class="external-event fc-event bg-danger-subtle text-danger" data-class="bg-danger-subtle">
|
||||
<i class="mdi mdi-checkbox-blank-circle me-2"></i>Create New theme
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h5 class="mb-1">Upcoming Events</h5>
|
||||
<p class="text-muted">Don't miss scheduled events</p>
|
||||
<div class="me-n1 mb-3 pe-2" data-simplebar style="height: 400px">
|
||||
<div id="upcoming-event-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body bg-info-subtle">
|
||||
<div class="d-flex">
|
||||
<div class="flex-shrink-0">
|
||||
<i data-feather="calendar" class="text-info icon-dual-info"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h6 class="fs-15">Welcome to your Calendar!</h6>
|
||||
<p class="text-muted mb-0">Event that applications book will appear here. Click on an event to see
|
||||
the details and manage applicants event.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end card-->
|
||||
</div> <!-- end col-->
|
||||
|
||||
<div class="col-xl-9">
|
||||
<div class="card card-h-100">
|
||||
<div class="card-body">
|
||||
<div id="calendar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!--end row-->
|
||||
|
||||
<div style='clear:both'></div>
|
||||
|
||||
<!-- Add New Event MODAL -->
|
||||
<div class="modal fade" id="event-modal" tabindex="-1">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content border-0">
|
||||
<div class="modal-header bg-info-subtle p-3">
|
||||
<h5 class="modal-title" id="modal-title">Event</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-hidden="true"></button>
|
||||
</div>
|
||||
<div class="modal-body p-4">
|
||||
<form class="needs-validation" name="event-form" id="form-event" novalidate>
|
||||
<div class="text-end">
|
||||
<a href="#" class="btn btn-sm btn-soft-primary" id="edit-event-btn" data-id="edit-event"
|
||||
onclick="editEvent(this)" role="button">Edit</a>
|
||||
</div>
|
||||
<div class="event-details">
|
||||
<div class="d-flex mb-2">
|
||||
<div class="flex-grow-1 d-flex align-items-center">
|
||||
<div class="me-3 flex-shrink-0">
|
||||
<i class="ri-calendar-event-line text-muted fs-16"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h6 class="d-block fw-semibold mb-0" id="event-start-date-tag"></h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
<div class="me-3 flex-shrink-0">
|
||||
<i class="ri-time-line text-muted fs-16"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h6 class="d-block fw-semibold mb-0"><span id="event-timepicker1-tag"></span> - <span
|
||||
id="event-timepicker2-tag"></span></h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
<div class="me-3 flex-shrink-0">
|
||||
<i class="ri-map-pin-line text-muted fs-16"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<h6 class="d-block fw-semibold mb-0"> <span id="event-location-tag"></span></h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex mb-3">
|
||||
<div class="me-3 flex-shrink-0">
|
||||
<i class="ri-discuss-line text-muted fs-16"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<p class="d-block text-muted mb-0" id="event-description-tag"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row event-form">
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Type</label>
|
||||
<select class="form-select d-none" name="category" id="event-category" required>
|
||||
<option value="bg-danger-subtle">Danger</option>
|
||||
<option value="bg-success-subtle">Success</option>
|
||||
<option value="bg-primary-subtle">Primary</option>
|
||||
<option value="bg-info-subtle">Info</option>
|
||||
<option value="bg-dark-subtle">Dark</option>
|
||||
<option value="bg-warning-subtle">Warning</option>
|
||||
</select>
|
||||
<div class="invalid-feedback">Please select a valid event category</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Event Name</label>
|
||||
<input class="form-control d-none" placeholder="Enter event name" type="text"
|
||||
name="title" id="event-title" required value="" />
|
||||
<div class="invalid-feedback">Please provide a valid event name</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<label>Event Date</label>
|
||||
<div class="input-group d-none">
|
||||
<input type="text" id="event-start-date" class="form-control flatpickr flatpickr-input"
|
||||
placeholder="Select date" readonly required>
|
||||
<span class="input-group-text"><i class="ri-calendar-event-line"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-12" id="event-time">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Start Time</label>
|
||||
<div class="input-group d-none">
|
||||
<input id="timepicker1" type="text" class="form-control flatpickr flatpickr-input"
|
||||
placeholder="Select start time" readonly>
|
||||
<span class="input-group-text"><i class="ri-time-line"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">End Time</label>
|
||||
<div class="input-group d-none">
|
||||
<input id="timepicker2" type="text" class="form-control flatpickr flatpickr-input"
|
||||
placeholder="Select end time" readonly>
|
||||
<span class="input-group-text"><i class="ri-time-line"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<label for="event-location">Location</label>
|
||||
<div>
|
||||
<input type="text" class="form-control d-none" name="event-location"
|
||||
id="event-location" placeholder="Event location">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<input type="hidden" id="eventid" name="eventid" value="" />
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Description</label>
|
||||
<textarea class="form-control d-none" id="event-description" placeholder="Enter a description" rows="3"
|
||||
spellcheck="false"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
<div class="hstack justify-content-end gap-2">
|
||||
<button type="button" class="btn btn-soft-danger" id="btn-delete-event"><i
|
||||
class="ri-close-line align-bottom"></i> Delete</button>
|
||||
<button type="submit" class="btn btn-success" id="btn-save-event">Add Event</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end modal-content-->
|
||||
</div> <!-- end modal dialog-->
|
||||
</div> <!-- end modal-->
|
||||
<!-- end modal-->
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
41
Modules/Admin/resources/views/castes/edit.blade.php
Normal file
41
Modules/Admin/resources/views/castes/edit.blade.php
Normal file
@ -0,0 +1,41 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Caste'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class='card'>
|
||||
|
||||
<div class='card-body'>
|
||||
|
||||
<form action="{{ $editable ? route('castes.update', [$data->caste_id]) : route('castes.store') }}"
|
||||
id="updateCustomForm" method="POST">
|
||||
|
||||
@csrf
|
||||
<input type=hidden name='caste_id' value='{{ $editable ? $data->caste_id : '' }}' />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mt-2">
|
||||
|
||||
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('castes.index')); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -1,101 +1,92 @@
|
||||
@extends('layouts.app')
|
||||
@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="dataTable table" id="tbl_castes" data-url="{{ route('castes.sort') }}">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('title') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
|
||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach ($data as $item)
|
||||
<tr data-id="{{ $item->caste_id }}" data-display_order="{{ $item->display_order }}"
|
||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||
<td class="tb-col">{{ $i++ }}</td>
|
||||
<td class="tb-col">{{ $item->title }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="alias-wrapper" data-id="{{ $item->caste_id }}">
|
||||
<span class="alias">{{ $item->alias }}</span>
|
||||
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
|
||||
id="alias_{{ $item->caste_id }}" />
|
||||
</div>
|
||||
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
|
||||
</td>
|
||||
<td class="tb-col">
|
||||
<div class="dropdown d-inline-block">
|
||||
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown"
|
||||
aria-expanded="false">
|
||||
<i class="ri-more-fill align-middle"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a href="{{ route('castes.show', [$item->caste_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
|
||||
<li><a href="{{ route('castes.edit', [$item->caste_id]) }}" class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
|
||||
<li>
|
||||
<a href="{{ route('castes.toggle', [$item->caste_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
onclick="confirmToggle(this.href)">
|
||||
<i class="ri-article-fill text-muted me-2 align-bottom"></i>
|
||||
{{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
|
||||
</a>
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('castes.clone', [$item->caste_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
onclick="confirmClone(this.href)">
|
||||
<i class="ri-file-copy-line text-muted me-2 align-bottom"></i> {{ label('Clone') }}
|
||||
</a>
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Caste'])
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('castes.destroy', [$item->caste_id]) }}" class="dropdown-item remove-item-btn"
|
||||
onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
|
||||
</a>
|
||||
<!-- end page title -->
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="card">
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">Caste Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('castes.index') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create Caste</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="dataTable table" id="tbl_castes" data-url="{{ route('castes.sort') }}">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('title') }}</span></th>
|
||||
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
|
||||
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($data as $index => $item)
|
||||
<tr data-id="{{ $item->caste_id }}" data-display_order="{{ $item->display_order }}"
|
||||
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
|
||||
<td class="tb-col">{{ $index + 1 }}</td>
|
||||
<td class="tb-col">{{ $item->title }}</td>
|
||||
<td class="tb-col">
|
||||
<div class="alias-wrapper" data-id="{{ $item->caste_id }}">
|
||||
<span class="alias">{{ $item->alias }}</span>
|
||||
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
|
||||
id="alias_{{ $item->caste_id }}" />
|
||||
</div>
|
||||
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
|
||||
</td>
|
||||
<td class="tb-col">
|
||||
<div class="dropdown d-inline-block">
|
||||
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown"
|
||||
aria-expanded="false">
|
||||
<i class="ri-more-fill align-middle"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a href="{{ route('castes.show', [$item->caste_id]) }}" class="dropdown-item"><i
|
||||
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
|
||||
<li><a href="{{ route('castes.edit', [$item->caste_id]) }}"
|
||||
class="dropdown-item edit-item-btn"><i
|
||||
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
|
||||
<li>
|
||||
<a href="{{ route('castes.toggle', [$item->caste_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
onclick="confirmToggle(this.href)">
|
||||
<i class="ri-article-fill text-muted me-2 align-bottom"></i>
|
||||
{{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('castes.clone', [$item->caste_id]) }}" class="dropdown-item toggle-item-btn"
|
||||
onclick="confirmClone(this.href)">
|
||||
<i class="ri-file-copy-line text-muted me-2 align-bottom"></i> {{ label('Clone') }}
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('castes.destroy', [$item->caste_id]) }}"
|
||||
class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
|
||||
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
|
||||
@endpush
|
||||
@push('js')
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(e) {
|
||||
$('.change-alias-badge').on('click', function() {
|
43
Modules/Admin/resources/views/castes/show.blade.php
Normal file
43
Modules/Admin/resources/views/castes/show.blade.php
Normal file
@ -0,0 +1,43 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Caste'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class='card'>
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">View Detail</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('castes.index') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Back to List</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='card-body'>
|
||||
<p><b>Title : </b> <span>{{ $data->title }}</span></p>
|
||||
<p><b>Alias : </b> <span>{{ $data->alias }}</span></p>
|
||||
<p><b>Status : </b> <span
|
||||
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
|
||||
</p>
|
||||
<p><b>Remarks : </b> <span>{{ $data->remarks }}</span></p>
|
||||
<p><b>Display Order : </b> <span>{{ $data->display_order }}</span></p>
|
||||
<p><b>Createdby : </b> <span>{{ $data->createdby }}</span></p>
|
||||
<p><b>Updatedby : </b> <span>{{ $data->updatedby }}</span></p>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<p><b>Created On :</b> <span>{{ $data->created_at }}</span></p>
|
||||
<p><b>Created By :</b> <span>{{ $data->createdBy }}</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p><b>Updated On :</b> <span>{{ $data->updated_at }}</span></p>
|
||||
<p><b>Updated By :</b> <span>{{ $data->updatedBy }}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
47
Modules/Admin/resources/views/cities/edit.blade.php
Normal file
47
Modules/Admin/resources/views/cities/edit.blade.php
Normal file
@ -0,0 +1,47 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'City'])
|
||||
|
||||
<!-- end page title -->
|
||||
<div class='card'>
|
||||
<div class='card-body'>
|
||||
<form action="{{ $editable ? route('cities.update', [$data->city_id]) : route('cities.store') }}"
|
||||
id="updateCustomForm" method="POST">
|
||||
|
||||
@csrf
|
||||
<input type=hidden name='city_id' value='{{ $editable ? $data->city_id : '' }}' />
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-6">
|
||||
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
{{ createCustomSelect('tbl_districts', 'title', 'district_id', $editable ? $data->districts_id : '', 'District', 'districts_id', 'form-control select2', 'status<>-1') }}
|
||||
</div>
|
||||
|
||||
|
||||
{{-- <div class="col-lg-12 pb-2">
|
||||
{{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
|
||||
</div> --}}
|
||||
|
||||
<div class="col-lg-12 pb-2">
|
||||
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mt-2">
|
||||
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
|
||||
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('cities.index')); ?>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user