diff --git a/app/Modules/Discipline/Http/Controllers/DisciplinaryCasesActionsController.php b/app/Modules/Discipline/Http/Controllers/DisciplinaryCasesActionsController.php new file mode 100644 index 0000000..66edd14 --- /dev/null +++ b/app/Modules/Discipline/Http/Controllers/DisciplinaryCasesActionsController.php @@ -0,0 +1,135 @@ +disciplinaryCaseActionRepository = $disciplinaryCaseActionRepository; + } + + /** + * Display a listing of the resource. + * + * @param \App\Modules\Pim\Http\Repositories\Interfaces\EmployeeRepository $employeeRepository + * @return \Illuminate\Http\Response + */ + public function index(EmployeeRepository $employeeRepository) + { + $employees = $employeeRepository->pluckName(); + return view('discipline::disciplinary_cases_actions.index', compact('employees')); + } + + /** + * Returns data for the resource list + * + * @return \Illuminate\Http\Response + */ + public function getDatatable() + { + return Datatables::of($this->disciplinaryCaseActionRepository->getCollection([], ['id', 'name', 'description', 'disciplinary_case_id'])) + ->editColumn('disciplinary_case_id', function($disciplinary_case_action){ + return $disciplinary_case_action->disciplinaryCase->name; + }) + ->addColumn('actions', function($disciplinary_case_action){ + return view('includes._datatable_actions', [ + 'deleteUrl' => route('discipline.disciplinary_cases_actions.destroy', $disciplinary_case_action->id), + 'editUrl' => route('discipline.disciplinary_cases_actions.edit', $disciplinary_case_action->id) + ]); + }) + ->make(); + } + + /** + * Show the form for creating a new resource. + * + * @param \App\Modules\Pim\Http\Repositories\Interfaces\DisciplinaryCaseRepository $disciplinaryCaseRepository + * @return \Illuminate\Http\Response + */ + public function create(DisciplinaryCaseRepository $disciplinaryCaseRepository) + { + $disciplinary_cases = $disciplinaryCaseRepository->getAll()->pluck('name', 'id'); + return view('discipline::disciplinary_cases_actions.create', compact('disciplinary_cases')); + } + + /** + * Store a newly created resource in storage. + * + * @param \App\Modules\Discipline\Http\Requests\DisciplinaryCaseActionRequest $request + @param \App\Modules\Pim\Http\Repositories\Interfaces\EmployeeRepository $employeeRepository + * @return \Illuminate\Http\Response + */ + public function store(DisciplinaryCaseActionRequest $request, EmployeeRepository $employeeRepository) + { + $disciplinaryCaseData = $this->disciplinaryCaseActionRepository->create($request->all()); + + $request->session()->flash('success', trans('app.discipline.disciplinary_cases.store_success')); + return redirect()->route('discipline.disciplinary_cases_actions.edit', $disciplinaryCaseData->id); + } + + /** + * Display the specified resource. + * + * @param integer unique identifier for the resource + * @return \Illuminate\Http\Response + */ + public function show($id) + { + // + } + + /** + * Show the form for editing the specified resource. + * + * @param integer unique identifier for the resource + * @param \App\Modules\Pim\Http\Repositories\Interfaces\EmployeeRepository $employeeRepository + * @return \Illuminate\Http\Response + */ + public function edit($id, EmployeeRepository $employeeRepository, DisciplinaryCaseRepository $disciplinaryCaseRepository) + { + $disciplinary_case_action = $this->disciplinaryCaseActionRepository->getById($id); + $disciplinary_cases = $disciplinaryCaseRepository->getAll()->pluck('name', 'id'); + $employees = $employeeRepository->pluckName(); + $breadcrumb = ['title' => $disciplinary_case_action->name, 'id' => $disciplinary_case_action->id]; + return view('discipline::disciplinary_cases_actions.edit', compact('employees', 'disciplinary_case_action', 'disciplinary_cases', 'breadcrumb')); + } + + /** + * Update the specified resource in storage. + * + * @param integer unique identifier for the resource + * @param \App\Modules\Discipline\Http\Requests\DisciplinaryCaseActionRequest $request + * @return \Illuminate\Http\Response + */ + public function update($id, DisciplinaryCaseActionRequest $request) + { + $disciplinaryCaseData = $this->disciplinaryCaseActionRepository->update($id, $request->all()); + $request->session()->flash('success', trans('app.discipline.disciplinary_cases.update_success')); + return redirect()->route('discipline.disciplinary_cases_actions.edit', $disciplinaryCaseData->id); + } + + /** + * Remove the specified resource from storage. + * + * @param integer unique identifier for the resource + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function destroy($id, Request $request) + { + $this->disciplinaryCaseActionRepository->delete($id); + $request->session()->flash('success', trans('app.discipline.disciplinary_cases.delete_success')); + return redirect()->route('discipline.disciplinary_cases_actions.index'); + } +} \ No newline at end of file diff --git a/app/Modules/Discipline/Http/Controllers/DisciplinaryCasesController.php b/app/Modules/Discipline/Http/Controllers/DisciplinaryCasesController.php old mode 100644 new mode 100755 index a522b44..f3844d0 --- a/app/Modules/Discipline/Http/Controllers/DisciplinaryCasesController.php +++ b/app/Modules/Discipline/Http/Controllers/DisciplinaryCasesController.php @@ -8,6 +8,9 @@ use App\Modules\Discipline\Http\Requests\DisciplinaryCaseRequest; use Illuminate\Http\Request; use Datatables; +use App\Repositories\UserRepository; +use Illuminate\Support\Facades\Mail; +use Illuminate\Mail\Mailer; class DisciplinaryCasesController extends Controller { @@ -56,21 +59,31 @@ public function getDatatable() * @param \App\Modules\Pim\Http\Repositories\Interfaces\EmployeeRepository $employeeRepository * @return \Illuminate\Http\Response */ - public function create(EmployeeRepository $employeeRepository) + public function create(EmployeeRepository $employeeRepository, UserRepository $userRepository) { $employees = $employeeRepository->pluckName(); - return view('discipline::disciplinary_cases.create', compact('employees')); + $users = $userRepository->pluckName(); + + return view('discipline::disciplinary_cases.create', compact('employees', 'users')); } /** * Store a newly created resource in storage. * * @param \App\Modules\Discipline\Http\Requests\DisciplinaryCaseRequest $request + * @param \App\Modules\Pim\Http\Repositories\Interfaces\EmployeeRepository $employeeRepository + * @param \App\Repositories\UserRepository $userRepository * @return \Illuminate\Http\Response */ - public function store(DisciplinaryCaseRequest $request) + public function store(DisciplinaryCaseRequest $request, EmployeeRepository $employeeRepository) { $disciplinaryCaseData = $this->disciplinaryCaseRepository->create($request->all()); + $employee = $employeeRepository->getById($disciplinaryCaseData->user_id); + Mail::send('emails.employee-disciplinary-case', json_decode(json_encode($disciplinaryCaseData), true), function($message) use ($employee) + { + $message->from(env('MAIL_EMAIL_FROM')); + $message->to($employee['email']); + }); $request->session()->flash('success', trans('app.discipline.disciplinary_cases.store_success')); return redirect()->route('discipline.disciplinary_cases.edit', $disciplinaryCaseData->id); } @@ -91,14 +104,16 @@ public function show($id) * * @param integer unique identifier for the resource * @param \App\Modules\Pim\Http\Repositories\Interfaces\EmployeeRepository $employeeRepository + * @param \App\Repositories\UserRepository $userRepository * @return \Illuminate\Http\Response */ - public function edit($id, EmployeeRepository $employeeRepository) + public function edit($id, EmployeeRepository $employeeRepository, UserRepository $userRepository) { $disciplinary_case = $this->disciplinaryCaseRepository->getById($id); $employees = $employeeRepository->pluckName(); + $users = $userRepository->pluckName(); $breadcrumb = ['title' => $disciplinary_case->name, 'id' => $disciplinary_case->id]; - return view('discipline::disciplinary_cases.edit', compact('employees', 'disciplinary_case', 'breadcrumb')); + return view('discipline::disciplinary_cases.edit', compact('employees', 'disciplinary_case', 'users', 'breadcrumb')); } /** diff --git a/app/Modules/Discipline/Http/Requests/DisciplinaryCaseActionRequest.php b/app/Modules/Discipline/Http/Requests/DisciplinaryCaseActionRequest.php new file mode 100644 index 0000000..2d035be --- /dev/null +++ b/app/Modules/Discipline/Http/Requests/DisciplinaryCaseActionRequest.php @@ -0,0 +1,30 @@ + ['required'] + ]; + } +} diff --git a/app/Modules/Discipline/Models/DisciplinaryCaseAction.php b/app/Modules/Discipline/Models/DisciplinaryCaseAction.php new file mode 100644 index 0000000..ba0324c --- /dev/null +++ b/app/Modules/Discipline/Models/DisciplinaryCaseAction.php @@ -0,0 +1,18 @@ +belongsTo(DisciplinaryCase::class, 'disciplinary_case_id'); + } +} diff --git a/app/Modules/Discipline/Repositories/DisciplinaryCaseActionRepository.php b/app/Modules/Discipline/Repositories/DisciplinaryCaseActionRepository.php new file mode 100644 index 0000000..9f740c1 --- /dev/null +++ b/app/Modules/Discipline/Repositories/DisciplinaryCaseActionRepository.php @@ -0,0 +1,15 @@ +model = $model; + } +} diff --git a/app/Modules/Discipline/Repositories/Interfaces/DisciplinaryCaseActionRepositoryInterface.php b/app/Modules/Discipline/Repositories/Interfaces/DisciplinaryCaseActionRepositoryInterface.php new file mode 100644 index 0000000..aa4caf4 --- /dev/null +++ b/app/Modules/Discipline/Repositories/Interfaces/DisciplinaryCaseActionRepositoryInterface.php @@ -0,0 +1,7 @@ + 'form-control employees']) !!} +
+ {!! Form::label('reported_by', trans('app.discipline.disciplinary_cases.reported_by'), ['class' => 'col-sm-3']) !!} +
+ {!! Form::select('reported_by', $users, null, ['class' => 'form-control users']) !!} +
+
@include('errors._form-errors')
@@ -31,5 +37,6 @@ @endsection \ No newline at end of file diff --git a/app/Modules/Discipline/resources/views/disciplinary_cases_actions/_form.blade.php b/app/Modules/Discipline/resources/views/disciplinary_cases_actions/_form.blade.php new file mode 100644 index 0000000..e4f7415 --- /dev/null +++ b/app/Modules/Discipline/resources/views/disciplinary_cases_actions/_form.blade.php @@ -0,0 +1,35 @@ +
+ {!! Form::label('name', trans('app.discipline.disciplinary_cases.name').':', ['class' => 'col-sm-3']) !!} +
+ {!! Form::text('name', null, ['class' => 'form-control']) !!} +
+
+
+ {!! Form::label('description', trans('app.discipline.disciplinary_cases.description').':', ['class' => 'col-sm-3']) !!} +
+ {!! Form::textarea('description', null, ['class' => 'form-control']) !!} +
+
+
+ {!! Form::label('disciplinary_case', trans('app.discipline.disciplinary_cases_actions.main'), ['class' => 'col-sm-3']) !!} +
+ {!! Form::select('disciplinary_case_id', $disciplinary_cases, null, ['class' => 'form-control disciplinaryCases']) !!} +
+
+@include('errors._form-errors') +
+
+
+ {{trans('app.cancel')}} + {!! Form::submit($submitName, ['class' => 'btn btn-primary']) !!} +
+
+@section('additionalCSS') + +@endsection +@section('additionalJS') + + +@endsection \ No newline at end of file diff --git a/app/Modules/Discipline/resources/views/disciplinary_cases_actions/create.blade.php b/app/Modules/Discipline/resources/views/disciplinary_cases_actions/create.blade.php new file mode 100644 index 0000000..380fe86 --- /dev/null +++ b/app/Modules/Discipline/resources/views/disciplinary_cases_actions/create.blade.php @@ -0,0 +1,13 @@ +@extends('layouts.main') +@section('content') +
+
+
+
{{trans('app.discipline.disciplinary_cases.add_new')}}
+ {!! Form::open(['route' => 'discipline.disciplinary_cases_actions.store', 'class' => 'form-horizontal']) !!} + @include('discipline::disciplinary_cases_actions._form', ['submitName' => trans('app.submit')]) + {!! Form::close() !!} +
+
+
+@endsection \ No newline at end of file diff --git a/app/Modules/Discipline/resources/views/disciplinary_cases_actions/edit.blade.php b/app/Modules/Discipline/resources/views/disciplinary_cases_actions/edit.blade.php new file mode 100644 index 0000000..c920cbe --- /dev/null +++ b/app/Modules/Discipline/resources/views/disciplinary_cases_actions/edit.blade.php @@ -0,0 +1,13 @@ +@extends('layouts.main') +@section('content') +
+
+
+
{{trans('app.discipline.disciplinary_cases.edit_details')}}
+ {!! Form::model($disciplinary_case_action, ['method' => 'PUT', 'route' => ['discipline.disciplinary_cases_actions.update', $disciplinary_case_action->id], 'class' => 'form-horizontal']) !!} + @include('discipline::disciplinary_cases_actions._form', ['submitName' => trans('app.submit')]) + {!! Form::close() !!} +
+
+
+@endsection \ No newline at end of file diff --git a/app/Modules/Discipline/resources/views/disciplinary_cases_actions/index.blade.php b/app/Modules/Discipline/resources/views/disciplinary_cases_actions/index.blade.php new file mode 100644 index 0000000..c9aa976 --- /dev/null +++ b/app/Modules/Discipline/resources/views/disciplinary_cases_actions/index.blade.php @@ -0,0 +1,76 @@ +@extends('layouts.main') +@section('content') +
+ +
+
+
+
+
{{trans('app.discipline.disciplinary_cases_actions.main')}}
+ + + + + + + + + + + + + + + +
{{trans('app.id')}}{{trans('app.discipline.disciplinary_cases_actions.name')}}{{trans('app.discipline.disciplinary_cases_actions.description')}}{{trans('app.discipline.disciplinary_cases.main')}}
+ + + + + + + +
+
+
+
+@endsection +@section('additionalCSS') + +@endsection +@section('additionalJS') + + +@endsection \ No newline at end of file diff --git a/app/Modules/Discipline/resources/views/index.blade.php b/app/Modules/Discipline/resources/views/index.blade.php index 223b437..b1106d6 100644 --- a/app/Modules/Discipline/resources/views/index.blade.php +++ b/app/Modules/Discipline/resources/views/index.blade.php @@ -1,11 +1,16 @@ @extends('layouts.main') @section('content')
- @endsection @section('additionalCSS') diff --git a/app/Modules/Employee/Discipline/Http/Controllers/DisciplineController.php b/app/Modules/Employee/Discipline/Http/Controllers/DisciplineController.php new file mode 100755 index 0000000..ebbbe41 --- /dev/null +++ b/app/Modules/Employee/Discipline/Http/Controllers/DisciplineController.php @@ -0,0 +1,67 @@ +disciplinaryCaseRepository = $disciplinaryCaseRepository; + } + + /** + * Display a listing of the resource. + * + * @param \App\Modules\Pim\Http\Repositories\Interfaces\EmployeeRepository $employeeRepository + * @return \Illuminate\Http\Response + */ + public function index(EmployeeRepository $employeeRepository) + { + $employees = $employeeRepository->pluckName(); + return view('employee.discipline::index', compact('employees')); + } + + /** + * Returns data for the resource list + * + * @return \Illuminate\Http\Response + */ + public function getDatatable() + { + return Datatables::of($this->disciplinaryCaseRepository->getCollection([], ['id', 'user_id', 'name', 'description'])) + ->editColumn('user_id', function($disciplinary_case){ + return $disciplinary_case->employee->first_name.' '.$disciplinary_case->employee->last_name; + }) + ->addColumn('actions', function($disciplinary_case){ + return view('includes._datatable_actions', [ + 'showUrl' => route('employee.discipline.show', $disciplinary_case->id) + ]); + }) + ->make(); + } + + + /** + * Display the specified resource. + * + * @param integer unique identifier for the resource + * @return \Illuminate\Http\Response + */ + public function show($id) + { + $disciplinaryCase = $this->disciplinaryCaseRepository->getById($id); + checkValidity($disciplinaryCase->user_id); + $breadcrumb = ['title' => $disciplinaryCase->employee->first_name.' '.$disciplinaryCase->employee->last_name, 'id' => $disciplinaryCase->id]; + return view('employee.discipline::show', compact('disciplinaryCase', 'breadcrumb')); + } + +} \ No newline at end of file diff --git a/app/Modules/Employee/Discipline/resources/views/_form.blade.php b/app/Modules/Employee/Discipline/resources/views/_form.blade.php new file mode 100755 index 0000000..02380be --- /dev/null +++ b/app/Modules/Employee/Discipline/resources/views/_form.blade.php @@ -0,0 +1,35 @@ +
+ {!! Form::label('name', trans('app.discipline.disciplinary_cases.name').':', ['class' => 'col-sm-3']) !!} +
+ {!! Form::text('name', null, ['class' => 'form-control']) !!} +
+
+
+ {!! Form::label('description', trans('app.discipline.disciplinary_cases.description').':', ['class' => 'col-sm-3']) !!} +
+ {!! Form::textarea('description', null, ['class' => 'form-control']) !!} +
+
+
+ {!! Form::label('user_id', trans('app.discipline.disciplinary_cases.employee'), ['class' => 'col-sm-3']) !!} +
+ {!! Form::select('user_id', $employees, null, ['class' => 'form-control employees']) !!} +
+
+@include('errors._form-errors') +
+
+
+ {{trans('app.cancel')}} + {!! Form::submit($submitName, ['class' => 'btn btn-primary']) !!} +
+
+@section('additionalCSS') + +@endsection +@section('additionalJS') + + +@endsection \ No newline at end of file diff --git a/app/Modules/Employee/Discipline/resources/views/index.blade.php b/app/Modules/Employee/Discipline/resources/views/index.blade.php new file mode 100755 index 0000000..d06b58a --- /dev/null +++ b/app/Modules/Employee/Discipline/resources/views/index.blade.php @@ -0,0 +1,71 @@ +@extends('layouts.main_employee') +@section('content') +
+
+
+
{{trans('app.discipline.disciplinary_cases.main')}}
+ + + + + + + + + + + + + + + +
{{trans('app.id')}}{{trans('app.discipline.disciplinary_cases.employee')}}{{trans('app.discipline.disciplinary_cases.name')}}{{trans('app.discipline.disciplinary_cases.description')}}
+ + + {{Form::select('user_id', $employees, null, ['placeholder' => trans('app.discipline.disciplinary_cases.employee')])}} + + + + +
+
+
+
+@endsection +@section('additionalCSS') + +@endsection +@section('additionalJS') + + +@endsection \ No newline at end of file diff --git a/app/Modules/Employee/Discipline/resources/views/show.blade.php b/app/Modules/Employee/Discipline/resources/views/show.blade.php new file mode 100644 index 0000000..d85e699 --- /dev/null +++ b/app/Modules/Employee/Discipline/resources/views/show.blade.php @@ -0,0 +1,20 @@ +@extends('layouts.main_employee') +@section('content') +
+
+ {!! Form::label('name', trans('app.discipline.disciplinary_cases.name'), ['class' => 'col-sm-3']) !!} +
+ {!! Form::text($disciplinaryCase->id, $disciplinaryCase->name, ['class' => 'form-control', 'readonly']) !!} +
+
+
+ {!! Form::label('description', trans('app.discipline.disciplinary_cases.description'), ['class' => 'col-sm-3']) !!} +
+ {!! Form::textarea($disciplinaryCase->id, $disciplinaryCase->description, ['class' => 'form-control', 'readonly']) !!} +
+
+
+@endsection +@section('additionalCSS') + +@endsection \ No newline at end of file diff --git a/app/Modules/Pim/Repositories/EmployeeRepository.php b/app/Modules/Pim/Repositories/EmployeeRepository.php index aa41fbb..d857e36 100644 --- a/app/Modules/Pim/Repositories/EmployeeRepository.php +++ b/app/Modules/Pim/Repositories/EmployeeRepository.php @@ -19,7 +19,7 @@ public function __construct(User $model) public function getAll() { - return $this->model->where('role', $this->model->USER_ROLE_EMPLOYEE)->get(); + return $this->model->where('role', $this->model::USER_ROLE_EMPLOYEE)->get(); } @@ -49,7 +49,7 @@ public function getBirthdays($date = false) public function pluckName() { return $this->model->select(DB::raw('CONCAT(first_name, " ", last_name) as name, id')) - ->where('role', $this->model->USER_ROLE_EMPLOYEE) + ->where('role', $this->model::USER_ROLE_EMPLOYEE) ->pluck('name', 'id'); } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 656bb2e..1b57c59 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -26,6 +26,7 @@ public function boot() View::addNamespace('employee.leaves', base_path('app/Modules/Employee/Leaves/resources/views')); View::addNamespace('dashboard', base_path('app/Modules/Dashboard/resources/views')); View::addNamespace('employee.dashboard_documents', base_path('app/Modules/Employee/Dashboard/resources/views')); + View::addNamespace('employee.discipline', base_path('app/Modules/Employee/Discipline/resources/views')); } /** diff --git a/app/Providers/RepositoryServiceProvider.php b/app/Providers/RepositoryServiceProvider.php index 97c2a54..88aa581 100644 --- a/app/Providers/RepositoryServiceProvider.php +++ b/app/Providers/RepositoryServiceProvider.php @@ -42,6 +42,7 @@ public function register() Leave\Repositories\EmployeeLeaveStatusRepository::class => [Leave\Repositories\Interfaces\EmployeeLeaveStatusRepositoryInterface::class], Recruitment\Repositories\ReportRepository::class => [Recruitment\Repositories\Interfaces\ReportRepositoryInterface::class], Discipline\Repositories\DisciplinaryCaseRepository::class => [Discipline\Repositories\Interfaces\DisciplinaryCaseRepositoryInterface::class], + Discipline\Repositories\DisciplinaryCaseActionRepository::class => [Discipline\Repositories\Interfaces\DisciplinaryCaseActionRepositoryInterface::class], Time\Repositories\ClientRepository::class => [Time\Repositories\Interfaces\ClientRepositoryInterface::class], Time\Repositories\ProjectRepository::class => [Time\Repositories\Interfaces\ProjectRepositoryInterface::class], Time\Repositories\TimeLogRepository::class => [Time\Repositories\Interfaces\TimeLogRepositoryInterface::class], diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php new file mode 100644 index 0000000..df60a27 --- /dev/null +++ b/app/Repositories/UserRepository.php @@ -0,0 +1,23 @@ +model = $model; + } + + public function pluckName() + { + return $this->model->select(DB::raw('CONCAT(first_name, " ", last_name) as name, id')) + ->pluck('name', 'id'); + } +} diff --git a/config/dompdf.php b/config/dompdf.php new file mode 100644 index 0000000..09a41ed --- /dev/null +++ b/config/dompdf.php @@ -0,0 +1,266 @@ + false, // Throw an Exception on warnings from dompdf + 'orientation' => 'portrait', + 'defines' => array( + /** + * The location of the DOMPDF font directory + * + * The location of the directory where DOMPDF will store fonts and font metrics + * Note: This directory must exist and be writable by the webserver process. + * *Please note the trailing slash.* + * + * Notes regarding fonts: + * Additional .afm font metrics can be added by executing load_font.php from command line. + * + * Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must + * be embedded in the pdf file or the PDF may not display correctly. This can significantly + * increase file size unless font subsetting is enabled. Before embedding a font please + * review your rights under the font license. + * + * Any font specification in the source HTML is translated to the closest font available + * in the font directory. + * + * The pdf standard "Base 14 fonts" are: + * Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique, + * Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique, + * Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic, + * Symbol, ZapfDingbats. + */ + "DOMPDF_FONT_DIR" => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782) + + /** + * The location of the DOMPDF font cache directory + * + * This directory contains the cached font metrics for the fonts used by DOMPDF. + * This directory can be the same as DOMPDF_FONT_DIR + * + * Note: This directory must exist and be writable by the webserver process. + */ + "DOMPDF_FONT_CACHE" => storage_path('fonts/'), + + /** + * The location of a temporary directory. + * + * The directory specified must be writeable by the webserver process. + * The temporary directory is required to download remote images and when + * using the PFDLib back end. + */ + "DOMPDF_TEMP_DIR" => sys_get_temp_dir(), + + /** + * ==== IMPORTANT ==== + * + * dompdf's "chroot": Prevents dompdf from accessing system files or other + * files on the webserver. All local files opened by dompdf must be in a + * subdirectory of this directory. DO NOT set it to '/' since this could + * allow an attacker to use dompdf to read any files on the server. This + * should be an absolute path. + * This is only checked on command line call by dompdf.php, but not by + * direct class use like: + * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output(); + */ + "DOMPDF_CHROOT" => realpath(base_path()), + + /** + * Whether to use Unicode fonts or not. + * + * When set to true the PDF backend must be set to "CPDF" and fonts must be + * loaded via load_font.php. + * + * When enabled, dompdf can support all Unicode glyphs. Any glyphs used in a + * document must be present in your fonts, however. + */ + "DOMPDF_UNICODE_ENABLED" => true, + + /** + * Whether to enable font subsetting or not. + */ + "DOMPDF_ENABLE_FONT_SUBSETTING" => false, + + /** + * The PDF rendering backend to use + * + * Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and + * 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will + * fall back on CPDF. 'GD' renders PDFs to graphic files. {@link + * Canvas_Factory} ultimately determines which rendering class to instantiate + * based on this setting. + * + * Both PDFLib & CPDF rendering backends provide sufficient rendering + * capabilities for dompdf, however additional features (e.g. object, + * image and font support, etc.) differ between backends. Please see + * {@link PDFLib_Adapter} for more information on the PDFLib backend + * and {@link CPDF_Adapter} and lib/class.pdf.php for more information + * on CPDF. Also see the documentation for each backend at the links + * below. + * + * The GD rendering backend is a little different than PDFLib and + * CPDF. Several features of CPDF and PDFLib are not supported or do + * not make any sense when creating image files. For example, + * multiple pages are not supported, nor are PDF 'objects'. Have a + * look at {@link GD_Adapter} for more information. GD support is + * experimental, so use it at your own risk. + * + * @link http://www.pdflib.com + * @link http://www.ros.co.nz/pdf + * @link http://www.php.net/image + */ + "DOMPDF_PDF_BACKEND" => "CPDF", + + /** + * PDFlib license key + * + * If you are using a licensed, commercial version of PDFlib, specify + * your license key here. If you are using PDFlib-Lite or are evaluating + * the commercial version of PDFlib, comment out this setting. + * + * @link http://www.pdflib.com + * + * If pdflib present in web server and auto or selected explicitely above, + * a real license code must exist! + */ + //"DOMPDF_PDFLIB_LICENSE" => "your license key here", + + /** + * html target media view which should be rendered into pdf. + * List of types and parsing rules for future extensions: + * http://www.w3.org/TR/REC-html40/types.html + * screen, tty, tv, projection, handheld, print, braille, aural, all + * Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3. + * Note, even though the generated pdf file is intended for print output, + * the desired content might be different (e.g. screen or projection view of html file). + * Therefore allow specification of content here. + */ + "DOMPDF_DEFAULT_MEDIA_TYPE" => "screen", + + /** + * The default paper size. + * + * North America standard is "letter"; other countries generally "a4" + * + * @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.) + */ + "DOMPDF_DEFAULT_PAPER_SIZE" => "a4", + + /** + * The default font family + * + * Used if no suitable fonts can be found. This must exist in the font folder. + * @var string + */ + "DOMPDF_DEFAULT_FONT" => "serif", + + /** + * Image DPI setting + * + * This setting determines the default DPI setting for images and fonts. The + * DPI may be overridden for inline images by explictly setting the + * image's width & height style attributes (i.e. if the image's native + * width is 600 pixels and you specify the image's width as 72 points, + * the image will have a DPI of 600 in the rendered PDF. The DPI of + * background images can not be overridden and is controlled entirely + * via this parameter. + * + * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI). + * If a size in html is given as px (or without unit as image size), + * this tells the corresponding size in pt. + * This adjusts the relative sizes to be similar to the rendering of the + * html page in a reference browser. + * + * In pdf, always 1 pt = 1/72 inch + * + * Rendering resolution of various browsers in px per inch: + * Windows Firefox and Internet Explorer: + * SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:? + * Linux Firefox: + * about:config *resolution: Default:96 + * (xorg screen dimension in mm and Desktop font dpi settings are ignored) + * + * Take care about extra font/image zoom factor of browser. + * + * In images, size in pixel attribute, img css style, are overriding + * the real image dimension in px for rendering. + * + * @var int + */ + "DOMPDF_DPI" => 96, + + /** + * Enable inline PHP + * + * If this setting is set to true then DOMPDF will automatically evaluate + * inline PHP contained within tags. + * + * Enabling this for documents you do not trust (e.g. arbitrary remote html + * pages) is a security risk. Set this option to false if you wish to process + * untrusted documents. + * + * @var bool + */ + "DOMPDF_ENABLE_PHP" => false, + + /** + * Enable inline Javascript + * + * If this setting is set to true then DOMPDF will automatically insert + * JavaScript code contained within tags. + * + * @var bool + */ + "DOMPDF_ENABLE_JAVASCRIPT" => true, + + /** + * Enable remote file access + * + * If this setting is set to true, DOMPDF will access remote sites for + * images and CSS files as required. + * This is required for part of test case www/test/image_variants.html through www/examples.php + * + * Attention! + * This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and + * allowing remote access to dompdf.php or on allowing remote html code to be passed to + * $dompdf = new DOMPDF(, $dompdf->load_html(..., + * This allows anonymous users to download legally doubtful internet content which on + * tracing back appears to being downloaded by your server, or allows malicious php code + * in remote html pages to be executed by your server with your account privileges. + * + * @var bool + */ + "DOMPDF_ENABLE_REMOTE" => true, + + /** + * A ratio applied to the fonts height to be more like browsers' line height + */ + "DOMPDF_FONT_HEIGHT_RATIO" => 1.1, + + /** + * Enable CSS float + * + * Allows people to disabled CSS float support + * @var bool + */ + "DOMPDF_ENABLE_CSS_FLOAT" => false, + + + /** + * Use the more-than-experimental HTML5 Lib parser + */ + "DOMPDF_ENABLE_HTML5PARSER" => false, + + + ), + + +); diff --git a/database/migrations/2017_08_03_100940_update_disciplinary_cases_table.php b/database/migrations/2017_08_03_100940_update_disciplinary_cases_table.php new file mode 100644 index 0000000..19fe478 --- /dev/null +++ b/database/migrations/2017_08_03_100940_update_disciplinary_cases_table.php @@ -0,0 +1,36 @@ +integer('reported_by')->unsigned()->after('user_id'); + $table->foreign('reported_by') + ->references('id') + ->on('users') + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('disciplinary_cases', function (Blueprint $table) { + $table->dropColumn('reported_by'); + }); + } +} diff --git a/database/migrations/2017_08_08_111556_create_table_disciplinary_cases_actions.php b/database/migrations/2017_08_08_111556_create_table_disciplinary_cases_actions.php new file mode 100644 index 0000000..df62871 --- /dev/null +++ b/database/migrations/2017_08_08_111556_create_table_disciplinary_cases_actions.php @@ -0,0 +1,39 @@ +increments('id'); + $table->string('name', 100); + $table->string('description'); + $table->integer('disciplinary_case_id')->unsigned(); + $table->foreign('disciplinary_case_id') + ->references('id') + ->on('disciplinary_cases') + ->onDelete('cascade'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('disciplinary_cases_actions'); + } +} diff --git a/resources/lang/en/app.php b/resources/lang/en/app.php index cc53971..2ef941f 100644 --- a/resources/lang/en/app.php +++ b/resources/lang/en/app.php @@ -366,6 +366,7 @@ 'main' => 'Discipline', 'disciplinary_cases' => [ 'main' => 'Disciplinary cases', + 'actions' => 'Disciplinary cases actions', 'name' => 'Name', 'description' => 'Description', 'employee' => 'Employee', @@ -374,6 +375,18 @@ 'store_success' => 'Disciplinary case was successfully added.', 'update_success' => 'Disciplinary case was successfully updated.', 'delete_success' => 'Disciplinary case was successfully deleted.', + 'reported_by' => 'Reported by' + ], + 'disciplinary_cases_actions' => [ + 'main' => 'Disciplinary cases actions', + 'name' => 'Name', + 'description' => 'Description', + 'attachment' => 'Attachment', + 'add_new' => 'Add disciplinary case action', + 'edit_details' => 'Edit disciplinary case action', + 'store_success' => 'Disciplinary case action was successfully added.', + 'update_success' => 'Disciplinary case action was successfully updated.', + 'delete_success' => 'Disciplinary case action was successfully deleted.', ] ], 'time' => [ @@ -441,6 +454,9 @@ ], 'salary' => [ 'main' => 'Salary' + ], + 'discipline' => [ + 'main' => 'Discipline' ] ] ]; diff --git a/resources/views/emails/employee-disciplinary-case.blade.php b/resources/views/emails/employee-disciplinary-case.blade.php new file mode 100644 index 0000000..1f6d505 --- /dev/null +++ b/resources/views/emails/employee-disciplinary-case.blade.php @@ -0,0 +1,8 @@ + + + +

There has been a disciplinary report filed against you

+

{{$name}}

+

{{$description}}

+ + diff --git a/resources/views/includes/header_employee.blade.php b/resources/views/includes/header_employee.blade.php old mode 100644 new mode 100755 index 4bdf8cd..163b9d6 --- a/resources/views/includes/header_employee.blade.php +++ b/resources/views/includes/header_employee.blade.php @@ -43,6 +43,13 @@ @endif +
  • + {{trans('app.discipline.main')}} + @if($current == 'employee.discipline') + ({{trans('app.current')}}) + @endif + +