update addon HRM
Some checks failed
Some checks failed
This commit is contained in:
20
Modules/HrmAddon/App/Exports/ExportAttendanceReport.php
Normal file
20
Modules/HrmAddon/App/Exports/ExportAttendanceReport.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Exports;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
|
use Modules\HrmAddon\App\Models\Attendance;
|
||||||
|
|
||||||
|
class ExportAttendanceReport implements FromView
|
||||||
|
{
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
$attendances = Attendance::with(['employee:id,name', 'shift:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('hrmaddon::reports.attendances.excel', compact('attendances'));
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Modules/HrmAddon/App/Exports/ExportLeaveReport.php
Normal file
20
Modules/HrmAddon/App/Exports/ExportLeaveReport.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Exports;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
|
use Modules\HrmAddon\App\Models\Leave;
|
||||||
|
|
||||||
|
class ExportLeaveReport implements FromView
|
||||||
|
{
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
$leaves = Leave::with(['employee:id,name', 'leave_type:id,name', 'department:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('hrmaddon::reports.leaves.excel', compact('leaves'));
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Modules/HrmAddon/App/Exports/ExportPayrollReport.php
Normal file
21
Modules/HrmAddon/App/Exports/ExportPayrollReport.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Exports;
|
||||||
|
|
||||||
|
use App\Models\Sale;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
|
use Modules\HrmAddon\App\Models\Payroll;
|
||||||
|
|
||||||
|
class ExportPayrollReport implements FromView
|
||||||
|
{
|
||||||
|
public function view(): View
|
||||||
|
{
|
||||||
|
$payrolls = Payroll::with(['employee:id,name', 'payment_type:id,name', 'branch:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('hrmaddon::reports.payrolls.excel', compact('payrolls'));
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/HrmAddon/App/Http/Controllers/.gitkeep
Normal file
0
Modules/HrmAddon/App/Http/Controllers/.gitkeep
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use App\Models\Business;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Shift;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
use Modules\HrmAddon\App\Models\Attendance;
|
||||||
|
|
||||||
|
class AcnooAttendanceController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:attendances.read')->only(['index']);
|
||||||
|
$this->middleware('check.permission:attendances.create')->only(['store']);
|
||||||
|
$this->middleware('check.permission:attendances.update')->only(['update']);
|
||||||
|
$this->middleware('check.permission:attendances.delete')->only(['destroy', 'deleteAll']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::where('business_id', auth()->user()->business_id)->whereStatus('active')->latest()->get();
|
||||||
|
|
||||||
|
$attendances = Attendance::with(['employee:id,name', 'shift:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
|
||||||
|
->when($request->search, function ($query) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->whereHas('employee', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('shift', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
->when($request->employee, function ($query) use ($request) {
|
||||||
|
$employeeId = $request->employee;
|
||||||
|
$query->where('employee_id', $employeeId);
|
||||||
|
})
|
||||||
|
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$query->where('month', $request->month);
|
||||||
|
})
|
||||||
|
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::attendances.datas', compact('attendances'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('hrmaddon::attendances.index', compact('attendances', 'employees'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|integer|exists:employees,id',
|
||||||
|
'shift_id' => 'required|integer|exists:shifts,id',
|
||||||
|
'date' => 'required|date',
|
||||||
|
'time_in' => 'required|date_format:H:i',
|
||||||
|
'time_out' => 'required|date_format:H:i',
|
||||||
|
'duration' => 'nullable|date_format:H:i',
|
||||||
|
'note' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$business = Business::findOrFail(auth()->user()->business_id);
|
||||||
|
$employee = Employee::findOrFail($request->employee_id);
|
||||||
|
|
||||||
|
$timeIn = Carbon::parse($request->time_in);
|
||||||
|
$timeOut = Carbon::parse($request->time_out);
|
||||||
|
|
||||||
|
$durationInMinutes = $timeOut->diffInMinutes($timeIn);
|
||||||
|
$hours = floor($durationInMinutes / 60);
|
||||||
|
$minutes = $durationInMinutes % 60;
|
||||||
|
$formattedDuration = sprintf('%02d:%02d', $hours, $minutes);
|
||||||
|
$month = strtolower(Carbon::parse($request->date)->format('F'));
|
||||||
|
|
||||||
|
$attendance = Attendance::create($request->except(['business_id', 'duration', 'month']) + [
|
||||||
|
'business_id' => $business->id,
|
||||||
|
'duration' => $formattedDuration,
|
||||||
|
'month' => $month,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (moduleCheck('MarketingAddon')) {
|
||||||
|
$this->attendanceMessage($business, $attendance, $employee);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Attendance created successfully'),
|
||||||
|
'redirect' => route('hrm.attendances.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|integer|exists:employees,id',
|
||||||
|
'shift_id' => 'required|integer|exists:shifts,id',
|
||||||
|
'date' => 'required|date',
|
||||||
|
'time_in' => 'required',
|
||||||
|
'time_out' => 'required',
|
||||||
|
'duration' => 'nullable',
|
||||||
|
'note' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$attendance = Attendance::findOrFail($id);
|
||||||
|
|
||||||
|
$timeIn = Carbon::parse($request->time_in);
|
||||||
|
$timeOut = Carbon::parse($request->time_out);
|
||||||
|
|
||||||
|
$durationInMinutes = $timeOut->diffInMinutes($timeIn);
|
||||||
|
$hours = floor($durationInMinutes / 60);
|
||||||
|
$minutes = $durationInMinutes % 60;
|
||||||
|
$formattedDuration = sprintf('%02d:%02d', $hours, $minutes);
|
||||||
|
$month = strtolower(Carbon::parse($request->date)->format('F'));
|
||||||
|
|
||||||
|
$attendance->update($request->except(['business_id', 'duration', 'month']) + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'duration' => $formattedDuration,
|
||||||
|
'month' => $month,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Attendance Updated successfully'),
|
||||||
|
'redirect' => route('hrm.attendances.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$attendance = Attendance::findOrFail($id);
|
||||||
|
$attendance->delete();
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Attendance Deleted Successfully'),
|
||||||
|
'redirect' => route('hrm.attendances.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll(Request $request)
|
||||||
|
{
|
||||||
|
Attendance::whereIn('id', $request->input('ids'))->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('All Attendances deleted successfully'),
|
||||||
|
'redirect' => route('hrm.attendances.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShift()
|
||||||
|
{
|
||||||
|
$employee = Employee::findOrFail(request('employee_id'));
|
||||||
|
$shift = Shift::findOrFail($employee->shift_id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => [
|
||||||
|
'id' => $shift->id,
|
||||||
|
'name' => $shift->name
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\PdfService;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Modules\HrmAddon\App\Exports\ExportAttendanceReport;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
use Modules\HrmAddon\App\Models\Attendance;
|
||||||
|
|
||||||
|
class AcnooAttendanceReportController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:attendance-reports.read')->only(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::where('business_id', auth()->user()->business_id)->whereStatus('active')->latest()->get();
|
||||||
|
$attendances = Attendance::with(['employee:id,name', 'shift:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->search, function ($query) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->whereHas('employee', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('shift', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->employee, function ($query) use ($request) {
|
||||||
|
$employeeId = $request->employee;
|
||||||
|
$query->where('employee_id', $employeeId);
|
||||||
|
})
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$query->where('month', $request->month);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::reports.attendances.datas', compact('attendances'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('hrmaddon::reports.attendances.index', compact('attendances', 'employees'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportExcel()
|
||||||
|
{
|
||||||
|
return Excel::download(new ExportAttendanceReport, 'attendance-report.xlsx');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportCsv()
|
||||||
|
{
|
||||||
|
return Excel::download(new ExportAttendanceReport, 'attendance-report.csv');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportPdf(Request $request)
|
||||||
|
{
|
||||||
|
$attendances = Attendance::with(['employee:id,name', 'shift:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return PdfService::render('hrmaddon::reports.attendances.pdf', compact('attendances'),'attendance-report.pdf');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
use Modules\HrmAddon\App\Models\Attendance;
|
||||||
|
|
||||||
|
class AcnooAttendanceReportHistoryController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:attendance-reports.read')->only(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::where('business_id', auth()->user()->business_id)->whereStatus('active')->latest()->get();
|
||||||
|
$attendances = Attendance::with(['employee:id,name', 'shift:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->search, function ($query) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->whereHas('employee', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('shift', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->employee, function ($query) use ($request) {
|
||||||
|
$employeeId = $request->employee;
|
||||||
|
$query->where('employee_id', $employeeId);
|
||||||
|
})
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$query->where('month', $request->month);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::reports.attendances.datas', compact('attendances'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('hrmaddon::reports.attendances.index', compact('attendances', 'employees'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Department;
|
||||||
|
|
||||||
|
class AcnooDepartmentController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:dashboard.read')->only(['index']);
|
||||||
|
$this->middleware('check.permission:deparment.create')->only(['store']);
|
||||||
|
$this->middleware('check.permission:department.update')->only(['update', 'status']);
|
||||||
|
$this->middleware('check.permission:department.delete')->only(['destroy', 'deleteAll']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$departments = Department::where('business_id', auth()->user()->business_id)
|
||||||
|
->when(request('search'), function($q) use($request) {
|
||||||
|
$q->where(function($q) use($request) {
|
||||||
|
$q->where('name', 'like', '%'.$request->search.'%')
|
||||||
|
->orWhere('description', 'like', '%'.$request->search.'%');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if($request->ajax()){
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::department.datas',compact('departments'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return view('hrmaddon::department.index', compact('departments'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Department::create($request->except('business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Department created cuccessfully'),
|
||||||
|
'redirect' => route('hrm.department.index'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Department::where('id', $id)->update($request->except(['_token', '_method']));
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Department updated successfully'),
|
||||||
|
'redirect' => route('hrm.department.index'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
Department::where('id', $id)->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Department deleted successfully'),
|
||||||
|
'redirect' => route('hrm.department.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function status(Request $request, $id)
|
||||||
|
{
|
||||||
|
$department = Department::findOrFail($id);
|
||||||
|
$department->update(['status' => $request->status]);
|
||||||
|
return response()->json(['message' => __('Department')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll(Request $request)
|
||||||
|
{
|
||||||
|
Department::whereIn('id', $request->input('ids'))->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Selected Departments deleted successfully'),
|
||||||
|
'redirect' => route('hrm.department.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Designation;
|
||||||
|
|
||||||
|
class AcnooDesignationController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:designations.read')->only(['index']);
|
||||||
|
$this->middleware('check.permission:designations.create')->only(['store']);
|
||||||
|
$this->middleware('check.permission:designations.update')->only(['update', 'status']);
|
||||||
|
$this->middleware('check.permission:designations.delete')->only(['destroy', 'deleteAll']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$designations = Designation::where('business_id', auth()->user()->business_id)
|
||||||
|
->when(request('search'), function($q) use($request) {
|
||||||
|
$q->where(function($q) use($request) {
|
||||||
|
$q->where('name', 'like', '%'.$request->search.'%')
|
||||||
|
->orWhere('description', 'like', '%'.$request->search.'%');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if($request->ajax()){
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::designations.datas',compact('designations'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return view('hrmaddon::designations.index', compact('designations'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Designation::create($request->except('business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Designation created cuccessfully'),
|
||||||
|
'redirect' => route('hrm.designations.index'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$designation = Designation::findOrFail($id);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$designation->update($request->all());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Designation updated successfully'),
|
||||||
|
'redirect' => route('hrm.designations.index'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$designation = Designation::findOrFail($id);
|
||||||
|
|
||||||
|
$designation->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Designation deleted successfully'),
|
||||||
|
'redirect' => route('hrm.designations.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function status(Request $request, $id)
|
||||||
|
{
|
||||||
|
$designation = Designation::findOrFail($id);
|
||||||
|
$designation->update(['status' => $request->status]);
|
||||||
|
return response()->json(['message' => __('Designation')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll(Request $request)
|
||||||
|
{
|
||||||
|
Designation::whereIn('id', $request->input('ids'))->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Selected Designations deleted successfully'),
|
||||||
|
'redirect' => route('hrm.designations.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Helpers\HasUploader;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Imports\EmployeeImport;
|
||||||
|
use App\Models\Branch;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Modules\HrmAddon\App\Models\Department;
|
||||||
|
use Modules\HrmAddon\App\Models\Designation;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
use Modules\HrmAddon\App\Models\Shift;
|
||||||
|
|
||||||
|
class AcnooEmployeeController extends Controller
|
||||||
|
{
|
||||||
|
use HasUploader;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:employees.read')->only(['index']);
|
||||||
|
$this->middleware('check.permission:employees.create')->only(['create', 'store']);
|
||||||
|
$this->middleware('check.permission:employees.update')->only(['edit', 'update']);
|
||||||
|
$this->middleware('check.permission:employees.delete')->only(['destroy', 'deleteAll']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$branches = Branch::withTrashed()->where('business_id', auth()->user()->business_id)->latest()->get();
|
||||||
|
|
||||||
|
$employees = Employee::with('department', 'designation', 'shift', 'branch:id,name')
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when(request('search'), function ($q) {
|
||||||
|
$q->where('phone', 'like', '%' . request('search') . '%')
|
||||||
|
->orWhere('amount', 'like', '%' . request('search') . '%')
|
||||||
|
->orWhere('name', 'like', '%' . request('search') . '%');
|
||||||
|
$q->orwhereHas('department', function ($d) {
|
||||||
|
$d->where('name', 'like', '%' . request('search') . '%');
|
||||||
|
});
|
||||||
|
$q->orwhereHas('designation', function ($r) {
|
||||||
|
$r->where('name', 'like', '%' . request('search') . '%');
|
||||||
|
});
|
||||||
|
$q->orwhereHas('shift', function ($s) {
|
||||||
|
$s->where('name', 'like', '%' . request('search') . '%');
|
||||||
|
});
|
||||||
|
$q->orwhereHas('branch', function ($r) {
|
||||||
|
$r->where('name', 'like', '%' . request('search') . '%');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->branch_id, function ($q) use ($request) {
|
||||||
|
$q->where('branch_id', $request->branch_id);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::employees.datas', compact('employees', 'branches'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('hrmaddon::employees.index', compact('employees', 'branches'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$designations = Designation::where('business_id', auth()->user()->business_id)->where('status', 1)->get();
|
||||||
|
$departments = Department::where('business_id', auth()->user()->business_id)->where('status', 1)->get();
|
||||||
|
$shifts = Shift::where('business_id', auth()->user()->business_id)->where('status', 1)->get();
|
||||||
|
|
||||||
|
return view('hrmaddon::employees.create', compact('designations', 'departments', 'shifts'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'designation_id' => 'required|exists:designations,id',
|
||||||
|
'department_id' => 'required|exists:departments,id',
|
||||||
|
'shift_id' => 'required|exists:shifts,id',
|
||||||
|
'amount' => 'numeric|required',
|
||||||
|
'phone' => 'required|string|max:20',
|
||||||
|
'email' => 'nullable|email|max:255',
|
||||||
|
'gender' => 'required|in:male,female,others',
|
||||||
|
'country' => 'nullable|string|max:100',
|
||||||
|
'birth_date' => 'nullable|date',
|
||||||
|
'join_date' => 'nullable|date',
|
||||||
|
'image' => 'nullable|image|mimes:jpg,png,jpeg,svg',
|
||||||
|
'status' => 'required|in:active,terminated,suspended',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Employee::create($request->except('business_id', 'image') + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'image' => $request->image ? $this->upload($request, 'image') : NULL
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Employee created Successfully'),
|
||||||
|
'redirect' => route('hrm.employees.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function edit(string $id)
|
||||||
|
{
|
||||||
|
$employee = Employee::findOrFail($id);
|
||||||
|
$designations = Designation::where('business_id', auth()->user()->business_id)->where('status', 1)->get();
|
||||||
|
$departments = Department::where('business_id', auth()->user()->business_id)->where('status', 1)->get();
|
||||||
|
$shifts = Shift::where('business_id', auth()->user()->business_id)->where('status', 1)->get();
|
||||||
|
|
||||||
|
return view('hrmaddon::employees.edit', compact('employee', 'designations', 'departments', 'shifts'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, string $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'designation_id' => 'required|exists:designations,id',
|
||||||
|
'department_id' => 'required|exists:departments,id',
|
||||||
|
'shift_id' => 'required|exists:shifts,id',
|
||||||
|
'amount' => 'numeric|required',
|
||||||
|
'phone' => 'required|string|max:20',
|
||||||
|
'email' => 'nullable|email|max:255',
|
||||||
|
'gender' => 'required|in:male,female,others',
|
||||||
|
'country' => 'nullable|string|max:100',
|
||||||
|
'birth_date' => 'nullable|date',
|
||||||
|
'join_date' => 'nullable|date',
|
||||||
|
'image' => 'nullable|image|mimes:jpg,png,jpeg,svg',
|
||||||
|
'status' => 'required|in:active,terminated,suspended',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$employee = Employee::findOrFail($id);
|
||||||
|
|
||||||
|
$employee->update($request->except('business_id', 'image') + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'image' => $request->image ? $this->upload($request, 'image', $employee->image) : $employee->image
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Employee updated Successfully'),
|
||||||
|
'redirect' => route('hrm.employees.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(string $id)
|
||||||
|
{
|
||||||
|
$employee = Employee::findOrFail($id);
|
||||||
|
if (file_exists($employee->image)) {
|
||||||
|
Storage::delete($employee->image);
|
||||||
|
}
|
||||||
|
$employee->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Employee deleted successfully'),
|
||||||
|
'redirect' => route('hrm.employees.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::whereIn('id', $request->ids)->get();
|
||||||
|
|
||||||
|
foreach ($employees as $employee) {
|
||||||
|
if (file_exists($employee->image)) {
|
||||||
|
Storage::delete($employee->image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Employee::whereIn('id', $request->ids)->delete();
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Selected employees deleted successfully'),
|
||||||
|
'redirect' => route('hrm.employees.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bulkStore(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'file' => 'required|file|mimes:xlsx,xls,csv'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$businessId = auth()->user()->business_id;
|
||||||
|
$import = new EmployeeImport($businessId);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Excel::import($import, $request->file('file'));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true,
|
||||||
|
'message' => __('Bulk upload successfully.'),
|
||||||
|
'redirect' => route('hrm.employees.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
107
Modules/HrmAddon/App/Http/Controllers/AcnooHolidayController.php
Normal file
107
Modules/HrmAddon/App/Http/Controllers/AcnooHolidayController.php
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Branch;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Holiday;
|
||||||
|
|
||||||
|
class AcnooHolidayController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:holidays.read')->only(['index']);
|
||||||
|
$this->middleware('check.permission:holidays.create')->only(['store']);
|
||||||
|
$this->middleware('check.permission:holidays.update')->only(['update']);
|
||||||
|
$this->middleware('check.permission:holidays.delete')->only(['destroy', 'deleteAll']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$branches = Branch::withTrashed()->where('business_id', auth()->user()->business_id)->latest()->get();
|
||||||
|
|
||||||
|
$holidays = Holiday::with('branch:id,name')
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->branch_id, function ($q) use ($request) {
|
||||||
|
$q->where('branch_id', $request->branch_id);
|
||||||
|
})
|
||||||
|
->when($request->search, function ($q) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$q->where(function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('description', 'like', '%' . $search . '%')
|
||||||
|
->orWhereHas('branch', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::holidays.datas', compact('holidays'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('hrmaddon::holidays.index', compact('holidays', 'branches'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date|after_or_equal:start_date',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Holiday::create($request->except('business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Holiday created successfully'),
|
||||||
|
'redirect' => route('hrm.holidays.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, Holiday $holiday)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'nullable|string|max:255',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date|after_or_equal:start_date',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$holiday->update($request->except('business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Holiday updated successfully'),
|
||||||
|
'redirect' => route('hrm.holidays.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Holiday $holiday)
|
||||||
|
{
|
||||||
|
$holiday->delete();
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Holidays Deleted Successfully'),
|
||||||
|
'redirect' => route('hrm.holidays.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll(Request $request)
|
||||||
|
{
|
||||||
|
Holiday::whereIn('id', $request->ids)->delete();
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('All Holiday deleted successfully.'),
|
||||||
|
'redirect' => route('hrm.holidays.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
167
Modules/HrmAddon/App/Http/Controllers/AcnooLeaveController.php
Normal file
167
Modules/HrmAddon/App/Http/Controllers/AcnooLeaveController.php
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Branch;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Leave;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
use Modules\HrmAddon\App\Models\LeaveType;
|
||||||
|
use Modules\HrmAddon\App\Models\Department;
|
||||||
|
|
||||||
|
class AcnooLeaveController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:leaves.read')->only(['index']);
|
||||||
|
$this->middleware('check.permission:leaves.create')->only(['store']);
|
||||||
|
$this->middleware('check.permission:leaves.update')->only(['update', 'status']);
|
||||||
|
$this->middleware('check.permission:leaves.delete')->only(['destroy', 'deleteAll']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::where('business_id', auth()->user()->business_id)->latest()->get();
|
||||||
|
$departments = Department::where('business_id', auth()->user()->business_id)->whereStatus(1)->latest()->get();
|
||||||
|
$leave_types = LeaveType::where('business_id', auth()->user()->business_id)->whereStatus(1)->latest()->get();
|
||||||
|
|
||||||
|
$leaves = Leave::with(['employee:id,name', 'branch:id,name', 'leave_type:id,name', 'department:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->branch_id, function ($q) use ($request) {
|
||||||
|
$q->where('branch_id', $request->branch_id);
|
||||||
|
})
|
||||||
|
->when($request->search, function ($query) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->where(function ($query) use ($search) {
|
||||||
|
$query->where('description', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('start_date', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('end_date', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('leave_duration', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('month', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('status', 'like', '%' . $search . '%')
|
||||||
|
->orWhereHas('employee', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('department', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('branch', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('leave_type', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->employee, function ($query) use ($request) {
|
||||||
|
$employeeId = $request->employee;
|
||||||
|
$query->where('employee_id', $employeeId);
|
||||||
|
})
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$query->where('month', $request->month);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::leaves.datas', compact('leaves'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$branches = Branch::withTrashed()->where('business_id', auth()->user()->business_id)->latest()->get();
|
||||||
|
|
||||||
|
return view('hrmaddon::leaves.index', compact('leaves', 'employees', 'departments', 'leave_types', 'branches'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|exists:employees,id',
|
||||||
|
'department_id' => 'required|exists:departments,id',
|
||||||
|
'leave_type_id' => 'required|exists:leave_types,id',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date|after_or_equal:start_date',
|
||||||
|
'leave_duration' => 'required|numeric|min:0.5',
|
||||||
|
'month' => 'required|string',
|
||||||
|
'status' => 'required|in:pending,approved,rejected',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Leave::create($request->except('business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Leave created successfully'),
|
||||||
|
'redirect' => route('hrm.leaves.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|exists:employees,id',
|
||||||
|
'department_id' => 'required|exists:departments,id',
|
||||||
|
'leave_type_id' => 'required|exists:leave_types,id',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date|after_or_equal:start_date',
|
||||||
|
'leave_duration' => 'required|numeric|min:0.5',
|
||||||
|
'month' => 'required|string',
|
||||||
|
'status' => 'required|in:pending,approved,rejected',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$leave = Leave::findOrFail($id);
|
||||||
|
|
||||||
|
$leave->update($request->except('business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Leave Updated successfully'),
|
||||||
|
'redirect' => route('hrm.leaves.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$leave = Leave::findOrFail($id);
|
||||||
|
$leave->delete();
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Leave Deleted Successfully'),
|
||||||
|
'redirect' => route('hrm.leaves.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll(Request $request)
|
||||||
|
{
|
||||||
|
Leave::whereIn('id', $request->input('ids'))->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('All Leaves deleted successfully'),
|
||||||
|
'redirect' => route('hrm.leaves.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function status(Request $request, $id)
|
||||||
|
{
|
||||||
|
$order = Leave::findOrFail($id);
|
||||||
|
$order->update(['status' => $request->status]);
|
||||||
|
return response()->json(['message' => 'Leave']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDepartment()
|
||||||
|
{
|
||||||
|
$employee = Employee::findOrFail(request('employee_id'));
|
||||||
|
$department = Department::findOrFail($employee->department_id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => [
|
||||||
|
'id' => $department->id,
|
||||||
|
'name' => $department->name
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\PdfService;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Modules\HrmAddon\App\Exports\ExportLeaveReport;
|
||||||
|
use Modules\HrmAddon\App\Models\Leave;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
|
||||||
|
class AcnooLeaveReportController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:leave-reports.read')->only(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::where('business_id', auth()->user()->business_id)->whereStatus('active')->latest()->get();
|
||||||
|
|
||||||
|
$leaves = Leave::with(['employee:id,name', 'leave_type:id,name', 'department:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->search, function ($query) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->where(function ($query) use ($search) {
|
||||||
|
$query->where('description', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('start_date', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('end_date', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('leave_duration', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('month', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('status', 'like', '%' . $search . '%')
|
||||||
|
->orWhereHas('employee', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('department', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('leave_type', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->employee, function ($query) use ($request) {
|
||||||
|
$employeeId = $request->employee;
|
||||||
|
$query->where('employee_id', $employeeId);
|
||||||
|
})
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$query->where('month', $request->month);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::reports.leaves.datas', compact('leaves'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('hrmaddon::reports.leaves.index', compact('leaves', 'employees'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportExcel()
|
||||||
|
{
|
||||||
|
return Excel::download(new ExportLeaveReport, 'leave-report.xlsx');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportCsv()
|
||||||
|
{
|
||||||
|
return Excel::download(new ExportLeaveReport, 'leave-report.csv');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportPdf(Request $request)
|
||||||
|
{
|
||||||
|
$leaves = Leave::with(['employee:id,name', 'leave_type:id,name', 'department:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return PdfService::render('hrmaddon::reports.leaves.pdf', compact('leaves'),'leave-report.pdf');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Leave;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
|
||||||
|
class AcnooLeaveReportHistoryController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:leave-reports.read')->only(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::where('business_id', auth()->user()->business_id)->whereStatus('active')->latest()->get();
|
||||||
|
|
||||||
|
$leaves = Leave::with(['employee:id,name', 'leave_type:id,name', 'department:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->search, function ($query) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->where(function ($query) use ($search) {
|
||||||
|
$query->where('description', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('start_date', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('end_date', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('leave_duration', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('month', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('status', 'like', '%' . $search . '%')
|
||||||
|
->orWhereHas('employee', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('department', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('leave_type', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->employee, function ($query) use ($request) {
|
||||||
|
$employeeId = $request->employee;
|
||||||
|
$query->where('employee_id', $employeeId);
|
||||||
|
})
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$query->where('month', $request->month);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::reports.leaves.datas', compact('leaves'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('hrmaddon::reports.leaves.index', compact('leaves', 'employees'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\LeaveType;
|
||||||
|
|
||||||
|
class AcnooLeaveTypeController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:leave-types.read')->only(['index']);
|
||||||
|
$this->middleware('check.permission:leave-types.create')->only(['store']);
|
||||||
|
$this->middleware('check.permission:leave-types.update')->only(['update', 'status']);
|
||||||
|
$this->middleware('check.permission:leave-types.delete')->only(['destroy', 'deleteAll']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$leave_types = LeaveType::where('business_id', auth()->user()->business_id)
|
||||||
|
->when(request('search'), function($q) use($request) {
|
||||||
|
$q->where(function($q) use($request) {
|
||||||
|
$q->where('name', 'like', '%'.$request->search.'%')
|
||||||
|
->orWhere('description', 'like', '%'.$request->search.'%');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if($request->ajax()){
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::leave-types.datas',compact('leave_types'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return view('hrmaddon::leave-types.index',compact('leave_types'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
LeaveType::create($request->except('business_id') +[
|
||||||
|
'business_id' => auth()->user()->business_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Leave Type created cuccessfully.',
|
||||||
|
'redirect' => route('hrm.leave-types.index'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, LeaveType $leaveType)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$leaveType->update($request->except('business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Leave Type updated successfully.',
|
||||||
|
'redirect' => route('hrm.leave-types.index'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(LeaveType $leaveType)
|
||||||
|
{
|
||||||
|
$leaveType->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Leave Type deleted successfully',
|
||||||
|
'redirect' => route('hrm.leave-types.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function status(Request $request, $id)
|
||||||
|
{
|
||||||
|
$leaveType = LeaveType::findOrFail($id);
|
||||||
|
$leaveType->update(['status' => $request->status]);
|
||||||
|
return response()->json(['message' => 'Leave Type']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll(Request $request)
|
||||||
|
{
|
||||||
|
$leave_type = LeaveType::whereIn('id', $request->input('ids'));
|
||||||
|
$leave_type->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('All Leave Types deleted successfully.'),
|
||||||
|
'redirect' => route('hrm.leave-types.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
219
Modules/HrmAddon/App/Http/Controllers/AcnooPayrollController.php
Normal file
219
Modules/HrmAddon/App/Http/Controllers/AcnooPayrollController.php
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Branch;
|
||||||
|
use App\Models\PaymentType;
|
||||||
|
use App\Models\Transaction;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Events\MultiPaymentProcessed;
|
||||||
|
use Modules\HrmAddon\App\Models\Payroll;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
|
||||||
|
class AcnooPayrollController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:payrolls.read')->only(['index']);
|
||||||
|
$this->middleware('check.permission:payrolls.create')->only(['store']);
|
||||||
|
$this->middleware('check.permission:payrolls.update')->only(['update']);
|
||||||
|
$this->middleware('check.permission:payrolls.delete')->only(['destroy', 'deleteAll']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::where('business_id', auth()->user()->business_id)->whereStatus('active')->latest()->get();
|
||||||
|
$payment_types = PaymentType::where('business_id', auth()->user()->business_id)->whereStatus(1)->latest()->get();
|
||||||
|
|
||||||
|
$payrolls = Payroll::with(['employee:id,name', 'payment_type:id,name', 'branch:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->branch_id, function ($q) use ($request) {
|
||||||
|
$q->where('branch_id', $request->branch_id);
|
||||||
|
})
|
||||||
|
->when($request->search, function ($query) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->where(function ($query) use ($search) {
|
||||||
|
$query->where('puid', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('amount', 'like', '%' . $search . '%')
|
||||||
|
->orWhereHas('employee', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('branch', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('payment_type', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->employee, function ($query) use ($request) {
|
||||||
|
$employeeId = $request->employee;
|
||||||
|
$query->where('employee_id', $employeeId);
|
||||||
|
})
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$query->where('month', $request->month);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::payrolls.datas', compact('payrolls'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$branches = Branch::withTrashed()->where('business_id', auth()->user()->business_id)->latest()->get();
|
||||||
|
|
||||||
|
return view('hrmaddon::payrolls.index', compact('payrolls', 'employees', 'payment_types', 'branches'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|integer|exists:employees,id',
|
||||||
|
'payment_type_id' => 'required',
|
||||||
|
'month' => 'required|string',
|
||||||
|
'date' => 'nullable|date',
|
||||||
|
'amount' => 'required|numeric',
|
||||||
|
'note' => 'nullable|string',
|
||||||
|
'payemnt_year' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
|
||||||
|
$exists = Payroll::where('employee_id', $request->employee_id)
|
||||||
|
->where('month', $request->month)
|
||||||
|
->where('payemnt_year', $request->payemnt_year)
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($exists) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('This employee has already been paid for this month and year.'),
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateBalance($request->amount, 'decrement');
|
||||||
|
|
||||||
|
$payroll = Payroll::create($request->except('business_id', 'payment_type_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'payment_type_id' => $request->payment_type_id != 'cash' ? $request->payment_type_id : NULL,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$payments = [['amount' => $request->amount, 'type' => $request->payment_type_id]];
|
||||||
|
|
||||||
|
|
||||||
|
// MultiPaymentProcessed Event
|
||||||
|
event(new MultiPaymentProcessed(
|
||||||
|
$payments,
|
||||||
|
$payroll->id,
|
||||||
|
'payroll',
|
||||||
|
$total_amount ?? 0,
|
||||||
|
));
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Payroll created successfully'),
|
||||||
|
'redirect' => route('hrm.payrolls.index')
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollback();
|
||||||
|
return response()->json(['message' => __('Somethings went wrong!')], 404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|integer|exists:employees,id',
|
||||||
|
'payment_type_id' => 'required',
|
||||||
|
'date' => 'nullable|date',
|
||||||
|
'month' => 'required|string',
|
||||||
|
'amount' => 'required|numeric',
|
||||||
|
'note' => 'nullable|string',
|
||||||
|
'payemnt_year' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
|
||||||
|
$business_id = auth()->user()->business_id;
|
||||||
|
$payroll = Payroll::where('business_id', $business_id)->findOrFail($id);
|
||||||
|
|
||||||
|
updateBalance($request->amount - $payroll->amount, 'decrement');
|
||||||
|
|
||||||
|
$payroll->update($request->except(['business_id', 'amount', 'payment_type_id']) + [
|
||||||
|
'payment_type_id' => $request->payment_type_id != 'cash' ? $request->payment_type_id : NULL
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Delete old transactions
|
||||||
|
$transaction = Transaction::where('business_id', $business_id)
|
||||||
|
->where([
|
||||||
|
'platform' => 'payroll',
|
||||||
|
'reference_id' => $payroll->id
|
||||||
|
])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($transaction->bank_payment) {
|
||||||
|
PaymentType::find($transaction->payment_type_id)->decrement('balance', $transaction->amount);
|
||||||
|
}
|
||||||
|
$transaction->delete();
|
||||||
|
|
||||||
|
$payments = [['amount' => $request->amount, 'type' => $request->payment_type_id]];
|
||||||
|
|
||||||
|
// Process new payments
|
||||||
|
event(new MultiPaymentProcessed(
|
||||||
|
$payments,
|
||||||
|
$payroll->id,
|
||||||
|
'payroll',
|
||||||
|
$request->amount,
|
||||||
|
));
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Payroll Updated successfully'),
|
||||||
|
'redirect' => route('hrm.payrolls.index')
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollback();
|
||||||
|
return response()->json(['message' => $e->getMessage()], 404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$payroll = Payroll::findOrFail($id);
|
||||||
|
|
||||||
|
$payroll->delete();
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Payroll Deleted Successfully'),
|
||||||
|
'redirect' => route('hrm.payrolls.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll(Request $request)
|
||||||
|
{
|
||||||
|
Payroll::whereIn('id', $request->input('ids'))->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('All Payrolls deleted successfully'),
|
||||||
|
'redirect' => route('hrm.payrolls.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmpAmount()
|
||||||
|
{
|
||||||
|
$employee = Employee::findOrFail(request('employee_id'));
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => [
|
||||||
|
'amount' => $employee->amount
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Modules\HrmAddon\App\Models\Payroll;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\PdfService;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Modules\HrmAddon\App\Exports\ExportPayrollReport;
|
||||||
|
|
||||||
|
class AcnooPayrollReportController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:payroll-reports.read')->only(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::where('business_id', auth()->user()->business_id)->whereStatus('active')->latest()->get();
|
||||||
|
|
||||||
|
$payrolls = Payroll::with(['employee:id,name', 'payment_type:id,name', 'branch:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->search, function ($query) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->where(function ($query) use ($search) {
|
||||||
|
$query->where('puid', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('amount', 'like', '%' . $search . '%')
|
||||||
|
->orWhereHas('employee', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('payment_type', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->employee, function ($query) use ($request) {
|
||||||
|
$employeeId = $request->employee;
|
||||||
|
$query->where('employee_id', $employeeId);
|
||||||
|
})
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$query->where('month', $request->month);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::reports.payrolls.datas', compact('payrolls'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('hrmaddon::reports.payrolls.index', compact('payrolls', 'employees'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportExcel()
|
||||||
|
{
|
||||||
|
return Excel::download(new ExportPayrollReport, 'payroll-report.xlsx');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportCsv()
|
||||||
|
{
|
||||||
|
return Excel::download(new ExportPayrollReport, 'payroll-report.csv');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportPdf(Request $request)
|
||||||
|
{
|
||||||
|
$payrolls = Payroll::with(['employee:id,name', 'payment_type:id,name', 'branch:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return PdfService::render('hrmaddon::reports.payrolls.pdf', compact('payrolls'),'payroll-report.pdf');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Modules\HrmAddon\App\Models\Payroll;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
|
class AcnooPayrollReportHistoryController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:payroll-reports.read')->only(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$employees = Employee::where('business_id', auth()->user()->business_id)->whereStatus('active')->latest()->get();
|
||||||
|
|
||||||
|
$payrolls = Payroll::with(['employee:id,name', 'payment_type:id,name', 'branch:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->search, function ($query) use ($request) {
|
||||||
|
$search = $request->search;
|
||||||
|
$query->where(function ($query) use ($search) {
|
||||||
|
$query->where('puid', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('amount', 'like', '%' . $search . '%')
|
||||||
|
->orWhereHas('employee', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhereHas('payment_type', function ($q) use ($search) {
|
||||||
|
$q->where('name', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when($request->employee, function ($query) use ($request) {
|
||||||
|
$employeeId = $request->employee;
|
||||||
|
$query->where('employee_id', $employeeId);
|
||||||
|
})
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$query->where('month', $request->month);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::reports.payrolls.datas', compact('payrolls'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('hrmaddon::reports.payrolls.index', compact('payrolls', 'employees'));
|
||||||
|
}
|
||||||
|
}
|
||||||
135
Modules/HrmAddon/App/Http/Controllers/AcnooShiftController.php
Normal file
135
Modules/HrmAddon/App/Http/Controllers/AcnooShiftController.php
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Shift;
|
||||||
|
|
||||||
|
class AcnooShiftController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('check.permission:shifts.read')->only(['index']);
|
||||||
|
$this->middleware('check.permission:shifts.create')->only(['store']);
|
||||||
|
$this->middleware('check.permission:shifts.update')->only(['update', 'status']);
|
||||||
|
$this->middleware('check.permission:shifts.delete')->only(['destroy', 'deleteAll']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$shifts = Shift::where('business_id', auth()->user()->business_id)
|
||||||
|
->when(request('search'), function ($q) use ($request) {
|
||||||
|
$q->where(function ($q) use ($request) {
|
||||||
|
$q->where('name', 'like', '%' . $request->search . '%')
|
||||||
|
->orWhere('start_time', 'like', '%' . $request->search . '%')
|
||||||
|
->orWhere('end_time', 'like', '%' . $request->search . '%');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json([
|
||||||
|
'data' => view('hrmaddon::shifts.datas', compact('shifts'))->render()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return view('hrmaddon::shifts.index', compact('shifts'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|in:Morning,Day,Evening,Night',
|
||||||
|
'start_time' => 'required|date_format:H:i',
|
||||||
|
'end_time' => 'required|date_format:H:i',
|
||||||
|
'start_break_time' => 'nullable|date_format:H:i',
|
||||||
|
'end_break_time' => 'nullable|date_format:H:i',
|
||||||
|
'break_status' => 'nullable|in:yes,no',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->filled('start_break_time') && $request->filled('end_break_time')) {
|
||||||
|
$startTime = Carbon::parse($request->input('start_break_time'));
|
||||||
|
$endTime = Carbon::parse($request->input('end_break_time'));
|
||||||
|
|
||||||
|
$hoursDiff = $endTime->diffInHours($startTime);
|
||||||
|
$minutesDiff = $endTime->diffInMinutes($startTime) % 60;
|
||||||
|
|
||||||
|
$breakTime = sprintf('%02d:%02d', $hoursDiff, $minutesDiff);
|
||||||
|
} else {
|
||||||
|
$breakTime = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Shift::create($request->except('status','break_time', 'business_id')+[
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'break_time' => $breakTime,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Shift created successfully.'),
|
||||||
|
'redirect' => route('hrm.shifts.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, Shift $shift)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|in:Morning,Day,Evening,Night',
|
||||||
|
'start_time' => 'required',
|
||||||
|
'end_time' => 'required',
|
||||||
|
'start_break_time' => 'nullable',
|
||||||
|
'end_break_time' => 'nullable',
|
||||||
|
'break_status' => 'nullable|in:yes,no',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->filled('start_break_time') && $request->filled('end_break_time')) {
|
||||||
|
$startTime = Carbon::parse($request->input('start_break_time'));
|
||||||
|
$endTime = Carbon::parse($request->input('end_break_time'));
|
||||||
|
|
||||||
|
$hoursDiff = $endTime->diffInHours($startTime);
|
||||||
|
$minutesDiff = $endTime->diffInMinutes($startTime) % 60;
|
||||||
|
|
||||||
|
$breakTime = sprintf('%02d:%02d', $hoursDiff, $minutesDiff);
|
||||||
|
} else {
|
||||||
|
$breakTime = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$shift->update($request->except('status','break_time', 'business_id')+[
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'break_time' => $breakTime,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Shift Updated successfully.'),
|
||||||
|
'redirect' => route('hrm.shifts.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$shift = Shift::findOrFail($id);
|
||||||
|
$shift->delete();
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Shift deleted successfully.'),
|
||||||
|
'redirect' => route('hrm.shifts.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll(Request $request)
|
||||||
|
{
|
||||||
|
Shift::whereIn('id', $request->input('ids'))->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('All shifts deleted successfully'),
|
||||||
|
'redirect' => route('hrm.shifts.index')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function status(Request $request, $id)
|
||||||
|
{
|
||||||
|
$shift = Shift::findOrFail($id);
|
||||||
|
$shift->update(['status' => $request->status]);
|
||||||
|
return response()->json(['message' => 'Shift']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Models\Business;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
use Modules\HrmAddon\App\Models\Attendance;
|
||||||
|
|
||||||
|
class AttendanceController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$data = Attendance::with(['employee:id,name', 'shift:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->employee_id, function ($query) use ($request) {
|
||||||
|
$query->where('employee_id', $request->employee_id);
|
||||||
|
})
|
||||||
|
->when($request->duration, function ($query) use ($request) {
|
||||||
|
$today = Carbon::today();
|
||||||
|
|
||||||
|
if ($request->duration === 'today') {
|
||||||
|
$query->whereDate('date', $today);
|
||||||
|
} elseif ($request->duration === 'yesterday') {
|
||||||
|
$query->whereDate('date', Carbon::yesterday());
|
||||||
|
} elseif ($request->duration === 'last_seven_days') {
|
||||||
|
$startDate = Carbon::now()->subDays(7)->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'last_thirty_days') {
|
||||||
|
$startDate = Carbon::now()->subDays(30)->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'current_month') {
|
||||||
|
$startDate = Carbon::now()->startOfMonth()->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->endOfMonth()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'last_month') {
|
||||||
|
$startDate = Carbon::now()->subMonth()->startOfMonth()->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->subMonth()->endOfMonth()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'current_year') {
|
||||||
|
$startDate = Carbon::now()->startOfYear()->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->endOfYear()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'custom_date' && $request->from_date && $request->to_date) {
|
||||||
|
$startDate = Carbon::parse($request->from_date)->format('Y-m-d');
|
||||||
|
$endDate = Carbon::parse($request->to_date)->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|exists:employees,id',
|
||||||
|
'time_in' => 'required|date_format:H:i',
|
||||||
|
'time_out' => 'required|date_format:H:i',
|
||||||
|
'date' => 'required|date',
|
||||||
|
'note' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$timeIn = Carbon::parse($request->time_in);
|
||||||
|
$timeOut = Carbon::parse($request->time_out);
|
||||||
|
|
||||||
|
$durationInMinutes = $timeOut->diffInMinutes($timeIn);
|
||||||
|
$hours = floor($durationInMinutes / 60);
|
||||||
|
$minutes = $durationInMinutes % 60;
|
||||||
|
$formattedDuration = sprintf('%02d:%02d', $hours, $minutes);
|
||||||
|
$month = strtolower(Carbon::parse($request->date)->format('F'));
|
||||||
|
|
||||||
|
$business = Business::findOrFail(auth()->user()->business_id);
|
||||||
|
$employee = Employee::findOrFail($request->employee_id);
|
||||||
|
|
||||||
|
$data = Attendance::create($request->except(['business_id', 'duration', 'month', 'shift_id']) + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'duration' => $formattedDuration,
|
||||||
|
'month' => $month,
|
||||||
|
'shift_id' => $employee->shift_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (moduleCheck('MarketingAddon')) {
|
||||||
|
$this->attendanceMessage($business, $data, $employee);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Attendance::with(['employee:id,name', 'shift:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$attendance = Attendance::where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
if (!$attendance) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|exists:employees,id',
|
||||||
|
'time_in' => 'required|date_format:H:i',
|
||||||
|
'time_out' => 'required|date_format:H:i',
|
||||||
|
'date' => 'required|date',
|
||||||
|
'note' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$timeIn = Carbon::parse($request->time_in);
|
||||||
|
$timeOut = Carbon::parse($request->time_out);
|
||||||
|
|
||||||
|
$durationInMinutes = $timeOut->diffInMinutes($timeIn);
|
||||||
|
$hours = floor($durationInMinutes / 60);
|
||||||
|
$minutes = $durationInMinutes % 60;
|
||||||
|
$formattedDuration = sprintf('%02d:%02d', $hours, $minutes);
|
||||||
|
$month = strtolower(Carbon::parse($request->date)->format('F'));
|
||||||
|
$employee = Employee::findOrFail($request->employee_id);
|
||||||
|
|
||||||
|
$attendance->update($request->except(['duration', 'month']) + [
|
||||||
|
'duration' => $formattedDuration,
|
||||||
|
'month' => $month,
|
||||||
|
'shift_id' => $employee->shift_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $attendance,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$attendance = Attendance::where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
if (!$attendance) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$attendance->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data deleted successfully.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use Modules\HrmAddon\App\Models\Attendance;
|
||||||
|
|
||||||
|
class AttendanceReportController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$data = Attendance::with(['employee:id,name', 'shift:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->employee_id, function ($query) use ($request) {
|
||||||
|
$query->where('employee_id', $request->employee_id);
|
||||||
|
})
|
||||||
|
->when($request->duration, function ($query) use ($request) {
|
||||||
|
$today = Carbon::today();
|
||||||
|
|
||||||
|
if ($request->duration === 'today') {
|
||||||
|
$query->whereDate('date', $today);
|
||||||
|
} elseif ($request->duration === 'yesterday') {
|
||||||
|
$query->whereDate('date', Carbon::yesterday());
|
||||||
|
} elseif ($request->duration === 'last_seven_days') {
|
||||||
|
$startDate = Carbon::now()->subDays(7)->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'last_thirty_days') {
|
||||||
|
$startDate = Carbon::now()->subDays(30)->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'current_month') {
|
||||||
|
$startDate = Carbon::now()->startOfMonth()->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->endOfMonth()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'last_month') {
|
||||||
|
$startDate = Carbon::now()->subMonth()->startOfMonth()->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->subMonth()->endOfMonth()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'current_year') {
|
||||||
|
$startDate = Carbon::now()->startOfYear()->format('Y-m-d');
|
||||||
|
$endDate = Carbon::now()->endOfYear()->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
} elseif ($request->duration === 'custom_date' && $request->from_date && $request->to_date) {
|
||||||
|
$startDate = Carbon::parse($request->from_date)->format('Y-m-d');
|
||||||
|
$endDate = Carbon::parse($request->to_date)->format('Y-m-d');
|
||||||
|
$query->whereDate('date', '>=', $startDate)
|
||||||
|
->whereDate('date', '<=', $endDate);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\HrmAddon\App\Models\Department;
|
||||||
|
|
||||||
|
class DepartmentController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data = Department::where('business_id', auth()->user()->business_id)
|
||||||
|
->when(request('status'), function ($query) {
|
||||||
|
$query->where('status', request('status') == 'active' ? 1 : 0);
|
||||||
|
})
|
||||||
|
->latest()->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|unique:departments,name,NULL,id,business_id,' . auth()->user()->business_id,
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
'status' => 'nullable|boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = Department::create($request->all() + [
|
||||||
|
'business_id' => auth()->user()->business_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Department::where('business_id', auth()->user()->business_id)->findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$department = Department::where('business_id', auth()->user()->business_id)
|
||||||
|
->find($id);
|
||||||
|
|
||||||
|
if (!$department) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|unique:departments,name,' . $id . ',id,business_id,' . auth()->user()->business_id,
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
'status' => 'nullable|boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$department->update($request->except('business_id'));
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $department,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$department = Department::where('business_id', auth()->user()->business_id)
|
||||||
|
->find($id);
|
||||||
|
|
||||||
|
if (!$department) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$department->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data deleted successfully.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\HrmAddon\App\Models\Designation;
|
||||||
|
|
||||||
|
class DesignationController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data = Designation::where('business_id', auth()->user()->business_id)
|
||||||
|
->when(request('status'), function ($query) {
|
||||||
|
$query->where('status', request('status') == 'active' ? 1 : 0);
|
||||||
|
})
|
||||||
|
->latest()->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|unique:designations,name,NULL,id,business_id,' . auth()->user()->business_id,
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
'status' => 'nullable|boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = Designation::create($request->all() + [
|
||||||
|
'business_id' => auth()->user()->business_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Designation::where('business_id', auth()->user()->business_id)->findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$designation = Designation::where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
if (!$designation) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|unique:designations,name,' . $id . ',id,business_id,' . auth()->user()->business_id,
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
'status' => 'nullable|boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$designation->update($request->except('business_id'));
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $designation,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$designation = Designation::where('business_id', auth()->user()->business_id)
|
||||||
|
->find($id);
|
||||||
|
|
||||||
|
if (!$designation) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$designation->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data deleted successfully.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
126
Modules/HrmAddon/App/Http/Controllers/Api/EmployeeController.php
Normal file
126
Modules/HrmAddon/App/Http/Controllers/Api/EmployeeController.php
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Helpers\HasUploader;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
|
||||||
|
class EmployeeController extends Controller
|
||||||
|
{
|
||||||
|
use HasUploader;
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data = Employee::with('department:id,name', 'designation:id,name', 'shift:id,name', 'branch:id,name')
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when(request('status'), function ($query) {
|
||||||
|
$status = request('status');
|
||||||
|
if (in_array($status, ['active', 'terminated', 'suspended'])) {
|
||||||
|
$query->where('status', $status);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate($this->validationRules());
|
||||||
|
|
||||||
|
$data = Employee::create($request->except('business_id', 'image') + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'image' => $request->image ? $this->upload($request, 'image') : NULL
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Employee::with('department:id,name', 'designation:id,name', 'shift:id,name', 'branch:id,name')
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$employee = Employee::where('business_id', auth()->user()->business_id)
|
||||||
|
->find($id);
|
||||||
|
|
||||||
|
if (!$employee) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate($this->validationRules($id));
|
||||||
|
|
||||||
|
$data = $employee->update($request->except('business_id', 'image') + [
|
||||||
|
'image' => $request->image ? $this->upload($request, 'image', $employee->image) : $employee->image
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$employee = Employee::where('business_id', auth()->user()->business_id)
|
||||||
|
->find($id);
|
||||||
|
|
||||||
|
if (!$employee) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($employee->image)) {
|
||||||
|
Storage::delete($employee->image);
|
||||||
|
}
|
||||||
|
|
||||||
|
$employee->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data deleted successfully.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Common validation for store/update.
|
||||||
|
protected function validationRules($id = null)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'designation_id' => 'required|exists:designations,id',
|
||||||
|
'department_id' => 'required|exists:departments,id',
|
||||||
|
'shift_id' => 'required|exists:shifts,id',
|
||||||
|
'amount' => 'required|numeric',
|
||||||
|
'phone' => 'required|string|max:20',
|
||||||
|
'email' => 'nullable|email|max:255',
|
||||||
|
'gender' => 'required|in:male,female,others',
|
||||||
|
'country' => 'nullable|string|max:100',
|
||||||
|
'birth_date' => 'nullable|date',
|
||||||
|
'join_date' => 'nullable|date',
|
||||||
|
'image' => 'nullable|image|mimes:jpg,png,jpeg,svg',
|
||||||
|
'status' => 'required|in:active,terminated,suspended',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Holiday;
|
||||||
|
|
||||||
|
class HolidayController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$holidays = Holiday::with('branch:id,name')->where('business_id', auth()->user()->business_id)->latest()->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $holidays,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Holiday::where('business_id', auth()->user()->business_id)->findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = Holiday::create($request->except('business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, string $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'nullable|string|max:255',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$holiday = Holiday::where('business_id', auth()->user()->business_id)->findOrFail($id);
|
||||||
|
|
||||||
|
$holiday->update($request->except('business_id'));
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $holiday,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(string $id)
|
||||||
|
{
|
||||||
|
$holiday = Holiday::where('business_id', auth()->user()->business_id)->findOrFail($id);
|
||||||
|
|
||||||
|
if (!$holiday) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$holiday->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data deleted successfully.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
117
Modules/HrmAddon/App/Http/Controllers/Api/LeaveController.php
Normal file
117
Modules/HrmAddon/App/Http/Controllers/Api/LeaveController.php
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Leave;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
|
||||||
|
class LeaveController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$leaves = Leave::with(['employee:id,name', 'branch:id,name', 'leave_type:id,name', 'department:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->employee_id, function ($query) use ($request) {
|
||||||
|
$query->where('employee_id', $request->employee_id);
|
||||||
|
})
|
||||||
|
->when($request->month, function ($query) use ($request) {
|
||||||
|
$month = strtolower($request->month);
|
||||||
|
$query->whereRaw("LOWER(month) = ?", [$month]);
|
||||||
|
})
|
||||||
|
->latest()->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $leaves,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Leave::with(['employee:id,name', 'branch:id,name', 'leave_type:id,name', 'department:id,name'])->where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|exists:employees,id',
|
||||||
|
'leave_type_id' => 'required|exists:leave_types,id',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date|after_or_equal:start_date',
|
||||||
|
'leave_duration' => 'required|numeric|min:0.5',
|
||||||
|
'month' => 'required|string',
|
||||||
|
'status' => 'required|in:pending,approved,rejected',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$employee = Employee::where('business_id', auth()->user()->business_id)->findOrFail($request->employee_id);
|
||||||
|
|
||||||
|
$data = Leave::create($request->except(['business_id', 'department_id']) + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'department_id' => $employee->department_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, string $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|exists:employees,id',
|
||||||
|
'leave_type_id' => 'required|exists:leave_types,id',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date|after_or_equal:start_date',
|
||||||
|
'leave_duration' => 'required|numeric|min:0.5',
|
||||||
|
'month' => 'required|string',
|
||||||
|
'status' => 'required|in:pending,approved,rejected',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$leave = Leave::find($id);
|
||||||
|
|
||||||
|
if (!$leave) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$employee = Employee::where('business_id', auth()->user()->business_id)->findOrFail($request->employee_id);
|
||||||
|
|
||||||
|
$leave->update($request->except('business_id','department_id') + [
|
||||||
|
'department_id' => $employee->department_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data update successfully.'),
|
||||||
|
'data' => $leave,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(string $id)
|
||||||
|
{
|
||||||
|
$leave = Leave::find($id);
|
||||||
|
|
||||||
|
if (!$leave) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$leave->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data deleted successfully.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Leave;
|
||||||
|
|
||||||
|
class LeaveReportController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$data = Leave::with(['employee:id,name', 'branch:id,name', 'leave_type:id,name', 'department:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->employee_id, function ($query) use ($request) {
|
||||||
|
$query->where('employee_id', $request->employee_id);
|
||||||
|
})
|
||||||
|
->when($request->month, function ($query) use ($request) {
|
||||||
|
$month = strtolower($request->month);
|
||||||
|
$query->whereRaw("LOWER(month) = ?", [$month]);
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\LeaveType;
|
||||||
|
|
||||||
|
class LeaveTypeController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$types = LeaveType::where('business_id', auth()->user()->business_id)->when(request('search'), function ($query) {
|
||||||
|
$query->where('name', 'like', '%' . request('search') . '%')
|
||||||
|
->orwhere('description', 'like', '%' . request('search') . '%');
|
||||||
|
})->latest()->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $types,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = LeaveType::where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
'status' => 'nullable|boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = LeaveType::create($request->except('business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, string $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'description' => 'nullable|string',
|
||||||
|
'status' => 'nullable|boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$leaveType = LeaveType::where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
$leaveType->update($request->except('business_id'));
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data update successfully.'),
|
||||||
|
'data' => $leaveType,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(string $id)
|
||||||
|
{
|
||||||
|
$leaveType = LeaveType::where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
if (!$leaveType) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$leaveType->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data deleted successfully.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
137
Modules/HrmAddon/App/Http/Controllers/Api/PayrollController.php
Normal file
137
Modules/HrmAddon/App/Http/Controllers/Api/PayrollController.php
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Events\MultiPaymentProcessed;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Payroll;
|
||||||
|
use Modules\HrmAddon\App\Models\Employee;
|
||||||
|
|
||||||
|
class PayrollController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$payrolls = Payroll::with(['employee:id,name', 'branch:id,name', 'transactions:id,platform,transaction_type,amount,date,invoice_no,reference_id,payment_type_id,meta', 'transactions.paymentType:id,name'])->where('business_id', auth()->user()->business_id)->latest()->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $payrolls,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Payroll::with(['employee:id,name', 'branch:id,name', 'transactions:id,platform,transaction_type,amount,date,invoice_no,reference_id,payment_type_id,meta', 'transactions.paymentType:id,name'])->where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|integer|exists:employees,id',
|
||||||
|
'month' => 'required|string',
|
||||||
|
'date' => 'nullable|date',
|
||||||
|
'note' => 'nullable|string',
|
||||||
|
'payemnt_year' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$exists = Payroll::where('employee_id', $request->employee_id)
|
||||||
|
->where('month', $request->month)
|
||||||
|
->where('payemnt_year', $request->payemnt_year)
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($exists) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('This employee has already been paid for this month and year.'),
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$employee = Employee::where('business_id', auth()->user()->business_id)->findOrFail($request->employee_id);
|
||||||
|
|
||||||
|
$data = Payroll::create($request->except(['business_id', 'amount']) + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'amount' => $employee->amount,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Handle payments
|
||||||
|
$payments = collect($request->payments ?? [])->map(function ($payment) use ($employee) {
|
||||||
|
$payment['amount'] = $employee->amount;
|
||||||
|
return $payment;
|
||||||
|
})->toArray();
|
||||||
|
|
||||||
|
// Trigger multipayment event
|
||||||
|
event(new MultiPaymentProcessed(
|
||||||
|
$payments,
|
||||||
|
$data->id,
|
||||||
|
'payroll',
|
||||||
|
$employee->amount ?? 0,
|
||||||
|
));
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, string $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'employee_id' => 'required|integer|exists:employees,id',
|
||||||
|
'date' => 'nullable|date',
|
||||||
|
'month' => 'required|string',
|
||||||
|
'note' => 'nullable|string',
|
||||||
|
'payemnt_year' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$Payroll = Payroll::find($id);
|
||||||
|
|
||||||
|
if (!$Payroll) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$exists = Payroll::where('employee_id', $request->employee_id)
|
||||||
|
->where('month', $request->month)
|
||||||
|
->where('payemnt_year', $request->payemnt_year)
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->where('id', '!=', $id)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($exists) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('This employee has already been paid for this month and year.'),
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$Payroll->update($request->except(['business_id', 'amount']));
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data update successfully.'),
|
||||||
|
'data' => $Payroll,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(string $id)
|
||||||
|
{
|
||||||
|
$Payroll = Payroll::where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
if (!$Payroll) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$Payroll->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data deleted successfully.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Modules\HrmAddon\App\Models\Payroll;
|
||||||
|
|
||||||
|
class PayrollReportController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$data = Payroll::with(['employee:id,name', 'payment_type:id,name', 'branch:id,name'])
|
||||||
|
->where('business_id', auth()->user()->business_id)
|
||||||
|
->when($request->employee_id, function ($query) use ($request) {
|
||||||
|
$query->where('employee_id', $request->employee_id);
|
||||||
|
})
|
||||||
|
->when($request->filled('month'), function ($query) use ($request) {
|
||||||
|
$search = $request->month;
|
||||||
|
$query->where('month', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->latest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
150
Modules/HrmAddon/App/Http/Controllers/Api/ShiftController.php
Normal file
150
Modules/HrmAddon/App/Http/Controllers/Api/ShiftController.php
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\HrmAddon\App\Models\Shift;
|
||||||
|
|
||||||
|
class ShiftController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data = Shift::where('business_id', auth()->user()->business_id)
|
||||||
|
->when(request('status'), function ($query) {
|
||||||
|
$query->where('status', request('status') == 'active' ? 1 : 0);
|
||||||
|
})
|
||||||
|
->latest()->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|in:Morning,Day,Evening,Night',
|
||||||
|
'start_time' => 'required|date_format:H:i',
|
||||||
|
'end_time' => 'required|date_format:H:i',
|
||||||
|
'start_break_time' => 'nullable|date_format:H:i',
|
||||||
|
'end_break_time' => 'nullable|date_format:H:i',
|
||||||
|
'break_status' => 'nullable|in:yes,no',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->start_break_time && $request->end_break_time) {
|
||||||
|
$startTime = Carbon::parse($request->input('start_break_time'));
|
||||||
|
$endTime = Carbon::parse($request->input('end_break_time'));
|
||||||
|
|
||||||
|
$hoursDiff = $endTime->diffInHours($startTime);
|
||||||
|
$minutesDiff = $endTime->diffInMinutes($startTime) % 60;
|
||||||
|
|
||||||
|
$breakTime = sprintf('%02d:%02d', $hoursDiff, $minutesDiff);
|
||||||
|
} else {
|
||||||
|
$breakTime = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = Shift::create($request->except('break_time', 'business_id') + [
|
||||||
|
'business_id' => auth()->user()->business_id,
|
||||||
|
'break_time' => $breakTime,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Shift::where('business_id', auth()->user()->business_id)->findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data fetched successfully.'),
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$shift = Shift::where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
if (!$shift) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|in:Morning,Day,Evening,Night',
|
||||||
|
'start_time' => 'required|date_format:H:i',
|
||||||
|
'end_time' => 'required|date_format:H:i',
|
||||||
|
'start_break_time' => 'nullable|date_format:H:i',
|
||||||
|
'end_break_time' => 'nullable|date_format:H:i',
|
||||||
|
'break_status' => 'nullable|in:yes,no',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->start_break_time && $request->end_break_time) {
|
||||||
|
$startTime = Carbon::parse($request->input('start_break_time'));
|
||||||
|
$endTime = Carbon::parse($request->input('end_break_time'));
|
||||||
|
|
||||||
|
$hoursDiff = $endTime->diffInHours($startTime);
|
||||||
|
$minutesDiff = $endTime->diffInMinutes($startTime) % 60;
|
||||||
|
|
||||||
|
$breakTime = sprintf('%02d:%02d', $hoursDiff, $minutesDiff);
|
||||||
|
} else {
|
||||||
|
$breakTime = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$shift->update($request->except('break_time', 'business_id') + [
|
||||||
|
'break_time' => $breakTime,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data saved successfully.'),
|
||||||
|
'data' => $shift,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$shift = Shift::where('business_id', auth()->user()->business_id)
|
||||||
|
->find($id);
|
||||||
|
|
||||||
|
if (!$shift) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data not found.'),
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$shift->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Data deleted successfully.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function status(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'status' => 'required|boolean'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$shift = Shift::where('business_id', auth()->user()->business_id)->find($id);
|
||||||
|
|
||||||
|
if (!$shift) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Shift not found.'
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$shift->update(['status' => $request->status]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Shift status updated successfully.',
|
||||||
|
'data' => $shift
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
69
Modules/HrmAddon/App/Models/Attendance.php
Normal file
69
Modules/HrmAddon/App/Models/Attendance.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Models;
|
||||||
|
|
||||||
|
use App\Models\Branch;
|
||||||
|
use App\Models\Scopes\BranchScope;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Attendance extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'business_id',
|
||||||
|
'branch_id',
|
||||||
|
'employee_id',
|
||||||
|
'shift_id',
|
||||||
|
'time_in',
|
||||||
|
'time_out',
|
||||||
|
'date',
|
||||||
|
'duration',
|
||||||
|
'month',
|
||||||
|
'note',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function branch(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Branch::class)->withTrashed();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::addGlobalScope(new BranchScope);
|
||||||
|
|
||||||
|
if (auth()->check() && auth()->user()->accessToMultiBranch()) {
|
||||||
|
static::addGlobalScope('withBranch', function ($builder) {
|
||||||
|
$builder->with('branch:id,name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::creating(function ($model) {
|
||||||
|
$model->branch_id = auth()->user()->branch_id ?? auth()->user()->active_branch_id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function employee()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Employee::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function shift()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Shift::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'business_id' => 'integer',
|
||||||
|
'branch_id' => 'integer',
|
||||||
|
'employee_id' => 'integer',
|
||||||
|
'shift_id' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
18
Modules/HrmAddon/App/Models/Department.php
Normal file
18
Modules/HrmAddon/App/Models/Department.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Department extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = ['business_id', 'name', 'description', 'status'];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'business_id' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
21
Modules/HrmAddon/App/Models/Designation.php
Normal file
21
Modules/HrmAddon/App/Models/Designation.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Designation extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = ['business_id', 'name', 'description', 'status'];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'business_id' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
84
Modules/HrmAddon/App/Models/Employee.php
Normal file
84
Modules/HrmAddon/App/Models/Employee.php
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Models;
|
||||||
|
|
||||||
|
use App\Models\Branch;
|
||||||
|
use App\Models\Scopes\BranchScope;
|
||||||
|
use App\Traits\ImageUrlTrait;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class Employee extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, ImageUrlTrait;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'business_id',
|
||||||
|
'branch_id',
|
||||||
|
'designation_id',
|
||||||
|
'department_id',
|
||||||
|
'shift_id',
|
||||||
|
'phone',
|
||||||
|
'amount',
|
||||||
|
'email',
|
||||||
|
'gender',
|
||||||
|
'country',
|
||||||
|
'birth_date',
|
||||||
|
'join_date',
|
||||||
|
'image',
|
||||||
|
'status',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function branch(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Branch::class)->withTrashed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::creating(function ($model) {
|
||||||
|
$model->branch_id = auth()->user()->branch_id ?? auth()->user()->active_branch_id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::addGlobalScope(new BranchScope);
|
||||||
|
|
||||||
|
if (auth()->check() && auth()->user()->accessToMultiBranch()) {
|
||||||
|
static::addGlobalScope('withBranch', function ($builder) {
|
||||||
|
$builder->with('branch:id,name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function department()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Department::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function designation()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Designation::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function shift()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Shift::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'business_id' => 'integer',
|
||||||
|
'designation_id' => 'integer',
|
||||||
|
'department_id' => 'integer',
|
||||||
|
'shift_id' => 'integer',
|
||||||
|
'amount' => 'double',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $imageFields = ['image'];
|
||||||
|
|
||||||
|
}
|
||||||
41
Modules/HrmAddon/App/Models/Holiday.php
Normal file
41
Modules/HrmAddon/App/Models/Holiday.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Models;
|
||||||
|
|
||||||
|
use App\Models\Branch;
|
||||||
|
use App\Models\Scopes\BranchScope;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Holiday extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = ['name', 'business_id', 'branch_id', 'description', 'start_date', 'end_date'];
|
||||||
|
|
||||||
|
public function branch(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Branch::class)->withTrashed();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::addGlobalScope(new BranchScope);
|
||||||
|
|
||||||
|
if (auth()->check() && auth()->user()->accessToMultiBranch()) {
|
||||||
|
static::addGlobalScope('withBranch', function ($builder) {
|
||||||
|
$builder->with('branch:id,name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::creating(function ($model) {
|
||||||
|
$model->branch_id = auth()->user()->branch_id ?? auth()->user()->active_branch_id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
56
Modules/HrmAddon/App/Models/Leave.php
Normal file
56
Modules/HrmAddon/App/Models/Leave.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Models;
|
||||||
|
|
||||||
|
use App\Models\Branch;
|
||||||
|
use App\Models\Scopes\BranchScope;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Leave extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = ['business_id', 'branch_id', 'employee_id', 'leave_type_id', 'department_id', 'start_date', 'end_date', 'leave_duration', 'month', 'status', 'description'];
|
||||||
|
|
||||||
|
public function branch(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Branch::class)->withTrashed();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::addGlobalScope(new BranchScope);
|
||||||
|
|
||||||
|
if (auth()->check() && auth()->user()->accessToMultiBranch()) {
|
||||||
|
static::addGlobalScope('withBranch', function ($builder) {
|
||||||
|
$builder->with('branch:id,name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::creating(function ($model) {
|
||||||
|
$model->branch_id = auth()->user()->branch_id ?? auth()->user()->active_branch_id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function employee()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Employee::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function leave_type()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(LeaveType::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function department()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Department::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Modules/HrmAddon/App/Models/LeaveType.php
Normal file
13
Modules/HrmAddon/App/Models/LeaveType.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class LeaveType extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = ['name', 'description', 'status', 'business_id'];
|
||||||
|
}
|
||||||
71
Modules/HrmAddon/App/Models/Payroll.php
Normal file
71
Modules/HrmAddon/App/Models/Payroll.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Models;
|
||||||
|
|
||||||
|
use App\Models\Branch;
|
||||||
|
use App\Models\PaymentType;
|
||||||
|
use App\Models\Scopes\BranchScope;
|
||||||
|
use App\Models\Transaction;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Payroll extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'business_id',
|
||||||
|
'branch_id',
|
||||||
|
'employee_id',
|
||||||
|
'payment_type_id',
|
||||||
|
'month',
|
||||||
|
'date',
|
||||||
|
'note',
|
||||||
|
'amount',
|
||||||
|
'payemnt_year',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function branch(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Branch::class)->withTrashed();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::addGlobalScope(new BranchScope);
|
||||||
|
|
||||||
|
if (auth()->check() && auth()->user()->accessToMultiBranch()) {
|
||||||
|
static::addGlobalScope('withBranch', function ($builder) {
|
||||||
|
$builder->with('branch:id,name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function employee()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Employee::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function payment_type()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(PaymentType::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function transactions()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Transaction::class, 'reference_id')
|
||||||
|
->where('platform', 'payroll');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::creating(function ($model) {
|
||||||
|
$id = Payroll::where('business_id', auth()->user()->business_id)->count() + 1;
|
||||||
|
$model->puid = 'Ps_' . str_pad($id, 4, '0', STR_PAD_LEFT);
|
||||||
|
$model->branch_id = auth()->user()->branch_id ?? auth()->user()->active_branch_id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Modules/HrmAddon/App/Models/Shift.php
Normal file
21
Modules/HrmAddon/App/Models/Shift.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Shift extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = ['name', 'business_id', 'start_time', 'end_time', 'start_break_time','end_break_time', 'status', 'break_time', 'break_status'];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'business_id' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
0
Modules/HrmAddon/App/Providers/.gitkeep
Normal file
0
Modules/HrmAddon/App/Providers/.gitkeep
Normal file
111
Modules/HrmAddon/App/Providers/HrmAddonServiceProvider.php
Normal file
111
Modules/HrmAddon/App/Providers/HrmAddonServiceProvider.php
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Blade;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class HrmAddonServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
protected string $moduleName = 'HrmAddon';
|
||||||
|
|
||||||
|
protected string $moduleNameLower = 'hrmaddon';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boot the application events.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
$this->registerCommands();
|
||||||
|
$this->registerCommandSchedules();
|
||||||
|
$this->registerTranslations();
|
||||||
|
$this->registerConfig();
|
||||||
|
$this->registerViews();
|
||||||
|
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->app->register(RouteServiceProvider::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register commands in the format of Command::class
|
||||||
|
*/
|
||||||
|
protected function registerCommands(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register command Schedules.
|
||||||
|
*/
|
||||||
|
protected function registerCommandSchedules(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register translations.
|
||||||
|
*/
|
||||||
|
public function registerTranslations(): void
|
||||||
|
{
|
||||||
|
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
||||||
|
|
||||||
|
if (is_dir($langPath)) {
|
||||||
|
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||||
|
$this->loadJsonTranslationsFrom($langPath);
|
||||||
|
} else {
|
||||||
|
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||||
|
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register config.
|
||||||
|
*/
|
||||||
|
protected function registerConfig(): void
|
||||||
|
{
|
||||||
|
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||||
|
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register views.
|
||||||
|
*/
|
||||||
|
public function registerViews(): void
|
||||||
|
{
|
||||||
|
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||||
|
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||||
|
|
||||||
|
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||||
|
|
||||||
|
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||||
|
|
||||||
|
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path'));
|
||||||
|
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the services provided by the provider.
|
||||||
|
*/
|
||||||
|
public function provides(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPublishableViewPaths(): array
|
||||||
|
{
|
||||||
|
$paths = [];
|
||||||
|
foreach (config('view.paths') as $path) {
|
||||||
|
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
|
||||||
|
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
59
Modules/HrmAddon/App/Providers/RouteServiceProvider.php
Normal file
59
Modules/HrmAddon/App/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The module namespace to assume when generating URLs to actions.
|
||||||
|
*/
|
||||||
|
protected string $moduleNamespace = 'Modules\HrmAddon\App\Http\Controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before routes are registered.
|
||||||
|
*
|
||||||
|
* Register any model bindings or pattern based filters.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the routes for the application.
|
||||||
|
*/
|
||||||
|
public function map(): void
|
||||||
|
{
|
||||||
|
$this->mapApiRoutes();
|
||||||
|
|
||||||
|
$this->mapWebRoutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "web" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes all receive session state, CSRF protection, etc.
|
||||||
|
*/
|
||||||
|
protected function mapWebRoutes(): void
|
||||||
|
{
|
||||||
|
Route::middleware('web')
|
||||||
|
->namespace($this->moduleNamespace)
|
||||||
|
->group(module_path('HrmAddon', '/routes/web.php'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "api" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes are typically stateless.
|
||||||
|
*/
|
||||||
|
protected function mapApiRoutes(): void
|
||||||
|
{
|
||||||
|
Route::prefix('api')
|
||||||
|
->middleware('api')
|
||||||
|
->namespace($this->moduleNamespace)
|
||||||
|
->group(module_path('HrmAddon', '/routes/api.php'));
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/HrmAddon/Database/Seeders/.gitkeep
Normal file
0
Modules/HrmAddon/Database/Seeders/.gitkeep
Normal file
16
Modules/HrmAddon/Database/Seeders/HrmAddonDatabaseSeeder.php
Normal file
16
Modules/HrmAddon/Database/Seeders/HrmAddonDatabaseSeeder.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HrmAddon\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class HrmAddonDatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('departments', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->string('name')->nullable();
|
||||||
|
$table->text('description')->nullable();
|
||||||
|
$table->boolean('status')->default(1);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('departments');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('designations', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name')->nullable();
|
||||||
|
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->text('description')->nullable();
|
||||||
|
$table->boolean('status')->default(1);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('designations');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('shifts', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->time('start_time');
|
||||||
|
$table->time('end_time');
|
||||||
|
$table->time('start_break_time')->nullable();
|
||||||
|
$table->time('end_break_time')->nullable();
|
||||||
|
$table->time('break_time')->nullable();
|
||||||
|
$table->string('break_status')->nullable();
|
||||||
|
$table->boolean('status')->default(1);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('shifts');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('employees', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->foreignId('designation_id')->nullable()->constrained()->nullOnDelete();
|
||||||
|
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete();
|
||||||
|
$table->foreignId('shift_id')->nullable()->constrained()->nullOnDelete();
|
||||||
|
$table->double('amount', 10, 2)->default(0);
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->string('phone');
|
||||||
|
$table->string('email')->nullable();
|
||||||
|
$table->string('gender');
|
||||||
|
$table->string('country')->nullable();
|
||||||
|
$table->date('birth_date')->nullable();
|
||||||
|
$table->date('join_date')->nullable();
|
||||||
|
$table->string('status')->default('active'); // active || terminated || suspended
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('employees');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('leave_types', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('description')->nullable();
|
||||||
|
$table->boolean('status')->default(1);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('leave_types');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('leaves', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->foreignId('leave_type_id')->nullable()->constrained()->nullOnDelete();
|
||||||
|
$table->foreignId('department_id')->nullable()->constrained()->nullOnDelete();
|
||||||
|
$table->date('start_date');
|
||||||
|
$table->date('end_date');
|
||||||
|
$table->double('leave_duration');
|
||||||
|
$table->string('month');
|
||||||
|
$table->string('status')->default('pending'); // rejected, pending, approved
|
||||||
|
$table->text('description')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('leaves');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('holidays', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->string('name');
|
||||||
|
$table->date('start_date');
|
||||||
|
$table->date('end_date');
|
||||||
|
$table->text('description')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('holidays');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('attendances', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->foreignId('shift_id')->nullable()->constrained()->nullOnDelete();
|
||||||
|
$table->time('time_in');
|
||||||
|
$table->time('time_out');
|
||||||
|
$table->date('date');
|
||||||
|
$table->time('duration');
|
||||||
|
$table->string('month');
|
||||||
|
$table->longText('note')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('attendances');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('payrolls', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->foreignId('employee_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->foreignId('payment_type_id')->nullable()->constrained()->nullOnDelete();
|
||||||
|
$table->string('month');
|
||||||
|
$table->string('puid');
|
||||||
|
$table->date('date')->nullable();
|
||||||
|
$table->double('amount', 10, 2);
|
||||||
|
$table->string('payemnt_year');
|
||||||
|
$table->longText('note')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('payrolls');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
// HOLIDAYS, ATTENDANCES, LEAVES, PAYROLLS, employees
|
||||||
|
foreach (['holidays', 'attendances', 'leaves', 'payrolls', 'employees'] as $tableName) {
|
||||||
|
Schema::table($tableName, function (Blueprint $table) {
|
||||||
|
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// 'holidays', 'attendances', 'leaves', 'payrolls', 'employees'
|
||||||
|
foreach (['holidays', 'attendances', 'leaves', 'payrolls', 'employees'] as $tableName) {
|
||||||
|
Schema::table($tableName, function (Blueprint $table) {
|
||||||
|
$table->dropColumn('branch_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
31
Modules/HrmAddon/composer.json
Normal file
31
Modules/HrmAddon/composer.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"name": "nwidart/hrmaddon",
|
||||||
|
"description": "",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Widart",
|
||||||
|
"email": "n.widart@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [],
|
||||||
|
"aliases": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\HrmAddon\\": "",
|
||||||
|
"Modules\\HrmAddon\\App\\": "app/",
|
||||||
|
"Modules\\HrmAddon\\Database\\Factories\\": "database/factories/",
|
||||||
|
"Modules\\HrmAddon\\Database\\Seeders\\": "database/seeders/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\HrmAddon\\Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/HrmAddon/config/.gitkeep
Normal file
0
Modules/HrmAddon/config/.gitkeep
Normal file
5
Modules/HrmAddon/config/config.php
Normal file
5
Modules/HrmAddon/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => 'HrmAddon',
|
||||||
|
];
|
||||||
10
Modules/HrmAddon/module.json
Normal file
10
Modules/HrmAddon/module.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "HrmAddon",
|
||||||
|
"alias": "hrmaddon",
|
||||||
|
"version": "1.4",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"priority": 0,
|
||||||
|
"providers": ["Modules\\HrmAddon\\App\\Providers\\HrmAddonServiceProvider"],
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
15
Modules/HrmAddon/package.json
Normal file
15
Modules/HrmAddon/package.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"axios": "^1.1.2",
|
||||||
|
"laravel-vite-plugin": "^0.7.5",
|
||||||
|
"sass": "^1.69.5",
|
||||||
|
"postcss": "^8.3.7",
|
||||||
|
"vite": "^4.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/HrmAddon/resources/assets/js/app.js
Normal file
0
Modules/HrmAddon/resources/assets/js/app.js
Normal file
0
Modules/HrmAddon/resources/assets/sass/app.scss
Normal file
0
Modules/HrmAddon/resources/assets/sass/app.scss
Normal file
0
Modules/HrmAddon/resources/views/.gitkeep
Normal file
0
Modules/HrmAddon/resources/views/.gitkeep
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
<div class="modal fade common-validation-modal" id="attendances-create-modal">
|
||||||
|
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Create Attendance') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="{{ route('hrm.attendances.store') }}" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Employee') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="employee_id" required class="form-control get-employee-shift">
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<option value="{{ $employee->id }}">{{ $employee->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Shift') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="shift_id" required class="form-control shift-select" @readonly(true)>
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
{{-- Options will be populated via JS --}}
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{__('Date')}}</label>
|
||||||
|
<input type="date" name="date" required value="{{ date('Y-m-d') }}" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Time In') }}</label>
|
||||||
|
<input type="time" name="time_in" required value="{{ date('H:i') }}" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Time Out') }}</label>
|
||||||
|
<input type="time" name="time_out" required value="{{ date('H:i') }}" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{__('Note')}}</label>
|
||||||
|
<textarea name="note" class="form-control" placeholder="{{ __('Enter note') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('attendances.create')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" value="{{ route('hrm.attendances.getShift') }}" id="get-shift">
|
||||||
|
|
||||||
79
Modules/HrmAddon/resources/views/attendances/datas.blade.php
Normal file
79
Modules/HrmAddon/resources/views/attendances/datas.blade.php
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<div class="responsive-table m-0">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@usercan('attendances.delete')
|
||||||
|
<th class="w-60">
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<input type="checkbox" class="select-all-delete multi-delete">
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
@endusercan
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Employee') }}</th>
|
||||||
|
<th class="text-start">{{ __('Month') }}</th>
|
||||||
|
<th class="text-start">{{ __('Shift') }}</th>
|
||||||
|
<th class="text-start">{{ __('date') }}</th>
|
||||||
|
<th class="text-start">{{ __('Time In') }}</th>
|
||||||
|
<th class="text-start">{{ __('Time Out') }}</th>
|
||||||
|
<th class="text-start">{{ __('Duration') }}</th>
|
||||||
|
<th>{{ __('Action') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($attendances as $attendance)
|
||||||
|
<tr>
|
||||||
|
@usercan('attendances.delete')
|
||||||
|
<td class="w-60 checkbox">
|
||||||
|
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete" value="{{ $attendance->id }}">
|
||||||
|
</td>
|
||||||
|
@endusercan
|
||||||
|
<td>{{ ($attendances->currentPage() - 1) * $attendances->perPage() + $loop->iteration }}</td>
|
||||||
|
|
||||||
|
<td class="text-start">{{ $attendance->employee->name ?? '' }}</td>
|
||||||
|
<td class="text-start">{{ ucfirst($attendance->month ?? '') }}</td>
|
||||||
|
<td class="text-start">{{ $attendance->shift->name ?? '' }}</td>
|
||||||
|
<td class="text-start">{{ formatted_date($attendance->date) }}</td>
|
||||||
|
<td class="text-start">{{ formatted_time($attendance->time_in) }}</td>
|
||||||
|
<td class="text-start">{{ formatted_time($attendance->time_out) }}</td>
|
||||||
|
<td class="text-start">{{ formatTimeToWords($attendance->duration) }}</td>
|
||||||
|
<td class="print-d-none">
|
||||||
|
<div class="dropdown table-action">
|
||||||
|
<button type="button" data-bs-toggle="dropdown">
|
||||||
|
<i class="far fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
@usercan('attendances.update')
|
||||||
|
<li>
|
||||||
|
<a href="#attendances-edit-modal" data-bs-toggle="modal"
|
||||||
|
class="attendances-edit-btn"
|
||||||
|
data-url="{{ route('hrm.attendances.update', $attendance->id) }}"
|
||||||
|
data-employee-id="{{ $attendance->employee_id }}"
|
||||||
|
data-month="{{ $attendance->month }}" data-date="{{ $attendance->date }}"
|
||||||
|
data-time-in="{{ $attendance->time_in }}"
|
||||||
|
data-time-out="{{ $attendance->time_out }}"
|
||||||
|
data-note="{{ $attendance->note }}">
|
||||||
|
<i class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
@usercan('attendances.delete')
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('hrm.attendances.destroy', $attendance->id) }}"
|
||||||
|
class="confirm-action" data-method="DELETE">
|
||||||
|
<i class="fal fa-trash-alt"></i>
|
||||||
|
{{ __('Delete') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ $attendances->links('vendor.pagination.bootstrap-5') }}
|
||||||
|
</div>
|
||||||
69
Modules/HrmAddon/resources/views/attendances/edit.blade.php
Normal file
69
Modules/HrmAddon/resources/views/attendances/edit.blade.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<div class="modal fade common-validation-modal editModal" id="attendances-edit-modal">
|
||||||
|
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Edit Attendance') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload editAttendanceForm">
|
||||||
|
@csrf
|
||||||
|
@method('put')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Employee') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="employee_id" id="employee_id" required class="form-control get-employee-shift">
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<option value="{{ $employee->id }}">{{ $employee->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Shift') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="shift_id" required class="form-control shift-select" @readonly(true)>
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
{{-- Options will be populated via JS --}}
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{__('Date')}}</label>
|
||||||
|
<input type="date" name="date" required value="{{ date('Y-m-d') }}" id="date" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Time In') }}</label>
|
||||||
|
<input type="time" name="time_in" value="{{ date('H:i') }}" id="time_in" required class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Time Out') }}</label>
|
||||||
|
<input type="time" name="time_out" value="{{ date('H:i') }}" id="time_out" required class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{__('Note')}}</label>
|
||||||
|
<textarea name="note" id="note" class="form-control" placeholder="{{ __('Enter note') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('attendances.update')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" value="{{ route('hrm.attendances.getShift') }}" id="get-shift">
|
||||||
94
Modules/HrmAddon/resources/views/attendances/index.blade.php
Normal file
94
Modules/HrmAddon/resources/views/attendances/index.blade.php
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Attendance List') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<div class="table-header p-16">
|
||||||
|
<h4>{{ __('Attendance List') }}</h4>
|
||||||
|
@usercan('attendances.create')
|
||||||
|
<a type="button" href="#attendances-create-modal" data-bs-toggle="modal" class="add-order-btn rounded-2"><i class="fas fa-plus-circle me-1"></i>{{ __('Add new Attendance') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
<div class="table-top-form p-16-0">
|
||||||
|
<div class="d-flex align-items-center gap-1 flex-wrap">
|
||||||
|
<form action="{{ route('hrm.attendances.index') }}" method="GET" class="filter-form" table="#attendances-data">
|
||||||
|
|
||||||
|
<div class="table-top-left d-flex gap-3 margin-l-16">
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="per_page" class="form-control">
|
||||||
|
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||||
|
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||||
|
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||||
|
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="table-search position-relative">
|
||||||
|
<input type="text" name="search" class="form-control" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||||
|
<span class="position-absolute">
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="gpt-up-down-arrow position-relative d-print-none employee-select ">
|
||||||
|
<select name="employee" class="form-control">
|
||||||
|
<option value="">{{ __('Select employee') }}</option>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<option value="{{ $employee->id }}" @selected(request('employee') == $employee->id) >{{ $employee->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="gpt-up-down-arrow position-relative d-print-none">
|
||||||
|
<select name="month" class="form-control">
|
||||||
|
<option value="">{{__('All month')}}</option>
|
||||||
|
@for ($month = 1; $month <= 12; $month++)
|
||||||
|
@php
|
||||||
|
$monthSlug = strtolower(date('F', mktime(0, 0, 0, $month, 1)));
|
||||||
|
@endphp
|
||||||
|
<option value="{{ $monthSlug }}">
|
||||||
|
{{ date('F', mktime(0, 0, 0, $month, 1)) }}
|
||||||
|
</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="delete-item delete-show d-none">
|
||||||
|
<div class="delete-item-show">
|
||||||
|
<p class="fw-bold"><span class="selected-count"></span> {{ __('items show') }}</p>
|
||||||
|
<button data-bs-toggle="modal" class="trigger-modal" data-bs-target="#multi-delete-modal" data-url="{{ route('hrm.attendances.delete-all') }}">{{ __('Delete') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="attendances-data">
|
||||||
|
@include('hrmaddon::attendances.datas')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('modal')
|
||||||
|
@include('hrmaddon::component.delete-modal')
|
||||||
|
@include('hrmaddon::attendances.create')
|
||||||
|
@include('hrmaddon::attendances.edit')
|
||||||
|
@endpush
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<div class="modal fade" id="multi-delete-modal" tabindex="-1" aria-labelledby="multi-delete-modal-label" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="text-end">
|
||||||
|
<button type="button" class="btn-close m-3 mb-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body pt-0">
|
||||||
|
<div class="delete-modal">
|
||||||
|
<h5>{{ __('Are You Sure?') }}</h5>
|
||||||
|
<p>{{ __("You want to delete everything!") }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="multiple-button-group">
|
||||||
|
<button class="btn reset-btn" data-bs-dismiss="modal">{{ __('Cancel') }}</button>
|
||||||
|
<form id="dynamic-delete-form" method="POST" class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
<button class="btn theme-btn submit-btn create-all-delete" type="submit">{{ __('Yes, Delete It!') }}</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
36
Modules/HrmAddon/resources/views/department/create.blade.php
Normal file
36
Modules/HrmAddon/resources/views/department/create.blade.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<div class="modal fade common-validation-modal" id="department-create-modal">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Create Department') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="{{ route('hrm.department.store') }}" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" required class="form-control" placeholder="{{ __('Enter Department Name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mt-1">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" class="form-control" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('department.create')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
74
Modules/HrmAddon/resources/views/department/datas.blade.php
Normal file
74
Modules/HrmAddon/resources/views/department/datas.blade.php
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<div class="responsive-table m-0">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@usercan('department.delete')
|
||||||
|
<th class="w-60">
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<input type="checkbox" class="select-all-delete multi-delete">
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
@endusercan
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Name') }}</th>
|
||||||
|
<th class="text-start">{{ __('Description') }}</th>
|
||||||
|
<th>{{ __('Status') }}</th>
|
||||||
|
<th>{{ __('Action') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($departments as $department)
|
||||||
|
<tr>
|
||||||
|
@usercan('department.delete')
|
||||||
|
<td class="w-60 checkbox">
|
||||||
|
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
||||||
|
value="{{ $department->id }}">
|
||||||
|
</td>
|
||||||
|
@endusercan
|
||||||
|
<td>{{ ($departments->currentPage() - 1) * $departments->perPage() + $loop->iteration }}</td>
|
||||||
|
|
||||||
|
<td class="text-start">{{ $department->name }}</td>
|
||||||
|
<td class="text-start">{{ Str::limit($department->description, 20, '...') }}</td>
|
||||||
|
<td>
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" {{ $department->status == 1 ? 'checked' : '' }} class="status"
|
||||||
|
data-url="{{ route('hrm.department.status', $department->id) }}">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td class="print-d-none">
|
||||||
|
<div class="dropdown table-action">
|
||||||
|
<button type="button" data-bs-toggle="dropdown">
|
||||||
|
<i class="far fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
@usercan('department.update')
|
||||||
|
<li>
|
||||||
|
<a href="#department-edit-modal" data-bs-toggle="modal" class="department-edit-btn"
|
||||||
|
data-url="{{ route('hrm.department.update', $department->id) }}"
|
||||||
|
data-department-name="{{ $department->name }}"
|
||||||
|
data-department-description="{{ $department->description }}">
|
||||||
|
<i class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
@usercan('department.delete')
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('hrm.department.destroy', $department->id) }}"
|
||||||
|
class="confirm-action" data-method="DELETE">
|
||||||
|
<i class="fal fa-trash-alt"></i>
|
||||||
|
{{ __('Delete') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ $departments->links('vendor.pagination.bootstrap-5') }}
|
||||||
|
</div>
|
||||||
37
Modules/HrmAddon/resources/views/department/edit.blade.php
Normal file
37
Modules/HrmAddon/resources/views/department/edit.blade.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<div class="modal fade common-validation-modal" id="department-edit-modal">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Edit Department') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload departmentUpdateForm">
|
||||||
|
@csrf
|
||||||
|
@method('put')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" id="department_view_name" required class="form-control" placeholder="{{ __('Enter Department Name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" id="department_view_description" class="form-control" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<a href="{{ route('hrm.department.index') }}" class="theme-btn border-btn m-2">{{ __('Cancel') }}</a>
|
||||||
|
@usercan('department.update')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
66
Modules/HrmAddon/resources/views/department/index.blade.php
Normal file
66
Modules/HrmAddon/resources/views/department/index.blade.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Department List') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<div class="table-header p-16">
|
||||||
|
<h4>{{ __('Department List') }}</h4>
|
||||||
|
@usercan('department.create')
|
||||||
|
<a type="button" href="#department-create-modal" data-bs-toggle="modal" class="add-order-btn rounded-2"><i class="fas fa-plus-circle me-1"></i>{{ __('Add Department') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-top-form p-16-0">
|
||||||
|
<form action="{{ route('hrm.department.index') }}" method="GET" class="filter-form" table="#department-data">
|
||||||
|
|
||||||
|
<div class="table-top-left d-flex gap-3 margin-l-16">
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="per_page" class="form-control">
|
||||||
|
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||||
|
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||||
|
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||||
|
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="table-search position-relative">
|
||||||
|
<input type="text" name="search" class="form-control" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||||
|
<span class="position-absolute">
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="delete-item delete-show d-none">
|
||||||
|
<div class="delete-item-show">
|
||||||
|
<p class="fw-bold"><span class="selected-count"></span> {{ __('items show') }}</p>
|
||||||
|
<button data-bs-toggle="modal" class="trigger-modal" data-bs-target="#multi-delete-modal" data-url="{{ route('hrm.department.delete-all') }}">{{ __('Delete') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="department-data">
|
||||||
|
@include('hrmaddon::department.datas')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('modal')
|
||||||
|
@include('hrmaddon::component.delete-modal')
|
||||||
|
@include('hrmaddon::department.create')
|
||||||
|
@include('hrmaddon::department.edit')
|
||||||
|
@endpush
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<div class="modal fade common-validation-modal" id="designations-create-modal">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Create Designation') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="{{ route('hrm.designations.store') }}" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" required class="form-control" placeholder="{{ __('Enter Designation Name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mt-1">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" class="form-control" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('designations.create')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<div class="responsive-table m-0">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@usercan('designations.delete')
|
||||||
|
<th class="w-60">
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<input type="checkbox" class="select-all-delete multi-delete">
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
@endusercan
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Name') }}</th>
|
||||||
|
<th class="text-start">{{ __('Description') }}</th>
|
||||||
|
<th>{{ __('Status') }}</th>
|
||||||
|
<th>{{ __('Action') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($designations as $designation)
|
||||||
|
<tr>
|
||||||
|
@usercan('designations.delete')
|
||||||
|
<td class="w-60 checkbox">
|
||||||
|
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
||||||
|
value="{{ $designation->id }}">
|
||||||
|
</td>
|
||||||
|
@endusercan
|
||||||
|
<td>{{ ($designations->currentPage() - 1) * $designations->perPage() + $loop->iteration }}</td>
|
||||||
|
|
||||||
|
<td class="text-start">{{ $designation->name }}</td>
|
||||||
|
<td class="text-start">{{ Str::limit($designation->description, 20, '...') }}</td>
|
||||||
|
<td>
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" {{ $designation->status == 1 ? 'checked' : '' }} class="status"
|
||||||
|
data-url="{{ route('hrm.designations.status', $designation->id) }}">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td class="print-d-none">
|
||||||
|
<div class="dropdown table-action">
|
||||||
|
<button type="button" data-bs-toggle="dropdown">
|
||||||
|
<i class="far fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
@usercan('designations.read')
|
||||||
|
<li>
|
||||||
|
<a href="#designations-edit-modal" data-bs-toggle="modal"
|
||||||
|
class="designations-edit-btn"
|
||||||
|
data-url="{{ route('hrm.designations.update', $designation->id) }}"
|
||||||
|
data-designations-name="{{ $designation->name }}"
|
||||||
|
data-designations-description="{{ $designation->description }}">
|
||||||
|
<i class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
@usercan('designations.delete')
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('hrm.designations.destroy', $designation->id) }}"
|
||||||
|
class="confirm-action" data-method="DELETE">
|
||||||
|
<i class="fal fa-trash-alt"></i>
|
||||||
|
{{ __('Delete') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ $designations->links('vendor.pagination.bootstrap-5') }}
|
||||||
|
</div>
|
||||||
37
Modules/HrmAddon/resources/views/designations/edit.blade.php
Normal file
37
Modules/HrmAddon/resources/views/designations/edit.blade.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<div class="modal fade common-validation-modal" id="designations-edit-modal">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Edit Designation') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload designationUpdateForm">
|
||||||
|
@csrf
|
||||||
|
@method('put')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" id="designations_view_name" required class="form-control" placeholder="{{ __('Enter Designation Name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" id="designations_view_description" class="form-control" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<a href="{{ route('hrm.designations.index') }}" class="theme-btn border-btn m-2">{{ __('Cancel') }}</a>
|
||||||
|
@usercan('designations.update')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Designation List') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<div class="table-header p-16">
|
||||||
|
<h4>{{ __('Designation List') }}</h4>
|
||||||
|
@usercan('designations.create')
|
||||||
|
<a type="button" href="#designations-create-modal" data-bs-toggle="modal" class="add-order-btn rounded-2"><i class="fas fa-plus-circle me-1"></i>{{ __('Add Designation') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-top-form p-16-0">
|
||||||
|
<form action="{{ route('hrm.designations.index') }}" method="GET" class="filter-form" table="#designations-data">
|
||||||
|
|
||||||
|
<div class="table-top-left d-flex gap-3 margin-l-16">
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="per_page" class="form-control">
|
||||||
|
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||||
|
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||||
|
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||||
|
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="table-search position-relative">
|
||||||
|
<input type="text" name="search" class="form-control" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||||
|
<span class="position-absolute">
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="delete-item delete-show d-none">
|
||||||
|
<div class="delete-item-show">
|
||||||
|
<p class="fw-bold"><span class="selected-count"></span> {{ __('items show') }}</p>
|
||||||
|
<button data-bs-toggle="modal" class="trigger-modal" data-bs-target="#multi-delete-modal" data-url="{{ route('hrm.designations.delete-all') }}">{{ __('Delete') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="designations-data">
|
||||||
|
@include('hrmaddon::designations.datas')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('modal')
|
||||||
|
@include('hrmaddon::component.delete-modal')
|
||||||
|
@include('hrmaddon::designations.create')
|
||||||
|
@include('hrmaddon::designations.edit')
|
||||||
|
@endpush
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
<div class="modal fade" id="employees-import-modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered modal-xl">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<!-- Modal Header -->
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="exampleModalLabel">{{__('Bulk Upload')}}</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal Body -->
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="border-0">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<form action="{{ route('hrm.employees.bulk-store') }}" method="post" enctype="multipart/form-data" class="ajaxform">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div class="bulk-upload-container w-100">
|
||||||
|
<div class="d-flex justify-content-between align-items-center w-100">
|
||||||
|
<div class="bulk-input w-100">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="custom-upload-wrapper">
|
||||||
|
<div class="custom-file-box">
|
||||||
|
<div class="custom-file-content">
|
||||||
|
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M12 5V19M5 12H19" stroke="#4B5563" stroke-width="2.0" stroke-linecap="round"/>
|
||||||
|
</svg>
|
||||||
|
<span class="custom-upload-text">{{ __('Add File') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="preview-file d-none"></p>
|
||||||
|
<input type="file" name="file" class="preview-file-input" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex align-items-center justify-content-center gap-2 flex-wrap">
|
||||||
|
<button type="submit" class="add-order-btn process-csv-btn rounded-2 border-0 submit-btn mt-3">{{__('Submit')}}</button>
|
||||||
|
<a href="{{ asset('assets/employee-bulk-upload.xlsx') }}" download="employee-bulk-upload.xlsx" class="download-file-btn mt-3"><i class="fas fa-download"></i> {{__('Download Sample File')}}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bulk-upload-container mt-3">
|
||||||
|
<div class="instruction-header">
|
||||||
|
<h5>{{__('Instructions')}}</h5>
|
||||||
|
<div class="mt-3">
|
||||||
|
<h6><strong>{{__('Note')}}: </strong> {{__('Please follow the instructions below to upload your file.')}}</h6>
|
||||||
|
<ul>
|
||||||
|
<li><b>{{__('1.')}}</b> {{__('Download the sample file first and add all your purchases data to it.')}}</li>
|
||||||
|
<li><b>{{__('2.')}}</b> <span class="text-danger">*</span> {{__('Indicates a required field. If you do not provide the required fields, the system will ignore except party information.')}}</li>
|
||||||
|
<li><b>{{__('3.')}}</b> {{__('After adding all your data, please save the file and then upload the updated version.')}}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Fields Documentation Table --}}
|
||||||
|
<div class="responsive-table mt-4">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Field Name') }}</th>
|
||||||
|
<th class="text-start">{{ __('Description') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="business-category-data">
|
||||||
|
<tr>
|
||||||
|
<td>{{__('1.')}}</td>
|
||||||
|
<td class="text-start">{{__('Employee Name')}} <span class="text-danger fw-bold">*</span></td>
|
||||||
|
<td class="text-start">{{__('Enter the full name of the employee')}} ({{__('e.g.,')}} <b>{{__('James')}}</b>).</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{__('2.')}}</td>
|
||||||
|
<td class="text-start">{{__('Gender')}}<span class="text-danger fw-bold">*</span></td>
|
||||||
|
<td class="text-start">
|
||||||
|
{{__('Enter the gender of the employee')}} ({{__('e.g.,')}} <b>{{__('male, female, or other')}}</b>).
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{__('3.')}}</td>
|
||||||
|
<td class="text-start">{{__('Phone Number')}} <span class="text-danger fw-bold">*</span></td>
|
||||||
|
<td class="text-start">
|
||||||
|
{{__('Enter the employee’s valid phone number')}} ({{__('e.g.,')}} <b>{{__('01*******')}}</b>).
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{__('4.')}}</td>
|
||||||
|
<td class="text-start">{{__('Designation')}}</td>
|
||||||
|
<td class="text-start">
|
||||||
|
{{__('Enter the employee’s job title or position within the organization.')}} ({{__('e.g.,')}} <b>{{__('Ceo')}}</b>)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{__('5.')}}</td>
|
||||||
|
<td class="text-start">{{__('Department')}}</td>
|
||||||
|
<td class="text-start">
|
||||||
|
{{__('Enter the department where the employee works.')}} ({{__('e.g.,')}} <b>{{__('It')}}</b>)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{__('6.')}}</td>
|
||||||
|
<td class="text-start">{{__('Email')}}</td>
|
||||||
|
<td class="text-start">
|
||||||
|
{{__('Enter a valid and unique email address for the employee.')}} ({{__('e.g.,')}} <b>{{__('demo@gmail.com')}}</b>).
|
||||||
|
<br><small>{{__('Duplicate email addresses will be ignored during upload.')}}</small>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{__('7.')}}</td>
|
||||||
|
<td class="text-start">{{__('Birth Date')}}</td>
|
||||||
|
<td class="text-start">
|
||||||
|
{{__('Enter the employee’s date of birth.')}} ({{__('e.g.,')}} <b>{{__('01/01/2026')}}</b>)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{__('8.')}}</td>
|
||||||
|
<td class="text-start">{{__('Joining Date')}}</td>
|
||||||
|
<td class="text-start">
|
||||||
|
{{__('Enter the employee’s joining date.')}} ({{__('e.g.,')}} <b>{{__('01/01/2026')}}</b>)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{__('9.')}}</td>
|
||||||
|
<td class="text-start">{{__('Salary')}}</td>
|
||||||
|
<td class="text-start">{{__('Enter the employee’s salary amount.')}} ({{__('e.g.,')}} <b>{{__('500')}}</b>)</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
160
Modules/HrmAddon/resources/views/employees/create.blade.php
Normal file
160
Modules/HrmAddon/resources/views/employees/create.blade.php
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Create Employee') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card border-0">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<div class="table-header p-16">
|
||||||
|
<h4>{{ __('Add new Employee') }}</h4>
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<a data-bs-toggle="modal" data-bs-target="#employees-import-modal" class="save-publish-btn" href="#">
|
||||||
|
{{__('Bulk Upload')}}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
@usercan('employees.read')
|
||||||
|
<a href="{{ route('hrm.employees.index') }}" class="add-order-btn rounded-2"><i class="far fa-list" aria-hidden="true"></i> {{ __('Employee List') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="order-form-section p-16">
|
||||||
|
<form action="{{ route('hrm.employees.store') }}" method="POST"
|
||||||
|
class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
<div class="add-suplier-modal-wrapper d-block">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" required class="form-control"
|
||||||
|
placeholder="{{ __('Enter employee name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Designation') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="designation_id" class="form-control table-select w-100 role" required>
|
||||||
|
<option value=""> {{ __('Select one') }}</option>
|
||||||
|
@foreach ($designations as $designation)
|
||||||
|
<option value="{{ $designation->id }}"> {{ ucfirst($designation->name) }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Department') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="department_id" class="form-control table-select w-100 role" required>
|
||||||
|
<option value=""> {{ __('Select one') }}</option>
|
||||||
|
@foreach ($departments as $department)
|
||||||
|
<option value="{{ $department->id }}"> {{ ucfirst($department->name) }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Shift') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="shift_id" class="form-control table-select w-100 role" required>
|
||||||
|
<option value=""> {{ __('Select one') }}</option>
|
||||||
|
@foreach ($shifts as $shift)
|
||||||
|
<option value="{{ $shift->id }}"> {{ ucfirst($shift->name) }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Gender') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="gender" class="form-control table-select w-100 role" required>
|
||||||
|
<option value=""> {{ __('Select one') }}</option>
|
||||||
|
<option value="male">{{ __('Male')}}</option>
|
||||||
|
<option value="female">{{ __('Female')}}</option>
|
||||||
|
<option value="others">{{ __('Others')}}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Birth Date') }}</label>
|
||||||
|
<input type="date" name="birth_date" value="{{ date('Y-m-d') }}" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Email') }}</label>
|
||||||
|
<input type="email" name="email" class="form-control" placeholder="{{ __('Enter email address') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Country') }}</label>
|
||||||
|
<input type="text" name="country" class="form-control" placeholder="{{ __('Enter country') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Phone') }}</label>
|
||||||
|
<input type="number" name="phone" required class="form-control" placeholder="{{ __('Enter phone number') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Salary') }}</label>
|
||||||
|
<input type="number" name="amount" required class="form-control" placeholder="{{ __('Enter salary amount') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Join Date') }}</label>
|
||||||
|
<input type="date" name="join_date" value="{{ date('Y-m-d') }}" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Status') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="status" class="form-control table-select w-100 role" required>
|
||||||
|
<option value="">{{ __('Select one') }}</option>
|
||||||
|
<option value="active">{{ __('Active')}}</option>
|
||||||
|
<option value="terminated">{{ __('Terminate')}}</option>
|
||||||
|
<option value="suspended">{{ __('Suspended')}}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<label class="img-label">{{ __('Image') }}</label>
|
||||||
|
<div class="custom-upload-wrapper">
|
||||||
|
<div class="custom-image-box">
|
||||||
|
<div class="custom-image-content">
|
||||||
|
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M18.3327 7.5026V12.5026C18.3327 14.8596 18.3327 16.0381 17.6004 16.7704C16.8682 17.5026 15.6897 17.5026 13.3327 17.5026H6.66602C4.309 17.5026 3.13048 17.5026 2.39825 16.7704C1.66602 16.0381 1.66602 14.8596 1.66602 12.5026V9.21404C1.66602 8.39729 1.66602 7.98892 1.76053 7.65502C1.99698 6.81974 2.64982 6.1669 3.48509 5.93046C3.819 5.83594 4.22736 5.83594 5.04409 5.83594C5.34907 5.83594 5.50157 5.83594 5.64361 5.81118C5.99556 5.74983 6.31847 5.577 6.56476 5.3182C6.66415 5.21375 6.91352 4.8397 7.08268 4.58594C7.413 4.09048 7.57815 3.84275 7.80393 3.67233C7.94181 3.56826 8.09502 3.48627 8.25809 3.42927C8.52512 3.33594 8.82287 3.33594 9.41837 3.33594H10.8327" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
<path d="M13.3327 11.2474C13.3327 13.0883 11.8403 14.5807 9.99937 14.5807C8.1584 14.5807 6.66602 13.0883 6.66602 11.2474C6.66602 9.40641 8.1584 7.91406 9.99937 7.91406C11.8403 7.91406 13.3327 9.40641 13.3327 11.2474Z" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
<path d="M13.334 4.58333H17.5007M15.4173 6.66667V2.5" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
<span class="custom-upload-text">{{ __('Add Image') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Preview image -->
|
||||||
|
<img class="preview-image d-none" id="image" src="" alt="Preview">
|
||||||
|
<input type="file" name="image" class="preview-image-input" data-id="#image" accept="image/*">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('employees.create')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('modal')
|
||||||
|
@include('hrmaddon::employees.bulk-upload.employees-import')
|
||||||
|
@endpush
|
||||||
110
Modules/HrmAddon/resources/views/employees/datas.blade.php
Normal file
110
Modules/HrmAddon/resources/views/employees/datas.blade.php
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<div class="responsive-table m-0">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@usercan('employees.delete')
|
||||||
|
<th class="w-60 d-print-none">
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<input type="checkbox" class="select-all-delete multi-delete">
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
@endusercan
|
||||||
|
<th> {{ __('SL') }}. </th>
|
||||||
|
<th> {{ __('Image') }}. </th>
|
||||||
|
@if (auth()->user()->accessToMultiBranch())
|
||||||
|
<th>{{ __('Branch') }}</th>
|
||||||
|
@endif
|
||||||
|
<th> {{ __('Name') }} </th>
|
||||||
|
<th> {{ __('Department') }} </th>
|
||||||
|
<th> {{ __('Designation') }} </th>
|
||||||
|
<th> {{ __('shift') }} </th>
|
||||||
|
<th> {{ __('Phone') }} </th>
|
||||||
|
<th> {{ __('Salary') }} </th>
|
||||||
|
<th> {{ __('Action') }} </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<tr>
|
||||||
|
@usercan('employees.delete')
|
||||||
|
<td class="w-60 checkbox d-print-none">
|
||||||
|
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
||||||
|
value="{{ $employee->id }}">
|
||||||
|
</td>
|
||||||
|
@endusercan
|
||||||
|
<td>{{ ($employees->currentPage() - 1) * $employees->perPage() + $loop->iteration }}</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<img src="{{ asset($employee->image ?? 'assets/images/logo/upload2.jpg') }}" alt="Img"
|
||||||
|
class="table-product-img">
|
||||||
|
</td>
|
||||||
|
|
||||||
|
@if (auth()->user()->accessToMultiBranch())
|
||||||
|
<td>{{ $employee->branch->name ?? '' }}</td>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<td>{{ $employee->name }}</td>
|
||||||
|
<td>{{ $employee->department->name ?? '' }}</td>
|
||||||
|
<td>{{ $employee->designation->name ?? '' }}</td>
|
||||||
|
<td>{{ $employee->shift->name ?? '' }}</td>
|
||||||
|
<td>{{ $employee->phone }}</td>
|
||||||
|
<td>{{ currency_format($employee->amount, 'icon', 2, business_currency()) }}</td>
|
||||||
|
<td class="print-d-none">
|
||||||
|
<div class="dropdown table-action">
|
||||||
|
<button type="button" data-bs-toggle="dropdown">
|
||||||
|
<i class="far fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
@usercan('employees.read')
|
||||||
|
<li>
|
||||||
|
<a href="#employees-view" class="employees-view" data-bs-toggle="modal"
|
||||||
|
data-employees-name="{{ $employee->name }}"
|
||||||
|
data-employees-gender="{{ $employee->gender }}"
|
||||||
|
data-employees-phone="{{ $employee->phone }}"
|
||||||
|
data-employees-amount="{{ currency_format($employee->amount, 'icon', 2, business_currency()) }}"
|
||||||
|
data-employees-email="{{ $employee->email }}"
|
||||||
|
data-employees-country="{{ $employee->country }}"
|
||||||
|
data-employees-birth-date="{{ $employee->birth_date }}"
|
||||||
|
data-employees-join-date="{{ $employee->join_date }}"
|
||||||
|
data-employees-designation="{{ $employee->designation->name ?? '' }}"
|
||||||
|
data-employees-department="{{ $employee->department->name ?? '' }}"
|
||||||
|
data-employees-shift="{{ $employee->shift->name ?? '' }}"
|
||||||
|
data-employees-status="{{ $employee->status }}"
|
||||||
|
data-employees-image="{{ asset($employee->image ?? 'assets/images/logo/upload2.jpg') }}">
|
||||||
|
<i class="fal fa-eye"></i>
|
||||||
|
{{ __('View') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
|
||||||
|
@usercan('employees.update')
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('hrm.employees.edit', $employee->id) }}">
|
||||||
|
<i class="fal fa-edit"></i>
|
||||||
|
{{ __('Edit') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
|
||||||
|
@usercan('employees.delete')
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('hrm.employees.destroy', $employee->id) }}"
|
||||||
|
class="confirm-action" data-method="DELETE">
|
||||||
|
<i class="fal fa-trash-alt"></i>
|
||||||
|
{{ __('Delete') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ $employees->links('vendor.pagination.bootstrap-5') }}
|
||||||
|
</div>
|
||||||
150
Modules/HrmAddon/resources/views/employees/edit.blade.php
Normal file
150
Modules/HrmAddon/resources/views/employees/edit.blade.php
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Edit Employee') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card border-0">
|
||||||
|
<div class="card-bodys ">
|
||||||
|
<div class="table-header p-16">
|
||||||
|
<h4>{{ __('Edit Employee') }}</h4>
|
||||||
|
@usercan('employees.read')
|
||||||
|
<a href="{{ route('hrm.employees.index') }}" class="add-order-btn rounded-2"><i class="far fa-list" aria-hidden="true"></i> {{ __('Employee List') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
<div class="order-form-section p-16">
|
||||||
|
<form action="{{ route('hrm.employees.update', $employee->id) }}" method="POST"
|
||||||
|
class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
@method('put')
|
||||||
|
<div class="add-suplier-modal-wrapper d-block">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" value="{{ $employee->name }}" required class="form-control"
|
||||||
|
placeholder="{{ __('Enter employee name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Designation') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="designation_id" class="form-control table-select w-100 role" required>
|
||||||
|
<option value=""> {{ __('Select one') }}</option>
|
||||||
|
@foreach ($designations as $designation)
|
||||||
|
<option @selected($employee->designation_id) value="{{ $designation->id }}"> {{ ucfirst($designation->name) }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Department') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="department_id" class="form-control table-select w-100 role" required>
|
||||||
|
<option value=""> {{ __('Select one') }}</option>
|
||||||
|
@foreach ($departments as $department)
|
||||||
|
<option @selected($employee->department_id) value="{{ $department->id }}"> {{ ucfirst($department->name) }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Shift') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="shift_id" class="form-control table-select w-100 role" required>
|
||||||
|
<option value=""> {{ __('Select one') }}</option>
|
||||||
|
@foreach ($shifts as $shift)
|
||||||
|
<option @selected($employee->shift_id) value="{{ $shift->id }}"> {{ ucfirst($shift->name) }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Gender') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="gender" class="form-control table-select w-100 role" required>
|
||||||
|
<option value=""> {{ __('Select one') }}</option>
|
||||||
|
<option @selected($employee->gender == 'male') value="male">{{ __('Male')}}</option>
|
||||||
|
<option @selected($employee->gender == 'female') value="female">{{ __('Female')}}</option>
|
||||||
|
<option @selected($employee->gender == 'others') value="others">{{ __('Others')}}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Birth Date') }}</label>
|
||||||
|
<input type="date" name="birth_date" value="{{ $employee->birth_date ?? date('Y-m-d') }}" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Email') }}</label>
|
||||||
|
<input type="email" name="email" value="{{ $employee->email }}" class="form-control" placeholder="{{ __('Enter email address') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Country') }}</label>
|
||||||
|
<input type="text" name="country" value="{{ $employee->country }}" class="form-control" placeholder="{{ __('Enter country') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Phone') }}</label>
|
||||||
|
<input type="number" name="phone" value="{{ $employee->phone }}" required class="form-control" placeholder="{{ __('Enter phone number') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Salary') }}</label>
|
||||||
|
<input type="number" name="amount" required value="{{ $employee->amount }}" class="form-control" placeholder="{{ __('Enter salary amount') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Join Date') }}</label>
|
||||||
|
<input type="date" name="join_date" value="{{ $employee->join_date ?? date('Y-m-d') }}" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Status') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="status" class="form-control table-select w-100 role" required>
|
||||||
|
<option value="">{{ __('Select one') }}</option>
|
||||||
|
<option @selected($employee->status == 'active') value="active">{{ __('Active')}}</option>
|
||||||
|
<option @selected($employee->status == 'terminated') value="terminated">{{ __('Terminate')}}</option>
|
||||||
|
<option @selected($employee->status == 'suspended') value="suspended">{{ __('Suspended')}}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<label class="img-label">{{ __('Image') }}</label>
|
||||||
|
<div class="custom-upload-wrapper">
|
||||||
|
<div class="custom-image-box">
|
||||||
|
<div class="custom-image-content">
|
||||||
|
<svg width="30" height="30" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M18.3327 7.5026V12.5026C18.3327 14.8596 18.3327 16.0381 17.6004 16.7704C16.8682 17.5026 15.6897 17.5026 13.3327 17.5026H6.66602C4.309 17.5026 3.13048 17.5026 2.39825 16.7704C1.66602 16.0381 1.66602 14.8596 1.66602 12.5026V9.21404C1.66602 8.39729 1.66602 7.98892 1.76053 7.65502C1.99698 6.81974 2.64982 6.1669 3.48509 5.93046C3.819 5.83594 4.22736 5.83594 5.04409 5.83594C5.34907 5.83594 5.50157 5.83594 5.64361 5.81118C5.99556 5.74983 6.31847 5.577 6.56476 5.3182C6.66415 5.21375 6.91352 4.8397 7.08268 4.58594C7.413 4.09048 7.57815 3.84275 7.80393 3.67233C7.94181 3.56826 8.09502 3.48627 8.25809 3.42927C8.52512 3.33594 8.82287 3.33594 9.41837 3.33594H10.8327" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
<path d="M13.3327 11.2474C13.3327 13.0883 11.8403 14.5807 9.99937 14.5807C8.1584 14.5807 6.66602 13.0883 6.66602 11.2474C6.66602 9.40641 8.1584 7.91406 9.99937 7.91406C11.8403 7.91406 13.3327 9.40641 13.3327 11.2474Z" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
<path d="M13.334 4.58333H17.5007M15.4173 6.66667V2.5" stroke="#4B5563" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
<span class="custom-upload-text">{{ __('Add Image') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Preview image -->
|
||||||
|
<img class="preview-image d-none" id="image" src="{{ asset( $employee->image) }}" alt="Preview">
|
||||||
|
<input type="file" name="image" class="preview-image-input" data-id="#image" accept="image/*">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('employees.update')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
84
Modules/HrmAddon/resources/views/employees/index.blade.php
Normal file
84
Modules/HrmAddon/resources/views/employees/index.blade.php
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Employee List') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card ">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<div class="table-header p-16 d-print-none">
|
||||||
|
<h4>{{ __('Employee List') }}</h4>
|
||||||
|
@usercan('employees.create')
|
||||||
|
<a type="button" href="{{ route('hrm.employees.create') }}" class="add-order-btn rounded-2" class="btn btn-primary"><i class="fas fa-plus-circle me-1"></i>{{ __('Add new Employee') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
<div class="table-header justify-content-center border-0 text-center d-none d-block d-print-block">
|
||||||
|
@include('business::print.header')
|
||||||
|
<h4 class="mt-2">{{ __('Employee List') }}</h4>
|
||||||
|
</div>
|
||||||
|
<div class="table-top-form p-16">
|
||||||
|
<form action="{{ route('hrm.employees.index') }}" method="GET" class="filter-form" table="#employees-data">
|
||||||
|
|
||||||
|
<div class="table-top-left d-flex gap-3">
|
||||||
|
|
||||||
|
<div class="gpt-up-down-arrow position-relative d-print-none">
|
||||||
|
<select name="per_page" class="form-control">
|
||||||
|
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||||
|
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||||
|
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||||
|
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(auth()->user()->accessToMultiBranch())
|
||||||
|
<div class="table-search position-relative">
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="branch_id" class="form-control">
|
||||||
|
<option value="">{{ __('Select Branch') }}</option>
|
||||||
|
@foreach ($branches as $branch)
|
||||||
|
<option value="{{ $branch->id }}" @selected(request('branch_id') == $branch->id) >{{ $branch->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="table-search position-relative d-print-none">
|
||||||
|
<input class="form-control searchInput" type="text" name="search" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||||
|
<span class="position-absolute">
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="delete-item delete-show d-none">
|
||||||
|
<div class="delete-item-show">
|
||||||
|
<p class="fw-bold"><span class="selected-count"></span> {{ __('items show') }}</p>
|
||||||
|
<button data-bs-toggle="modal" class="trigger-modal" data-bs-target="#multi-delete-modal" data-url="{{ route('hrm.employees.delete-all') }}">{{ __('Delete') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="employees-data">
|
||||||
|
@include('hrmaddon::employees.datas')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('modal')
|
||||||
|
@include('hrmaddon::component.delete-modal')
|
||||||
|
@include('hrmaddon::employees.view')
|
||||||
|
@endpush
|
||||||
|
|
||||||
81
Modules/HrmAddon/resources/views/employees/view.blade.php
Normal file
81
Modules/HrmAddon/resources/views/employees/view.blade.php
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<div class="modal fade p-0" id="employees-view">
|
||||||
|
<div class="modal-dialog modal-dialog-centered modal-md">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('View') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body order-form-section">
|
||||||
|
<table class="info-table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Image') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td><img class="table-img" src="" alt="" id="employees_image"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Name') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_name"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Gender') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_gender"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Phone') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_phone"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Salary') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_amount"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Email') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_email"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Country') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_country"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Birth Date') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_birth_date"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Join Date') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_join_date"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Designation') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_designation"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Department') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_department"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Shift') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_shift"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ __('Status') }}</td>
|
||||||
|
<td>:</td>
|
||||||
|
<td id="employees_status"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
48
Modules/HrmAddon/resources/views/holidays/create.blade.php
Normal file
48
Modules/HrmAddon/resources/views/holidays/create.blade.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<div class="modal fade common-validation-modal" id="holidays-create-modal">
|
||||||
|
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Create Holiday') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="{{ route('hrm.holidays.store') }}" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" required class="form-control" placeholder="{{ __('Enter Name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Start Date') }}</label>
|
||||||
|
<input type="date" name="start_date" value="{{ date('Y-m-d') }}" required class="form-control holy-start">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('End Date') }}</label>
|
||||||
|
<input type="date" name="end_date" value="{{ date('Y-m-d') }}" required class="form-control holy-end">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Duration') }}</label>
|
||||||
|
<input type="text" class="form-control holy-duration" placeholder="{{ __('1 days') }}" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mt-1">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" class="form-control" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('holidays.create')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
77
Modules/HrmAddon/resources/views/holidays/datas.blade.php
Normal file
77
Modules/HrmAddon/resources/views/holidays/datas.blade.php
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<div class="responsive-table m-0">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@usercan('holidays.delete')
|
||||||
|
<th class="w-60">
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<input type="checkbox" class="select-all-delete multi-delete">
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
@endusercan
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Name') }}</th>
|
||||||
|
@if (auth()->user()->accessToMultiBranch())
|
||||||
|
<th class="text-start">{{ __('Branch') }}</th>
|
||||||
|
@endif
|
||||||
|
<th class="text-start">{{ __('Start Date') }}</th>
|
||||||
|
<th class="text-start">{{ __('End Date') }}</th>
|
||||||
|
<th class="text-start">{{ __('Description') }}</th>
|
||||||
|
<th>{{ __('Action') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($holidays as $holiday)
|
||||||
|
<tr>
|
||||||
|
@usercan('holidays.delete')
|
||||||
|
<td class="w-60 checkbox">
|
||||||
|
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
||||||
|
value="{{ $holiday->id }}">
|
||||||
|
</td>
|
||||||
|
@endusercan
|
||||||
|
<td>{{ ($holidays->currentPage() - 1) * $holidays->perPage() + $loop->iteration }}</td>
|
||||||
|
<td class="text-start">{{ $holiday->name }}</td>
|
||||||
|
@if (auth()->user()->accessToMultiBranch())
|
||||||
|
<td class="text-start">{{ $holiday->branch->name ?? '' }}</td>
|
||||||
|
@endif
|
||||||
|
<td class="text-start">{{ formatted_date($holiday->start_date) }}</td>
|
||||||
|
<td class="text-start">{{ formatted_date($holiday->end_date) }}</td>
|
||||||
|
<td class="text-start">{{ Str::limit($holiday->description, 20, '...') }}</td>
|
||||||
|
<td class="print-d-none">
|
||||||
|
<div class="dropdown table-action">
|
||||||
|
<button type="button" data-bs-toggle="dropdown">
|
||||||
|
<i class="far fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
@usercan('holidays.update')
|
||||||
|
<li>
|
||||||
|
<a href="#holidays-edit-modal" data-bs-toggle="modal" class="holidays-edit-btn"
|
||||||
|
data-url="{{ route('hrm.holidays.update', $holiday->id) }}"
|
||||||
|
data-holidays-name="{{ $holiday->name }}"
|
||||||
|
data-holidays-start-date="{{ $holiday->start_date }}"
|
||||||
|
data-holidays-end-date="{{ $holiday->end_date }}"
|
||||||
|
data-holidays-description="{{ $holiday->description }}">
|
||||||
|
<i class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
@usercan('holidays.delete')
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('hrm.holidays.destroy', $holiday->id) }}" class="confirm-action"
|
||||||
|
data-method="DELETE">
|
||||||
|
<i class="fal fa-trash-alt"></i>
|
||||||
|
{{ __('Delete') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ $holidays->links('vendor.pagination.bootstrap-5') }}
|
||||||
|
</div>
|
||||||
50
Modules/HrmAddon/resources/views/holidays/edit.blade.php
Normal file
50
Modules/HrmAddon/resources/views/holidays/edit.blade.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
|
||||||
|
<div class="modal fade common-validation-modal" id="holidays-edit-modal">
|
||||||
|
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Edit Holiday') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload editHoldayForm">
|
||||||
|
@csrf
|
||||||
|
@method('put')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" id="name" required class="form-control" placeholder="{{ __('Enter Name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Start Date') }}</label>
|
||||||
|
<input type="date" name="start_date" id="start_date" required class="form-control holy-start">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('End Date') }}</label>
|
||||||
|
<input type="date" name="end_date" id="end_date" required class="form-control holy-end">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Duration') }}</label>
|
||||||
|
<input type="text" class="form-control holy-duration" placeholder="{{ __('1 days') }}" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" id="description" class="form-control" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<a href="{{ route('hrm.holidays.index') }}" class="theme-btn border-btn m-2">{{ __('Cancel') }}</a>
|
||||||
|
@usercan('holidays.update')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
80
Modules/HrmAddon/resources/views/holidays/index.blade.php
Normal file
80
Modules/HrmAddon/resources/views/holidays/index.blade.php
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Holiday List') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<div class="table-header p-16">
|
||||||
|
<h4>{{ __('Holiday List') }}</h4>
|
||||||
|
@usercan('holidays.create')
|
||||||
|
<a type="button" href="#holidays-create-modal" data-bs-toggle="modal" class="add-order-btn rounded-2"><i class="fas fa-plus-circle me-1"></i>{{ __('Add new Holiday') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
<div class="table-top-form p-16-0">
|
||||||
|
<form action="{{ route('hrm.holidays.index') }}" method="GET" class="filter-form" table="#holidays-data">
|
||||||
|
|
||||||
|
<div class="table-top-left d-flex gap-3 margin-lr-16 flex-wrap">
|
||||||
|
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="per_page" class="form-control">
|
||||||
|
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||||
|
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||||
|
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||||
|
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(auth()->user()->accessToMultiBranch())
|
||||||
|
<div class="table-search position-relative">
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="branch_id" class="form-control">
|
||||||
|
<option value="">{{ __('Select Branch') }}</option>
|
||||||
|
@foreach ($branches as $branch)
|
||||||
|
<option value="{{ $branch->id }}" @selected(request('branch_id') == $branch->id) >{{ $branch->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="table-search position-relative">
|
||||||
|
<input type="text" name="search" class="form-control" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||||
|
<span class="position-absolute">
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="delete-item delete-show d-none">
|
||||||
|
<div class="delete-item-show">
|
||||||
|
<p class="fw-bold"><span class="selected-count"></span> {{ __('items show') }}</p>
|
||||||
|
<button data-bs-toggle="modal" class="trigger-modal" data-bs-target="#multi-delete-modal" data-url="{{ route('hrm.holidays.delete-all') }}">{{ __('Delete') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="holidays-data">
|
||||||
|
@include('hrmaddon::holidays.datas')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('modal')
|
||||||
|
@include('hrmaddon::component.delete-modal')
|
||||||
|
@include('hrmaddon::holidays.create')
|
||||||
|
@include('hrmaddon::holidays.edit')
|
||||||
|
@endpush
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
<div class="modal fade common-validation-modal" id="leave-types-create-modal">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Create Leave Type') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="{{ route('hrm.leave-types.store') }}" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" required class="form-control" placeholder="{{ __('Enter Name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mt-1">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" class="form-control" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('leave-types.create')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
74
Modules/HrmAddon/resources/views/leave-types/datas.blade.php
Normal file
74
Modules/HrmAddon/resources/views/leave-types/datas.blade.php
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<div class="responsive-table m-0">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@usercan('leave-types.delete')
|
||||||
|
<th class="w-60">
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<input type="checkbox" class="select-all-delete multi-delete">
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
@endusercan
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Name') }}</th>
|
||||||
|
<th class="text-start">{{ __('Description') }}</th>
|
||||||
|
<th>{{ __('Status') }}</th>
|
||||||
|
<th>{{ __('Action') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($leave_types as $leave_type)
|
||||||
|
<tr>
|
||||||
|
@usercan('leave-types.delete')
|
||||||
|
<td class="w-60 checkbox">
|
||||||
|
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
||||||
|
value="{{ $leave_type->id }}">
|
||||||
|
</td>
|
||||||
|
@endusercan
|
||||||
|
<td>{{ ($leave_types->currentPage() - 1) * $leave_types->perPage() + $loop->iteration }}</td>
|
||||||
|
|
||||||
|
<td class="text-start">{{ $leave_type->name }}</td>
|
||||||
|
<td class="text-start">{{ Str::limit($leave_type->description, 20, '...') }}</td>
|
||||||
|
<td>
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" {{ $leave_type->status == 1 ? 'checked' : '' }} class="status" data-url="{{ route('hrm.leave-types.status', $leave_type->id) }}">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
<td class="print-d-none">
|
||||||
|
<div class="dropdown table-action">
|
||||||
|
<button type="button" data-bs-toggle="dropdown">
|
||||||
|
<i class="far fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
@usercan('leave-types.update')
|
||||||
|
<li>
|
||||||
|
<a href="#leave-types-edit-modal" data-bs-toggle="modal"
|
||||||
|
class="leave-types-edit-btn"
|
||||||
|
data-url="{{ route('hrm.leave-types.update', $leave_type->id) }}"
|
||||||
|
data-leave-types-name="{{ $leave_type->name }}"
|
||||||
|
data-leave-types-description="{{ $leave_type->description }}">
|
||||||
|
<i class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
@usercan('leave-types.delete')
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('hrm.leave-types.destroy', $leave_type->id) }}"
|
||||||
|
class="confirm-action" data-method="DELETE">
|
||||||
|
<i class="fal fa-trash-alt"></i>
|
||||||
|
{{ __('Delete') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ $leave_types->links('vendor.pagination.bootstrap-5') }}
|
||||||
|
</div>
|
||||||
37
Modules/HrmAddon/resources/views/leave-types/edit.blade.php
Normal file
37
Modules/HrmAddon/resources/views/leave-types/edit.blade.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<div class="modal fade common-validation-modal" id="leave-types-edit-modal">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Edit Leave Type') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload leaveTypeEditForm">
|
||||||
|
@csrf
|
||||||
|
@method('put')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{ __('Name') }}</label>
|
||||||
|
<input type="text" name="name" id="leave_types_name" required class="form-control" placeholder="{{ __('Enter Name') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" id="leave_types_description" class="form-control" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<a href="{{ route('hrm.leave-types.index') }}" class="theme-btn border-btn m-2">{{ __('Cancel') }}</a>
|
||||||
|
@usercan('leave-types.update')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
64
Modules/HrmAddon/resources/views/leave-types/index.blade.php
Normal file
64
Modules/HrmAddon/resources/views/leave-types/index.blade.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Leave Type List') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<div class="table-header p-16">
|
||||||
|
<h4>{{ __('Leave Type List') }}</h4>
|
||||||
|
@usercan('leave-types.read')
|
||||||
|
<a type="button" href="#leave-types-create-modal" data-bs-toggle="modal" class="add-order-btn rounded-2"><i class="fas fa-plus-circle me-1"></i>{{ __('Add Leave Type') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
<div class="table-top-form p-16-0">
|
||||||
|
<form action="{{ route('hrm.leave-types.index') }}" method="GET" class="filter-form" table="#leave-types-data">
|
||||||
|
|
||||||
|
<div class="table-top-left d-flex gap-3 margin-l-16">
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="per_page" class="form-control">
|
||||||
|
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||||
|
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||||
|
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||||
|
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="table-search position-relative">
|
||||||
|
<input type="text" name="search" class="form-control" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||||
|
<span class="position-absolute">
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="delete-item delete-show d-none">
|
||||||
|
<div class="delete-item-show">
|
||||||
|
<p class="fw-bold"><span class="selected-count"></span> {{ __('items show') }}</p>
|
||||||
|
<button data-bs-toggle="modal" class="trigger-modal" data-bs-target="#multi-delete-modal" data-url="{{ route('hrm.leave-types.delete-all') }}">{{ __('Delete') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="leave-types-data">
|
||||||
|
@include('hrmaddon::leave-types.datas')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('modal')
|
||||||
|
@include('hrmaddon::component.delete-modal')
|
||||||
|
@include('hrmaddon::leave-types.create')
|
||||||
|
@include('hrmaddon::leave-types.edit')
|
||||||
|
@endpush
|
||||||
103
Modules/HrmAddon/resources/views/leaves/create.blade.php
Normal file
103
Modules/HrmAddon/resources/views/leaves/create.blade.php
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<div class="modal fade common-validation-modal" id="leaves-create-modal">
|
||||||
|
<div class="modal-dialog modal-dialog-centered modal-lg ">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Create Leave') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="{{ route('hrm.leaves.store') }}" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Employee') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="employee_id" required class="form-control get-employee-department">
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<option value="{{ $employee->id }}">{{ $employee->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Department') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="department_id" required class="form-control department-select" @readonly(true)>
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
{{-- Options will be populated via JS --}}
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Leave Type') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="leave_type_id" required class="form-control">
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
@foreach ($leave_types as $leave_type)
|
||||||
|
<option value="{{ $leave_type->id }}">{{ $leave_type->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Apply Month') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="month" required class="form-control">
|
||||||
|
<option value="">{{ __('Select One') }}</option>
|
||||||
|
@for ($month = 1; $month <= 12; $month++)
|
||||||
|
<option {{ $month == date('m') ? 'selected' : '' }} value="{{ strtolower(date('F', mktime(0, 0, 0, $month, 1))) }}">{{ date('F', mktime(0, 0, 0, $month, 1)) }}</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{__('Start Date')}}</label>
|
||||||
|
<input type="date" name="start_date" value="{{ date('Y-m-d') }}" required class="form-control leave_start_date">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('End Date') }}</label>
|
||||||
|
<input type="date" name="end_date" value="{{ date('Y-m-d') }}" required class="form-control leave_end_date">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Leave Duration') }}</label>
|
||||||
|
<input type="number" name="leave_duration" class="form-control leave_duration_cal" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Status') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="status" class="form-control" required>
|
||||||
|
<option value="pending">{{ __('Pending') }}</option>
|
||||||
|
<option value="approved">{{ __('Approved') }}</option>
|
||||||
|
<option value="rejected">{{ __('Rejected') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" class="form-control" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('leaves.create')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" value="{{ route('hrm.leaves.get.department') }}" id="get-department">
|
||||||
100
Modules/HrmAddon/resources/views/leaves/datas.blade.php
Normal file
100
Modules/HrmAddon/resources/views/leaves/datas.blade.php
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<div class="responsive-table m-0">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@usercan('leaves.delete')
|
||||||
|
<th class="w-60">
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<input type="checkbox" class="select-all-delete multi-delete">
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
@endusercan
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Employee') }}</th>
|
||||||
|
@if (auth()->user()->accessToMultiBranch())
|
||||||
|
<th class="text-start">{{ __('Branch') }}</th>
|
||||||
|
@endif
|
||||||
|
<th class="text-start">{{ __('Month') }}</th>
|
||||||
|
<th class="text-start">{{ __('Department') }}</th>
|
||||||
|
<th class="text-start">{{ __('Start Date') }}</th>
|
||||||
|
<th class="text-start">{{ __('End Date') }}</th>
|
||||||
|
<th class="text-start">{{ __('Leave Type') }}</th>
|
||||||
|
<th class="text-start">{{ __('Leave Duration') }}</th>
|
||||||
|
<th class="text-center">{{ __('Status') }}</th>
|
||||||
|
<th>{{ __('Action') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($leaves as $leave)
|
||||||
|
<tr>
|
||||||
|
@usercan('leaves.delete')
|
||||||
|
<td class="w-60 checkbox">
|
||||||
|
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
||||||
|
value="{{ $leave->id }}">
|
||||||
|
</td>
|
||||||
|
@endusercan
|
||||||
|
<td>{{ ($leaves->currentPage() - 1) * $leaves->perPage() + $loop->iteration }}</td>
|
||||||
|
<td class="text-start">{{ $leave->employee->name ?? '' }}</td>
|
||||||
|
@if (auth()->user()->accessToMultiBranch())
|
||||||
|
<td class="text-start">{{ $leave->branch->name ?? '' }}</td>
|
||||||
|
@endif
|
||||||
|
<td class="text-start">{{ ucfirst($leave->month) }}</td>
|
||||||
|
<td class="text-start">{{ $leave->department->name ?? '' }}</td>
|
||||||
|
<td class="text-start">{{ formatted_date($leave->start_date) }}</td>
|
||||||
|
<td class="text-start">{{ formatted_date($leave->end_date) }}</td>
|
||||||
|
<td class="text-start">{{ $leave->leave_type->name ?? '' }}</td>
|
||||||
|
<td class="text-start">{{ $leave->leave_duration }} {{ __('Days') }}</td>
|
||||||
|
@if ($leave->status == 'pending')
|
||||||
|
<td class="text-warning text-center">
|
||||||
|
<div class="padding-status">Pending</div>
|
||||||
|
</td>
|
||||||
|
@elseif ($leave->status == 'approved')
|
||||||
|
<td class="text-warning text-center">
|
||||||
|
<div class="approved-status">Approved</div>
|
||||||
|
</td>
|
||||||
|
@elseif ($leave->status == 'rejected')
|
||||||
|
<td class="text-warning text-center">
|
||||||
|
<div class="rejected-status">Rejected</div>
|
||||||
|
</td>
|
||||||
|
@endif
|
||||||
|
<td class="print-d-none">
|
||||||
|
<div class="dropdown table-action">
|
||||||
|
<button type="button" data-bs-toggle="dropdown">
|
||||||
|
<i class="far fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
@usercan('leaves.update')
|
||||||
|
<li>
|
||||||
|
<a href="#leaves-edit-modal" data-bs-toggle="modal" class="leaves-edit-btn"
|
||||||
|
data-url="{{ route('hrm.leaves.update', $leave->id) }}"
|
||||||
|
data-employee-id="{{ $leave->employee_id }}" data-month="{{ $leave->month }}"
|
||||||
|
data-leave-type-id="{{ $leave->leave_type_id }}"
|
||||||
|
data-start-date="{{ $leave->start_date }}"
|
||||||
|
data-end-date="{{ $leave->end_date }}"
|
||||||
|
data-leave-duration="{{ $leave->leave_duration }}"
|
||||||
|
data-status="{{ $leave->status }}"
|
||||||
|
data-description="{{ $leave->description }}">
|
||||||
|
<i class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
@usercan('leaves.delete')
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('hrm.leaves.destroy', $leave->id) }}" class="confirm-action"
|
||||||
|
data-method="DELETE">
|
||||||
|
<i class="fal fa-trash-alt"></i>
|
||||||
|
{{ __('Delete') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ $leaves->links('vendor.pagination.bootstrap-5') }}
|
||||||
|
</div>
|
||||||
106
Modules/HrmAddon/resources/views/leaves/edit.blade.php
Normal file
106
Modules/HrmAddon/resources/views/leaves/edit.blade.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<div class="modal fade common-validation-modal editModal" id="leaves-edit-modal">
|
||||||
|
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Edit Leave') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload editLeaveForm">
|
||||||
|
@csrf
|
||||||
|
@method('put')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Employee') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="employee_id" required id="employee_id" class="form-control get-employee-department">
|
||||||
|
<option value="">{{ __('Selectm a One') }}</option>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<option value="{{ $employee->id }}">{{ $employee->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Department') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="department_id" required class="form-control department-select" @readonly(true)>
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
{{-- Options will be populated via JS --}}
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Leave Type') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="leave_type_id" required id="leave_type_id" class="form-control">
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
@foreach ($leave_types as $leave_type)
|
||||||
|
<option value="{{ $leave_type->id }}">{{ $leave_type->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Apply Month') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="month" id="month" required class="form-control">
|
||||||
|
<option value="">{{ __('Select One') }}</option>
|
||||||
|
@for ($month = 1; $month <= 12; $month++)
|
||||||
|
<option {{ $month == date('m') ? 'selected' : '' }} value="{{ strtolower(date('F', mktime(0, 0, 0, $month, 1))) }}">{{ date('F', mktime(0, 0, 0, $month, 1)) }}</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{__('Start Date')}}</label>
|
||||||
|
<input type="date" name="start_date" id="start_date" required class="form-control leave_edit_start_date">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('End Date') }}</label>
|
||||||
|
<input type="date" name="end_date" id="end_date" required class="form-control leave_edit_end_date">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Leave Duration') }}</label>
|
||||||
|
<input type="number" name="leave_duration" id="leave_duration" readonly class="form-control leave_edit_duration">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Status') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="status" id="status" class="form-control" required>
|
||||||
|
<option value="pending">{{ __('Pending') }}</option>
|
||||||
|
<option value="approved">{{ __('Approved') }}</option>
|
||||||
|
<option value="rejected">{{ __('Rejected') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{__('Description')}}</label>
|
||||||
|
<textarea name="description" class="form-control" id="description" placeholder="{{ __('Enter Description') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('leaves.update')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" value="{{ route('hrm.leaves.get.department') }}" id="get-department">
|
||||||
107
Modules/HrmAddon/resources/views/leaves/index.blade.php
Normal file
107
Modules/HrmAddon/resources/views/leaves/index.blade.php
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Leave List') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<div class="table-header p-16">
|
||||||
|
<h4>{{ __('Leave List') }}</h4>
|
||||||
|
@usercan('leaves.create')
|
||||||
|
<a type="button" href="#leaves-create-modal" data-bs-toggle="modal" class="add-order-btn rounded-2"><i class="fas fa-plus-circle me-1"></i>{{ __('Add new Leave') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
<div class="table-top-form p-16-0">
|
||||||
|
<div class="d-flex align-items-center gap-1 flex-wrap">
|
||||||
|
<form action="{{ route('hrm.leaves.index') }}" method="GET" class="filter-form" table="#leaves-data">
|
||||||
|
<div class="table-top-left d-flex gap-3 margin-lr-16 flex-wrap">
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="per_page" class="form-control">
|
||||||
|
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||||
|
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||||
|
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||||
|
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(auth()->user()->accessToMultiBranch())
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="branch_id" class="form-control">
|
||||||
|
<option value="">{{ __('Select Branch') }}</option>
|
||||||
|
@foreach ($branches as $branch)
|
||||||
|
<option value="{{ $branch->id }}" @selected(request('branch_id') == $branch->id) >{{ $branch->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="table-search position-relative">
|
||||||
|
<input type="text" name="search" class="form-control" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||||
|
<span class="position-absolute">
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="gpt-up-down-arrow position-relative d-print-none employee-select">
|
||||||
|
<select name="employee" class="form-control">
|
||||||
|
<option value="">{{ __('Select employee') }}</option>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<option value="{{ $employee->id }}" @selected(request('employee') == $employee->id) >{{ $employee->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="gpt-up-down-arrow position-relative d-print-none">
|
||||||
|
<select name="month" class="form-control">
|
||||||
|
<option value=""> {{__('All month')}} </option>
|
||||||
|
@for ($month = 1; $month <= 12; $month++)
|
||||||
|
@php
|
||||||
|
$monthSlug = strtolower(date('F', mktime(0, 0, 0, $month, 1)));
|
||||||
|
@endphp
|
||||||
|
<option value="{{ $monthSlug }}">
|
||||||
|
{{ date('F', mktime(0, 0, 0, $month, 1)) }}
|
||||||
|
</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="delete-item delete-show d-none">
|
||||||
|
<div class="delete-item-show">
|
||||||
|
<p class="fw-bold"><span class="selected-count"></span> {{ __('items show') }}</p>
|
||||||
|
<button data-bs-toggle="modal" class="trigger-modal" data-bs-target="#multi-delete-modal" data-url="{{ route('hrm.leaves.delete-all') }}">{{ __('Delete') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="leaves-data">
|
||||||
|
@include('hrmaddon::leaves.datas')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('modal')
|
||||||
|
@include('hrmaddon::component.delete-modal')
|
||||||
|
@include('hrmaddon::leaves.create')
|
||||||
|
@include('hrmaddon::leaves.edit')
|
||||||
|
@endpush
|
||||||
99
Modules/HrmAddon/resources/views/payrolls/create.blade.php
Normal file
99
Modules/HrmAddon/resources/views/payrolls/create.blade.php
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<div class="modal fade common-validation-modal" id="payrolls-create-modal">
|
||||||
|
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Create Payroll') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="{{ route('hrm.payrolls.store') }}" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Employee') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="employee_id" class="form-control empAmount" required>
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<option value="{{ $employee->id }}">{{ $employee->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Payment Year') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select class="form-control" name="payemnt_year">
|
||||||
|
@for ($i = date('Y'); $i >= 2022; $i--)
|
||||||
|
<option @selected($i == date('Y')) value="{{ $i }}">
|
||||||
|
{{ $i }}
|
||||||
|
</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Month') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="month" id="month" class="form-control" required>
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
@for ($month = 1; $month <= 12; $month++)
|
||||||
|
<option {{ $month == date('m') ? 'selected' : '' }}
|
||||||
|
value="{{ strtolower(date('F', mktime(0, 0, 0, $month, 1))) }}">
|
||||||
|
{{ date('F', mktime(0, 0, 0, $month, 1)) }}</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Date') }}</label>
|
||||||
|
<input type="date" name="date" value="{{ date('Y-m-d') }}" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Amount') }}</label>
|
||||||
|
<input type="number" name="amount" readonly class="form-control amountInput" placeholder="{{ __('Enter amount') }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Payment Type') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="payment_type_id" required class="form-control">
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
<option value="cash">{{ __('Cash') }}</option>
|
||||||
|
@foreach ($payment_types as $payment_type)
|
||||||
|
<option value="{{ $payment_type->id }}">{{ $payment_type->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{ __('Note') }}</label>
|
||||||
|
<textarea name="note" class="form-control" placeholder="{{ __('Enter note') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('payrolls.create')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" value="{{ route('hrm.payrolls.getEmpAmount') }}" id="get-empAmount">
|
||||||
88
Modules/HrmAddon/resources/views/payrolls/datas.blade.php
Normal file
88
Modules/HrmAddon/resources/views/payrolls/datas.blade.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<div class="responsive-table m-0">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@usercan('payrolls.delete')
|
||||||
|
<th class="w-60">
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<input type="checkbox" class="select-all-delete multi-delete">
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
@endusercan
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Employee') }}</th>
|
||||||
|
@if (auth()->user()->accessToMultiBranch())
|
||||||
|
<th class="text-start">{{ __('Branch') }}</th>
|
||||||
|
@endif
|
||||||
|
<th class="text-start">{{ __('Payment Year') }}</th>
|
||||||
|
<th class="text-start">{{ __('Month') }}</th>
|
||||||
|
<th class="text-start">{{ __('Receipt No') }}</th>
|
||||||
|
<th class="text-start">{{ __('date') }}</th>
|
||||||
|
<th class="text-start">{{ __('Amount') }}</th>
|
||||||
|
<th class="text-start">{{ __('Payment Type') }}</th>
|
||||||
|
<th class="text-center">{{ __('Status') }}</th>
|
||||||
|
<th>{{ __('Action') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($payrolls as $payroll)
|
||||||
|
<tr>
|
||||||
|
@usercan('payrolls.delete')
|
||||||
|
<td class="w-60 checkbox">
|
||||||
|
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
||||||
|
value="{{ $payroll->id }}">
|
||||||
|
</td>
|
||||||
|
@endusercan
|
||||||
|
<td>{{ ($payrolls->currentPage() - 1) * $payrolls->perPage() + $loop->iteration }}</td>
|
||||||
|
<td class="text-start">{{ $payroll->employee->name ?? '' }}</td>
|
||||||
|
@if (auth()->user()->accessToMultiBranch())
|
||||||
|
<td class="text-start">{{ $payroll->branch->name ?? '' }}</td>
|
||||||
|
@endif
|
||||||
|
<td class="text-start">{{ $payroll->payemnt_year }}</td>
|
||||||
|
<td class="text-start">{{ ucfirst($payroll->month) }}</td>
|
||||||
|
<td class="text-start">{{ $payroll->puid }}</td>
|
||||||
|
<td class="text-start">{{ formatted_date($payroll->date) }}</td>
|
||||||
|
<td class="text-start">{{ currency_format($payroll->amount, 'icon', 2, business_currency()) }}</td>
|
||||||
|
<td class="text-start">{{ $payroll->payment_type->name ?? 'Cash' }}</td>
|
||||||
|
<td class="text-warning text-center">
|
||||||
|
<div class="approved-status">Paid</div>
|
||||||
|
</td>
|
||||||
|
<td class="print-d-none">
|
||||||
|
<div class="dropdown table-action">
|
||||||
|
<button type="button" data-bs-toggle="dropdown">
|
||||||
|
<i class="far fa-ellipsis-v"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
@usercan('payrolls.update')
|
||||||
|
<li>
|
||||||
|
<a href="#payrolls-edit-modal" data-bs-toggle="modal" class="payrolls-edit-btn"
|
||||||
|
data-url="{{ route('hrm.payrolls.update', $payroll->id) }}"
|
||||||
|
data-employee-id="{{ $payroll->employee_id }}"
|
||||||
|
data-payment-type-id="{{ $payroll->payment_type_id }}"
|
||||||
|
data-date="{{ $payroll->date }}" data-month="{{ $payroll->month }}"
|
||||||
|
data-note="{{ $payroll->note }}" data-amount="{{ $payroll->amount }}"
|
||||||
|
data-payment-year="{{ $payroll->payemnt_year }}">
|
||||||
|
<i class="fal fa-pencil-alt"></i>{{ __('Edit') }}</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
@usercan('payrolls.delete')
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('hrm.payrolls.destroy', $payroll->id) }}" class="confirm-action"
|
||||||
|
data-method="DELETE">
|
||||||
|
<i class="fal fa-trash-alt"></i>
|
||||||
|
{{ __('Delete') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endusercan
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ $payrolls->links('vendor.pagination.bootstrap-5') }}
|
||||||
|
</div>
|
||||||
97
Modules/HrmAddon/resources/views/payrolls/edit.blade.php
Normal file
97
Modules/HrmAddon/resources/views/payrolls/edit.blade.php
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<div class="modal fade common-validation-modal" id="payrolls-edit-modal">
|
||||||
|
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5">{{ __('Edit Payroll') }}</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="personal-info">
|
||||||
|
<form action="" method="post" enctype="multipart/form-data"
|
||||||
|
class="ajaxform_instant_reload editPayrollForm">
|
||||||
|
@csrf
|
||||||
|
@method('put')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Employee') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="employee_id" id="employee_id" required class="form-control empAmount">
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<option value="{{ $employee->id }}">{{ $employee->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Payment Year') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select class="form-control" name="payemnt_year" id="payment_year">
|
||||||
|
@for ($i = date('Y'); $i >= 2022; $i--)
|
||||||
|
<option @selected($i == date('Y')) value="{{ $i }}">
|
||||||
|
{{ $i }}
|
||||||
|
</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Month') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="month" id="month" required class="form-control salary-month">
|
||||||
|
<option value="">{{ __('Select a One') }}</option>
|
||||||
|
@for ($month = 1; $month <= 12; $month++)
|
||||||
|
<option value="{{ strtolower(date('F', mktime(0, 0, 0, $month, 1))) }}">
|
||||||
|
{{ date('F', mktime(0, 0, 0, $month, 1)) }}
|
||||||
|
</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label>{{ __('Date') }}</label>
|
||||||
|
<input type="date" name="date" value="{{ date('Y-m-d') }}" id="date"
|
||||||
|
class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Amount') }}</label>
|
||||||
|
<input type="number" name="amount" readonly class="form-control amountInput"
|
||||||
|
placeholder="{{ __('Enter amount') }}">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mb-2">
|
||||||
|
<label class="required">{{ __('Payment Type') }}</label>
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="payment_type_id" id="payment_type_id" required class="form-control">
|
||||||
|
<option value="cash">{{ __('Cash') }}</option>
|
||||||
|
@foreach ($payment_types as $payment_type)
|
||||||
|
<option value="{{ $payment_type->id }}">{{ $payment_type->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 mb-2">
|
||||||
|
<label>{{ __('Note') }}</label>
|
||||||
|
<textarea name="note" id="note" class="form-control" placeholder="{{ __('Enter note') }}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="button-group text-center mt-5">
|
||||||
|
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||||
|
@usercan('payrolls.udpate')
|
||||||
|
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" value="{{ route('hrm.payrolls.getEmpAmount') }}" id="get-empAmount">
|
||||||
107
Modules/HrmAddon/resources/views/payrolls/index.blade.php
Normal file
107
Modules/HrmAddon/resources/views/payrolls/index.blade.php
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
@extends('layouts.business.master')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
{{ __('Payroll List') }}
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('main_content')
|
||||||
|
<div class="erp-table-section">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-bodys">
|
||||||
|
<div class="table-header p-16">
|
||||||
|
<h4>{{ __('Payroll List') }}</h4>
|
||||||
|
@usercan('payrolls.create')
|
||||||
|
<a type="button" href="#payrolls-create-modal" data-bs-toggle="modal" class="add-order-btn rounded-2"><i class="fas fa-plus-circle me-1"></i>{{ __('Add new Payroll') }}</a>
|
||||||
|
@endusercan
|
||||||
|
</div>
|
||||||
|
<div class="table-top-form p-16-0">
|
||||||
|
<div class="d-flex align-items-center gap-1 flex-wrap">
|
||||||
|
<form action="{{ route('hrm.payrolls.index') }}" method="GET" class="filter-form" table="#payrolls-data">
|
||||||
|
|
||||||
|
<div class="table-top-left d-flex gap-3 margin-lr-16 flex-wrap">
|
||||||
|
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="per_page" class="form-control">
|
||||||
|
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||||
|
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||||
|
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||||
|
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(auth()->user()->accessToMultiBranch())
|
||||||
|
<div class="gpt-up-down-arrow position-relative">
|
||||||
|
<select name="branch_id" class="form-control">
|
||||||
|
<option value="">{{ __('Select Branch') }}</option>
|
||||||
|
@foreach ($branches as $branch)
|
||||||
|
<option value="{{ $branch->id }}" @selected(request('branch_id') == $branch->id) >{{ $branch->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="table-search position-relative">
|
||||||
|
<input type="text" name="search" class="form-control" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||||
|
<span class="position-absolute">
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="gpt-up-down-arrow position-relative d-print-none employee-select">
|
||||||
|
<select name="employee" class="form-control custom-days">
|
||||||
|
<option value="">{{ __('Select employee') }}</option>
|
||||||
|
@foreach ($employees as $employee)
|
||||||
|
<option value="{{ $employee->id }}" @selected(request('employee') == $employee->id) >{{ $employee->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="gpt-up-down-arrow position-relative d-print-none">
|
||||||
|
<select name="month" class="form-control custom-days">
|
||||||
|
<option value=""> {{__('All month')}} </option>
|
||||||
|
@for ($month = 1; $month <= 12; $month++)
|
||||||
|
@php
|
||||||
|
$monthSlug = strtolower(date('F', mktime(0, 0, 0, $month, 1)));
|
||||||
|
@endphp
|
||||||
|
<option value="{{ $monthSlug }}">
|
||||||
|
{{ date('F', mktime(0, 0, 0, $month, 1)) }}
|
||||||
|
</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="delete-item delete-show d-none">
|
||||||
|
<div class="delete-item-show">
|
||||||
|
<p class="fw-bold"><span class="selected-count"></span> {{ __('items show') }}</p>
|
||||||
|
<button data-bs-toggle="modal" class="trigger-modal" data-bs-target="#multi-delete-modal" data-url="{{ route('hrm.payrolls.delete-all') }}">{{ __('Delete') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="payrolls-data">
|
||||||
|
@include('hrmaddon::payrolls.datas')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('modal')
|
||||||
|
@include('hrmaddon::component.delete-modal')
|
||||||
|
@include('hrmaddon::payrolls.create')
|
||||||
|
@include('hrmaddon::payrolls.edit')
|
||||||
|
@endpush
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<div class="responsive-table m-0">
|
||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Employee') }}</th>
|
||||||
|
<th class="text-start">{{ __('Date') }}</th>
|
||||||
|
<th class="text-start d-print-none">{{ __('Month') }}</th>
|
||||||
|
<th class="text-start">{{ __('Shift') }}</th>
|
||||||
|
<th class="text-start">{{ __('Time In') }}</th>
|
||||||
|
<th class="text-start">{{ __('Time Out') }}</th>
|
||||||
|
<th class="text-start">{{ __('Duration') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($attendances as $attendance)
|
||||||
|
<tr>
|
||||||
|
<td>{{ ($attendances->currentPage() - 1) * $attendances->perPage() + $loop->iteration }}</td>
|
||||||
|
<td class="text-start">{{ $attendance->employee->name ?? '' }}</td>
|
||||||
|
<td class="text-start">{{ formatted_date($attendance->date) }}</td>
|
||||||
|
<td class="text-start d-print-none">{{ ucfirst($attendance->month) }}</td>
|
||||||
|
<td class="text-start">{{ $attendance->shift->name ?? '' }}</td>
|
||||||
|
<td class="text-start">{{ formatted_time($attendance->time_in) }}</td>
|
||||||
|
<td class="text-start">{{ formatted_time($attendance->time_out) }}</td>
|
||||||
|
<td class="text-start">{{ formatTimeToWords($attendance->duration) }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ $attendances->links('vendor.pagination.bootstrap-5') }}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<table class="table" id="datatable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ __('SL') }}.</th>
|
||||||
|
<th class="text-start">{{ __('Employee') }}</th>
|
||||||
|
<th class="text-start">{{ __('Date') }}</th>
|
||||||
|
<th class="text-start">{{ __('Month') }}</th>
|
||||||
|
<th class="text-start">{{ __('Shift') }}</th>
|
||||||
|
<th class="text-start">{{ __('Time In') }}</th>
|
||||||
|
<th class="text-start">{{ __('Time Out') }}</th>
|
||||||
|
<th class="text-start">{{ __('Duration') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($attendances as $attendance)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $loop->iteration }}</td>
|
||||||
|
<td class="text-start">{{ $attendance->employee->name ?? '' }}</td>
|
||||||
|
<td class="text-start">{{ formatted_date($attendance->date) }}</td>
|
||||||
|
<td class="text-start">{{ ucfirst($attendance->month) }}</td>
|
||||||
|
<td class="text-start">{{ $attendance->shift->name ?? '' }}</td>
|
||||||
|
<td class="text-start">{{ formatted_time($attendance->time_in) }}</td>
|
||||||
|
<td class="text-start">{{ formatted_time($attendance->time_out) }}</td>
|
||||||
|
<td class="text-start">{{ formatTimeToWords($attendance->duration) }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user