115 lines
3.1 KiB
PHP
115 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace Modules\Meeting\Http\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
use Modules\Employee\Repositories\EmployeeInterface;
|
|
use Modules\Employee\Repositories\EmployeeRepository;
|
|
use Modules\Meeting\Repositories\MeetingInterface;
|
|
use Modules\Meeting\Repositories\MeetingRepository;
|
|
use Modules\PMS\Repositories\ClientInterface;
|
|
use Modules\PMS\Repositories\ClientRepository;
|
|
|
|
class MeetingController extends Controller
|
|
{
|
|
private $meetingRepository;
|
|
private $employeeRepository;
|
|
private $clientRepository;
|
|
|
|
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function __construct(
|
|
MeetingInterface $meetingRepository,
|
|
EmployeeInterface $employeeRepository,
|
|
ClientInterface $clientRepository
|
|
) {
|
|
$this->meetingRepository = $meetingRepository;
|
|
$this->employeeRepository = $employeeRepository;
|
|
$this->clientRepository = $clientRepository;
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$data['title'] = 'Meeting Lists';
|
|
$data['meetingLists'] = $this->meetingRepository->findAll();
|
|
return view('meeting::meeting.index', $data);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
$data['title'] = 'Create Meeting';
|
|
$data['editable'] = false;
|
|
$data['memberList'] = $this->employeeRepository->pluck();
|
|
$data['clientList'] = $this->clientRepository->pluck();
|
|
|
|
return view('meeting::meeting.create', $data);
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request): RedirectResponse
|
|
{
|
|
try {
|
|
$this->meetingRepository->create($request->all());
|
|
toastr()->success('Meeting created successfully');
|
|
} catch (\Throwable $th) {
|
|
toastr()->error($th->getMessage());
|
|
}
|
|
return redirect()->route('meeting.index');
|
|
|
|
}
|
|
|
|
/**
|
|
* Show the specified resource.
|
|
*/
|
|
public function show($id)
|
|
{
|
|
$data['title'] = 'Meeting Details';
|
|
$data['item'] = $this->meetingRepository->getMeetingById($id);
|
|
return view('meeting::meeting.show', $data);
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
$data['title'] = 'Edit Leave';
|
|
$data['editable'] = true;
|
|
$data['meeting'] = $this->meetingRepository->getMeetingById($id);
|
|
|
|
return view('meeting::edit', $data);
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, $id): RedirectResponse
|
|
{
|
|
$inputData = $request->except(['_method', '_token']);
|
|
$this->meetingRepository->update($id, $inputData);
|
|
toastr()->success('Meeting Updated Succesfully');
|
|
|
|
return redirect()->route('meeting.index');
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy($id)
|
|
{
|
|
$this->meetingRepository->delete($id);
|
|
toastr()->success('Meeting Deleted Succesfully');
|
|
|
|
}
|
|
}
|