first commit
This commit is contained in:
0
Modules/Admin/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Admin/app/Http/Controllers/.gitkeep
Normal file
66
Modules/Admin/app/Http/Controllers/AdminController.php
Normal file
66
Modules/Admin/app/Http/Controllers/AdminController.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
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,94 @@
|
||||
<?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;
|
||||
use Modules\Employee\Repositories\EmployeeRepository;
|
||||
|
||||
class AppreciationController extends Controller
|
||||
{
|
||||
private $appreciationRepository;
|
||||
private $employeeRepository;
|
||||
|
||||
public function __construct(AppreciationRepository $appreciationRepository, EmployeeRepository $employeeRepository)
|
||||
{
|
||||
$this->appreciationRepository = $appreciationRepository;
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
$data['employeeLists'] = $this->employeeRepository->pluck();
|
||||
return view('admin::appreciations.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->appreciationRepository->create($request->all());
|
||||
toastr()->success('Appreciation Created Successfully.');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
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['employeeLists'] = $this->employeeRepository->pluck();
|
||||
$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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
110
Modules/Admin/app/Http/Controllers/CalendarController.php
Normal file
110
Modules/Admin/app/Http/Controllers/CalendarController.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Admin\Models\Event;
|
||||
use Modules\Admin\Models\Holiday;
|
||||
use Modules\Admin\Repositories\EventRepository;
|
||||
use Modules\Meeting\Models\Meeting;
|
||||
|
||||
class CalendarController extends Controller
|
||||
{
|
||||
private $eventRepository;
|
||||
|
||||
public function __construct(EventRepository $eventRepository)
|
||||
{
|
||||
$this->eventRepository = $eventRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Calendar';
|
||||
$filters['start_date'] = now()->toDateString();
|
||||
$data['events'] = $this->eventRepository->findAll($filters);
|
||||
return view('admin::calendars.index', $data);
|
||||
}
|
||||
public function calendarByAjax(Request $request)
|
||||
{
|
||||
$filters['start_date'] = $request->start;
|
||||
$filters['end_date'] = $request->end;
|
||||
|
||||
$events = Event::when($filters, function ($query) use ($filters) {
|
||||
if (isset($filters["start_date"])) {
|
||||
$query->whereDate("start_date", ">=", $filters["start_date"]);
|
||||
}
|
||||
|
||||
if (isset($filters["end_date"])) {
|
||||
$query->whereDate("end_date", "<=", $filters["end_date"]);
|
||||
}
|
||||
|
||||
})->get();
|
||||
$list = [];
|
||||
foreach ($events as $event) {
|
||||
$list[] = [
|
||||
"id" => $event->event_id,
|
||||
"title" => $event->title,
|
||||
"type" => 'event',
|
||||
"start" => $event->start_date,
|
||||
"end" => $event->end_date,
|
||||
"className" => "bg-info-subtle",
|
||||
"desc" => $event->description,
|
||||
"location" => $event->location,
|
||||
];
|
||||
}
|
||||
|
||||
$meetings = Meeting::when($filters, function ($query) use ($filters) {
|
||||
if (isset($filters["start_date"])) {
|
||||
$query->whereDate("date", ">=", $filters["start_date"]);
|
||||
}
|
||||
|
||||
if (isset($filters["end_date"])) {
|
||||
$query->whereDate("date", "<=", $filters["end_date"]);
|
||||
}
|
||||
|
||||
})->get();
|
||||
foreach ($meetings as $meeting) {
|
||||
$list[] = [
|
||||
"id" => $meeting->meeting_id,
|
||||
"title" => $meeting->title,
|
||||
"type" => 'meeting',
|
||||
"start" => $meeting->date,
|
||||
"className" => "bg-warning-subtle",
|
||||
"location" => $meeting->location,
|
||||
"desc" => $event->description,
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
$holidays = Holiday::when($filters, function ($query) use ($filters) {
|
||||
if (isset($filters["start_date"])) {
|
||||
$query->whereDate("start_date", ">=", $filters["start_date"]);
|
||||
}
|
||||
|
||||
if (isset($filters["end_date"])) {
|
||||
$query->whereDate("end_date", "<=", $filters["end_date"]);
|
||||
}
|
||||
|
||||
})->get();
|
||||
foreach ($holidays as $holiday) {
|
||||
$list[] = [
|
||||
"id" => $holiday->holiday_id,
|
||||
"title" => $holiday->title,
|
||||
"type" => 'holiday',
|
||||
"start" => $holiday->start_date,
|
||||
"end" => $holiday->end_date,
|
||||
"className" => "bg-danger",
|
||||
"overlap" => false,
|
||||
"display" => 'background',
|
||||
"color" => '#ff9f89',
|
||||
"desc" => $event->description,
|
||||
|
||||
];
|
||||
}
|
||||
return $list;
|
||||
|
||||
}
|
||||
}
|
83
Modules/Admin/app/Http/Controllers/CasteController.php.bak
Normal file
83
Modules/Admin/app/Http/Controllers/CasteController.php.bak
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\CasteRepository;
|
||||
|
||||
class CasteController extends Controller
|
||||
{
|
||||
private $casteRepository;
|
||||
|
||||
public function __construct(CasteRepository $casteRepository)
|
||||
{
|
||||
$this->casteRepository = $casteRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Caste List';
|
||||
$data['casteLists'] = $this->casteRepository->findAll();
|
||||
return view('admin::castes.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Caste';
|
||||
$data['editable'] = false;
|
||||
return view('admin::castes.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->casteRepository->create($request->all());
|
||||
return redirect()->route('caste.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::castes.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Caste';
|
||||
$data['editable'] = true;
|
||||
$data['caste'] = $this->casteRepository->getCasteById($id);
|
||||
return view('admin::castes.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->casteRepository->update($id, $request->all());
|
||||
return redirect()->route('caste.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
83
Modules/Admin/app/Http/Controllers/CityController.php
Normal file
83
Modules/Admin/app/Http/Controllers/CityController.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\CityRepository;
|
||||
|
||||
class CityController extends Controller
|
||||
{
|
||||
private $cityRepository;
|
||||
|
||||
public function __construct(CityRepository $cityRepository)
|
||||
{
|
||||
$this->cityRepository = $cityRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'City List';
|
||||
$data['cityLists'] = $this->cityRepository->findAll();
|
||||
return view('admin::cities.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create City';
|
||||
$data['editable'] = false;
|
||||
return view('admin::cities.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->cityRepository->create($request->all());
|
||||
return redirect()->route('city.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::cities.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit City';
|
||||
$data['editable'] = true;
|
||||
$data['city'] = $this->cityRepository->getCityById($id);
|
||||
return view('admin::cities.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->cityRepository->update($id, $request->all());
|
||||
return redirect()->route('city.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
115
Modules/Admin/app/Http/Controllers/CompanyController.php
Normal file
115
Modules/Admin/app/Http/Controllers/CompanyController.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?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')->with('Company created successfully!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->except(['_method','_token']));
|
||||
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->getCompanyTypeById($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->except(['_token', '_method']));
|
||||
toastr()->success('Company Type Updated Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('companyType.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');
|
||||
}
|
||||
}
|
83
Modules/Admin/app/Http/Controllers/CountryController.php
Normal file
83
Modules/Admin/app/Http/Controllers/CountryController.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\CountryRepository;
|
||||
|
||||
class CountryController extends Controller
|
||||
{
|
||||
private $countryRepository;
|
||||
|
||||
public function __construct(CountryRepository $countryRepository)
|
||||
{
|
||||
$this->countryRepository = $countryRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Country List';
|
||||
$data['countryLists'] = $this->countryRepository->findAll();
|
||||
return view('admin::countries.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Country';
|
||||
$data['editable'] = false;
|
||||
return view('admin::countries.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->countryRepository->create($request->all());
|
||||
return redirect()->route('country.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::countries.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Country';
|
||||
$data['editable'] = true;
|
||||
$data['country'] = $this->countryRepository->getCountryById($id);
|
||||
return view('admin::countries.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->countryRepository->update($id, $request->all());
|
||||
return redirect()->route('country.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
104
Modules/Admin/app/Http/Controllers/DepartmentController.php
Normal file
104
Modules/Admin/app/Http/Controllers/DepartmentController.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Admin\Repositories\DepartmentRepository;
|
||||
use Modules\Employee\Repositories\EmployeeRepository;
|
||||
|
||||
class DepartmentController extends Controller
|
||||
{
|
||||
private $departmentRepository;
|
||||
private $employeeRepository;
|
||||
|
||||
public function __construct(DepartmentRepository $departmentRepository, EmployeeRepository $employeeRepository)
|
||||
{
|
||||
$this->departmentRepository = $departmentRepository;
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// toastr()
|
||||
// ->info('Welcome back')
|
||||
// ->success('Data has been saved successfully!')
|
||||
// ->warning('Are you sure you want to proceed ?');
|
||||
$data['title'] = 'Department List';
|
||||
$data['departmentLists'] = $this->departmentRepository->findAll();
|
||||
return view('admin::departments.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
// toastr('Department has been created!', 'success');
|
||||
$data['title'] = 'Create Department';
|
||||
$data['editable'] = false;
|
||||
$data['employeeLists'] = $this->employeeRepository->pluck();
|
||||
return view('admin::departments.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
// try {
|
||||
$this->departmentRepository->create($request->all());
|
||||
// toastr()->success('Department has been created!');
|
||||
// } catch (\Throwable $th) {
|
||||
// toastr()->error($th->getMessage());
|
||||
// }
|
||||
// toastr('Department has been created!', 'success');
|
||||
// return back();
|
||||
return redirect()->route('department.index')->with('sucess', 'adw');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::departments.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Department';
|
||||
$data['editable'] = true;
|
||||
$data['employeeLists'] = $this->employeeRepository->pluck();
|
||||
$data['department'] = $this->departmentRepository->getDepartmentById($id);
|
||||
return view('admin::departments.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->departmentRepository->update($id, $request->except(['_token', '_method']));
|
||||
toastr()->success('Department has been updated!');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('department.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
83
Modules/Admin/app/Http/Controllers/DesignationController.php
Normal file
83
Modules/Admin/app/Http/Controllers/DesignationController.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\DesignationRepository;
|
||||
|
||||
class DesignationController extends Controller
|
||||
{
|
||||
private $designationRepository;
|
||||
|
||||
public function __construct(DesignationRepository $designationRepository)
|
||||
{
|
||||
$this->designationRepository = $designationRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Designation List';
|
||||
$data['designationLists'] = $this->designationRepository->findAll();
|
||||
return view('admin::designations.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Designation';
|
||||
$data['editable'] = false;
|
||||
return view('admin::designations.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->designationRepository->create($request->all());
|
||||
return redirect()->route('designation.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::designations.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Designation';
|
||||
$data['editable'] = true;
|
||||
$data['designation'] = $this->designationRepository->getDesignationById($id);
|
||||
return view('admin::designations.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->designationRepository->update($id, $request->all());
|
||||
return redirect()->route('designation.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
108
Modules/Admin/app/Http/Controllers/DistrictController.php
Normal file
108
Modules/Admin/app/Http/Controllers/DistrictController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?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\DistrictRepository;
|
||||
use Modules\Admin\Services\AdminService;
|
||||
|
||||
class DistrictController extends Controller
|
||||
{
|
||||
private $districtRepository;
|
||||
private $adminService;
|
||||
|
||||
public function __construct(DistrictRepository $districtRepository, AdminService $adminService)
|
||||
{
|
||||
$this->districtRepository = $districtRepository;
|
||||
$this->adminService = $adminService;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'District List';
|
||||
$data['districtLists'] = $this->districtRepository->findAll();
|
||||
return view('admin::districts.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create District';
|
||||
$data['editable'] = false;
|
||||
$data['provinceLists'] = $this->adminService->pluckProvinces();
|
||||
return view('admin::districts.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->districtRepository->create($request->all());
|
||||
toastr()->success('District created successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
return redirect()->route('district.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::districts.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit District';
|
||||
$data['editable'] = true;
|
||||
$data['district'] = $this->districtRepository->getDistrictById($id);
|
||||
$data['provinceLists'] = $this->adminService->pluckProvinces();
|
||||
return view('admin::districts.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->districtRepository->update($id, $request->all());
|
||||
toastr()->success('District updated successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('district.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
|
||||
$this->districtRepository->delete($id);
|
||||
toastr()->success('District deleted successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('district.index');
|
||||
}
|
||||
}
|
111
Modules/Admin/app/Http/Controllers/DropdownController.php
Normal file
111
Modules/Admin/app/Http/Controllers/DropdownController.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Admin\Repositories\DropdownInterface;
|
||||
use Modules\Admin\Repositories\FieldInterface;
|
||||
|
||||
class DropdownController extends Controller
|
||||
{
|
||||
private $fieldRepository;
|
||||
private $dropdownRepository;
|
||||
|
||||
public function __construct(FieldInterface $fieldRepository,
|
||||
DropdownInterface $dropdownRepository) {
|
||||
$this->fieldRepository = $fieldRepository;
|
||||
$this->dropdownRepository = $dropdownRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Dropdown List';
|
||||
$data['fields'] = $this->fieldRepository->findAll();
|
||||
$data['fieldLists'] = $data['fields']->pluck('title', 'id');
|
||||
|
||||
return view('admin::dropdown.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
$inputData = $request->all();
|
||||
try {
|
||||
// $inputData['status'] = $request->status ?? 10;
|
||||
$this->dropdownRepository->create($inputData);
|
||||
toastr()->success('Dropdown Created Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('dropdown.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$dropdownModel = $this->dropdownRepository->getDropdownById($id);
|
||||
$fieldLists = $this->fieldRepository->getList();
|
||||
|
||||
return response()->json([
|
||||
'view' => view('admin::dropdown.edit', compact('dropdownModel', 'fieldLists'))->render(),
|
||||
'status' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
|
||||
try {
|
||||
$inputData['status'] = $request->status ?? 10;
|
||||
$this->dropdownRepository->update($id, $inputData);
|
||||
toastr()->success('Dropdown Update Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('dropdown.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->dropdownRepository->delete($id);
|
||||
toastr()->success('Dropdown Deleted Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
]);
|
||||
}
|
||||
}
|
@ -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\EthnicityRepository;
|
||||
|
||||
class EthnicityController extends Controller
|
||||
{
|
||||
private $ethnicityRepository;
|
||||
|
||||
public function __construct(EthnicityRepository $ethnicityRepository)
|
||||
{
|
||||
$this->ethnicityRepository = $ethnicityRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Ethnicity List';
|
||||
$data['ethnicityLists'] = $this->ethnicityRepository->findAll();
|
||||
return view('admin::ethnicities.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Ethnicity';
|
||||
$data['editable'] = false;
|
||||
return view('admin::ethnicities.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->ethnicityRepository->create($request->all());
|
||||
return redirect()->route('ethnicity.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::ethnicities.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Ethnicity';
|
||||
$data['editable'] = true;
|
||||
$data['ethnicity'] = $this->ethnicityRepository->getEthnicityById($id);
|
||||
return view('admin::ethnicities.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->ethnicityRepository->update($id, $request->all());
|
||||
return redirect()->route('ethnicity.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
106
Modules/Admin/app/Http/Controllers/EventController.php
Normal file
106
Modules/Admin/app/Http/Controllers/EventController.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
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->except(['_method', '_token']));
|
||||
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');
|
||||
}
|
||||
}
|
83
Modules/Admin/app/Http/Controllers/FieldController.php
Normal file
83
Modules/Admin/app/Http/Controllers/FieldController.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 Modules\Admin\Repositories\DropdownInterface;
|
||||
use Modules\Admin\Repositories\FieldInterface;
|
||||
|
||||
class FieldController extends Controller
|
||||
{
|
||||
private $fieldRepository;
|
||||
private $dropdownRepository;
|
||||
|
||||
public function __construct(FieldInterface $fieldRepository,
|
||||
DropdownInterface $dropdownRepository) {
|
||||
$this->fieldRepository = $fieldRepository;
|
||||
$this->dropdownRepository = $dropdownRepository;
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
$inputData = $request->all();
|
||||
try {
|
||||
$this->fieldRepository->create($inputData);
|
||||
toastr()->success('Field Created Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('dropdown.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
83
Modules/Admin/app/Http/Controllers/GenderController.php.bak
Normal file
83
Modules/Admin/app/Http/Controllers/GenderController.php.bak
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\GenderRepository;
|
||||
|
||||
class GenderController extends Controller
|
||||
{
|
||||
private $genderRepository;
|
||||
|
||||
public function __construct(GenderRepository $genderRepository)
|
||||
{
|
||||
$this->genderRepository = $genderRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Gender List';
|
||||
$data['genderLists'] = $this->genderRepository->findAll();
|
||||
return view('admin::genders.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Gender';
|
||||
$data['editable'] = false;
|
||||
return view('admin::genders.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->genderRepository->create($request->all());
|
||||
return redirect()->route('gender.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::genders.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Gender';
|
||||
$data['editable'] = true;
|
||||
$data['gender'] = $this->genderRepository->getGenderById($id);
|
||||
return view('admin::genders.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->genderRepository->update($id, $request->all());
|
||||
return redirect()->route('gender.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
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');
|
||||
}
|
||||
}
|
108
Modules/Admin/app/Http/Controllers/MunicipalityController.php
Normal file
108
Modules/Admin/app/Http/Controllers/MunicipalityController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?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\MunicipalityRepository;
|
||||
use Modules\Admin\Services\AdminService;
|
||||
|
||||
class MunicipalityController extends Controller
|
||||
{
|
||||
private $municipalityRepository;
|
||||
private $adminService;
|
||||
|
||||
public function __construct(MunicipalityRepository $municipalityRepository, AdminService $adminService)
|
||||
{
|
||||
$this->municipalityRepository = $municipalityRepository;
|
||||
$this->adminService = $adminService;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Municipality List';
|
||||
$data['municipalityLists'] = $this->municipalityRepository->findAll();
|
||||
return view('admin::municipalities.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Municipality';
|
||||
$data['editable'] = false;
|
||||
$data['districtLists'] = $this->adminService->pluckDistricts();
|
||||
return view('admin::municipalities.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->municipalityRepository->create($request->all());
|
||||
toastr()->success('Municipality created successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
return redirect()->route('municipality.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::municipalities.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Municipality';
|
||||
$data['editable'] = true;
|
||||
$data['municipality'] = $this->municipalityRepository->getMunicipalityById($id);
|
||||
$data['districtLists'] = $this->adminService->pluckDistricts();
|
||||
return view('admin::municipalities.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->municipalityRepository->update($id, $request->all());
|
||||
toastr()->success('Municipality updated successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('municipality.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
|
||||
$this->municipalityRepository->delete($id);
|
||||
toastr()->success('Municipality deleted successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('municipality.index');
|
||||
}
|
||||
}
|
@ -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\NationalityRepository;
|
||||
|
||||
class NationalityController extends Controller
|
||||
{
|
||||
private $nationalityRepository;
|
||||
|
||||
public function __construct(NationalityRepository $nationalityRepository)
|
||||
{
|
||||
$this->nationalityRepository = $nationalityRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Nationality List';
|
||||
$data['nationalityLists'] = $this->nationalityRepository->findAll();
|
||||
return view('admin::nationalities.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Nationality';
|
||||
$data['editable'] = false;
|
||||
return view('admin::nationalities.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->nationalityRepository->create($request->all());
|
||||
return redirect()->route('nationality.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::nationalities.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Nationality';
|
||||
$data['editable'] = true;
|
||||
$data['nationality'] = $this->nationalityRepository->getNationalityById($id);
|
||||
return view('admin::nationalities.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->nationalityRepository->update($id, $request->all());
|
||||
return redirect()->route('nationality.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data['notifications'] = auth()->user()->notifications;
|
||||
return view('notification.index', $data);
|
||||
}
|
||||
|
||||
public function markAsRead(Request $request)
|
||||
{
|
||||
$filterData = $request->all();
|
||||
try {
|
||||
$notification = auth()->user()->notifications()->where('id', $filterData['id'])->first();
|
||||
if ($notification) {
|
||||
$notification->markAsRead();
|
||||
}
|
||||
return redirect()->back()->withSuccess('Mark As Read');
|
||||
} catch (\Throwable $th) {
|
||||
return redirect()->back()->withError('Something Went Wrong!');
|
||||
}
|
||||
}
|
||||
|
||||
public function markAllAsRead(Request $request)
|
||||
{
|
||||
try {
|
||||
foreach (auth()->user()->unreadNotifications as $notification) {
|
||||
$notification->markAsRead();
|
||||
}
|
||||
return redirect()->back()->withSuccess('Mark All As Read');
|
||||
} catch (\Throwable $th) {
|
||||
//throw $th;
|
||||
return redirect()->back()->withError('Something Went Wrong!');
|
||||
}
|
||||
}
|
||||
}
|
@ -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\ProgressStatusRepository;
|
||||
|
||||
class ProgressStatusController extends Controller
|
||||
{
|
||||
private $progressStatusRepository;
|
||||
|
||||
public function __construct(ProgressStatusRepository $progressStatusRepository)
|
||||
{
|
||||
$this->progressStatusRepository = $progressStatusRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'ProgressStatus List';
|
||||
$data['progressStatusLists'] = $this->progressStatusRepository->findAll();
|
||||
return view('admin::progressstatuses.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create ProgressStatus';
|
||||
$data['editable'] = false;
|
||||
return view('admin::progressstatuses.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->progressStatusRepository->create($request->all());
|
||||
return redirect()->route('progressStatus.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::progressstatuses.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit ProgressStatus';
|
||||
$data['editable'] = true;
|
||||
$data['progressStatus'] = $this->progressStatusRepository->getProgressStatusById($id);
|
||||
return view('admin::progressstatuses.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->progressStatusRepository->update($id, $request->all());
|
||||
return redirect()->route('progressStatus.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
<?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\DepartmentInterface;
|
||||
use Modules\Admin\Repositories\DepartmentRepository;
|
||||
use Modules\Admin\Repositories\DesignationInterface;
|
||||
use Modules\Admin\Repositories\DesignationRepository;
|
||||
use Modules\Admin\Repositories\FieldInterface;
|
||||
use Modules\Admin\Repositories\FieldRepository;
|
||||
use Modules\Admin\Repositories\PromotionDemotionInterface;
|
||||
use Modules\Employee\Repositories\EmployeeInterface;
|
||||
use Modules\Employee\Repositories\EmployeeRepository;
|
||||
|
||||
class PromotionDemotionController extends Controller
|
||||
{
|
||||
private $promotionDemotionRepository;
|
||||
private $designationRepository;
|
||||
private $departmentRepository;
|
||||
private $employeeRepository;
|
||||
private $fieldRepository;
|
||||
|
||||
public function __construct(PromotionDemotionInterface $promotionDemotionRepository, DepartmentInterface $departmentRepository, DesignationInterface $designationRepository, EmployeeInterface $employeeRepository, FieldInterface $fieldRepository)
|
||||
{
|
||||
$this->promotionDemotionRepository = $promotionDemotionRepository;
|
||||
$this->designationRepository = $designationRepository;
|
||||
$this->departmentRepository = $departmentRepository;
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
$this->fieldRepository = $fieldRepository;
|
||||
}
|
||||
/**
|
||||
* 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";
|
||||
$data['employeeList'] = $this->employeeRepository->pluck();
|
||||
$data['designationList'] = $this->designationRepository->pluck();
|
||||
$data['departmentList'] = $this->departmentRepository->pluck();
|
||||
$data['rankingTypeList'] = $this->fieldRepository->getDropdownByAlias('ranking-type');
|
||||
return view('admin::promotiondemotions.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->promotionDemotionRepository->create($request->all());
|
||||
toastr()->success('Record has been created!');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
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);
|
||||
$data['designationList'] = $this->designationRepository->pluck();
|
||||
$data['employeeList'] = $this->employeeRepository->pluck();
|
||||
$data['departmentList'] = $this->departmentRepository->pluck();
|
||||
$data['rankingTypeList'] = $this->fieldRepository->getDropdownByAlias('ranking-type');
|
||||
return view('admin::promotiondemotions.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->promotionDemotionRepository->update($id, $request->all());
|
||||
toastr()->success('Record has been updated');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('promotionDemotion.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->promotionDemotionRepository->delete($id);
|
||||
toastr()->success('Record has been deleted!');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
return redirect()->route('promotionDemotion.index');
|
||||
}
|
||||
}
|
108
Modules/Admin/app/Http/Controllers/ProvinceController.php
Normal file
108
Modules/Admin/app/Http/Controllers/ProvinceController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?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\ProvinceRepository;
|
||||
use Modules\Admin\Services\AdminService;
|
||||
|
||||
class ProvinceController extends Controller
|
||||
{
|
||||
private $provinceRepository;
|
||||
private $adminService;
|
||||
|
||||
public function __construct(ProvinceRepository $provinceRepository, AdminService $adminService)
|
||||
{
|
||||
$this->provinceRepository = $provinceRepository;
|
||||
$this->adminService = $adminService;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Province List';
|
||||
$data['provinceLists'] = $this->provinceRepository->findAll();
|
||||
return view('admin::provinces.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Province';
|
||||
$data['editable'] = false;
|
||||
$data['countryLists'] = $this->adminService->pluckCountries();
|
||||
return view('admin::provinces.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->provinceRepository->create($request->all());
|
||||
toastr()->success('Province created successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
return redirect()->route('province.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::provinces.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Province';
|
||||
$data['editable'] = true;
|
||||
$data['province'] = $this->provinceRepository->getProvinceById($id);
|
||||
$data['countryLists'] = $this->adminService->pluckCountries();
|
||||
return view('admin::provinces.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->provinceRepository->update($id, $request->all());
|
||||
toastr()->success('Province updated successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('province.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
|
||||
$this->provinceRepository->delete($id);
|
||||
toastr()->success('Province deleted successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('province.index');
|
||||
}
|
||||
}
|
104
Modules/Admin/app/Http/Controllers/ResignationController.php
Normal file
104
Modules/Admin/app/Http/Controllers/ResignationController.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?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;
|
||||
use Modules\Employee\Repositories\EmployeeRepository;
|
||||
|
||||
class ResignationController extends Controller
|
||||
{
|
||||
private $resignationRepository;
|
||||
private $employeeRepository;
|
||||
|
||||
public function __construct(ResignationRepository $resignationRepository, EmployeeRepository $employeeRepository)
|
||||
{
|
||||
$this->resignationRepository = $resignationRepository;
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Resignation Lists';
|
||||
$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;
|
||||
$data['employeeLists'] = $this->employeeRepository->pluck();
|
||||
return view('admin::resignations.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->resignationRepository->create($request->all());
|
||||
toastr()->success('Resignation has been created!');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
// 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['employeeLists'] = $this->employeeRepository->pluck();
|
||||
$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
|
||||
{
|
||||
try {
|
||||
$this->resignationRepository->update($id, $request->except(['_method', '_token']));
|
||||
toastr()->success('Resignation has been updated!');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('resignation.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->resignationRepository->delete($id);
|
||||
toastr()->success('Resignation has been deleted');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return to_route('resignation.index');
|
||||
}
|
||||
}
|
119
Modules/Admin/app/Http/Controllers/TransferController.php
Normal file
119
Modules/Admin/app/Http/Controllers/TransferController.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?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;
|
||||
use Modules\Admin\Services\AdminService;
|
||||
use Modules\Employee\Repositories\EmployeeRepository;
|
||||
|
||||
class TransferController extends Controller
|
||||
{
|
||||
private $transferRepository;
|
||||
private $employeeRepository;
|
||||
private $adminService;
|
||||
|
||||
public function __construct(TransferRepository $transferRepository, EmployeeRepository $employeeRepository, AdminService $adminService)
|
||||
{
|
||||
$this->transferRepository = $transferRepository;
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
$this->adminService = $adminService;
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
$data['employeeLists'] = $this->employeeRepository->pluck();
|
||||
$data['departmentLists'] = $this->adminService->pluckDepartments();
|
||||
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['employeeLists'] = $this->employeeRepository->pluck();
|
||||
$data['departmentLists'] = $this->adminService->pluckDepartments();
|
||||
$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->except(['_method','_token']));
|
||||
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');
|
||||
}
|
||||
}
|
114
Modules/Admin/app/Http/Controllers/WarningController.php
Normal file
114
Modules/Admin/app/Http/Controllers/WarningController.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\WarningRepository;
|
||||
use Modules\Employee\Repositories\EmployeeRepository;
|
||||
|
||||
class WarningController extends Controller
|
||||
{
|
||||
private $warningRepository;
|
||||
private $employeeRepository;
|
||||
|
||||
public function __construct(WarningRepository $warningRepository, EmployeeRepository $employeeRepository)
|
||||
{
|
||||
$this->warningRepository = $warningRepository;
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
$data['employeeLists'] = $this->employeeRepository->pluck();
|
||||
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['employeeLists'] = $this->employeeRepository->pluck();
|
||||
$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->except(['_method', '_token']));
|
||||
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');
|
||||
}
|
||||
}
|
109
Modules/Admin/app/Http/Controllers/WorkShiftController.php
Normal file
109
Modules/Admin/app/Http/Controllers/WorkShiftController.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\WorkShiftRepository;
|
||||
|
||||
class WorkShiftController extends Controller
|
||||
{
|
||||
private $workShiftRepository;
|
||||
|
||||
public function __construct(WorkShiftRepository $workShiftRepository)
|
||||
{
|
||||
$this->workShiftRepository = $workShiftRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'WorkShift Lists';
|
||||
$data['workShiftLists'] = $this->workShiftRepository->findAll();
|
||||
return view('admin::workshifts.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create WorkShift';
|
||||
$data['editable'] = false;
|
||||
return view('admin::workshifts.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->workShiftRepository->create($request->all());
|
||||
toastr()->success('WorkShift Created Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('workShift.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('admin::workshifts.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
try {
|
||||
$data['title'] = 'Edit WorkShift';
|
||||
$data['editable'] = true;
|
||||
$data['workShift'] = $this->workShiftRepository->getWorkShiftById($id);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return view('admin::workshifts.edit', $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->workShiftRepository->update($id, $request->all());
|
||||
toastr()->success('WorkShift Updated Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('workShift.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->workShiftRepository->delete($id);
|
||||
toastr()->success('WorkShift Deleted Successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('workShift.index');
|
||||
}
|
||||
}
|
0
Modules/Admin/app/Http/Requests/.gitkeep
Normal file
0
Modules/Admin/app/Http/Requests/.gitkeep
Normal file
Reference in New Issue
Block a user