Showing AI reviews for army
Project AI Score ?
67%
Quality Avg ?
72%
Security Avg ?
54%
Reviews ?
37

Review Result ?

jattin01/army · 1b9fc262
The commit adds a ComplaintReportExport class for exporting complaint data with filters, and adds helper functions related to staff leave balances in StaffController. The code appears functionally complete and uses proper Laravel constructs but lacks some input validation and proper commit messaging. The commit message is non-descriptive which reduces business value and trust. Filtering logic is straightforward but could benefit from type validation to reduce bug risk. Security can be improved by explicitly validating/sanitizing request inputs.
Quality ?
75%
Security ?
30%
Business Value ?
70%
Maintainability ?
78%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Non Descriptive
Where commit message
Issue / Evidence non-descriptive
Suggested Fix improve the commit message to describe the purpose and scope of changes clearly
Missing Validation
Where app/Exports/ComplaintReportExport.php:24
Issue / Evidence missing validation on request inputs
Suggested Fix add validation or sanitize inputs before using them in query builder to improve security and bug risk
Direct Request Property Use
Where app/Exports/ComplaintReportExport.php:40
Issue / Evidence direct request property use
Suggested Fix consider validating or casting inputs to expected types
Where Clause Using Null Or Empty String Ch...
Where app/Exports/ComplaintReportExport.php:56
Issue / Evidence where clause using null or empty string checks
Suggested Fix clarify data model assumptions or handle edge cases explicitly
Private Methods Lack Docblocks
Where app/Http/Controllers/Admin/StaffController.php:13
Issue / Evidence private methods lack docblocks
Suggested Fix add comments to describe method purpose improving maintainability
Staffleavedata Returns 3 Collections Or Ar...
Where app/Http/Controllers/Admin/StaffController.php:70
Issue / Evidence staffLeaveData returns 3 collections or array but signature not explicit
Suggested Fix consider adding typing or doc comment
Missing Validation
Where app/Http/Controllers/Admin/StaffController.php:91
Issue / Evidence no validation before processing leave balances
Suggested Fix validate input structure to avoid unexpected data
Usage Of In Array With Casting
Where app/Http/Controllers/Admin/StaffController.php:103
Issue / Evidence usage of in_array with casting
Suggested Fix ensure input casting is safe and consistent
Code Change Preview · app/Exports/ComplaintReportExport.php ?
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ <?php
+ 
+ namespace App\Exports;
+ 
+ use App\Models\Complaint;
+ use Maatwebsite\Excel\Concerns\FromCollection;
+ use Maatwebsite\Excel\Concerns\WithHeadings;
+ 
+ class ComplaintReportExport implements FromCollection, WithHeadings
+ {
+     protected $request;
+ 
+     public function __construct($request)
+     {
+         $this->request = $request;
+     }
+ 
+     public function collection()
Removed / Before Commit
- use App\Models\EmployeeCategory;
- use App\Models\Vertical;
- use App\Models\Group;
- use Illuminate\Support\Facades\Storage;
- use App\Imports\StaffImport;
- use Maatwebsite\Excel\Facades\Excel;
- 
- class StaffController extends Controller
- {
- // List all staff
- // public function index()
- // {
- $query->where(function($q) use ($searchTerm) {
- $q->where('name', 'LIKE', '%' . $searchTerm . '%')
- ->orWhere('employee_number', 'LIKE', '%' . $searchTerm . '%')
- ->orWhere('biometric', 'LIKE', '%' . $searchTerm . '%')
- ->orWhere('email', 'LIKE', '%' . $searchTerm . '%')
- ->orWhere('phone', 'LIKE', '%' . $searchTerm . '%');
Added / After Commit
+ use App\Models\EmployeeCategory;
+ use App\Models\Vertical;
+ use App\Models\Group;
+ use App\Models\Leave;
+ use App\Models\LeaveType;
+ use App\Models\StaffLeaveBalance;
+ use App\Services\LeaveValidationService;
+ use Illuminate\Support\Facades\Storage;
+ use App\Imports\StaffImport;
+ use Maatwebsite\Excel\Facades\Excel;
+ 
+ class StaffController extends Controller
+ {
+     private function normalizeLeaveCategory(?string $category): ?string
+     {
+         if (!$category) {
+             return null;
+         }
Removed / Before Commit
- 
- class AttendanceController extends Controller
- {
- /**
- * Show attendance list
- */
- /**
- * Upload and import attendance Excel
- */
-    public function upload(Request $request)
- {
- try {
-         // Validate file
- $request->validate([
-             'attendance_file' => 'required|mimes:xlsx,xls|max:5120' // max 5MB
- ], [
- 'attendance_file.required' => 'Please select an attendance file to upload.',
-             'attendance_file.mimes' => 'The file must be an Excel file (.xlsx or .xls).',
Added / After Commit
+ 
+ class AttendanceController extends Controller
+ {
+     private function normalizeCategory(?string $category): ?string
+     {
+         if (!$category) {
+             return null;
+         }
+ 
+         $category = strtolower(trim(str_replace('-', ' ', $category)));
+         $category = preg_replace('/\s+/', ' ', $category);
+ 
+         return match ($category) {
+             'industrial' => 'Industrial',
+             'non industrial' => 'Non Industrial',
+             'both' => 'Both',
+             default => trim($category),
+         };
Removed / Before Commit
- use App\Models\User;
- use App\Models\Group;
- use App\Models\ProductionYear;
- 
- class ComplaintController extends Controller
- {
- ]);
- }
- 
- 
- /**
- * Show pending complaints for admin approval
- 
- // Get all users grouped by group_id for assignment dropdowns
- $groupUsers = [];
- try {
- // Get all active groups
-             $groups = \App\Models\Group::where('status', '1')->get();
Added / After Commit
+ use App\Models\User;
+ use App\Models\Group;
+ use App\Models\ProductionYear;
+ use App\Exports\ComplaintReportExport;
+ use Maatwebsite\Excel\Facades\Excel;
+ 
+ class ComplaintController extends Controller
+ {
+ ]);
+ }
+ 
+     public function exportComplaintReport(Request $request)
+ {
+     return Excel::download(
+         new ComplaintReportExport($request),
+         'complaint-report.xlsx'
+     );
+ }
Removed / Before Commit
- namespace App\Http\Controllers;
- 
- use App\Models\Designation;
- use App\Models\LeaveType;
- use Illuminate\Http\Request;
- 
- class DesignationController extends Controller
- 
- public function create()
- {
-         $leaveTypes = LeaveType::all();
-         return view('designations.create', compact('leaveTypes'));
- }
- 
- public function store(Request $request)
- {
- $request->validate([
- 'name'=>'required|string|max:255',
Added / After Commit
+ namespace App\Http\Controllers;
+ 
+ use App\Models\Designation;
+ use Illuminate\Http\Request;
+ 
+ class DesignationController extends Controller
+ 
+ public function create()
+ {
+         return view('designations.create');
+ }
+ 
+ public function store(Request $request)
+ {
+ $request->validate([
+ 'name'=>'required|string|max:255',
+ ]);
+ 
Removed / Before Commit
- }
- };
- 
- /*
- |--------------------------------------------------------------------------
- | MAIN LIST : UNDER REPAIR equipments
- $sub->where('job_no', 'like', '%' . $request->job_number . '%');
- });
- })
- 
- // 🔍 Filter by Regd No
- ->when($request->filled('regd_no'), function ($q) use ($request) {
- ->filter()
- ->unique()
- ->values();
- 
-     return view('repairs.index', compact('repairs', 'jobNumbers', 'regdNos'));
- }
Added / After Commit
+ }
+ };
+ 
+   
+ 
+ /*
+ |--------------------------------------------------------------------------
+ | MAIN LIST : UNDER REPAIR equipments
+ $sub->where('job_no', 'like', '%' . $request->job_number . '%');
+ });
+ })
+        ->when($request->filled('equipment_name'), function ($q) use ($request) {
+ 
+             $q->whereHas('Equipments', function ($sub) use ($request) {
+ 
+                 $sub->where('name', $request->equipment_name);
+ 
+             });
Removed / Before Commit
- 'under_repair'             => 'UNDER REPAIR',
- 'under_wcn_process'        => 'UNDER WCN PROCESS',
- 'awaiting_collection'      => 'AWAITING COLLECTION',
- ];
- 
- if (isset($statusMap[$request->status])) {
- ]);
- }
- 
- /*
- |--------------------------------------------------------------------------
- | EXPORTS
- Carbon::parse(trim($end))->endOfDay(),
- ]);
- }
- 
- /*
- |--------------------------------------------------------------------------
Added / After Commit
+ 'under_repair'             => 'UNDER REPAIR',
+ 'under_wcn_process'        => 'UNDER WCN PROCESS',
+ 'awaiting_collection'      => 'AWAITING COLLECTION',
+                          'eqpt_collected'         => 'EQPT COLLECTED',
+ ];
+ 
+ if (isset($statusMap[$request->status])) {
+ ]);
+ }
+ 
+                 if ($request->filled('daterange') && str_contains($request->daterange, ' - ')) {
+ 
+                     [$start, $end] = explode(' - ', $request->daterange);
+ 
+                     $startDate = Carbon::parse(trim($start))->startOfDay();
+                     $endDate   = Carbon::parse(trim($end))->endOfDay();
+ 
+                     // EQPT COLLECTED => WCN Date
Removed / Before Commit
- use App\Models\Leave;
- use App\Models\Staff;
- use App\Models\LeaveType;
- 
- class LeaveApprovalController extends Controller
- {
- // public function index()
- // {
- //     $leaves = Leave::with(['employee.department', 'employee.designation', 'leaveType'])
- $status = $action === 'approve' ? 'approved' : 'rejected';
- 
- $updated = Leave::whereIn('id', $ids)
-                 ->where('approval_status', 'pending') // Only update pending approval status
- ->update([
- 'status' => $status,
- 'approval_status' => $status,
- return view('leave.past-leave-application', compact('employees', 'leaveTypes'));
- }
Added / After Commit
+ use App\Models\Leave;
+ use App\Models\Staff;
+ use App\Models\LeaveType;
+ use App\Models\Attendance;
+ use Illuminate\Support\Facades\Auth;
+ use Illuminate\Support\Facades\Validator;
+ 
+ class LeaveApprovalController extends Controller
+ {
+     private function normalizeCategory(?string $category): ?string
+     {
+         if (!$category) {
+             return null;
+         }
+ 
+         $category = strtolower(trim(str_replace('-', ' ', $category)));
+         $category = preg_replace('/\s+/', ' ', $category);
+ 
Removed / Before Commit
- use Carbon\Carbon;
- use Carbon\CarbonPeriod;
- use App\Services\LeaveValidationService;
- use Illuminate\Support\Facades\Log;
- 
- class LeaveController extends Controller
- {
- public function index() {
- $userdata = auth()->user();
- 
-         $employee = Staff::where('employee_number',$userdata->employee_number)->first();
- 
-         // Get employee category ID
-         $employeeCategoryId = $employee->employee_category_id;
-         $employeeGender = strtolower($employee->gender ?? '');
- 
- // Debug: Log employee details
- \Log::info('Index Employee Details:', [
Added / After Commit
+ use Carbon\Carbon;
+ use Carbon\CarbonPeriod;
+ use App\Services\LeaveValidationService;
+ use Illuminate\Support\Facades\DB;
+ use Illuminate\Support\Facades\Log;
+ 
+ class LeaveController extends Controller
+ {
+     private function normalizeCategory(?string $category): ?string
+     {
+         if (!$category) {
+             return null;
+         }
+ 
+         $category = strtolower(trim(str_replace('-', ' ', $category)));
+         $category = preg_replace('/\s+/', ' ', $category);
+ 
+         return match ($category) {
Removed / Before Commit
- 
- 
- public function index(Request $request)
- {
-     $query = LeaveType::query();
-     
-     // Get employee categories for filter dropdown
-     $employeeCategories = EmployeeCategory::where('is_active', 1)->get();
- 
-     // Apply filters
-     if ($request->filled('leave_category')) {
-         $selectedCategory = $request->leave_category;
-         $query->where('leave_category', 'LIKE', '%'.$selectedCategory.'%');
-     }
- 
-     if ($request->filled('gender')) {
-         $selectedGender = $request->gender;
-         if ($selectedGender === 'Male') {
Added / After Commit
+ 
+ 
+ public function index(Request $request)
+     {
+         $query = LeaveType::query();
+         
+         // Get employee categories for filter dropdown
+         $employeeCategories = EmployeeCategory::where('is_active', 1)->get();
+         $typeCategoryOptions = [
+             'Industrial' => 'Industrial',
+             'Non Industrial' => 'Non Industrial',
+             'Both' => 'Both'
+         ];
+ 
+         // Apply filters
+         if ($request->filled('type_category')) {
+             $selectedCategory = $request->type_category;
+             $query->where('leave_category', $selectedCategory);
Removed / Before Commit
- $query->where('percentage', $request->percentage);
- }
- 
- $spares = $query->paginate(20);
- 
- // Get draft entries (status = 1)
- $catPartNos = DB::table($tableName)->distinct()->pluck('cat_part_no');
- $nomenclatures = DB::table($tableName)->distinct()->pluck('nomenclature');
- $percentages = DB::table($tableName)->distinct()->pluck('percentage');
- 
- return view('demand.spares', compact(
- 'spares',
- 'nomenclatures',
- 'activeYear',
- 'percentages',
- 'draftPartNos' // ✅ send to view
- ));
- }
Added / After Commit
+ $query->where('percentage', $request->percentage);
+ }
+ 
+             // ✅ NEW FILTERS
+         if ($request->os_ser_no) {
+             $query->where('os_ser_no', 'LIKE', '%' . $request->os_ser_no . '%');
+         }
+ 
+         if ($request->material_no) {
+             $query->where('material_no', 'LIKE', '%' . $request->material_no . '%');
+         }
+ 
+ $spares = $query->paginate(20);
+ 
+ // Get draft entries (status = 1)
+ $catPartNos = DB::table($tableName)->distinct()->pluck('cat_part_no');
+ $nomenclatures = DB::table($tableName)->distinct()->pluck('nomenclature');
+ $percentages = DB::table($tableName)->distinct()->pluck('percentage');
Removed / Before Commit
- if ($request->filled('regd_no')) {
- $query->where('regd_no', 'like', '%' . $request->regd_no . '%');
- }
- 
- // Use paginate with query persistence
- $equipments = $query
- ->filter()
- ->unique()
- ->values();
- 
- $arccGroup = Group::where('name', 'ARCC')->first();
- $arccUsers = collect();
- if ($arccGroup) {
- $arccUsers = \App\Models\User::where('group_id', $arccGroup->id)->get();
- }
- 
-     return view('vir.index', compact('equipments', 'controlNumbers', 'regdNos','arccUsers'));
- }
Added / After Commit
+ if ($request->filled('regd_no')) {
+ $query->where('regd_no', 'like', '%' . $request->regd_no . '%');
+ }
+     if ($request->filled('equipment_name')) {
+ 
+     $query->whereHas('Equipments', function ($q) use ($request) {
+ 
+         $q->where('name', $request->equipment_name);
+ 
+     });
+ 
+ }
+ 
+ // Use paginate with query persistence
+ $equipments = $query
+ ->filter()
+ ->unique()
+ ->values();
Removed / Before Commit
- {
- // 🔹 Always available
- $jobNumbers = WorkOrder::whereHas('equipments', function ($q) {
-         $q->where('status', 'UNDER WCN PROCESS');
- })
- ->whereNotNull('job_no')
- ->pluck('job_no')
- if ($job) 
- {
- $equipments = $job->equipments()
-                 ->where('status', 'UNDER WCN PROCESS')
- ->whereNull('wcn_number')   // ✅ jinka wcn_number null hai
- ->get();
- }
Added / After Commit
+ {
+ // 🔹 Always available
+ $jobNumbers = WorkOrder::whereHas('equipments', function ($q) {
+         $q->where('status', 'INITATE TO WCN');
+ })
+ ->whereNotNull('job_no')
+ ->pluck('job_no')
+ if ($job) 
+ {
+ $equipments = $job->equipments()
+                 ->where('status', 'INITATE TO WCN')
+ ->whereNull('wcn_number')   // ✅ jinka wcn_number null hai
+ ->get();
+ }
Removed / Before Commit
- return redirect()->route('login');
- }
- 
- // Super Admin (no role): Allow all
-         if (empty($user->role)) {
- return $next($request);
- }
- 
- // Get menu ID by slug
- $menu = Menu::where('name', $menuSlug)->first();
Added / After Commit
+ return redirect()->route('login');
+ }
+ 
+         $username = strtolower($user->username ?? $user->name ?? '');
+         $isSuperAdmin = empty($user->role) && in_array($username, ['admin', 'superadmin'], true);
+ 
+ // Super Admin (no role): Allow all
+         if ($isSuperAdmin) {
+ return $next($request);
+ }
+ 
+         if (empty($user->role)) {
+             return response()->view('403', [], 403);
+         }
+ 
+ // Get menu ID by slug
+ $menu = Menu::where('name', $menuSlug)->first();
Removed / Before Commit
- 
- // Job Details
- 'location_name'        => $row['location_name'] ?? null,
- 'shift_id'             => $this->getShiftId($row['shift'] ?? null),
- 'department_id'        => $this->getDepartmentId($row['department'] ?? null),
- 'designation_id'       => $this->getDesignationId($row['designation'] ?? null),
- 'name' => $staff->name,
- 'email' => $staff->email,
- 'phone' => $staff->phone,
- 'designation' => $staff->designation?->name ?? '-',
- 'vertical' => $staff->vertical?->name ?? '-',
- 'group' => $staff->user?->group?->name ?? '-',
Added / After Commit
+ 
+ // Job Details
+ 'location_name'        => $row['location_name'] ?? null,
+                 'part_2_no'            => $this->convertToString($row['part_2_no'] ?? $row['part_2_number'] ?? null),
+ 'shift_id'             => $this->getShiftId($row['shift'] ?? null),
+ 'department_id'        => $this->getDepartmentId($row['department'] ?? null),
+ 'designation_id'       => $this->getDesignationId($row['designation'] ?? null),
+ 'name' => $staff->name,
+ 'email' => $staff->email,
+ 'phone' => $staff->phone,
+                 'part_2_no' => $staff->part_2_no ?? '-',
+ 'designation' => $staff->designation?->name ?? '-',
+ 'vertical' => $staff->vertical?->name ?? '-',
+ 'group' => $staff->user?->group?->name ?? '-',
Removed / Before Commit
- 'user_name',
- 'user_id',
- 'group_id',
- 'location',
- 'nature_of_complaint',
- 'complaint_description',
Added / After Commit
+ 'user_name',
+ 'user_id',
+ 'group_id',
+         'sub_group_id',
+ 'location',
+ 'nature_of_complaint',
+ 'complaint_description',
Removed / Before Commit
- 'registation_no',
- 'cos_sec',
- 'status',
- ];
- 
- public function workEquipment()
Added / After Commit
+ 'registation_no',
+ 'cos_sec',
+ 'status',
+         'qty_faulty',
+         'faulty_remarks'
+ ];
+ 
+ public function workEquipment()
Removed / Before Commit
- 'status',
- 'approval_status',
- 'leave_type',
-         'duration'
- ];
- 
- public function employee() {
Added / After Commit
+ 'status',
+ 'approval_status',
+ 'leave_type',
+         'duration',
+         'do_2_part_no'
+ ];
+ 
+ public function employee() {
Removed / Before Commit
- {
- return $this->belongsToMany(Designation::class, 'designation_leave_type', 'leave_type_id', 'designation_id');
- }
- }
Added / After Commit
+ {
+ return $this->belongsToMany(Designation::class, 'designation_leave_type', 'leave_type_id', 'designation_id');
+ }
+ 
+     public function staffLeaveBalances()
+     {
+         return $this->hasMany(StaffLeaveBalance::class, 'leave_type_id');
+     }
+ }
Removed / Before Commit
- 
- // Job Info
- 'location_name',
- 'shift_id',
- 'department_id',
- 'designation_id',
- 'level_id',
- 'pay_level',
- 'pay_cell',
- 'hra',
- 'da',
- 'extra_data',
- ];
- 
- protected $casts = [
- 'children_details' => 'array',
- 'dependent_details' => 'array',
- 'spouse_details' => 'array',
Added / After Commit
+ 
+ // Job Info
+ 'location_name',
+         'part_2_no',
+ 'shift_id',
+ 'department_id',
+ 'designation_id',
+ 'level_id',
+ 'pay_level',
+ 'pay_cell',
+         'retirementremark',
+ 'hra',
+ 'da',
+ 'extra_data',
+ 
+         'bank_name',
+ 'account_holder_name',
+ 'account_number',
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class StaffLeaveBalance extends Model
+ {
+     use HasFactory;
+ 
+     protected $fillable = [
+         'staff_id',
+         'leave_type_id',
+         'allocated_days',
+     ];
+ 
+     protected $casts = [
Removed / Before Commit
- /**
- * Bootstrap any application services.
- */
- public function boot(): void
- {
-     View::composer('*', function ($view) {
-         $user = Auth::user();
- 
-         if ($user && empty($user->role)) 
-         {
-             // Super Admin: show all menus
-             $menus = Menu::whereNull('parent_id')
-                 ->with(['children.children'])
-                 ->get();
-         } 
-         elseif ($user) 
-         {
- $roleId = $user->role;
Added / After Commit
+ /**
+ * Bootstrap any application services.
+ */
+ 	public function boot(): void
+ 	{
+ 	    View::composer('*', function ($view) {
+ 	        $user = Auth::user();
+             $defaultPersonalMenus = function () {
+                 return collect([
+                     (object) [
+                         'name' => 'My Leave',
+                         'icon' => '<i class="fas fa-calendar-check"></i>',
+                         'route' => 'leave',
+                         'children' => collect(),
+                     ],
+                     (object) [
+                         'name' => 'Attendance Calendar',
+                         'icon' => '<i class="fas fa-calendar-alt"></i>',
Removed / Before Commit
- use App\Models\LeaveType;
- use App\Models\Staff;
- use App\Models\Leave;
- use Carbon\Carbon;
- 
- class LeaveValidationService
- {
- /**
- * Validate if an employee can apply for a specific leave type
- * 
- }
- 
- // 5. Check leave balance
-         if ($leaveType->leave_count > 0) {
-             $currentYear = Carbon::now()->year;
- 
- // Calculate total leaves taken this year
- $leavesTaken = Leave::where('employee_id', $employee->id)
Added / After Commit
+ use App\Models\LeaveType;
+ use App\Models\Staff;
+ use App\Models\Leave;
+ use App\Models\StaffLeaveBalance;
+ use Carbon\Carbon;
+ 
+ class LeaveValidationService
+ {
+     public function getFinancialYearRange($date = null): array
+     {
+         $date = $date ? Carbon::parse($date) : Carbon::now();
+ 
+         return [
+             Carbon::create($date->year, 1, 1)->startOfDay(),
+             Carbon::create($date->year, 12, 31)->endOfDay(),
+         ];
+     }
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         Schema::create('staff_leave_balances', function (Blueprint $table) {
+             $table->id();
+             $table->foreignId('staff_id')->constrained('staff')->cascadeOnDelete();
+             $table->foreignId('leave_type_id')->constrained('leave_types')->cascadeOnDelete();
+             $table->decimal('allocated_days', 8, 2)->default(0);
+             $table->timestamps();
+ 
+             $table->unique(['staff_id', 'leave_type_id']);
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration {
+     public function up(): void
+     {
+         Schema::table('staff', function (Blueprint $table) {
+             if (!Schema::hasColumn('staff', 'part_2_no')) {
+                 $table->string('part_2_no')->nullable()->after('location_name');
+             }
+         });
+     }
+ 
+     public function down(): void
+     {
Removed / Before Commit
- </ul>
- </div>
- @endif
- 
- <div class="card-body p-4">
-                     <form action="{{ isset($staff) ? route('admin.staff.update', $staff->id) : route('admin.staff.store') }}"
-                         enctype="multipart/form-data" method="POST">
-                         @csrf
-                         @if (isset($staff))
-                             @method('PUT')
-                         @endif
- 
- <ul class="nav nav-tabs" id="staffTab" role="tablist">
- <li class="nav-item" role="presentation">
- </li>
- <li class="nav-item" role="presentation">
- <button class="nav-link" id="company-tab" data-bs-toggle="tab" data-bs-target="#company"
-                                     type="button">Company Relation</button>
Added / After Commit
+ </ul>
+ </div>
+ @endif
+                 <form action="{{ isset($staff) ? route('admin.staff.update', $staff->id) : route('admin.staff.store') }}"
+                 enctype="multipart/form-data" method="POST">
+                 @csrf
+                 @if (isset($staff))
+                     @method('PUT')
+                 @endif
+ <div class="card-body p-4">
+ 
+ 
+ <ul class="nav nav-tabs" id="staffTab" role="tablist">
+ <li class="nav-item" role="presentation">
+ </li>
+ <li class="nav-item" role="presentation">
+ <button class="nav-link" id="company-tab" data-bs-toggle="tab" data-bs-target="#company"
+                                     type="button">Unit Relation</button>
Removed / Before Commit
- <!-- Right Side: Filters + Add Button -->
- <div class="col-md-8 d-flex justify-content-end">
- {{-- <form method="GET" action="{{ route('admin.staff.index') }}" id="filterForm" class="d-flex me-2">
-                     
- <div class="me-2">
- <label class="form-label">Name</label>
- <select name="employee_name" class="form-select select2" id="employeeNameSelect">
- <label class="form-label">Search</label>
- <input type="text" name="search" class="form-control" placeholder="Emp-No, Biometric" value="{{ request('search') }}" oninput="setTimeout(() => this.form.submit(), 2000)">
- </div>
-                     
- <div class="me-2">
- <label class="form-label">Category</label>
- <select name="employee_category_id" class="form-select select2" onchange="$('#filterForm').submit()">
- </form> --}}
- {{-- <div class="d-flex align-items-end text-end justify-content-end col-md-4">
- <!-- Add Button -->
-                     
Added / After Commit
+ <!-- Right Side: Filters + Add Button -->
+ <div class="col-md-8 d-flex justify-content-end">
+ {{-- <form method="GET" action="{{ route('admin.staff.index') }}" id="filterForm" class="d-flex me-2">
+ 
+ <div class="me-2">
+ <label class="form-label">Name</label>
+ <select name="employee_name" class="form-select select2" id="employeeNameSelect">
+ <label class="form-label">Search</label>
+ <input type="text" name="search" class="form-control" placeholder="Emp-No, Biometric" value="{{ request('search') }}" oninput="setTimeout(() => this.form.submit(), 2000)">
+ </div>
+ 
+ <div class="me-2">
+ <label class="form-label">Category</label>
+ <select name="employee_category_id" class="form-select select2" onchange="$('#filterForm').submit()">
+ </form> --}}
+ {{-- <div class="d-flex align-items-end text-end justify-content-end col-md-4">
+ <!-- Add Button -->
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <!DOCTYPE html>
+ <html>
+ <head>
+     <meta charset="utf-8">
+     <title>Form of Leave Accounts - {{ $staff->name }}</title>
+     <style>
+         @page { size: A4 portrait; margin: 12mm; }
+         body { color: #111; font-family: "Times New Roman", serif; font-size: 13px; }
+         .sheet { max-width: 920px; margin: 0 auto; }
+         .center { text-align: center; }
+         .right { text-align: right; }
+         .bold { font-weight: 700; }
+         .title { font-size: 22px; text-decoration: underline; letter-spacing: .5px; margin: 0; }
+         .subtitle { font-size: 18px; text-decoration: underline; margin: 2px 0; }
+         .meta { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 14px; margin: 14px 0 10px; }
+         .meta div { white-space: nowrap; }
+         table { width: 100%; border-collapse: collapse; }
+         th, td { border-bottom: 1px solid #444; padding: 4px 6px; vertical-align: top; }
Removed / Before Commit
- <div class="row mb-4">
- <div class="col-12">
- <h5 class="mb-3"><i class="fa fa-users"></i> Family Details</h5>
-                 
- @if($staff->is_married && !empty($staff->spouse_details))
- <div class="mb-4">
- <h6 class="text-primary mb-3"><i class="fa fa-heart me-2"></i>Spouse Information</h6>
- <td>{{ $rawData['trade'] ?? 'N/A' }}</td>
- <td><strong>Employee Category</strong></td>
- <td>{{ $staff->employeeCategory?->name ?? 'N/A' }}</td>
-                                 
- </tr>
- <tr>
- <td width="20%"><strong>Category</strong></td>
- <td><strong>Designation</strong></td>
- <td>{{ $staff->designation?->name ?? 'N/A' }}</td>
- </tr>
- <tr>
Added / After Commit
+ <div class="row mb-4">
+ <div class="col-12">
+ <h5 class="mb-3"><i class="fa fa-users"></i> Family Details</h5>
+ 
+ @if($staff->is_married && !empty($staff->spouse_details))
+ <div class="mb-4">
+ <h6 class="text-primary mb-3"><i class="fa fa-heart me-2"></i>Spouse Information</h6>
+ <td>{{ $rawData['trade'] ?? 'N/A' }}</td>
+ <td><strong>Employee Category</strong></td>
+ <td>{{ $staff->employeeCategory?->name ?? 'N/A' }}</td>
+ 
+ </tr>
+ <tr>
+ <td width="20%"><strong>Category</strong></td>
+ <td><strong>Designation</strong></td>
+ <td>{{ $staff->designation?->name ?? 'N/A' }}</td>
+ </tr>
+                             <tr>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <style>
+     .attendance-calendar-wrap {
+         max-width: 1200px;
+     }
+ 
+     .attendance-filter-card {
+         background: #fff;
+         border: 1px solid #dee2e6;
+         border-radius: 6px;
+         padding: 16px;
+         margin-bottom: 18px;
+     }
+ 
+     .attendance-calendar-table {
+         table-layout: fixed;
Removed / Before Commit
- </div>
- 
- 
-         <form id="filterForm" method="GET" action="{{ route('attendance.index') }}" class="row g-2 align-items-end">
-             <div class="col-md-1">
-                 <label class="form-label">Shift</label>
-                 <select name="shift" class="form-select select2 filter-field">
-                     <option value="">All</option>
-                     @foreach($shifts as $shift)
-                     <option value="{{ $shift->id }}" {{ request('shift') == $shift->id ? 'selected' : '' }}>{{ $shift->name }}</option>
-                     @endforeach
-                 </select>
-             </div>
- 
-             <div class="col-md-2">
-                 <label class="form-label">Department</label>
-                 <select name="department" class="form-select select2 filter-field">
-                     <option value="">All</option>
Added / After Commit
+ </div>
+ 
+ 
+         <form id="filterForm"
+             method="GET"
+             action="{{ route('attendance.index') }}"
+             class="attendance-filter-card">
+ 
+             <div class="row g-3 align-items-end">
+ 
+                 <!-- Shift -->
+                 <div class="col-xl-2 col-lg-3 col-md-4">
+                     <label class="filter-label">Shift</label>
+                     <select name="shift" class="form-select select2 filter-field"  data-placeholder="All">
+                         <option value="" selected>All</option>
+                         @foreach($shifts as $shift)
+                             <option value="{{ $shift->id }}"
+                                 {{ request('shift') == $shift->id ? 'selected' : '' }}>
Removed / Before Commit
- <th>User Name</th>
- <th>Nature of Complaint</th>
- <th>Group</th>
- <th>Description</th>
- <th>Assign To</th>
- <th>Status</th>
- N/A
- @endif
- </td>
-                               <td>{{ $complaint->group->name ?? '-' }}</td>
- <td>{{ Str::limit($complaint->complaint_description, 50) }}</td>
- <td>
- <select class="form-select form-select-sm assign-user-select select2" 
- <button type="button" class="btn " onclick="openEquipmentModal({{ $complaint->id }}, 'edit')" title="Equipment">
- <i class="fas fa-tools text-black"></i>
- </button>
- @if($complaint->user_status && $complaint->user_remark)
- <!-- <button type="button" class="btn btn-sm" onclick="openResponseModal({{ $complaint->id }})" title="Resolver Response">
Added / After Commit
+ <th>User Name</th>
+ <th>Nature of Complaint</th>
+ <th>Group</th>
+                         <th>Sub Group</th>
+ <th>Description</th>
+ <th>Assign To</th>
+ <th>Status</th>
+ N/A
+ @endif
+ </td>
+                             <td>{{ $complaint->group->name ?? '-' }}</td>
+                             <td> <select class="form-select form-select-sm subgroup-select"
+         data-complaint-id="{{ $complaint->id }}">
+ 
+     <option value="">Select Sub Group</option>
+ 
+     @foreach($groups as $group)
+ 
Removed / Before Commit
- </div>
- <div class="field">
- <label>Sec:</label>
-                 <span class="field-value">{{ $complaint->natureOfComplaint->group->name ?? '' }}</span>
- </div>
- <div class="field">
- <label>Date:</label>
- 
- <div class="complaint-nature">
- <p><strong>Nature of Complaint:</strong> {{ $complaint->natureOfComplaint->name ?? '' }}</p>
- </div>
- 
- <div class="row">
Added / After Commit
+ </div>
+ <div class="field">
+ <label>Sec:</label>
+                 <span class="field-value">{{ 'WSG/'.$complaint->natureOfComplaint->group->name ?? '' }}</span>
+ </div>
+ <div class="field">
+ <label>Date:</label>
+ 
+ <div class="complaint-nature">
+ <p><strong>Nature of Complaint:</strong> {{ $complaint->natureOfComplaint->name ?? '' }}</p>
+               <p><strong>Complaint Description:</strong> {{ $complaint->complaint_description ?? '' }}</p>
+ </div>
+ 
+ <div class="row">
Removed / Before Commit
- <div class="card">
- <div class="card-header">
- <div class="row">
-                 <div class="col-md-9">
- <h4><i class="fas fa-chart-line pt-2 me-3"></i><strong>Complaint Report</strong></h4>
- </div>
- <div class="col-md-3" style="text-align:end">
- <a href="{{ url()->previous() }}" class="btn btn-secondary btn-sm">
- <i class="fas fa-arrow-left"></i> Back
- </a>
- </div>
- </div>
- 
- <!-- Filter Section -->
- 
- </select>
- </div>
- <div class="col-md-2">
Added / After Commit
+ <div class="card">
+ <div class="card-header">
+ <div class="row">
+                 <div class="col-md-6">
+ <h4><i class="fas fa-chart-line pt-2 me-3"></i><strong>Complaint Report</strong></h4>
+ </div>
+ <div class="col-md-3" style="text-align:end">
+ <a href="{{ url()->previous() }}" class="btn btn-secondary btn-sm">
+ <i class="fas fa-arrow-left"></i> Back
+ </a>
+ </div>
+                 <div class="col-md-3" style="text-align:end">
+                     <button class="btn btn-success" id="downloadexportExcel">
+                         <i class="fas fa-file-excel"></i> Export Excel
+                     </button>
+                 </div>
+ </div>
+ 
Removed / Before Commit
- {{-- <button type="button" class="btn btn-sm btn-warning" onclick="quickApprove({{ $complaint->id }})">
- <i class="fas fa-bolt"></i> Quick
- </button> --}}
-                                         {{-- <button type="button" class="btn " onclick="rejectComplaint({{ $complaint->id }})">
-                                             <i class="fas fa-times text-danger"></i> 
-                                         </button> --}}
- 
- </div>
- </td>
- </div>
- </div>
- 
- <!-- Bulk Approval Modal -->
- <div class="modal fade" id="bulkApprovalModal" tabindex="-1" aria-labelledby="bulkApprovalModalLabel" aria-hidden="true">
- <div class="modal-dialog">
- }
- }
- 
Added / After Commit
+ {{-- <button type="button" class="btn btn-sm btn-warning" onclick="quickApprove({{ $complaint->id }})">
+ <i class="fas fa-bolt"></i> Quick
+ </button> --}}
+                                        <button type="button" class="btn" onclick="openRejectModal({{ $complaint->id }})">
+     <i class="fas fa-times text-danger"></i>
+ </button>
+ 
+ </div>
+ </td>
+ </div>
+ </div>
+ 
+ <!-- Reject Modal -->
+ <div class="modal fade" id="rejectModal" tabindex="-1" aria-labelledby="rejectModalLabel" aria-hidden="true">
+     <div class="modal-dialog">
+         <div class="modal-content">
+             <div class="modal-header">
+                 <h5 class="modal-title" id="rejectModalLabel">Reject Complaint</h5>
Removed / Before Commit
- <th>Description</th>
- <th>Approved At</th>  
- <th>Assigned To</th>
-                         <th>Status</th>
- <th>User Status</th>
- <th>Actions</th>
- </tr>
- {{ ucfirst($complaint->complaint_status) }}
- </span>
- </td>
- <td>
- @if($complaint->user_status)
- <span class="badge bg-{{ $complaint->user_status_color }}">
Added / After Commit
+ <th>Description</th>
+ <th>Approved At</th>  
+ <th>Assigned To</th>
+                         <th>Complaint Status</th>
+                         <th>Admin Status</th>
+ <th>User Status</th>
+ <th>Actions</th>
+ </tr>
+ {{ ucfirst($complaint->complaint_status) }}
+ </span>
+ </td>
+                            <td>
+     <span class="badge bg-{{
+         $complaint->admin_status == 'approved'
+             ? 'success'
+             : ($complaint->admin_status == 'rejected'
+                 ? 'danger'
+                 : 'warning')
Removed / Before Commit
- <div class="col-md-12" style="height:450px;!important">
- <div class="chart-container" style="position: relative;height:400px;!important">
- <div class="d-flex" style="justify-content:center">
-               <div><h6 class="mb-3"><strong>Monthly Repair State {{ \App\Models\MasterLogo::first()->name }}</strong></h6></div>
- </div>
- <canvas id="comparisonChart" style="height:400px;!important"></canvas>
- </div>
Added / After Commit
+ <div class="col-md-12" style="height:450px;!important">
+ <div class="chart-container" style="position: relative;height:400px;!important">
+ <div class="d-flex" style="justify-content:center">
+               <div><h6 class="mb-3"><strong>Monthly Repair State 510</strong></h6></div>
+ </div>
+ <canvas id="comparisonChart" style="height:400px;!important"></canvas>
+ </div>
Removed / Before Commit
- <div class="row" style="margin-top:20px">
- <form method="GET" action="{{ route('demand.spares', $equipment->id) }}" class="mb-1" id="filterForm">
- <div class="row">
- <div class="col-md-3">
- <label for="cos_sec">COS Sec</label>
- <select name="cos_sec" class="form-control select2 auto-submit">
Added / After Commit
+ <div class="row" style="margin-top:20px">
+ <form method="GET" action="{{ route('demand.spares', $equipment->id) }}" class="mb-1" id="filterForm">
+ <div class="row">
+                 <div class="col-md-3">
+                     <label for="os_ser_no">OS Ser No</label>
+                     <select name="os_ser_no" class="form-control select2 auto-submit">
+                         <option value="">-- Select --</option>
+                         @foreach($osSerNos as $os)
+                             <option value="{{ $os }}" {{ request('os_ser_no') == $os ? 'selected' : '' }}>
+                                 {{ $os }}
+                             </option>
+                         @endforeach
+                     </select>
+                 </div>
+ 
+                 <div class="col-md-3">
+                     <label for="material_no">Material No</label>
+                     <select name="material_no" class="form-control select2 auto-submit">
Removed / Before Commit
- </div>
- </div>
- 
-             <div class="mb-3">
-     <label>Assign Leave Types</label>
-     <select name="leave_types[]" class="form-select select2 select2-hidden-accessible" multiple>
-         @foreach($leaveTypes as $lt)
-             <option value="{{ $lt->id }}" {{ isset($selectedLeaves) && in_array($lt->id, $selectedLeaves) ? 'selected' : '' }}>
-                 {{ $lt->leave_name }}
-             </option>
-         @endforeach
-     </select>
- </div>
- 
- <div>
- <button type="submit" class="btn btn-success">{{ isset($designation) ? 'Update' : 'Save' }}</button>
- <a href="{{ route('designations.index') }}" class="btn btn-secondary">Cancel</a>
Added / After Commit
+ </div>
+ </div>
+ 
+ <div>
+ <button type="submit" class="btn btn-success">{{ isset($designation) ? 'Update' : 'Save' }}</button>
+ <a href="{{ route('designations.index') }}" class="btn btn-secondary">Cancel</a>
Removed / Before Commit
- <th>Name</th>
- <th>Code</th>
- <th>Status</th>
-                             <th>Leave Types</th>
- <th width="120">Actions</th>
- </tr>
- </thead>
- 
- </td>
- 
-                             <td>
-                                 @foreach($des->leaveTypes as $lt)
-                                 <span class="badge bg-info">{{ $lt->leave_name }}</span>
-                                 @endforeach
-                             </td>
- <td>
- <a href="{{ route('designations.edit',$des->id) }}"><i class="fas fa-pencil ms-2"></i></a>
- <!-- <form action="{{ route('designations.destroy',$des->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Delete?')">
Added / After Commit
+ <th>Name</th>
+ <th>Code</th>
+ <th>Status</th>
+ <th width="120">Actions</th>
+ </tr>
+ </thead>
+ 
+ </td>
+ 
+ <td>
+ <a href="{{ route('designations.edit',$des->id) }}"><i class="fas fa-pencil ms-2"></i></a>
+ <!-- <form action="{{ route('designations.destroy',$des->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Delete?')">
+ </tr>
+ @empty
+ <tr>
+                             <td colspan="5" class="text-center">No designations found.</td>
+ </tr>
+ @endforelse
Removed / Before Commit
- 'sub_eqpt' => $subEquipments,
- 'control_number' => $controlNumbers,
- ];
-                                 $statuses = ['AWAITING JOB NO','UNDER VIR','AWAITING QC CONTROL NO', 'UNDER REPAIR', 'UNDER WCN PROCESS', 'AWAITING COLLECTION', 'VIR REJECTED'];
- @endphp
- @foreach ($filters as $field => $options)
- <div class="col-md-2 mt-3">
- @endforeach
- </select>
- </div>
-                             <!-- <div class="col-md-2 mt-3">
- <label class="form-label">Date Range</label>
- <input type="text" class="form-control" name="daterange" id="daterange"
- value="{{ request('daterange') }}" placeholder="Date range">
-                             </div> -->
- <div class="col-md-2 mt-3">
- <label class="form-label d-block">&nbsp;</label>
- <button type="submit" class="btn btn-search" style="color:white">Search</button>
Added / After Commit
+ 'sub_eqpt' => $subEquipments,
+ 'control_number' => $controlNumbers,
+ ];
+                                 $statuses = ['AWAITING JOB NO','UNDER VIR','AWAITING QC CONTROL NO', 'UNDER REPAIR', 'UNDER WCN PROCESS', 'AWAITING COLLECTION',  'EQPT COLLECTED','VIR REJECTED'];
+ @endphp
+ @foreach ($filters as $field => $options)
+ <div class="col-md-2 mt-3">
+ @endforeach
+ </select>
+ </div>
+                             <div class="col-md-2 mt-3">
+ <label class="form-label">Date Range</label>
+ <input type="text" class="form-control" name="daterange" id="daterange"
+ value="{{ request('daterange') }}" placeholder="Date range">
+                             </div>
+ <div class="col-md-2 mt-3">
+ <label class="form-label d-block">&nbsp;</label>
+ <button type="submit" class="btn btn-search" style="color:white">Search</button>
Removed / Before Commit
- 
- <div class="card-body">
- <!-- Filter Form -->
-         <div class="row py-3 align-items-center">
-             <div class="col-md-5 ">
-                 <h4><b>Generate Gate Pass</b></h4>
-             </div>
-             <div class="col-md-7">
-                 <form method="GET" action="{{ route('gatepass.index') }}" class="row g-3 justify-content-end ">
-                     <div class="col-md-2">
-                         <label>Status</label>
-                         <select name="commit_status" class="form-control select2">
-                             <option value="">-- All --</option>
-                             <option value="1" {{ request('commit_status') == '1' ? 'selected' : '' }}>
-                                 Committed
-                             </option>
-                             <option value="0" {{ request('commit_status') == '0' ? 'selected' : '' }}>
-                                 Not Committed
Added / After Commit
+ 
+ <div class="card-body">
+ <!-- Filter Form -->
+        <form method="GET" action="{{ route('gatepass.index') }}" class="container-fluid">
+ 
+     <div class="row align-items-end g-3 py-3">
+ 
+         <div class="col-md-3">
+             <h4 class="mb-0"><b>Generate Gate Pass</b></h4>
+         </div>
+ 
+         <div class="col-md-3">
+             <label class="form-label">Status</label>
+             <select name="commit_status" class="form-control select2">
+                 <option value="">-- All --</option>
+ 
+                 <option value="1"
+                     {{ request('commit_status') == '1' ? 'selected' : '' }}>
Removed / Before Commit
- <!-- Filters -->
- <div class="col-md-2">
- <label class="form-label">Type Category</label>
-                             <select id="leaveCategoryFilter" class="form-control select2">
-                                 
-                                 @foreach ($employeeCategories as $category)
-                                     <option value="{{ $category->id }}"
-                                         {{ request('leave_category') == $category->id ? 'selected' : '' }}>
-                                         {{ $category->name }}</option>
- @endforeach
- </select>
- </div>
- 
- <div class="col-md-1">
- <label class="form-label">Gender</label>
-                             <select id="genderFilter" class="form-control select2">
-                                 
- <option value="Male" {{ request('gender') == 'Male' ? 'selected' : '' }}>Male</option>
Added / After Commit
+ <!-- Filters -->
+ <div class="col-md-2">
+ <label class="form-label">Type Category</label>
+                             <select name="type_category" class="form-control select2 filter-field">
+                                 <option value="">All</option>
+                                 @foreach ($typeCategoryOptions as $key => $label)
+                                     <option value="{{ $key }}"
+                                         {{ request('type_category') == $key ? 'selected' : '' }}>
+                                         {{ $label }}
+                                     </option>
+ @endforeach
+ </select>
+ </div>
+ 
+ <div class="col-md-1">
+ <label class="form-label">Gender</label>
+                             <select name="gender" class="form-control select2 filter-field">
+                                 <option value="">All</option>
Removed / Before Commit
- success: function(response) {
- if (response.success) {
- showResponseModal('success', 'Success!', response.message, function() {
-                             location.reload(); // Reload to show updated data
- });
- } else {
- showResponseModal('error', 'Error!', response.message);
- }
Added / After Commit
+ success: function(response) {
+ if (response.success) {
+ showResponseModal('success', 'Success!', response.message, function() {
+                             window.location.reload();
+ });
+                         setTimeout(function() {
+                             window.location.reload();
+                         }, 1200);
+ } else {
+ showResponseModal('error', 'Error!', response.message);
+ }
Removed / Before Commit
- 
- </div>
- <hr>
- <!-- Leave Balance -->
- <div class="row my-3 px-3 ">
- @foreach($leaveBalance as $balance)
- </div>
- </div>
- </div>
- @endsection
- \ No newline at end of file
Added / After Commit
+ 
+ </div>
+ <hr>
+     @if(session('error') || isset($error))
+         <div class="alert alert-danger mx-3">
+             {{ session('error') ?? $error }}
+         </div>
+     @endif
+ <!-- Leave Balance -->
+ <div class="row my-3 px-3 ">
+ @foreach($leaveBalance as $balance)
+ </div>
+ </div>
+ </div>
+ \ No newline at end of file
+ @endsection
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="container-fluid">
+     <div class="d-flex justify-content-between align-items-center mb-3">
+         <h4 class="mb-0"><i class="fas fa-file-signature"></i> Leave Part 2 No</h4>
+     </div>
+ 
+     @if(session('success'))
+         <div class="alert alert-success alert-dismissible fade show" role="alert">
+             {{ session('success') }}
+             <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
+         </div>
+     @endif
+ 
+     @if(session('error'))
+         <div class="alert alert-danger alert-dismissible fade show" role="alert">
+             {{ session('error') }}
Removed / Before Commit
- allowClear: true
- });
- 
- // Employee selection change
- $('#employeeSelect').on('change', function() {
- const employeeId = $(this).val();
- const fromDate = $('#fromDate').val();
- const toDate = $('#toDate').val();
- 
-         if (!employeeId || !fromDate || !toDate) {
-             Swal.fire({
-                 icon: 'warning',
-                 title: 'Missing Information',
-                 text: 'Please select employee and date range first.',
-                 confirmButtonColor: '#3085d6'
-             });
-             return;
-         }
Added / After Commit
+ allowClear: true
+ });
+ 
+     function setDefaultCalendarFilters() {
+         if (!$('#employeeSelect').val()) {
+             const firstEmployeeId = $('#employeeSelect option[value!=""]').first().val();
+ 
+             if (firstEmployeeId) {
+                 $('#employeeSelect').val(firstEmployeeId).trigger('change.select2');
+                 loadEmployeeDetails(firstEmployeeId);
+                 loadLeaveTypesByEmployee(firstEmployeeId);
+             }
+         }
+ 
+         if (!$('#fromDate').val()) {
+             $('#fromDate').val("{{ now()->startOfMonth()->toDateString() }}");
+         }
+ 
Removed / Before Commit
- <hr>
- 
- <div class="table-responsive">
-                 <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th>Sr. No</th>
- 
- <!-- 🔹 BODY -->
- <div class="modal-body">
- 
- <!-- 🔹 TABLE -->
- <div class="table-responsive">
- <!-- JS se fill hoga -->
- </tbody>
- 
-                     <!-- 🔹 OPTIONAL TOTAL ROW -->
-                     <!-- <tfoot>
Added / After Commit
+ <hr>
+ 
+ <div class="table-responsive">
+                 <table class="table table-bordered table-striped" id="mcoReportTable">
+ <thead>
+ <tr>
+ <th>Sr. No</th>
+ 
+ <!-- 🔹 BODY -->
+ <div class="modal-body">
+ <div class="d-flex justify-content-end mb-2">
+     <button class="btn btn-success btn-sm" onclick="exportModalTable()">
+         <i class="fas fa-file-excel"></i> Export Excel
+     </button>
+ </div>
+ 
+ <!-- 🔹 TABLE -->
+ <div class="table-responsive">
Removed / Before Commit
- <th>Qty Demaned</th>
- <th>Qty Approved</th>
- <th>Qty Received</th>
- <!-- <th>Action</th> -->
- </tr>
- </thead>
- <td>{{ $spare->qty_demanded }}</td>
- <td>{{$approved?->qty_demanded ?? 'Requisition Approval Pending'}}</td>
- <td>{{$received ?? 0}}</td>
- </tr>
- @endif
- @empty
- </div>
- </div>
- </div>
- @endsection
Added / After Commit
+ <th>Qty Demaned</th>
+ <th>Qty Approved</th>
+ <th>Qty Received</th>
+                         <th>Qty Faulty</th>
+                         <th>Action</th>
+ <!-- <th>Action</th> -->
+ </tr>
+ </thead>
+ <td>{{ $spare->qty_demanded }}</td>
+ <td>{{$approved?->qty_demanded ?? 'Requisition Approval Pending'}}</td>
+ <td>{{$received ?? 0}}</td>
+                                 <td>
+     @if(($spare->qty_faulty ?? 0) > 0)
+         <span class="badge bg-danger">
+             {{ $spare->qty_faulty }}
+         </span>
+     @else
+         0
Removed / Before Commit
- <i class="fa fa-print"  style="color: #008cff;background:white"></i>
- </a>
- @endif
- </td>
- </tr>
- @endforeach
Added / After Commit
+ <i class="fa fa-print"  style="color: #008cff;background:white"></i>
+ </a>
+ @endif
+                                 @if($row->status != 'cancelled')
+                                     <form action="{{ route('demand.cancel', encrypt($row->req_no)) }}"
+                                         method="POST"
+                                         style="display:inline-block;"
+                                         onsubmit="return confirm('Are you sure you want to cancel this demand?')">
+ 
+                                         @csrf
+ 
+                                         <button type="submit"
+                                                 style="border:none;background:none;padding:0;"
+                                                 title="Cancel Demand">
+ 
+                                             <i class="fa fa-times text-danger"></i>
+                                         </button>
+                                     </form>
Removed / Before Commit
- </div>
- <div class="col-md-6">
- <form method="GET" action="{{ route('repairs.index') }}" id="filterForm" class="mb-1">
-     <div class="row align-items-end">
-         <div class="col-md-6">
-             <label for="Job_number" class="form-label">Job Number</label>
-             <select name="job_number" class="form-control  filter-auto select2">
-                 <option value="">-- Select Job Number --</option>
-                 @foreach ($jobNumbers as $job)
-                     <option value="{{ $job }}" {{ request('job_number') == $job ? 'selected' : '' }}>
-                         {{ $job }}
-                     </option>
-                 @endforeach
-             </select>
-         </div>
- 
-         <div class="col-md-6">
-             <label for="regd_no" class="form-label">Regd No</label>
Added / After Commit
+ </div>
+ <div class="col-md-6">
+ <form method="GET" action="{{ route('repairs.index') }}" id="filterForm" class="mb-1">
+                     <div class="row align-items-end">
+                         <div class="col-md-4">
+                             <label for="equipment_name" class="form-label">
+                                 Equipment Name
+                             </label>
+ 
+                             <select name="equipment_name"
+                                 class="form-control filter-auto select2">
+ 
+                                 <option value="">-- Select Equipment --</option>
+ 
+                                 @foreach ($equipmentNames as $equipment)
+ 
+                                     <option value="{{ $equipment }}"
+                                         {{ request('equipment_name') == $equipment ? 'selected' : '' }}>
Removed / Before Commit
- 
- @section('content')
- <div class="card">
-         <!-- <div class="card-header py-3">
-             <div class="row align-items-center">
-                 <div class="col-md-5">
-                     <h4><b>Staff Management</b></h4>
-                 </div>
-                 <div class="col-md-7">
-                     <div class="d-flex justify-content-end">
-                         <a href="{{ route('admin.staff.create') }}">
-                             <button class="btn btn-primary mb-3">Add Staff</button>
-                         </a>
-                     </div>
-                 </div>
-             </div>
-         </div> -->
- 
Added / After Commit
+ 
+ @section('content')
+ <div class="card">
+        
+ 
+ <div class="card-header py-3">
+ <div class="row align-items-end">
+ <div>
+ <label class="form-label fw-bold">Search</label>
+ </div>
+                             <input type="text"
+        name="search"
+        class="form-control"
+        placeholder="Emp-No, Biometric"
+        value="{{ request('search') }}"
+        id="searchInput"
+        style="min-width: 200px;">
+ </div>
Removed / Before Commit
- @if(Str::contains(strtolower($order->c_n), 'crc'))
- <div style="width: 74%;"><strong>WORK ORDER NO:</strong> {{$order->control_no}}</div>
- @else
-     <div style="width: 74%;"><strong>WORK ORDER NO:</strong> {{$order->id}}</div>
- @endif
-     <div style="width: 26%;"><strong>WO DATE:</strong> {{ date('d-M-Y',strtotime($order->created_at)) }}</div>
- </div>
- @php
- $totalManHours = 0;
Added / After Commit
+ @if(Str::contains(strtolower($order->c_n), 'crc'))
+ <div style="width: 74%;"><strong>WORK ORDER NO:</strong> {{$order->control_no}}</div>
+ @else
+     <div style="width: 74%;"><strong>WORK ORDER NO:</strong> {{$order?->equipment?->unit_wo_no}}</div>
+ @endif
+     <div style="width: 26%;"><strong>WO DATE:</strong> {{ date('d-M-Y',strtotime($order?->equipment?->unit_wo_date)) }}</div>
+ </div>
+ @php
+ $totalManHours = 0;
Removed / Before Commit
- 
- {{-- Control Number --}}
- <div>
- <label for="control_number" class="form-label mb-1">Control Number</label>
- <select name="control_number" class="form-select select2 filter-change" style="min-width:180px">
- <option value="">-- All Control Numbers --</option>
- </div>
- 
- <hr>
- 
- <div class="card-body">
- <div class="container-fluid">
- <table class="table table-bordered table-striped" id="example">
- <thead class="table-primary">
- <tr>
- <th>Unit</th>
- <th>WKSP</th>
- <!-- <th>Command</th> -->
Added / After Commit
+ 
+ {{-- Control Number --}}
+ <div>
+     <label for="equipment_name" class="form-label mb-1">
+         Equipment Name
+     </label>
+ 
+     <select name="equipment_name"
+         class="form-select select2 filter-change"
+         style="min-width:180px">
+ 
+         <option value="">-- All Equipment --</option>
+ 
+         @foreach($equipmentNames as $name)
+ 
+             <option value="{{ $name }}"
+                 {{ request('equipment_name') == $name ? 'selected' : '' }}>
+ 
Removed / Before Commit
- @if(count($committedData))
- @foreach($committedData as $equipment)
- <tr>
- <td>{{ $equipment->group?->name }}</td>
- <td>{{ $equipment->Equipments?->name ?: $equipment->main_eqpt }}</td>
- <td>{{ $equipment->assy }}</td>
- <td>{{ $equipment->Equipments?->name ? $equipment->quantity : $equipment->qcInspection?->mr?->quantity }}</td>
- <td>{{ $equipment->wcn_number }}</td>
- <td>{{ $equipment->wcn_date }}</td>
Added / After Commit
+ @if(count($committedData))
+ @foreach($committedData as $equipment)
+ <tr>
+             <td>{{ $equipment?->workOrder?->job_no }}</td>
+             <td>{{ date('d-m-Y',strtotime($equipment?->workOrder?->job_date)) }}</td>
+ <td>{{ $equipment->group?->name }}</td>
+ <td>{{ $equipment->Equipments?->name ?: $equipment->main_eqpt }}</td>
+ <td>{{ $equipment->assy }}</td>
+             <td>{{ $equipment->regd_no }}</td>
+             <td>{{ strtoupper($equipment->type ?? '-') }}</td>
+ <td>{{ $equipment->Equipments?->name ? $equipment->quantity : $equipment->qcInspection?->mr?->quantity }}</td>
+ <td>{{ $equipment->wcn_number }}</td>
+ <td>{{ $equipment->wcn_date }}</td>
Removed / Before Commit
- <thead class="table-secondary">
- <tr>
- <th><input type="checkbox" id="selectAll"></th>
- <th>Group</th>
- <th>Main Eqpt</th>
- <th>Sub Assy</th>
- <th>Qty</th>
- <th>QC Insepection Status</th>
- <th>QC Inspection Date</th>
- @foreach($equipments as $equipment)
- <tr>
- <td><input type="checkbox" name="equipment_ids[]" value="{{ $equipment->id }}"></td>
- <td>{{ $equipment->group?->name }}</td>
- @if(Str::contains(strtolower($equipment->workOrder->c_n), 'crc'))
- <td>{{ $equipment->CrcEquipments?->equipment_name ?? '-' }}</td>
- <td>{{ $equipment->Equipments?->name ? $equipment->Equipments?->name : $equipment->main_eqpt  }}</td>
- <td>{{ $equipment->assy }}</td>
- @endif
Added / After Commit
+ <thead class="table-secondary">
+ <tr>
+ <th><input type="checkbox" id="selectAll"></th>
+                             <th>Job No </th>
+                             <th>Job Date </th>
+ <th>Group</th>
+ <th>Main Eqpt</th>
+ <th>Sub Assy</th>
+                             <th>Regd No</th>
+                             <th>Type</th>
+ <th>Qty</th>
+ <th>QC Insepection Status</th>
+ <th>QC Inspection Date</th>
+ @foreach($equipments as $equipment)
+ <tr>
+ <td><input type="checkbox" name="equipment_ids[]" value="{{ $equipment->id }}"></td>
+                             <td>{{ $equipment?->workOrder?->job_no }}</td>
+                             <td>{{ date('d-m-Y',strtotime($equipment?->workOrder?->job_date)) }}</td>
Removed / Before Commit
- @endif
- <td>{{$equip?->regd_no}}</td>
- <td>{{$equip?->quantity}}</td>
-         <td>{{$equip?->type}}</td>
- <td>✔</td>
- </tr>
- @endforeach
Added / After Commit
+ @endif
+ <td>{{$equip?->regd_no}}</td>
+ <td>{{$equip?->quantity}}</td>
+         <td>{{ strtoupper($equip?->type) }}</td>
+ <td>✔</td>
+ </tr>
+ @endforeach
Removed / Before Commit
- @foreach($committedData as $equipment)
- <tr>
- <td>{{ $equipment->group?->name }}</td>
- <td>{{ $equipment->main_eqpt }}</td>
- <td>{{ $equipment->assy }}</td>
- <td>{{ $equipment->quantity }}</td>
- <td>{{ $equipment->wcn_number }}</td>
- <td>{{ $equipment->wcn_date }}</td>
Added / After Commit
+ @foreach($committedData as $equipment)
+ <tr>
+     <td>{{ $equipment?->workOrder?->job_no }}</td>
+     <td>{{ date('d-m-Y',strtotime($equipment?->workOrder?->job_date)) }}</td>
+ <td>{{ $equipment->group?->name }}</td>
+ <td>{{ $equipment->main_eqpt }}</td>
+ <td>{{ $equipment->assy }}</td>
+     <td>{{ $equipment->regd_no }}</td>
+     <td>{{ strtoupper($equipment->type ?? '-') }}</td>
+ <td>{{ $equipment->quantity }}</td>
+ <td>{{ $equipment->wcn_number }}</td>
+ <td>{{ $equipment->wcn_date }}</td>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ 
+ @if ($errors->any())
+     <div class="alert alert-danger">
+         <strong>Whoops!</strong> Please fix the following:
+         <ul>
+             @foreach ($errors->all() as $error)
+                 <li>{{ $error }}</li>
+             @endforeach
+         </ul>
+     </div>
+ @endif
+ 
+ 
+  <div class="card">
+     <div class="card-header py-3">
Removed / Before Commit
- Route::post('/crc/repairs/{id}/iv-entry', [CrcRepairController::class, 'saveIvEntry'])->name('crc.repairs.iv-entry');
- 
- Route::prefix('admin')->name('admin.')->group(function() {
- Route::resource('staff', \App\Http\Controllers\Admin\StaffController::class);
- 
- Route::get('staffshow/{id}', [\App\Http\Controllers\Admin\StaffController::class, 'showstaff'])->name('staff.show');
- Route::get('/demand-approval/details', [ProductionDemandController::class, 'details'])->name('demand.approve.details');
- Route::get('/previous-demands/{req_no}', [ProductionDemandController::class, 'previousdetailsdata'])
- ->name('previous.demands.details');
- 
- 
- Route::prefix('mco-demands')->name('mco.demands.')->group(function () {
- Route::delete('/{id}', [LeaveController::class, 'destroy'])->name('leave.destroy');
- Route::post('/get-leave-types-with-balance', [LeaveController::class, 'getLeaveTypesWithBalance'])->name('leave.get-leave-types-with-balance');
- });
- Route::get('leave-approve', [LeaveApprovalController::class, 'index'])->name('leave.approve.index');
- Route::post('leave-approve/{id}/approve', [LeaveApprovalController::class, 'approve'])->name('leave.approve');
- Route::post('leave-approve/{id}/reject', [LeaveApprovalController::class, 'reject'])->name('leave.reject');
Added / After Commit
+ Route::post('/crc/repairs/{id}/iv-entry', [CrcRepairController::class, 'saveIvEntry'])->name('crc.repairs.iv-entry');
+ 
+ Route::prefix('admin')->name('admin.')->group(function() {
+             Route::get('staff/{id}/leave-print', [\App\Http\Controllers\Admin\StaffController::class, 'leavePrint'])->name('staff.leave-print');
+ Route::resource('staff', \App\Http\Controllers\Admin\StaffController::class);
+ 
+ Route::get('staffshow/{id}', [\App\Http\Controllers\Admin\StaffController::class, 'showstaff'])->name('staff.show');
+ Route::get('/demand-approval/details', [ProductionDemandController::class, 'details'])->name('demand.approve.details');
+ Route::get('/previous-demands/{req_no}', [ProductionDemandController::class, 'previousdetailsdata'])
+ ->name('previous.demands.details');
+         Route::post('/demand/cancel/{req_no}', [ProductionDemandController::class, 'cancelDemand'])
+     ->name('demand.cancel');
+     Route::post('/demand/mark-faulty',
+     [ProductionDemandController::class, 'markFaulty'])
+     ->name('demand.mark.faulty');
+ 
+ 
+ Route::prefix('mco-demands')->name('mco.demands.')->group(function () {