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

Review Result ?

jattin01/army · ec4d6992
The commit adds multiple search and filter features, as well as functionality for toggling staff status, retrieving employee names for dropdowns, and handling Attendance file uploads and parsing. While it increases business value and search capabilities, there are concerns about inconsistent input validation, lack of input sanitization on search parameters, insufficient error handling in some code paths, and presence of debugging/logging statements which might expose sensitive info in production. The commit message is uninformative, reducing traceability. Overall, code quality and security could be improved.
Quality ?
70%
Security ?
40%
Business Value ?
75%
Maintainability ?
65%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Issue
Where commit message
Issue / Evidence issue
Suggested Fix provide a meaningful descriptive commit message summarizing the purpose and impact of the changes
Debug Log Exposes Search Term
Where app/Http/Controllers/Admin/StaffController.php:37
Issue / Evidence debug log exposes search term
Suggested Fix remove or redact logs for production to avoid information leakage
Debug Log Exposes Search Term
Where app/Http/Controllers/Admin/StaffController.php:51
Issue / Evidence debug log exposes search term
Suggested Fix remove or redact logs for production to avoid information leakage
Filtering By Exact Name Match With No Sani...
Where app/Http/Controllers/Admin/StaffController.php:72
Issue / Evidence filtering by exact name match with no sanitization
Suggested Fix add input validation and consider partial matching or normalization
Security Issue
Where app/Http/Controllers/Admin/StaffController.php:151
Issue / Evidence no authorization check before toggling staff status
Suggested Fix add permission checks to prevent unauthorized updates
Missing Validation
Where app/Http/Controllers/Admin/StaffController.php:369
Issue / Evidence User updateOrCreate relies on request input without validation
Suggested Fix validate and sanitize vertical_id and group_id before use
Leave Data Lookup Per Attendance Record In...
Where app/Http/Controllers/AttendanceController.php:82-91
Issue / Evidence leave data lookup per attendance record in a loop
Suggested Fix optimize by eager loading leaves to reduce database queries
Debug Logs Output Excel Headers And Data R...
Where app/Http/Controllers/AttendanceController.php:137
Issue / Evidence debug logs output Excel headers and data rows
Suggested Fix remove or disable debug logs in production
Continue On Empty Employee Number Without...
Where app/Http/Controllers/AttendanceController.php:149
Issue / Evidence continue on empty employee number without reporting mechanism
Suggested Fix consider more robust error reporting or input validation
Log Employee Not Found Warning But No User...
Where app/Http/Controllers/AttendanceController.php:156-159
Issue / Evidence log employee not found warning but no user feedback
Suggested Fix improve error handling to return informative messages to users
Long Function
Where app/Http/Controllers/AttendanceController.php:164-185
Issue / Evidence complex date parsing has uncertain error handling
Suggested Fix add try-catch for Carbon::createFromFormat and validate date formats more robustly
Code Change Preview · app/Http/Controllers/Admin/StaffController.php ?
Removed / Before Commit
- use App\Models\SalaryGroup;
- use App\Models\EmployeeStatus;
- use App\Models\EmployeeCategory;
- use Illuminate\Support\Facades\Storage;
- use App\Imports\StaffImport;
- use Maatwebsite\Excel\Facades\Excel;
- {
- $query = Staff::query();
- 
- // Apply filters
- if ($request->filled('employee_category_id')) {
- $query->where('employee_category_id', $request->employee_category_id);
- $query->where('department_id', $request->department_id);
- }
- 
-     // $staffs = $query->paginate(10)->appends($request->all())->orderBy('employee_number', 'asc')->get(); // keep filters during pagination
- 
- $staffs = $query
Added / After Commit
+ use App\Models\SalaryGroup;
+ use App\Models\EmployeeStatus;
+ 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;
+ {
+ $query = Staff::query();
+ 
+     // Apply search filter
+         if ($request->filled('search') && !empty($request->search['value'])) {
+             $searchTerm = $request->search['value'];
+             \Log::info('Search term:', ['term' => $searchTerm]);
+             
+             $query->where(function($q) use ($searchTerm) {
+                 $q->where('name', 'LIKE', '%' . $searchTerm . '%')
Removed / Before Commit
- */
- public function index(Request $request)
- {
-    $query = Attendance::query()
-     ->with([
-         'employee',
-         'leave',
-         'leave.leaveType'
-     ]);
- 
- 
- // Shift
- if ($request->shift) {
- 
- $attendances = $query->orderBy('date', 'desc')->paginate(20);
- 
- // Pass dropdown data
- $shifts = Shift::all();
Added / After Commit
+ */
+ public function index(Request $request)
+ {
+     $query = Attendance::query()
+         ->with([
+             'employee',
+             'leave',
+             'leave.leaveType'
+         ]);
+ 
+ // Shift
+ if ($request->shift) {
+ 
+ $attendances = $query->orderBy('date', 'desc')->paginate(20);
+ 
+     // Check for approved leaves for each attendance record based on date
+     foreach ($attendances as $attendance) {
+         $leave = Leave::with('leaveType')
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use Illuminate\Http\Request;
+ use App\Models\CodControl;
+ 
+ class CodControlController extends Controller
+ {
+     public function index()
+     {
+         $records = CodControl::latest()->get();
+ 
+         $equipments = \DB::table('crc_part_master')->get();
+ 
+         return view('crc.cod.index',compact('records','equipments'));
+     }
+ 
Removed / Before Commit
- use Carbon\Carbon;
- use App\Models\User;
- use App\Models\Group;
- 
- class ComplaintController extends Controller
- {
- 
- public function store(Request $request)
- {
-         echo($request->group_id);
- $request->validate([
- 'group_id' => 'required|exists:groups,id',
- 'location' => 'required|string|max:255',
- 'nature_of_complaint_id' => 'required|exists:nature_of_complaints,id',
-             
- ]);
- 
-         Complaint::create([
Added / After Commit
+ use Carbon\Carbon;
+ use App\Models\User;
+ use App\Models\Group;
+ use App\Models\ProductionYear;
+ 
+ class ComplaintController extends Controller
+ {
+ 
+ public function store(Request $request)
+ {
+ $request->validate([
+ 'group_id' => 'required|exists:groups,id',
+ 'location' => 'required|string|max:255',
+ 'nature_of_complaint_id' => 'required|exists:nature_of_complaints,id',
+ ]);
+ 
+         try {
+             // Generate complaint number
Removed / Before Commit
- use App\Imports\CrcPartMasterImport;
- use Throwable;
- use App\Models\BerDetail;
- 
- class CrcEntryController extends Controller
- {
- })
- 
- // 🔹 Unit Name filter
-         ->when($request->unit_name, function ($q) use ($request) {
- $q->whereHas('workUnit.units', function ($u) use ($request) {
-                 $u->where('name',$request->unit_name);
- });
- })
- ->when($request->part_no, function ($q) use ($request) {
- throw new \Exception("Equipment not found: ".$part['equipment_name']);
- }
- 
Added / After Commit
+ use App\Imports\CrcPartMasterImport;
+ use Throwable;
+ use App\Models\BerDetail;
+ use NumberFormatter;
+ 
+ class CrcEntryController extends Controller
+ {
+ })
+ 
+ // 🔹 Unit Name filter
+        ->when($request->unit_name, function ($q) use ($request) {
+ $q->whereHas('workUnit.units', function ($u) use ($request) {
+                 $u->where('name', 'like', '%' . $request->unit_name . '%');
+ });
+ })
+ ->when($request->part_no, function ($q) use ($request) {
+ throw new \Exception("Equipment not found: ".$part['equipment_name']);
+ }
Removed / Before Commit
- 
- $repair->update([
- 'iv_entry' => $request->iv_entry,
- ]);
- 
- return response()->json([
Added / After Commit
+ 
+ $repair->update([
+ 'iv_entry' => $request->iv_entry,
+         'iv_entry_date' => date('Y-m-d H:i:s'),
+ ]);
+ 
+ return response()->json([
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ <?php
+ namespace App\Http\Controllers;
+ 
+ use Illuminate\Http\Request;
+ use App\Models\WorkEquipment;
+ use App\Models\WorkOrder;
+ use DB;
+ use App\Models\BerDetail;
+ 
+ class CrcReportController extends Controller
+ {
+ 
+ public function index(Request $request)
+ {
+     $query = WorkEquipment::with([
+         'workOrder',
+         'workOrder.workUnit.units',
+         'workOrder.workUnit.commands',
Removed / Before Commit
- return response()->json(['message' => 'Equipment deleted successfully.']);
- }
- 
-         public function getByGroup($id)
-     {
-         $equipments = Equipment::where('group_id', $id)->get(['id', 'name']);
- 
-         return response()->json($equipments);
-     }
- 
- public function getSubAssy($equipmentId)
- {
- $subAssys = SubAssyEquipment::where('equipment_id', $equipmentId)
- ->where('is_active', true)
- ->pluck('sub_equipment_name', 'id');
- 
- return response()->json($subAssys);
Added / After Commit
+ return response()->json(['message' => 'Equipment deleted successfully.']);
+ }
+ 
+        public function getByGroup($id)
+         {
+             $equipments = Equipment::where('group_id', $id)
+                 ->orderBy('name', 'asc')
+                 ->get(['id', 'name']);
+ 
+             return response()->json($equipments);
+         }
+ 
+ public function getSubAssy($equipmentId)
+ {
+ $subAssys = SubAssyEquipment::where('equipment_id', $equipmentId)
+ ->where('is_active', true)
+             ->orderBy('sub_equipment_name', 'asc')
+ ->pluck('sub_equipment_name', 'id');
Removed / Before Commit
- public function index(Request $request)
- {
- 
- $wcnNumber = $request->wcn_number;
- $unitId = $request->unit_id;
- $jobNo = $request->job_no;
- 
- $equipments = [];
- 
-     if ($wcnNumber || $unitId || $jobNo) 
- {
-         $query = WorkEquipment::with('workOrder.workUnit.units');
- 
-         if ($wcnNumber) {
-             $query->where('wcn_number', $wcnNumber);
-         }
- 
-         if ($unitId) {
Added / After Commit
+ public function index(Request $request)
+ {
+ 
+     $controlNo = $request->control_no;
+ $wcnNumber = $request->wcn_number;
+ $unitId = $request->unit_id;
+ $jobNo = $request->job_no;
+     $commitStatus = $request->commit_status;
+ 
+ $equipments = [];
+ 
+     if ($controlNo || $wcnNumber || $unitId || $jobNo) 
+ {
+         $query = WorkEquipment::with('workOrder.workUnit.units')
+ 
+                 // ✅ Eligible equipments
+                 ->where(function ($eligible) {
+ 
Removed / Before Commit
- 
- 
- // Fetch qty_issue sums from issue table grouped by the keys above
-                 $receiveSums = DB::table('receiving')
-                 ->select('req_no', 'mco_demand_no','job_no', 'work_equipment_id', DB::raw('SUM(qty_received) as total_qty_receive'))
-                 ->where('prod_year', $keys->pluck('prod_year'))
-                 ->whereIn('mco_demand_no', $keys->pluck('mco_demand_no'))
-                 ->whereIn('job_no', $keys->pluck('job_no'))
-                 ->whereIn('work_equipment_id', $keys->pluck('work_equipment_id'))
-                 ->groupBy('req_no', 'job_no', 'work_equipment_id','mco_demand_no','prod_year')
-                 ->get()
-                 ->keyBy(function($item) {
-                     return $item->mco_demand_no.'_'.$item->job_no.'_'.$item->work_equipment_id;
-                 });
Added / After Commit
+ 
+ 
+ // Fetch qty_issue sums from issue table grouped by the keys above
+                $receiveSums = DB::table('receiving')
+                             ->select(
+                                 'req_no',
+                                 'mco_demand_no',
+                                 'job_no',
+                                 'work_equipment_id',
+                                 DB::raw('SUM(qty_received) as total_qty_receive')
+                             )
+                             ->where('prod_year', $year) // ✅ FIXED
+                             ->whereIn('mco_demand_no', $keys->pluck('mco_demand_no')->unique())
+                             ->whereIn('job_no', $keys->pluck('job_no')->unique())
+                             ->whereIn('work_equipment_id', $keys->pluck('work_equipment_id')->unique())
+                             ->groupBy('req_no', 'job_no', 'work_equipment_id', 'mco_demand_no', 'prod_year')
+                             ->get()
+                             ->keyBy(function($item) {
Removed / Before Commit
- $voucher_no =$regn_no;
- return view('issues.show', compact('spares', 'voucher_no'));
- }
- 
- public function storeIssueGroup(Request $request)
- {
Added / After Commit
+ $voucher_no =$regn_no;
+ return view('issues.show', compact('spares', 'voucher_no'));
+ }
+     public function newshow($group_req_no,$mco_demand_no,$regn_no,$prod_year)
+     {
+         $spares = Receive::where('req_no', $group_req_no)->where('mco_demand_no', $mco_demand_no)->where('voucher_no', decrypt($regn_no))->where('prod_year', decrypt($prod_year))->get();
+         $voucher_no =$regn_no;
+         return view('issues.show', compact('spares', 'voucher_no'));
+     }
+ 
+ public function storeIssueGroup(Request $request)
+ {
Removed / Before Commit
- public function index(Request $request)
- {
- $query = Leave::with(['employee.department', 'employee.designation', 'leaveType'])
-             ->orderBy('created_at', 'desc');
- 
- // Apply filters
- if ($request->filled('status')) {
- return back()->with('error', 'Leave rejected.');
- }
- 
-     public function appliedLeaves()
-     {
-         return view('leave.applied-leaves');
- }
- 
- public function appliedLeavesList(Request $request)
- {
- $columns = [
Added / After Commit
+ public function index(Request $request)
+ {
+ $query = Leave::with(['employee.department', 'employee.designation', 'leaveType'])
+             ->where('leave_type', 1)->orderBy('created_at', 'desc');
+ 
+ // Apply filters
+ if ($request->filled('status')) {
+ return back()->with('error', 'Leave rejected.');
+ }
+ 
+     public function appliedLeaves(Request $request){
+         // Get AJAX data with condition leave_type == 0
+         $appliedLeaves = Leave::with(['employee.department', 'employee.designation', 'leaveType'])
+             ->where('leave_type', 0)
+             ->get();
+             
+         // Return JSON response for AJAX requests
+         if ($request->ajax()) {
Removed / Before Commit
- use App\Models\Leave;
- use App\Models\LeaveType;
- use App\Models\Staff;
- use Illuminate\Http\Request;
- use Carbon\Carbon;
- use Carbon\CarbonPeriod;
- 
- class LeaveController extends Controller
- {
- 
- $employee = Staff::where('employee_number',$userdata->employee_number)->first();
- 
-         $assignedLeaveTypes = $employee->designation->leaveTypes ?? [];
- 
- $leaves = Leave::with('leaveType')->where('employee_id', optional($employee)->id)->orderBy('from_date', 'desc')->paginate(20);
- 
- ->where('leave_type_id', $type->id)
- ->whereIn('status', ['approved', 'pending'])
Added / After Commit
+ use App\Models\Leave;
+ use App\Models\LeaveType;
+ use App\Models\Staff;
+ use App\Models\EmployeeCategory;
+ use Illuminate\Http\Request;
+ use Carbon\Carbon;
+ use Carbon\CarbonPeriod;
+ use App\Services\LeaveValidationService;
+ use Illuminate\Support\Facades\Log;
+ 
+ class LeaveController extends Controller
+ {
+ 
+ $employee = Staff::where('employee_number',$userdata->employee_number)->first();
+ 
+         // Get employee category ID
+         $employeeCategoryId = $employee->employee_category_id;
+         $employeeGender = strtolower($employee->gender ?? '');
Removed / Before Commit
- namespace App\Http\Controllers;
- 
- use App\Models\LeaveType;
- use Illuminate\Http\Request;
- use App\Imports\LeaveTypeImport;
- use Maatwebsite\Excel\Facades\Excel;
- public function index(Request $request)
- {
- $query = LeaveType::query();
- 
- // Apply filters
- if ($request->filled('leave_category')) {
-         $query->where('leave_category', $request->leave_category);
- }
- 
-     if ($request->filled('leave_category')) {
-         $query->where('leave_category', $request->leave_category);
- }
Added / After Commit
+ namespace App\Http\Controllers;
+ 
+ use App\Models\LeaveType;
+ use App\Models\EmployeeCategory;
+ use Illuminate\Http\Request;
+ use App\Imports\LeaveTypeImport;
+ use Maatwebsite\Excel\Facades\Excel;
+ 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.'%');
Removed / Before Commit
- use App\Models\QCCheck;
- use App\Models\WorkEquipment;
- use App\Models\WorkOrder;
- use App\Models\VIR;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Auth;
- 
- class QCCheckController extends Controller
- {
- 
- 
- public function store(Request $request)
-     {
-         $request->validate([
-             'work_order_id' => 'required|exists:work_orders,id',
-             'remark' => 'nullable|string',
- ]);
- 
Added / After Commit
+ use App\Models\QCCheck;
+ use App\Models\WorkEquipment;
+ use App\Models\WorkOrder;
+ use App\Models\Unit;
+ use App\Models\Group;
+ use App\Models\MasterCommand;
+ use App\Models\VIR;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\Auth;
+ use Carbon\Carbon;
+ 
+ class QCCheckController extends Controller
+ {
+ 
+ 
+ public function store(Request $request)
+ {
+     $request->validate([
Removed / Before Commit
- $components = [];
- $netSalary = 0;
- 
-     foreach ($employee->salaryGroup->components as $comp) {
-     $monthlyAmount = 0;
- 
-     if ($comp->component->name === "Basic Pay" && $comp->component->calculation_type === "fixed") {
-         $basicPay = $comp->value;
-         $monthlyAmount = $basicPay;
-     }
-     elseif ($comp->component->name === "Dearness Allowance" && $comp->component->calculation_type === "percentage") {
-         $da = ($comp->value / 100) * $basicPay;
-         $monthlyAmount = $da;
-     }
-     elseif ($comp->component->calculation_type === "percentage") {
-         $base = $basicPay;
-         if ($comp->component->name === "Pension Contribution") {
-             $base = $basicPay + $da;
Added / After Commit
+ $components = [];
+ $netSalary = 0;
+ 
+     // foreach ($employee?->salaryGroup?->components as $comp) {
+     //         $monthlyAmount = 0;
+ 
+     //         if ($comp->component->name === "Basic Pay" && $comp->component->calculation_type === "fixed") {
+     //             $basicPay = $comp->value;
+     //             $monthlyAmount = $basicPay;
+     //         }
+     //         elseif ($comp->component->name === "Dearness Allowance" && $comp->component->calculation_type === "percentage") {
+     //             $da = ($comp->value / 100) * $basicPay;
+     //             $monthlyAmount = $da;
+     //         }
+     //         elseif ($comp->component->calculation_type === "percentage") {
+     //             $base = $basicPay;
+     //             if ($comp->component->name === "Pension Contribution") {
+     //                 $base = $basicPay + $da;
Removed / Before Commit
- $rules = [
- 'name'        => 'required|string|max:255',
- 'username'    => 'required|string|max:255|unique:users,username,' . $request->user_id,
- 'telephone'   => 'nullable|string|max:20',
- 'role'        => 'required|exists:roles,id',
- 'approved'    => 'required|in:0,1',
- // Update user data
- $user->name        = $validated['name'];
- $user->username    = $validated['username'];
- $user->telephone   = $validated['telephone'] ?? null;
- $user->vertical_id = $validated['vertical_id'] ?? null;
- $user->group_id    = $validated['group_id'] ?? null;
Added / After Commit
+ $rules = [
+ 'name'        => 'required|string|max:255',
+ 'username'    => 'required|string|max:255|unique:users,username,' . $request->user_id,
+             'employee_number' => 'required|string|max:255|unique:users,employee_number,' . $request->user_id,
+ 'telephone'   => 'nullable|string|max:20',
+ 'role'        => 'required|exists:roles,id',
+ 'approved'    => 'required|in:0,1',
+ // Update user data
+ $user->name        = $validated['name'];
+ $user->username    = $validated['username'];
+             $user->employee_number = $validated['employee_number'];
+ $user->telephone   = $validated['telephone'] ?? null;
+ $user->vertical_id = $validated['vertical_id'] ?? null;
+ $user->group_id    = $validated['group_id'] ?? null;
Removed / Before Commit
- // WorkEquipment::where('work_order_id', $vir?->equipment?->work_order_id)
- //      ->update(['status' => 'UNDER VIR']); 
- 
-     if (!in_array(strtoupper(trim((string) $repairClass)), ['DR', 'CL A'])) {
-         QCCheck::create([
-                     'qc_control_no' =>$repairClass ?? 'repair class null',
-                     'work_order_id' => $vir?->equipment?->work_order_id,
-                     'work_equipment_id' => $vir?->equipment?->id,
-                     'vir_id' =>$vir?->id ?? null,
-                     'qc_control_date' => date('Y-m-d'),
-                     'status' => 'Passed',
-                     'remark' => $repairClass ?? null,
-                     'user_id' => Auth::id(),
-                 ]);
-        WorkEquipment::where('work_order_id', $vir?->equipment?->work_order_id)
-         ->where('status', 'AWAITING JOB NO')
-         ->update([
-             'status' => 'UNDER REPAIR'
Added / After Commit
+ // WorkEquipment::where('work_order_id', $vir?->equipment?->work_order_id)
+ //      ->update(['status' => 'UNDER VIR']); 
+ 
+     if (strtoupper(trim((string) $repairClass)) !== 'DR') {
+ 
+         // QCCheck::create([
+         //     'qc_control_no' => $repairClass ?? 'repair class null',
+         //     'work_order_id' => $vir?->equipment?->work_order_id,
+         //     'work_equipment_id' => $vir?->equipment?->id,
+         //     'vir_id' => $vir?->id ?? null,
+         //     'qc_control_date' => date('Y-m-d'),
+         //     'status' => 'Passed',
+         //     'remark' => $repairClass ?? null,
+         //     'user_id' => Auth::id(),
+         // ]);
+ 
+         WorkEquipment::where('work_order_id', $vir?->equipment?->work_order_id)
+             ->where('status', 'AWAITING JOB NO')
Removed / Before Commit
- if ($job) 
- {
- $equipments = $job->equipments()
- ->whereNull('wcn_number')   // ✅ jinka wcn_number null hai
- ->get();
- }
- 	
- 	if(count($equipments)>0)
- 	{
- 
- 		$committedData = [];
- 	}
- 	else
- 	{
- 	
- 	  $committedData = $job->equipments()->whereNotNull('wcn_number')
-         	->with(['workOrder', 'qcInspection']) // optional eager loading
-         	->get();
Added / After Commit
+ if ($job) 
+ {
+ $equipments = $job->equipments()
+                 ->where('status', 'UNDER WCN PROCESS')
+ ->whereNull('wcn_number')   // ✅ jinka wcn_number null hai
+ ->get();
+ }
+ 	
+         if(count($equipments) == 0)
+         {
+ 
+              $committedData = $job->equipments()->whereNotNull('wcn_number')
+                 ->with(['workOrder', 'qcInspection']) // optional eager loading
+                 ->get();
+         }
+ }
+ 
+ return view('wcn.index', compact('jobNumbers', 'equipments', 'committedData'));
Removed / Before Commit
- ]);
- }
- 
- public function create(Request $request, $id = null)
- {
- $workOrder = null;
- 'workOrder' => $workOrder,
- 'workunit'  => $workunit,
- 'workUser'  => $workUser,
-         'equipment' => $equipment,
- ]);
- }
- 
- 'control_no' => $controlNo,
- 'control_date' => date('d-M-Y'),
- 'redirect_url' => route('work-orders.listing'),
- ]);
- }
Added / After Commit
+ ]);
+ }
+ 
+ public function checkUnitWoNo(Request $request)
+ {
+     $exists = WorkEquipment::where('unit_wo_no', $request->unit_wo_no)->exists();
+ 
+     return response()->json([
+         'exists' => $exists
+     ]);
+ }
+ 
+ public function create(Request $request, $id = null)
+ {
+ $workOrder = null;
+ 'workOrder' => $workOrder,
+ 'workunit'  => $workunit,
+ 'workUser'  => $workUser,
Removed / Before Commit
- $checkOut = !empty($row['check_out']) ? Carbon::parse($row['check_out']) : null;
- 
- /* =========================
-            2️⃣ LEAVE OVERRIDE
- ==========================*/
-         $approvedLeave = Leave::where('employee_id', $employee->id)
- ->where('from_date', '<=', $date)
- ->where('to_date', '>=', $date)
- ->where('status', 'approved')
-             ->exists();
- 
- if ($approvedLeave) {
-             return Attendance::updateOrCreate(
- ['employee_id' => $employee->id, 'date' => $date],
- [
- 'check_in' => null,
- 'check_out' => null,
- 'status' => 'Leave',
Added / After Commit
+ $checkOut = !empty($row['check_out']) ? Carbon::parse($row['check_out']) : null;
+ 
+ /* =========================
+            2️⃣ LEAVE OVERRIDE - Show Leave Type Name & Link Attendance ID
+ ==========================*/
+         $approvedLeave = Leave::with('leaveType')
+             ->where('employee_id', $employee->id)
+ ->where('from_date', '<=', $date)
+ ->where('to_date', '>=', $date)
+ ->where('status', 'approved')
+             ->first();
+ 
+ if ($approvedLeave) {
+             $leaveTypeName = $approvedLeave->leaveType->leave_name ?? 'Leave';
+             
+             // Create/Update attendance record
+             $attendance = Attendance::updateOrCreate(
+ ['employee_id' => $employee->id, 'date' => $date],
Removed / Before Commit
- protected $fillable = [
- 'employee_id',
- 'biometric_id',
- 'date',
- 'check_in',
- 'check_out',
- 
- public function leave()
- {
-         return $this->hasOne(Leave::class, 'attendance_id')
-                     ->whereNotNull('attendance_id');
- }
Added / After Commit
+ protected $fillable = [
+ 'employee_id',
+ 'biometric_id',
+         'employee_name',    // nullable - from staff table
+         'employee_code',    // nullable - from staff table
+         'employee_number',  // nullable - from staff table
+ 'date',
+ 'check_in',
+ 'check_out',
+ 
+ public function leave()
+ {
+         return $this->hasOne(Leave::class, 'attendance_id', 'id');
+ }
Removed / Before Commit
- 'cod_control_no',
- 'cod_control_date',
- 
- 'status',
- 'inventory_in_date',
- 
- 'remarks',
- 'created_by'
- ];
- }
- \ No newline at end of file
Added / After Commit
+ 'cod_control_no',
+ 'cod_control_date',
+ 
+         'cod_iv_no',
+         'cod_iv_date',
+ 
+         'unit_rv_no',
+         'unit_rv_date',
+ 
+ 'status',
+ 'inventory_in_date',
+ 
+ 'remarks',
+ 'created_by'
+ ];
+ 
+ 
+     /*
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class CodControl extends Model
+ {
+     protected $table = 'cod_controls';
+ 
+     protected $fillable = [
+         'equipment_name',
+         'part_no',
+         'nomenclature',
+         'cod_control_no',
+         'cod_control_date',
+         'rv_509_no',
+         'rv_509_date',
Removed / Before Commit
- 'resolved_by',
- 'resolved_at',
- 'equipment_details',
- ];
- 
- protected $casts = [
- 'partially_completed' => 'Partially Completed'
- ];
- }
- }
Added / After Commit
+ 'resolved_by',
+ 'resolved_at',
+ 'equipment_details',
+         'complaint_number',
+ ];
+ 
+ protected $casts = [
+ 'partially_completed' => 'Partially Completed'
+ ];
+ }
+ 
+     /**
+      * Generate complaint number in format: Sequence/Group/ProductionYear
+      * Format: 1/ELECTRICAL/2025-26
+      */
+     public static function generateComplaintNumber($natureOfComplaintId)
+     {
+         // Get the nature of complaint to find the group
Removed / Before Commit
- 'description',
- 'status',
- 'approval_status',
-         'leave_type'
- ];
- 
- public function employee() {
- }
- 
- 
- }
Added / After Commit
+ 'description',
+ 'status',
+ 'approval_status',
+         'leave_type',
+         'duration'
+ ];
+ 
+ public function employee() {
+ }
+ 
+ 
+     public function attendance()
+     {
+         return $this->belongsTo(Attendance::class, 'attendance_id', 'id');
+     }
+ 
+     
+ 
Removed / Before Commit
- 'remarks',
- 'status',
- 'deduction_rule',
- ];
- 
- protected $casts = [
Added / After Commit
+ 'remarks',
+ 'status',
+ 'deduction_rule',
+         'duration_type',
+ ];
+ 
+ protected $casts = [
Removed / Before Commit
- return $this->belongsTo(SalaryGroup::class);
- }
- 
- const STATUS_PROBATION = 1;
- const STATUS_ACTIVE = 2;
- const STATUS_NOTICE = 3;
Added / After Commit
+ return $this->belongsTo(SalaryGroup::class);
+ }
+ 
+     public function employeeCategory()
+     {
+         return $this->belongsTo(EmployeeCategory::class);
+     }
+ 
+     public function user()
+     {
+         return $this->belongsTo(User::class, 'employee_number', 'employee_number');
+     }
+ 
+     public function getVerticalNameAttribute()
+     {
+         return $this->user ? $this->user->vertical->name ?? null : null;
+     }
+ 
Removed / Before Commit
- 'wcn_date',
- 'wcn_committed',
- 'iv_entry',
- 'issued_iv_no',
- 'status',
- 'sus',
- 'repair_remarks',
- 
- public function CrcEquipments()
- {
-         return $this->belongsTo(CrcPartMaster::class, 'main_eqpt');
- }
- public function subassy()
- {
Added / After Commit
+ 'wcn_date',
+ 'wcn_committed',
+ 'iv_entry',
+         'iv_entry_date',
+ 'issued_iv_no',
+         'issued_iv_date',
+ 'status',
+ 'sus',
+ 'repair_remarks',
+ 
+ public function CrcEquipments()
+ {
+         return $this->belongsTo(CrcPartMaster::class, 'eqpt');
+ }
+ public function subassy()
+ {
Removed / Before Commit
- return ['valid' => false, 'message' => 'This leave type is currently inactive.'];
- }
- 
- $leaveGender = strtolower(trim($leaveType->gender));
- $employeeGender = strtolower(trim($employee->gender));
- 
- if ($leaveGender !== 'both' && $leaveGender !== $employeeGender) {
- return [
- 'valid' => false,
- 'message' => "This leave type is only available for {$leaveType->gender} employees."
- ];
- }
- 
- 
- 
- // 3. Check employee type (Permanent/Contract/Probation)
- }
- }
Added / After Commit
+ return ['valid' => false, 'message' => 'This leave type is currently inactive.'];
+ }
+ 
+         // 2. Check employee category and gender compatibility
+         $employeeCategoryId = $employee->employee_category_id;
+ $leaveGender = strtolower(trim($leaveType->gender));
+ $employeeGender = strtolower(trim($employee->gender));
+ 
+         // Gender validation
+ if ($leaveGender !== 'both' && $leaveGender !== $employeeGender) {
+ return [
+ 'valid' => false,
+ 'message' => "This leave type is only available for {$leaveType->gender} employees."
+ ];
+ }
+ 
+         // Category validation - check if employee category ID exists in leave_category comma-separated values
+         if (!empty($leaveType->leave_category)) {
Removed / Before Commit
- <div class="text-danger">{{ $message }}</div>
- @enderror
- </div>
- <div class="col-md-3">
- <label for="biometric" class="form-label">Biometric ID</label>
- <input type="text" id="biometric" name="biometric" class="form-control"
- @enderror
- </div>
- 
- {{-- Email --}}
- <div class="col-md-6">
- <label for="email" class="form-label">Working Email</label>
- @enderror
- </div>
- 
-                                 <div class="col-md-6">
- <label for="dob" class="form-label">Date of Birth</label>
- <input type="date" name="dob" id="dob" class="form-control"
Added / After Commit
+ <div class="text-danger">{{ $message }}</div>
+ @enderror
+ </div>
+ 
+ 
+                                 {{-- Biometric ID --}}
+ <div class="col-md-3">
+ <label for="biometric" class="form-label">Biometric ID</label>
+ <input type="text" id="biometric" name="biometric" class="form-control"
+ @enderror
+ </div>
+ 
+                                 
+ 
+ {{-- Email --}}
+ <div class="col-md-6">
+ <label for="email" class="form-label">Working Email</label>
+ @enderror
Removed / Before Commit
- @extends('layouts.app')
- 
- @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
+ @extends('layouts.app')
+ 
+ @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> -->
Removed / Before Commit
- <tr>
- <td width="20%"><strong>Trade</strong></td>
- <td>{{ $rawData['trade'] ?? 'N/A' }}</td>
-                                 <td width="20%"><strong>Category</strong></td>
-                                 <td>{{ $rawData['cat'] ?? 'N/A' }}</td>
- </tr>
- <tr>
-                                 <td><strong>Employee Category</strong></td>
-                                 <td>{{ $rawData['emp_cat'] ?? 'N/A' }}</td>
- <td><strong>Status</strong></td>
- <td>{{ ucfirst($rawData['status'] ?? 'N/A') }}</td>
- </tr>
- <tr>
- <td><strong>Department</strong></td>
-                                 <td>{{ $rawData['department'] ?? 'N/A' }}</td>
- <td><strong>Designation</strong></td>
-                                 <td>{{ $rawData['designation'] ?? 'N/A' }}</td>
- </tr>
Added / After Commit
+ <tr>
+ <td width="20%"><strong>Trade</strong></td>
+ <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>{{ $rawData['cat'] ?? 'N/A' }}</td>
+ <td><strong>Status</strong></td>
+ <td>{{ ucfirst($rawData['status'] ?? 'N/A') }}</td>
+                                 {{-- <td><strong>Employee Status</strong></td>
+                                 <td>{{ $staff->employee_status_id ?? 'N/A' }}</td> --}}
+ </tr>
+ <tr>
+ <td><strong>Department</strong></td>
+                                 <td>{{ $staff->department?->name ?? 'N/A' }}</td>
Removed / Before Commit
- @section('content')
- <div class="card">
- 
- <!-- Page Header -->
- 
- 
- </tr>
- </thead>
- <tbody>
- @forelse($attendances as $attendance)
- <tr>
- <td>{{ $attendance->employee->employee_number ?? $attendance->employee_code }}</td>
- <td>{{ $attendance->check_in }}</td>
- <td>{{ $attendance->check_out }}</td>
- <td>
-                                 @if($attendance->leave && $attendance->leave->leaveType)
- {{-- Leave Applied --}}
- <span class="badge bg-info">
Added / After Commit
+ @section('content')
+ <div class="card">
+ 
+     <!-- Success/Error Messages -->
+     @if(session('success'))
+         <div class="alert alert-success alert-dismissible fade show m-3" role="alert">
+             <i class="fa fa-check-circle"></i> {{ session('success') }}
+             <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
+         </div>
+     @endif
+ 
+     @if(session('error'))
+         <div class="alert alert-danger alert-dismissible fade show m-3" role="alert">
+             <i class="fa fa-exclamation-circle"></i> {{ session('error') }}
+             <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
+         </div>
+     @endif
+ 
Removed / Before Commit
- <td>{{ $complaint->formatted_complaint_date . '  ' . $complaint->formatted_complaint_time}}</td>
- <!-- <td>{{ $complaint->formatted_complaint_time }}</td> -->
- <td class="px-3">{{ $complaint->approved_at ? $complaint->approved_at->setTimezone('Asia/Kolkata')->format('d-m-Y h:i A') : '-' }}</td>
-                             <td>{{ $complaint->id }}</td>
- <td>{{ $complaint->user_name }}</td>
- <td>
- {{-- Debug: Show what's actually loaded --}}
- <div class="row align-items-center">
- <div class="col-md-12">
- <h4 class="mb-3 text-primary">
-                                                 <i class="fas fa-ticket-alt me-2"></i>Complaint #${data.id || 'N/A'}
- </h4>
- <div class="row">
- <div class="col-md-4">
Added / After Commit
+ <td>{{ $complaint->formatted_complaint_date . '  ' . $complaint->formatted_complaint_time}}</td>
+ <!-- <td>{{ $complaint->formatted_complaint_time }}</td> -->
+ <td class="px-3">{{ $complaint->approved_at ? $complaint->approved_at->setTimezone('Asia/Kolkata')->format('d-m-Y h:i A') : '-' }}</td>
+                             <td>{{ $complaint->complaint_number }}</td>
+ <td>{{ $complaint->user_name }}</td>
+ <td>
+ {{-- Debug: Show what's actually loaded --}}
+ <div class="row align-items-center">
+ <div class="col-md-12">
+ <h4 class="mb-3 text-primary">
+                                                 <i class="fas fa-ticket-alt me-2"></i>Complaint - ${data.complaint_number || 'N/A'}
+ </h4>
+ <div class="row">
+ <div class="col-md-4">
Removed / Before Commit
- <tbody>
- @forelse($assignedComplaints as $index => $complaint)
- <tr>
-                             <td>{{ $complaint->id }}</td>
- <td>{{ $complaint->formatted_complaint_date }}</td>
- <td>{{ $complaint->formatted_complaint_time }}</td>
- <td>{{ $complaint->user_name }}</td>
Added / After Commit
+ <tbody>
+ @forelse($assignedComplaints as $index => $complaint)
+ <tr>
+                             <td>{{ $complaint->complaint_number }}</td>
+ <td>{{ $complaint->formatted_complaint_date }}</td>
+ <td>{{ $complaint->formatted_complaint_time }}</td>
+ <td>{{ $complaint->user_name }}</td>
Removed / Before Commit
- <div class="row">
- <div class="field">
- <label>Complaint No:</label>
-                 <span class="field-value">{{ $complaint->id }}</span>
- </div>
- <div class="field">
- <label>Sec:</label>
Added / After Commit
+ <div class="row">
+ <div class="field">
+ <label>Complaint No:</label>
+                 <span class="field-value">{{ $complaint->complaint_number }}</span>
+ </div>
+ <div class="field">
+ <label>Sec:</label>
Removed / Before Commit
- 
- </select>
- </div>
- <div class="col-md-4">
- <label class="form-label">&nbsp;</label>
- <div>
- </div> --}}
- 
- <!-- Complaint Table -->
-             <div class="table-responsive">
-                 <table class="table table-striped table-hover" id="complaintTable">
- <thead>
- <tr>
- <th>#</th>
-                             <th>Date & Time</th>
-                              <th>Complaint No</th>
-                             <th>User Name</th>
-                             <th>Group</th>
Added / After Commit
+ 
+ </select>
+ </div>
+                 <div class="col-md-2">
+                     <label for="complaint_number" class="form-label">Complaint No</label>
+                     <select id="complaint_number" name="complaint_number" class="form-select select2">
+                         <option value="">All Complaints</option>
+                         @if(isset($complaintNumbers))
+                             @foreach($complaintNumbers as $number)
+                                 <option value="{{ $number }}">{{ $number }}</option>
+                             @endforeach
+                         @endif
+                     </select>
+                 </div>
+                 <div class="col-md-2">
+                     <label for="production_year" class="form-label">Production Year</label>
+                     <select id="production_year" name="production_year" class="form-select select2">
+                         <option value="">All Years</option>
Removed / Before Commit
- <td>{{ $index + 1 }}</td>
- <td>{{ $complaint->formatted_complaint_date }}</td>
- <td>{{ $complaint->formatted_complaint_time }}</td>
-                             <td>{{ $complaint->id }}</td>
- <td>{{ $complaint->user_name }}</td>
- <td>
- {{-- Debug: Show what's actually loaded --}}
Added / After Commit
+ <td>{{ $index + 1 }}</td>
+ <td>{{ $complaint->formatted_complaint_date }}</td>
+ <td>{{ $complaint->formatted_complaint_time }}</td>
+                             <td>{{ $complaint->complaint_number }}</td>
+ <td>{{ $complaint->user_name }}</td>
+ <td>
+ {{-- Debug: Show what's actually loaded --}}
Removed / Before Commit
- <td>{{ $index + 1 }}</td>
- <td>{{ $complaint->formatted_complaint_date }}</td>
- <td>{{ $complaint->formatted_complaint_time }}</td>
-                             <td>{{$complaint->id}}</td>
- <td>{{ $complaint->user_name }}</td>
- <td>
- {{-- Debug: Show what's actually loaded --}}
- <div class="row align-items-center">
- <div class="col-md-12">
- <h4 class="mb-3 text-primary">
-                                                 <i class="fas fa-ticket-alt me-2"></i>Complaint #${data.id || 'N/A'}
- </h4>
- <div class="row">
- <div class="col-md-4">
Added / After Commit
+ <td>{{ $index + 1 }}</td>
+ <td>{{ $complaint->formatted_complaint_date }}</td>
+ <td>{{ $complaint->formatted_complaint_time }}</td>
+                             <td>{{$complaint->complaint_number}}</td>
+ <td>{{ $complaint->user_name }}</td>
+ <td>
+ {{-- Debug: Show what's actually loaded --}}
+ <div class="row align-items-center">
+ <div class="col-md-12">
+ <h4 class="mb-3 text-primary">
+                                                 <i class="fas fa-ticket-alt me-2"></i>Complaint #${data.complaint_number || 'N/A'}
+ </h4>
+ <div class="row">
+ <div class="col-md-4">
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ 
+ <style>
+ 
+ .select2-container{
+ width:100% !important;
+ }
+ 
+ .select2-container--open{
+ z-index:999999 !important;
+ }
+ 
+ </style>
+ 
+ <div class="card">
+ 
Removed / Before Commit
- <th>Unit</th>
- <th>Work Order No</th>
- <th>Job Nos</th>
- <th>Part Nos</th>
- <th>Action</th>
- </tr>
- </thead>
- <td>{{ $entry?->workOrder->workUnit?->units?->name ?? '-' }}</td>
- <td>{{ $entry->workOrder->control_no }}</div>
- <td>{{ $entry->workOrder->job_no }}</td>
- <td>{{ $entry->assy }}</td>
- <td>
- <a href="{{'/crc/entries/berdetail/'.$entry->id}}" target="_blank"  >BER DETAIL</a>
- </td>
Added / After Commit
+ <th>Unit</th>
+ <th>Work Order No</th>
+ <th>Job Nos</th>
+                         <th>WCN No</th>
+ <th>Part Nos</th>
+                         <th>Nomenclature</th>
+                         <th>Equipment Name</th>
+ <th>Action</th>
+ </tr>
+ </thead>
+ <td>{{ $entry?->workOrder->workUnit?->units?->name ?? '-' }}</td>
+ <td>{{ $entry->workOrder->control_no }}</div>
+ <td>{{ $entry->workOrder->job_no }}</td>
+                         <td>{{ $entry->wcn_number }}</td>
+ <td>{{ $entry->assy }}</td>
+                         <td>{{$entry->CrcEquipments->nomenclature}}</td>
+                         <td>{{$entry->CrcEquipments->equipment_name}}</td>
+ <td>
Removed / Before Commit
- <input type="hidden" name="equipment_id" value="{{ $equipment_id }}">
- 
- <div class="row">
- 
- <!-- 509 Demand -->
- <div class="col-md-6">
- <div class="row mb-3">
- <div class="row">
- 
- <!-- COD -->
-                 <div class="col-md-6">
- <div class="row mb-3">
- <label class="col-sm-4 col-form-label">COD Control No</label>
- <div class="col-sm-8">
- </div>
- </div>
- </div>
- 
Added / After Commit
+ <input type="hidden" name="equipment_id" value="{{ $equipment_id }}">
+ 
+ <div class="row">
+                
+ <!-- 509 Demand -->
+ <div class="col-md-6">
+ <div class="row mb-3">
+ <div class="row">
+ 
+ <!-- COD -->
+                   <div class="col-md-6">
+ <div class="row mb-3">
+ <label class="col-sm-4 col-form-label">COD Control No</label>
+ <div class="col-sm-8">
+ </div>
+ </div>
+ </div>
+                  
Removed / Before Commit
- </div>
- <div class="col-md-3">
- <label for="unit_id">Unit Name:</label>
-                                                 <select name="unit_id" class="form-control select2-single" id="unit_id" required>
- <option value="">-- Select Unit --</option>
- @foreach($units as $unit)
- <option value="{{ $unit->id }}">{{ $unit->name }}</option>
- 
- <div class="col-md-3">
- <label for="command_id">Command Name:</label>
-                                                 <select name="command_id" class="form-control select2-single" id="command_id" required>
- <option value="">-- Select Command --</option>
- @foreach($commands as $command)
- <option value="{{ $command->id }}">{{ $command->name }}</option>
Added / After Commit
+ </div>
+ <div class="col-md-3">
+ <label for="unit_id">Unit Name:</label>
+                                                 <select name="unit_id" class="form-control select2" id="unit_id" required>
+ <option value="">-- Select Unit --</option>
+ @foreach($units as $unit)
+ <option value="{{ $unit->id }}">{{ $unit->name }}</option>
+ 
+ <div class="col-md-3">
+ <label for="command_id">Command Name:</label>
+                                                 <select name="command_id" class="form-control select2" id="command_id" required>
+ <option value="">-- Select Command --</option>
+ @foreach($commands as $command)
+ <option value="{{ $command->id }}">{{ $command->name }}</option>
Removed / Before Commit
- <td>{{ $entry->c_n }}</td>
- <td>{{ $entry?->workUnit?->units?->name ?? '-' }}</td>
- <td>@foreach ($entry->WorkOrders as $control)
-                             <div>{{ $control->control_no }}</div>
- @endforeach</td>
- <td>
- @if(count($entry->WorkOrders) == 0)
Added / After Commit
+ <td>{{ $entry->c_n }}</td>
+ <td>{{ $entry?->workUnit?->units?->name ?? '-' }}</td>
+ <td>@foreach ($entry->WorkOrders as $control)
+                             <div>{{ $control->control_no }}  <a href="{{ route('crc.workorder.print', base64_encode($control->control_no)) }}" target="_blank" class="btn" style="color:blue"><i class="fa fa-eye" aria-hidden="true"></i></a></div>
+                             
+ @endforeach</td>
+ <td>
+ @if(count($entry->WorkOrders) == 0)
Removed / Before Commit
- <div class="container">
- <div class="d-flex justify-content-between align-items-center mb-4">
- <h2 class="mb-0">Issue IV Parts</h2>
- 
- <button type="submit" form="issueForm" class="btn btn-success">
- Submit Issued IVs
- <th>Equipment Name</th>
- <th>Nomenclature</th>
- <th>Qty</th>
- <th>509 Issue IV No</th>
- </tr>
- </thead>
- <tbody>
- @foreach($data as $d)
-                                         <tr>
-                                             <th>{{$d->CrcEquipments->part_no}}</th>
-                                             <th>{{$d->CrcEquipments->equipment_name}}</th>
-                                             <th>{{$d->CrcEquipments->nomenclature}}</th>
Added / After Commit
+ <div class="container">
+ <div class="d-flex justify-content-between align-items-center mb-4">
+ <h2 class="mb-0">Issue IV Parts</h2>
+         <a href="{{ route('crc.voucher.print', base64_encode($workOrderIds)) }}" target="_blank" class="btn" style="color:blue">
+         <button class="btn btn-success">
+             Print Issued IVs
+         </button>       
+         </a>
+ 
+ <button type="submit" form="issueForm" class="btn btn-success">
+ Submit Issued IVs
+ <th>Equipment Name</th>
+ <th>Nomenclature</th>
+ <th>Qty</th>
+                                             <th>Inventory Stock</th>
+ <th>509 Issue IV No</th>
+ </tr>
+ </thead>
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Receipt Issue Voucher</title>
+ 
+ <style>
+ 
+ body{
+     font-family: Arial, sans-serif;
+     margin:40px;
+ }
+ 
+ .container{
+     width:900px;
+     margin:auto;
+ }
+ 
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Work Order</title>
+ 
+ <style>
+ 
+ body{
+     font-family: Arial, sans-serif;
+     margin:40px;
+     font-size:14px;
+ }
+ 
+ .container{
+     width:900px;
+     margin:auto;
+ }
Removed / Before Commit
- <table class="table table-bordered">
- <thead>
- <tr>
- <th>Cos Sec</th>
- <th>Material No</th>
- <th>Cat/Part No</th>
- @endphp
- @if($scale)
- <tr>
- <td>{{ $scale->cos_sec }}</td>
- <td>{{ $scale->material_no }}</td>
- <td>{{ $scale->cat_part_no }}</td>
Added / After Commit
+ <table class="table table-bordered">
+ <thead>
+ <tr>
+                 <th>Os Ser No</th>
+ <th>Cos Sec</th>
+ <th>Material No</th>
+ <th>Cat/Part No</th>
+ @endphp
+ @if($scale)
+ <tr>
+                      <td>{{$scale->os_ser_no}}</td>
+ <td>{{ $scale->cos_sec }}</td>
+ <td>{{ $scale->material_no }}</td>
+ <td>{{ $scale->cat_part_no }}</td>
Removed / Before Commit
- <table class="table table-bordered mb-4">
- <thead>
- <tr>
- <th>Cos Sec</th>
- <th>Material No</th>
- <th>Cat/Part No</th>
- @endphp
- @if($scale)
- <tr>
- <td>{{ $scale->cos_sec }}</td>
- <td>{{ $scale->material_no }}</td>
- <td>{{ $scale->cat_part_no }}</td>
Added / After Commit
+ <table class="table table-bordered mb-4">
+ <thead>
+ <tr>
+                             <th>OS Ser No</th>
+ <th>Cos Sec</th>
+ <th>Material No</th>
+ <th>Cat/Part No</th>
+ @endphp
+ @if($scale)
+ <tr>
+                                     <td>{{ $scale->os_ser_no }}</td>
+ <td>{{ $scale->cos_sec }}</td>
+ <td>{{ $scale->material_no }}</td>
+ <td>{{ $scale->cat_part_no }}</td>
Removed / Before Commit
- <table class="table table-bordered">
- <thead>
- <tr>
- <th>Cos Sec</th>
- <th>Cat/Part No</th>
- <th>Nomenclature</th>
- @endphp
- @if($scale)
- <tr>
- <td>{{ $scale->cos_sec }}</td>
- <td>{{ $scale->cat_part_no }}</td>
- <td>{{ $scale->nomenclature }}</td>
Added / After Commit
+ <table class="table table-bordered">
+ <thead>
+ <tr>
+                         <th>OS Ser No</th>
+ <th>Cos Sec</th>
+ <th>Cat/Part No</th>
+ <th>Nomenclature</th>
+ @endphp
+ @if($scale)
+ <tr>
+                                 <td>{{$scale->os_ser_no}}</td>
+ <td>{{ $scale->cos_sec }}</td>
+ <td>{{ $scale->cat_part_no }}</td>
+ <td>{{ $scale->nomenclature }}</td>
Removed / Before Commit
- <table>
- <thead>
- <tr>
-         <th>Sl No</th>
- <!-- <th>Portion</th> -->
- <!-- <th>Old Ohs</th> -->
- <th>Cos Sec</th>
- @endphp
- @if(!empty($scale))
- <tr>
-           <td>{{ $index + 1 }}</td>
- <!-- <td>{{ $item->portion ?? '' }}</td> -->
- <!-- <td>{{ $item->old_ohs ?? '' }}</td> -->
- <td>{{ $scale->cos_sec }}</td>
Added / After Commit
+ <table>
+ <thead>
+ <tr>
+         <th>OS Ser No</th>
+ <!-- <th>Portion</th> -->
+ <!-- <th>Old Ohs</th> -->
+ <th>Cos Sec</th>
+ @endphp
+ @if(!empty($scale))
+ <tr>
+           <td>{{ $scale->os_ser_no }}</td>
+ <!-- <td>{{ $item->portion ?? '' }}</td> -->
+ <!-- <td>{{ $item->old_ohs ?? '' }}</td> -->
+ <td>{{ $scale->cos_sec }}</td>
Removed / Before Commit
- </div>
- </div>
- <div class="table-responsive">
-                    <table class="table table-bordered table-striped" id="example24">
- <thead class="table-primary">
- <tr>
- <th>S. No</th>
-                                 <th>Unit Name</th>
- <th>Group Name</th>
- <th>Command</th>
-                                 <th>Workspace</th>
-                                 <th>Division</th>
-                                 <th>CORPS</th>
-                                 <th>COS</th>
-                                 <th>Repair Class</th>
- <th>Main Eqpt</th>
- <th>Sub Eqpt</th>
-                                 <th>Type</th>
Added / After Commit
+ </div>
+ </div>
+ <div class="table-responsive">
+                    <table class="table table-bordered table-striped" id="example242">
+ <thead class="table-primary">
+ <tr>
+ <th>S. No</th>
+ <th>Group Name</th>
+                                 <th>Unit Name</th>
+ <th>Command</th>
+                                 <th>CorpS</th>
+                                 <th>Div</th>
+                                 <th>Bde</th>
+ <th>Main Eqpt</th>
+ <th>Sub Eqpt</th>
+ <th>Regd No</th>
+                                 <th>Repair Class</th>
+ <th>Job No</th>
Removed / Before Commit
- </div>
- <div class="col-md-7">
- <form method="GET" action="{{ route('gatepass.index') }}" class="row g-3 justify-content-end ">
-                     <div class="col-md-4">
- <label>WCN Number</label>
- <!-- <select name="wcn_number" class="form-select select2" data-placeholder="Select WCN Number">
- <option value="">-- Select WCN Number --</option>
- @endif
- </select>
- </div>
-                     <div class="col-md-3">
- <label>Unit Name</label>
- <select name="unit_id" class="form-control select2" data-placeholder="Search or select">
- <option value="">-- Select Unit --</option>
- @endforeach
- </select>
- </div>
-                     <div class="col-md-3">
Added / After Commit
+ </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
+                             </option>
+                         </select>
+                     </div>
+                      <div class="col-md-2">
+                         <label>Control No</label>
+                        
Removed / Before Commit
- <td><strong>UNIT: {{ strtoupper($pass?->workOrder?->workUnit?->units?->name ?? '-') }}</strong></td>
- <td class="text-left">
- <strong>WCN NO.: @foreach($pass->details as $detail)
-     {{ $detail->workEquipment?->wcn_number ?? '-' }}@if (!$loop->last), @endif
- @endforeach</strong><br>
- <strong>{{ \Carbon\Carbon::parse($pass?->gate_pass_date)->format('d-M-Y') }}</strong>
- </td>
- </tr>
- </table>
- 
- <div class="section" style="font-size: 16px; text-align: center; font-weight: 400;"><strong>TOTAL NO OF EQPTS COLLECTED : {{ $pass->details->count() }}</strong> </div>
- <div class="section" style="font-size: 16px; text-align: center; font-weight: 400;">
-                 @foreach($pass->details as $detail)
-                     EQPT Name : {{ $detail->workEquipment?->Equipments?->name.'  Regd No : '.$detail->workEquipment?->regd_no ?? '-' }} @if (!$loop->last), 
-                     <br>
-                    
-                     @endif
-                 @endforeach </div>
Added / After Commit
+ <td><strong>UNIT: {{ strtoupper($pass?->workOrder?->workUnit?->units?->name ?? '-') }}</strong></td>
+ <td class="text-left">
+ <strong>WCN NO.: @foreach($pass->details as $detail)
+                             {{ $detail->workEquipment?->wcn_number ?? '-' }}@if (!$loop->last), @endif
+                         @endforeach</strong><br>
+ <strong>{{ \Carbon\Carbon::parse($pass?->gate_pass_date)->format('d-M-Y') }}</strong>
+ </td>
+ </tr>
+ </table>
+ 
+ <div class="section" style="font-size: 16px; text-align: center; font-weight: 400;"><strong>TOTAL NO OF EQPTS COLLECTED : {{ $pass->details->count() }}</strong> </div>
+ <div class="section" style="font-size: 16px; text-align: center; font-weight: 400;">
+               @foreach($pass->details as $detail)
+     EQPT Name : {{ $detail->workEquipment?->Equipments?->name ?? '-' }},
+     Regd No : {{ $detail->workEquipment?->regd_no ?? '-' }},
+     Type : {{ $detail->workEquipment->wcn_number != '' ? $detail->workEquipment?->type : 'VIR REJECTED' }}
+     
+     @if (!$loop->last)
Removed / Before Commit
- <table class="table table-bordered">
- <thead>
- <tr>
- <th>COS SEC</th>
- <th>Materail No</th>
- <th>Part No / Nomenclature</th>
- @endphp
- @if($scale)
- <tr>
- <td>
- {{ $scale->cos_sec }}
- <input type="hidden" name="items[{{ $index1 }}][item_id]" value="{{ $scale->id }}">
Added / After Commit
+ <table class="table table-bordered">
+ <thead>
+ <tr>
+                         <th>OS Ser No</th>
+ <th>COS SEC</th>
+ <th>Materail No</th>
+ <th>Part No / Nomenclature</th>
+ @endphp
+ @if($scale)
+ <tr>
+                         <td>{{ $scale->os_ser_no }}</td>
+ <td>
+ {{ $scale->cos_sec }}
+ <input type="hidden" name="items[{{ $index1 }}][item_id]" value="{{ $scale->id }}">
Removed / Before Commit
- <th>
- <input type="checkbox" id="selectAllSpares">
- </th>
-             <th>Ser No</th>
- <th>Cos Sec</th>
- <th>Material No</th>
- <th>Cat Part No</th>
- @if(isset($receiveSums[$item->id])) disabled @endif
- >
- </td>
-                         <td>{{ $index +1 }}</td>
- <td>{{ $scale->cos_sec }}</td>
- <td>{{ $scale->material_no }}</td>
- <td>{{ $scale->cat_part_no }}</td>
Added / After Commit
+ <th>
+ <input type="checkbox" id="selectAllSpares">
+ </th>
+             <th>OS Ser No</th>
+ <th>Cos Sec</th>
+ <th>Material No</th>
+ <th>Cat Part No</th>
+ @if(isset($receiveSums[$item->id])) disabled @endif
+ >
+ </td>
+                         <td>{{ $scale->os_ser_no }}</td>
+ <td>{{ $scale->cos_sec }}</td>
+ <td>{{ $scale->material_no }}</td>
+ <td>{{ $scale->cat_part_no }}</td>
Removed / Before Commit
- <td>{{ $receive->mco_demand_no }}</td>
- <td>{{ $receive->voucher_no }}</td>
- <td>
-     <a href="{{ route('issues.show', [
- 'regn_no' => encrypt($receive->voucher_no),
- 'prod_year' => encrypt($receive->prod_year)
- ]) }}">
Added / After Commit
+ <td>{{ $receive->mco_demand_no }}</td>
+ <td>{{ $receive->voucher_no }}</td>
+ <td>
+     <a href="{{ route('issues.newshow', [
+         'group_req_no' => $receive->req_no,
+         'mco_demand_no' => $receive->mco_demand_no,
+ 'regn_no' => encrypt($receive->voucher_no),
+ 'prod_year' => encrypt($receive->prod_year)
+ ]) }}">
Removed / Before Commit
- <table class="table table-bordered table-striped">
- <thead class="table-primary">
- <tr>
-                             <th>Ser No</th>
- <th>COS SEC</th>
- <th>Part No</th>
- <th>Nomenclature</th>
- @endphp
- @if($scale)
- <tr>
-                                 <td>{{ $index + 1 }}</td>
- <td>{{ $scale->cos_sec }}</td>
- <td>{{ $scale->cat_part_no }}</td>
- <td>{{ $scale->nomenclature }}</td>
Added / After Commit
+ <table class="table table-bordered table-striped">
+ <thead class="table-primary">
+ <tr>
+                             <th>OS Ser No</th>
+ <th>COS SEC</th>
+ <th>Part No</th>
+ <th>Nomenclature</th>
+ @endphp
+ @if($scale)
+ <tr>
+                                 <td>{{ $scale->os_ser_no }}</td>
+ <td>{{ $scale->cos_sec }}</td>
+ <td>{{ $scale->cat_part_no }}</td>
+ <td>{{ $scale->nomenclature }}</td>
Removed / Before Commit
- }
- });
- });
-     document.getElementById("selectFileBtn").addEventListener("click", function(){
-     document.getElementById("fileInput").click();
- });
- 
- document.getElementById("fileInput").addEventListener("change", function(){
-     if(this.files.length > 0){
-         autoUpload();
- }
- });
- </script>
Added / After Commit
+ }
+ });
+ });
+     const selectFileBtn = document.getElementById("selectFileBtn");
+     const fileInput = document.getElementById("fileInput");
+ 
+     if (selectFileBtn && fileInput) {
+         selectFileBtn.addEventListener("click", function () {
+             fileInput.click();
+         });
+     }
+ 
+     if (fileInput) {
+         fileInput.addEventListener("change", function () {
+             if (this.files.length > 0) {
+                 autoUpload();
+             }
+         });
Removed / Before Commit
- @endphp
- <div class="sidebar-wrapper" data-simplebar="true">
- <div class="sidebar-header">
-         <div><img src="{{asset('storage/'.$data->logo_path)}}" class="logo-icon" alt="logo icon"></div>
- <div><h4 class="logo-text">{{$data->title}}</h4></div>
- <div class="mobile-toggle-icon ms-auto"><i class='bx bx-x'></i></div>
- </div>
Added / After Commit
+ @endphp
+ <div class="sidebar-wrapper" data-simplebar="true">
+ <div class="sidebar-header">
+         <div><img src="{{asset('assets/images/'.$data->logo_path)}}" class="logo-icon" alt="logo icon"></div>
+ <div><h4 class="logo-text">{{$data->title}}</h4></div>
+ <div class="mobile-toggle-icon ms-auto"><i class='bx bx-x'></i></div>
+ </div>
Removed / Before Commit
- <h4>{{ isset($leaveType) ? 'Edit Leave Type' : 'Create Leave Type' }}</h4>
- </div>
- <div class="card-body">
- <form action="{{ isset($leaveType) ? route('leave-types.update', $leaveType->id) : route('leave-types.store') }}" method="POST">
- @csrf
- @if(isset($leaveType))
- <input type="text" name="leave_name" class="form-control" value="{{ old('leave_name', $leaveType->leave_name ?? '') }}" required>
- </div>
- 
-                 <div class="col-md-4 mb-3">
-                     <label>Category <span class="text-danger">*</span></label>
-                     <select name="leave_category" class="form-select" required>
-                         <option value="">--Select--</option>
-                         <option value="Full Day" {{ old('leave_category', $leaveType->leave_category ?? '') == 'Full Day' ? 'selected' : '' }}>Full Day</option>
-                         <option value="Half Day" {{ old('leave_category', $leaveType->leave_category ?? '') == 'Half Day' ? 'selected' : '' }}>Half Day</option>
-                         <option value="Hourly" {{ old('leave_category', $leaveType->leave_category ?? '') == 'Hourly' ? 'selected' : '' }}>Hourly</option>
- </select>
- </div>
Added / After Commit
+ <h4>{{ isset($leaveType) ? 'Edit Leave Type' : 'Create Leave Type' }}</h4>
+ </div>
+ <div class="card-body">
+         @if ($errors->any())
+             <div class="alert alert-danger alert-dismissible fade show" role="alert">
+                 <strong>Validation Errors:</strong>
+                 <ul class="mb-0">
+                     @foreach ($errors->all() as $error)
+                         <li>{{ $error }}</li>
+                     @endforeach
+                 </ul>
+                 <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
+             </div>
+         @endif
+         
+ <form action="{{ isset($leaveType) ? route('leave-types.update', $leaveType->id) : route('leave-types.store') }}" method="POST">
+ @csrf
+ @if(isset($leaveType))
Removed / Before Commit
- @extends('layouts.app')
- <!-- 
- Name	Leave type (Casual, Sick, Earned, Maternity, etc.)	Directly defines the type
- Category	Full Day / Half Day / Hourly	Can represent leave duration unit logically
- Eligible For	Annual / Monthly / Other	Annual covers yearly limit, monthly for monthly accrual
- Min Service (Months)	Months of service before eligible	Covers probation periods, service-based eligibility
- Remarks	Extra information	Any special notes, rules, exceptions
- Status	Active/Inactive	To enable or disable a leave type
- Actions	Edit/Delete	UI functionality 
- -->
- @section('content')
- <div class="card">
-     <!-- <div class="card-header py-3">
-         <div class="row align-items-center">
-             <div class="col-md-5">
-                 <h4><b>Leave Types</b></h4>
-             </div>
-             <div class="col-md-7">
Added / After Commit
+ @extends('layouts.app')
+ <!--
+ Name	Leave type (Casual, Sick, Earned, Maternity, etc.)	Directly defines the type
+ Category	Full Day / Half Day / Hourly	Can represent leave duration unit logically
+ Eligible For	Annual / Monthly / Other	Annual covers yearly limit, monthly for monthly accrual
+ Min Service (Months)	Months of service before eligible	Covers probation periods, service-based eligibility
+ Remarks	Extra information	Any special notes, rules, exceptions
+ Status	Active/Inactive	To enable or disable a leave type
+ Actions	Edit/Delete	UI functionality
+ -->
+ @section('content')
+     <div class="card">
+         <!-- <div class="card-header py-3">
+             <div class="row align-items-center">
+                 <div class="col-md-5">
+                     <h4><b>Leave Types</b></h4>
+                 </div>
+                 <div class="col-md-7">
Removed / Before Commit
- </tr>
- </thead>
- <tbody>
-                         <!-- AJAX DATA -->
- </tbody>
- </table>
- 
- </div>
- 
- </div>
- @endsection
- 
- 
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
- 
- <script>
- 
Added / After Commit
+ </tr>
+ </thead>
+ <tbody>
+                         @if(isset($appliedLeaves) && count($appliedLeaves) > 0)
+                             @foreach($appliedLeaves as $leave)
+                             <tr>
+                                 <td><input type="checkbox" class="row-checkbox form-check-input" value="{{ $leave->id }}"></td>
+                                 <td>{{ $leave->id }}</td>
+                                 <td>{{ $leave->attendance_id ?? '-' }}</td>
+                                 <td>{{ $leave->employee->name ?? '-' }}</td>
+                                 <td>{{ $leave->leaveType->leave_name ?? '-' }}</td>
+                                 <td>{{ $leave->subject }}</td>
+                                 <td>{{ $leave->from_date }}</td>
+                                 <td>{{ $leave->to_date }}</td>
+                                 <td>{{ $leave->total_days }}</td>
+                                 <td>{{ $leave->description }}</td>
+                                 <td>
+                                     @if($leave->approval_status == 'pending')
Removed / Before Commit
- <div class="mb-3">
- <label for="leave_type_id" class="form-label">Leave Type</label>
- <select name="leave_type_id" id="leave_type_id" class="form-select" required>
-                         <option value="">Select Leave Type</option>
-                         @foreach($leaveTypes as $type)
-                             @php
-                                 $balance = $leaveBalance[$type->id] ?? 0;
-                             @endphp
-                             <option value="{{ $type->id }}" data-balance="{{ $balance }}" {{ $balance == 0 ? 'disabled' : '' }}>
-                                 {{ $type->leave_name }} (Balance: {{ $balance }})
-                             </option>
-                         @endforeach
- </select>
- </div>
- 
- <textarea name="description" id="description" class="form-control" rows="4" required></textarea>
- </div>
- 
Added / After Commit
+ <div class="mb-3">
+ <label for="leave_type_id" class="form-label">Leave Type</label>
+ <select name="leave_type_id" id="leave_type_id" class="form-select" required>
+                         <option value="">Select Leave</option>
+                     </select>
+                 </div>
+ 
+                 <div class="mb-3" id="durationContainer" style="display: none;">
+                     <label for="duration" class="form-label">Duration <span class="text-danger">*</span></label>
+                     <select name="duration" id="duration" class="form-select" required>
+                         <option value="">Select Duration</option>
+ </select>
+ </div>
+ 
+ <textarea name="description" id="description" class="form-control" rows="4" required></textarea>
+ </div>
+ 
+                 {{-- <div id="leaveInfo" class="mb-3 text-primary fw-bold"></div> --}}
Removed / Before Commit
- 
- <div class="mb-3">
- <label for="leave_type_id" class="form-label">Leave Type</label>
-                     <select name="leave_type_id" id="leave_type_id" class="form-select" required>
-                         <option value="">Select Leave Type</option>
-                         @foreach($leaveTypes as $type)
-                             @php
-                                 $balance = $leaveBalance[$type->id] ?? 0;
-                             @endphp
-                             <option value="{{ $type->id }}" data-balance="{{ $balance }}" 
-                                 {{ $leave->leave_type_id == $type->id ? 'selected' : '' }}>
-                                 {{ $type->leave_name }} (Balance: {{ $balance }})
-                             </option>
-                         @endforeach
- </select>
- </div>
- 
- const fromDate = document.getElementById("from_date");
Added / After Commit
+ 
+ <div class="mb-3">
+ <label for="leave_type_id" class="form-label">Leave Type</label>
+                     <select name="leave_type_id" id="leave_type_id" class="form-select" required data-selected="{{ $leave->leave_type_id }}">
+                         <option value="">Select Leave</option>
+                     </select>
+                 </div>
+ 
+                 <div class="mb-3" id="durationContainer" style="display: none;">
+                     <label for="duration" class="form-label">Duration <span class="text-danger">*</span></label>
+                     <select name="duration" id="duration" class="form-select" required>
+                         <option value="">Select Duration</option>
+ </select>
+ </div>
+ 
+ const fromDate = document.getElementById("from_date");
+ const toDate = document.getElementById("to_date");
+ const leaveType = document.getElementById("leave_type_id");
Removed / Before Commit
- @extends('layouts.app')
- @section('content')
- 
- <div class="container-fluid mt-3">
- <div class="card">
- <div class="card-header py-3">
- <select id="leaveType" class="form-select">
- <option value="">Select Leave Type...</option>
- @foreach($leaveTypes as $type)
-                                             <option value="{{ $type->id }}">{{ $type->leave_name }}</option>
- @endforeach
- </select>
- </div>
- 
- <button type="button" id="addToListBtn" class="btn btn-primary w-100" disabled>
- <i class="fas fa-plus"></i> Add to Leave List
- </button>
- 
Added / After Commit
+ @extends('layouts.app')
+ @section('content')
+ 
+ <style>
+ /* Fix button styling issues */
+ .btn {
+     border: 1px solid transparent !important;
+     font-weight: 500 !important;
+     text-decoration: none !important;
+ }
+ 
+ .btn-primary {
+     background-color: #007bff !important;
+     border-color: #007bff !important;
+     color: #ffffff !important;
+ }
+ 
+ .btn-primary:hover {
Removed / Before Commit
- <table class="table table-bordered">
- <thead>
- <tr>
-                 <th>Ser No</th>
- <th>Cos Sec</th>
- <th>Material No</th>
- <th>Cat Part No</th>
- @endphp
- @if($scale)
- <tr>
-                     <td>{{$index+1}}</td>
- <td>{{ $scale->cos_sec }}</td>
- <td>{{ $scale->material_no }}</td>
- <td>{{ $scale->cat_part_no }}</td>
Added / After Commit
+ <table class="table table-bordered">
+ <thead>
+ <tr>
+                 <th>OS Ser No</th>
+ <th>Cos Sec</th>
+ <th>Material No</th>
+ <th>Cat Part No</th>
+ @endphp
+ @if($scale)
+ <tr>
+                     <td>{{ $scale->os_ser_no}}</td>
+ <td>{{ $scale->cos_sec }}</td>
+ <td>{{ $scale->material_no }}</td>
+ <td>{{ $scale->cat_part_no }}</td>
Removed / Before Commit
- <table class="table table-bordered">
- <thead>
- <tr>
-                     <th>Ser No</th>
- <th>Cos Sec</th>
- <th>Material No</th>
- <th>Cat Part No</th>
- @endphp
- @if($scale)
- <tr>
-                         <td>{{$index+1}}</td>
- <td>{{ $scale->cos_sec }}</td>
- <td>{{ $scale->material_no }}</td>
- <td>{{ $scale->cat_part_no }}</td>
Added / After Commit
+ <table class="table table-bordered">
+ <thead>
+ <tr>
+                     <th>OS Ser No</th>
+ <th>Cos Sec</th>
+ <th>Material No</th>
+ <th>Cat Part No</th>
+ @endphp
+ @if($scale)
+ <tr>
+                         <td>{{$scale->os_ser_no}}</td>
+ <td>{{ $scale->cos_sec }}</td>
+ <td>{{ $scale->material_no }}</td>
+ <td>{{ $scale->cat_part_no }}</td>
Removed / Before Commit
- <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-select  filter-auto" data-placeholder="Select or search Job Number">
- <option value="">-- Select Job Number --</option>
- @foreach($jobNumbers as $jobNo)
- <option value="{{ $jobNo }}" {{ request('job_number') == $jobNo ? 'selected' : '' }}>
- 
- <div class="col-md-6">
- <label for="regd_no" class="form-label">Regd No</label>
-                             <select name="regd_no" class="form-select  filter-auto" data-placeholder="Select or search Regd No">
- <option value="">-- Select Regd No --</option>
- @foreach($regdNos as $regd)
- <option value="{{ $regd }}" {{ request('regd_no') == $regd ? 'selected' : '' }}>
- <tr>
- <td>{{ $order->workUnit?->units?->name ?? '-' }}</td>
- <td>{{ $order->workUnit?->wksps?->name ?? '-' }}</td>
- <td>{{ $equipment->unit_wo_no ?? '-' }}</td>
Added / After Commit
+ <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-select filter-auto select2" data-placeholder="Select or search Job Number">
+ <option value="">-- Select Job Number --</option>
+ @foreach($jobNumbers as $jobNo)
+ <option value="{{ $jobNo }}" {{ request('job_number') == $jobNo ? 'selected' : '' }}>
+ 
+ <div class="col-md-6">
+ <label for="regd_no" class="form-label">Regd No</label>
+                             <select name="regd_no" class="form-select  filter-auto select2" data-placeholder="Select or search Regd No">
+ <option value="">-- Select Regd No --</option>
+ @foreach($regdNos as $regd)
+ <option value="{{ $regd }}" {{ request('regd_no') == $regd ? 'selected' : '' }}>
+ <tr>
+ <td>{{ $order->workUnit?->units?->name ?? '-' }}</td>
+ <td>{{ $order->workUnit?->wksps?->name ?? '-' }}</td>
+                             @if(Str::contains(strtolower($order->c_n), 'crc'))
Removed / Before Commit
- <tr>
- <td>{{ $order->job_no ?? '-' }}</td>
- <td>{{ $order->job_date ?? '-' }}</td>
- <td>{{ $equipment->Equipments?->name ? $equipment->Equipments?->name :  $equipment->main_eqpt}}</td>
- <td>{{ $equipment->quantity}}</td>
- <td>{{ $equipment->assy}}</td>
- <td>{{ $equipment->regd_no ?? '-' }}</td>
- <td>{{ $order->workUnit?->units?->name ?? '-' }}</td>
- <td>{{ $order->workUnit?->wksps?->name ?? '-' }}</td>
Added / After Commit
+ <tr>
+ <td>{{ $order->job_no ?? '-' }}</td>
+ <td>{{ $order->job_date ?? '-' }}</td>
+                             @if(Str::contains(strtolower($equipment->workOrder->c_n), 'crc'))
+                             <td>{{ $equipment->CrcEquipments?->equipment_name}}</td>
+                             @else
+ <td>{{ $equipment->Equipments?->name ? $equipment->Equipments?->name :  $equipment->main_eqpt}}</td>
+                             @endif
+ <td>{{ $equipment->quantity}}</td>
+                               @if(Str::contains(strtolower($equipment->workOrder->c_n), 'crc'))
+                               <td>{{  $equipment->CrcEquipments?->part_no}}</td>
+                               @else
+ <td>{{ $equipment->assy}}</td>
+                             @endif
+ <td>{{ $equipment->regd_no ?? '-' }}</td>
+ <td>{{ $order->workUnit?->units?->name ?? '-' }}</td>
+ <td>{{ $order->workUnit?->wksps?->name ?? '-' }}</td>
Removed / Before Commit
- @if($equipment)
- <div class="px-4 py-3 border-bottom bg-light">
- <div class="row mb-2">
-             <div class="col-md-3"><strong>Main Equipment:</strong> {{ $equipment?->Equipments?->name ?? '-' }}</div>
- <div class="col-md-3"><strong>Unit:</strong> {{ $equipment->workOrder->workUnit->units->name ?? '-' }}</div>
- <div class="col-md-3"><strong>Job No:</strong> {{ $equipment->workOrder->job_no ?? '-' }}</div>
- <div class="col-md-3"><strong>Job Date:</strong> {{ \Carbon\Carbon::parse($equipment->workOrder->job_date)->format('d-m-Y') ?? '-' }}</div>
- </div>
- <div class="row">
- <div class="col-md-3"><strong>Sub-Assy Equipment:</strong> {{ $equipment->assy ?? '-' }}</div>
- <div class="col-md-3"><strong>Regd No:</strong> {{ $equipment->regd_no ?? '-' }}</div>
- </div>
- </div>
- @endif
Added / After Commit
+ @if($equipment)
+ <div class="px-4 py-3 border-bottom bg-light">
+ <div class="row mb-2">
+              @if(Str::contains(strtolower($equipment->workOrder->c_n), 'crc'))
+             <div class="col-md-3"><strong>Main Equipment:</strong> {{ $equipment->CrcEquipments?->equipment_name ?? '-' }}</div>
+             @else
+              <div class="col-md-3"><strong>Main Equipment:</strong> {{ $equipment?->Equipments?->name ?? '-' }}</div>
+             @endif
+ <div class="col-md-3"><strong>Unit:</strong> {{ $equipment->workOrder->workUnit->units->name ?? '-' }}</div>
+ <div class="col-md-3"><strong>Job No:</strong> {{ $equipment->workOrder->job_no ?? '-' }}</div>
+ <div class="col-md-3"><strong>Job Date:</strong> {{ \Carbon\Carbon::parse($equipment->workOrder->job_date)->format('d-m-Y') ?? '-' }}</div>
+ </div>
+ <div class="row">
+             @if(Str::contains(strtolower($equipment->workOrder->c_n), 'crc'))
+             @else
+ <div class="col-md-3"><strong>Sub-Assy Equipment:</strong> {{ $equipment->assy ?? '-' }}</div>
+ <div class="col-md-3"><strong>Regd No:</strong> {{ $equipment->regd_no ?? '-' }}</div>
+             @endif
Removed / Before Commit
- <td>{{ $order->workUnit?->units?->name ?? '-' }}</td>
- <td>{{ $order->workUnit?->wksps?->name ?? '-' }}</td>
- <!-- <td>{{ $order->workUnit?->commands?->name ?? '-' }}</td> -->
- <td>{{ $equipment->unit_wo_no ?? '-' }}</td>
- <td>{{ $equipment->unit_wo_date ?? '-' }}</td>
- <td>{{ $equipment->Equipments?->name ?? '-' }}</td>
- <td>{{ $equipment->assy ?? '-' }}</td>
- <td>{{ $equipment->regd_no ?? '-' }}</td>
- <td>{{ $order->job_no ?? '-' }}</td>
- <td>{{ $vir?->vir_date?->format('Y-m-d') ?? '-' }}</td>
- <div class="modal-body row g-3">
- <div class="col-md-6">
- <label for="poc_date">PDC Date</label>
-           <input type="date" name="pdc_date" class="form-control" required>
- </div>
- 
- <div class="col-md-6">
- <label for="fault">Fault</label>
Added / After Commit
+ <td>{{ $order->workUnit?->units?->name ?? '-' }}</td>
+ <td>{{ $order->workUnit?->wksps?->name ?? '-' }}</td>
+ <!-- <td>{{ $order->workUnit?->commands?->name ?? '-' }}</td> -->
+                         @if(Str::contains(strtolower($order->c_n), 'crc'))
+                         <td>{{ $order->control_no ?? '-' }}</td>
+                         @else 
+ <td>{{ $equipment->unit_wo_no ?? '-' }}</td>
+                         @endif
+ <td>{{ $equipment->unit_wo_date ?? '-' }}</td>
+                          @if(Str::contains(strtolower($order->c_n), 'crc'))
+                          <td>{{ $equipment->CrcEquipments?->equipment_name ?? '-' }}</td>
+                          <td>{{ $equipment->CrcEquipments?->part_no ?? '-' }}</td>
+                          @else
+ <td>{{ $equipment->Equipments?->name ?? '-' }}</td>
+ <td>{{ $equipment->assy ?? '-' }}</td>
+                         @endif
+                         
+ <td>{{ $equipment->regd_no ?? '-' }}</td>
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ 
+ <style>
+ 
+ .select2-container { width:100% !important; }
+ 
+ .select2-selection{
+ min-height:32px;
+ }
+ 
+ form{
+ margin-bottom:40px;
+ }
+ 
+ </style>
+ 
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ 
+ <style>
+ 
+ .select2-container { width:100% !important; }
+ 
+ .select2-selection{
+ min-height:32px;
+ }
+ 
+ form{
+ margin-bottom:40px;
+ }
+ 
+ .cancelBtn
+ {
Removed / Before Commit
- \ No newline at end of file
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ 
+ <style>
+ .select2-container { width:100% !important; }
+ .select2-selection{ min-height:32px; }
+ form{ margin-bottom:40px; }
+ .cancelBtn
+ {
+     color: black!important;
+     border-color: black;
+ }
+ </style>
+ 
+ <div class="card">
+ 
+ <div class="card-header py-3">
Removed / Before Commit
- </div>
- </div>
- 
- 
- <script>
- // Set up CSRF token for AJAX requests
Added / After Commit
+ </div>
+ </div>
+ 
+ @endsection
+ 
+ @section('scripts')
+ 
+ <script>
+ // Set up CSRF token for AJAX requests
Removed / Before Commit
- <div class="col-md-9">
- <h4><i class="fas fa-clipboard-list pt-2 me-3"></i><strong>Group RV Number Management</strong></h4>
- </div>
-                 
-             {{-- </div>
-             <div class="row mt-3"> --}}
- <div class="col-md-3 " style="text-align:end ">
-                    <button type="button" id="toggleDataBtn" class="btn btn-info btn-sm">
-                             <i class="fas fa-list"></i> Show All Data
- </button>
- </div>
-                 
- </div>
- <div class="col-md-12 row">
-                     <div class="col-md-3">
-                         <label for="filter_iv_number" class="form-label">IV Number</label>
-                         <select id="filter_iv_number" class="form-select">
-                             <option value="">All IV Numbers</option>
Added / After Commit
+ <div class="col-md-9">
+ <h4><i class="fas fa-clipboard-list pt-2 me-3"></i><strong>Group RV Number Management</strong></h4>
+ </div>
+ 
+ <div class="col-md-3 " style="text-align:end ">
+                     <button type="button" id="toggleDataBtn" class="btn btn-info btn-sm">
+                         <i class="fas fa-list"></i> Show All Data
+ </button>
+ </div>
+ 
+ </div>
+ <div class="col-md-12 row">
+                 <div class="col-md-3">
+                     <label for="filter_iv_number" class="form-label">IV Number</label>
+                     <select id="filter_iv_number" class="form-select">
+                         <option value="">All IV Numbers</option>
+                         <option value="" disabled>--- Available Items ---</option>
+                         @foreach ($availableItems->unique('iv_number')->sortBy('iv_number') as $item)
Removed / Before Commit
- </div>
- </div>
- 
- 
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
- <script>
- // Global function for pagination
- function loadInventoryData(page = 1) {
- 
- $(document).ready(function() {
- // Initialize Select2 dropdowns
-     $('.select2').select2({
-         theme: 'bootstrap-5',
-         width: '100%'
-     });
- 
- // Apply filters
Added / After Commit
+ </div>
+ </div>
+ 
+ @endsection
+ 
+ @section('scripts')
+ 
+ <!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
+ <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> -->
+ 
+ 
+ <script>
+ // Global function for pagination
+ function loadInventoryData(page = 1) {
+ 
+ $(document).ready(function() {
+ // Initialize Select2 dropdowns
+    
Removed / Before Commit
- <div class="mb-3"><small id="subAssyTypeError" class="text-danger d-none">Please fill all required fields <br>(Sub Equipment Name, Equipment, Time Alot (hours)).</small></div>
- <div class="mb-3">
- <label class="form-label">Equipment<span class="text-danger">*</span></label>
-                                     <select class="form-select" id="equipmentSelect">
- <option value="">-- Select Equipment --</option>
- @foreach($equipments as $equipment)
- <option value="{{ $equipment->id }}">{{ $equipment->name }}</option>
- 
- @section('scripts')
- <script>
- $('[data-bs-target="#subAssyModal"]').on('click', function() {
- $('#subAssyId').val('');
- $('#equipmentSelect').val('');
Added / After Commit
+ <div class="mb-3"><small id="subAssyTypeError" class="text-danger d-none">Please fill all required fields <br>(Sub Equipment Name, Equipment, Time Alot (hours)).</small></div>
+ <div class="mb-3">
+ <label class="form-label">Equipment<span class="text-danger">*</span></label>
+                                     <select class="form-select select2" id="equipmentSelect">
+ <option value="">-- Select Equipment --</option>
+ @foreach($equipments as $equipment)
+ <option value="{{ $equipment->id }}">{{ $equipment->name }}</option>
+ 
+ @section('scripts')
+ <script>
+     $('#subAssyModal').on('shown.bs.modal', function () {
+     $('#equipmentSelect').select2({
+         dropdownParent: $('#subAssyModal')
+     });
+ });
+ $('[data-bs-target="#subAssyModal"]').on('click', function() {
+ $('#subAssyId').val('');
+ $('#equipmentSelect').val('');
Removed / Before Commit
- font-size: 14px;
- }
- .page {
-       padding: 10mm 10mm;
- /*      width: 210mm;*/
- /*      height: 260mm;*/
-       box-sizing: border-box;
-       overflow: hidden;
-     }
-     .page.one{
-       height: 250mm;
-     }
- .center-title {
- text-align: center;
- font-weight: bold;
- border: none;
- border-top: 1px dashed black;
- }
Added / After Commit
+ font-size: 14px;
+ }
+ .page {
+   padding: 10mm;
+   box-sizing: border-box;
+ }
+ 
+ .page-break {
+   page-break-before: always;
+ }
+ 
+ @media print {
+ 
+   .btns {
+     display: none;
+   }
+ 
+   .page-break {
Removed / Before Commit
- <table>
- <thead>
- <tr>
- <th>Ser No</th>
- <th>COS SEC</th>
- <th>Material No</th>
- <th>CAT/PART NO</th>
- <th>NOMENCLATURE</th>
- <th>A/U</th>
- <th>MCO Demand No</th>
- <th>MCO Demand Date</th>
- <th>Job No </th>
- <th>Epqt Regd No </th>
- <!-- <th>QTY REQD</th>
- 
- @if($scale)
- <tr>
- <td>{{ $i+1 }}</td>
Added / After Commit
+ <table>
+ <thead>
+ <tr>
+ <th>OS Ser No</th>
+ <th>COS SEC</th>
+ <th>Material No</th>
+ <th>CAT/PART NO</th>
+ <th>NOMENCLATURE</th>
+ <th>A/U</th>
+ <th>MCO Demand No</th>
+ <th>MCO Demand Date</th>
+ <th>Qty Demanded</th>
+ <th>Job No </th>
+ <th>Epqt Regd No </th>
+ <!-- <th>QTY REQD</th>
+ 
+ @if($scale)
+ <tr>
Removed / Before Commit
- </div>
- </div>
- 
- 
- {{-- Telephone --}}
- <div class="row mb-3">
Added / After Commit
+ </div>
+ </div>
+ 
+                     {{-- Employee Number --}}
+                     <div class="row mb-3">
+                         <label class="col-sm-3 col-form-label">Employee Number</label>
+                         <div class="col-sm-9">
+                             <input type="text" name="employee_number" class="form-control" value="{{ $user->employee_number }}" required>
+                         </div>
+                     </div>
+ 
+ 
+ {{-- Telephone --}}
+ <div class="row mb-3">
Removed / Before Commit
- 
- <div class="vir-list">
- <div class="row">
-                         @forelse($workOrders as $workOrder)
- @php $equip = $workOrder->equipment; @endphp
- @if(Str::contains(strtolower($workOrder->c_n), 'crc'))
-                                 <div class="col-md-12 mb-4"> 
-                                    
-                                     <div class="card-body">
- <p>Work Order: {{$workOrder->control_no}}</p>
-                                         <div class="row mb-4">
-                                             <div class="col-md-3">
-                                                 <label><b>CRC No</b></label>
-                                                 <div class="form-control bg-light">{{ preg_replace('#/\d+$#', '', $workOrder->c_n) }}</div>
-                                             </div>
-                                             <div class="col-md-3">
-                                                 <label><b>CRC Date</b></label>
-                                                 <div class="form-control bg-light">{{ \Carbon\Carbon::parse($workOrder->control_date)->format('d-m-Y') }}</div>
Added / After Commit
+ 
+ <div class="vir-list">
+ <div class="row">
+                         @foreach($workOrders as $workOrder)
+ @php $equip = $workOrder->equipment; @endphp
+ @if(Str::contains(strtolower($workOrder->c_n), 'crc'))
+                                 <div class="col-md-12 mb-4">
+                                 
+                                         <div class="row">
+ <p>Work Order: {{$workOrder->control_no}}</p>
+                                             <div class="row mb-4">
+                                                 <div class="col-md-3">
+                                                     <label><b>CRC No</b></label>
+                                                     <div class="form-control bg-light">{{ preg_replace('#/\d+$#', '', $workOrder->c_n) }}</div>
+                                                 </div>
+                                                 <div class="col-md-3">
+                                                     <label><b>CRC Date</b></label>
+                                                     <div class="form-control bg-light">{{ \Carbon\Carbon::parse($workOrder->control_date)->format('d-m-Y') }}</div>
Removed / Before Commit
- <td>{{ $equipment->Equipments?->name ? $equipment->quantity : $equipment->qcInspection?->mr?->quantity }}</td>
- <td>{{ $equipment->wcn_number }}</td>
- <td>{{ $equipment->wcn_date }}</td>
- </tr>
- @endforeach
- @endif
Added / After Commit
+ <td>{{ $equipment->Equipments?->name ? $equipment->quantity : $equipment->qcInspection?->mr?->quantity }}</td>
+ <td>{{ $equipment->wcn_number }}</td>
+ <td>{{ $equipment->wcn_date }}</td>
+             <td>
+             <a href="{{url('/wcn/print/'.encrypt($equipment->wcn_number))}}"  data-url="{{url('/wcn/print/'.encrypt($equipment->wcn_number))}}" target="_blank" id="printButton"  class="btn btn-success">Commit</a>
+             </td>
+ </tr>
+ @endforeach
+ @endif
Removed / Before Commit
- <tr>
- <td><input type="checkbox" name="equipment_ids[]" value="{{ $equipment->id }}"></td>
- <td>{{ $equipment->group?->name }}</td>
- <td>{{ $equipment->Equipments?->name ? $equipment->Equipments?->name : $equipment->main_eqpt  }}</td>
- <td>{{ $equipment->assy }}</td>
- <td>
- {{
- $equipment?->work_equipment_id
- <th>Qty</th>
- <th>WCN No</th>
- <th>WCN Date</th>
- </tr>
- </thead>
- <tbody id="committedBody">
- @if (isset($committedData) && is_countable($committedData) && count($committedData) > 0)
- @foreach($committedData as $equipment)
- <tr>
- <td>{{ $equipment->group?->name }}</td>
Added / After Commit
+ <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->CrcEquipments?->part_no ?? '-' }}</td>
+                              @else
+ <td>{{ $equipment->Equipments?->name ? $equipment->Equipments?->name : $equipment->main_eqpt  }}</td>
+ <td>{{ $equipment->assy }}</td>
+                             @endif
+                             
+ <td>
+ {{
+ $equipment?->work_equipment_id
+ <th>Qty</th>
+ <th>WCN No</th>
+ <th>WCN Date</th>
+                         <th>Action</th>
Removed / Before Commit
- </tr>
- </thead>
- <tbody>
-     @foreach($WorkEquipment?->workOrder?->equipments as $index => $equip)
- <tr>
- <td>{{$index+1}}</td>
-         <td>{{$equip?->Equipments?->name}}</td>
- <td>{{$equip?->assy}}</td>
- <td>{{$equip?->regd_no}}</td>
- <td>1</td>
-         <td>-</td>
- <td>✔</td>
- </tr>
- @endforeach
Added / After Commit
+ </tr>
+ </thead>
+ <tbody>
+     <!-- @foreach($WorkEquipment?->workOrder?->equipments as $index => $equip)@endforeach -->
+      @foreach($WorkEquipments as $index => $equip)
+ <tr>
+ <td>{{$index+1}}</td>
+         @if(Str::contains(strtolower($equip->workOrder->c_n), 'crc'))
+         <td>{{ $equip->CrcEquipments?->equipment_name ?? '-' }}</td>
+         <td>{{ $equip->CrcEquipments?->part_no ?? '-' }}</td>
+         @else
+          <td>{{$equip?->Equipments?->name}}</td>
+ <td>{{$equip?->assy}}</td>
+         @endif
+ <td>{{$equip?->regd_no}}</td>
+ <td>1</td>
+         <td>{{$equip?->type}}</td>
+ <td>✔</td>
Removed / Before Commit
- </div>
- </div>
- <hr>
- 				<form method="POST"
- action="{{ route('work-orders.storeorupdate') }}">
- 
- @csrf
-                     @if(isset($workOrder))
-                         @method('PUT')
-                     @endif
- 
- <div class="card-body p-4">
- 				        <h5 class="mb-4 ch"><b>Unit Details</b></h5>
- <div class="row mb-3">
- <label class="col-sm-4 col-form-label">Unit</label>
- <div class="col-sm-8">
-                                         <select name="unit" class="form-select select2">
- <option value="" >Select</option>
Added / After Commit
+ </div>
+ </div>
+ <hr>
+ 				<form method="POST" id="workOrderForm"
+ action="{{ route('work-orders.storeorupdate') }}">
+ 
+ @csrf
+                    
+                     <input type="hidden" name="action_type" id="actionType">
+ 
+ <div class="card-body p-4">
+ 				        <h5 class="mb-4 ch"><b>Unit Details</b></h5>
+ <div class="row mb-3">
+ <label class="col-sm-4 col-form-label">Unit</label>
+ <div class="col-sm-8">
+                                         <select name="unit_id" class="form-select select2">
+ <option value="" >Select</option>
+ @foreach ($units as $uni)
Removed / Before Commit
- </div>
- <div class="col-md-9 text-end">
- <a href="{{ url('work-orders-unit') }}" class="btn btn-primary">Add Work Order</a>
- </div>
- </div>
- </div>
- 
- <a href="{{ url('work-orders-unit/' . $order->work_unit_id . '?user_id=' . $order->work_user_id) }}"
- class="text-primary" title="Edit">
- <i class="fas fa-pencil"></i>
- </a>
- <a href="javascript:void(0);" class="text-danger btn-delete ms-2" data-id="{{ $order->id }}" title="Delete">
- <i class="fas fa-trash text-dark"></i>
Added / After Commit
+ </div>
+ <div class="col-md-9 text-end">
+ <a href="{{ url('work-orders-unit') }}" class="btn btn-primary">Add Work Order</a>
+                         <a href="{{ url('work-orders/create') }}" class="btn btn-primary">Add New Work Order</a>
+ </div>
+                     
+ </div>
+ </div>
+ 
+ <a href="{{ url('work-orders-unit/' . $order->work_unit_id . '?user_id=' . $order->work_user_id) }}"
+ class="text-primary" title="Edit">
+ <i class="fas fa-pencil"></i>
+                         <a href="{{ url('work-orders/'.$order->id.'/edit') }}"
+                            class="text-primary" title="Edit" style="color:red">
+                             <i class="fas fa-pencil" style="color:red"></i>
+ </a>
+ <a href="javascript:void(0);" class="text-danger btn-delete ms-2" data-id="{{ $order->id }}" title="Delete">
+ <i class="fas fa-trash text-dark"></i>
Removed / Before Commit
- use App\Http\Controllers\GrantController;
- use App\Http\Controllers\StoreInventoryMasterController;
- use App\Http\Controllers\PeopleGatePassController;
- 
- /*
- |--------------------------------------------------------------------------
- | Web Routes
- Route::get('work-orders', [WorkOrderController::class, 'index'])->name('work-orders.listing');
- Route::get('work-orders/create', [WorkOrderController::class,'create'])
- ->name('work-orders.create');
- 
- // Edit
- Route::get('work-orders/{id}/edit', [WorkOrderController::class,'create'])
- ->name('work-orders.edit');
-          Route::get('work-orders-storeorupdate', [WorkOrderController::class,'storeorupdate'])
- ->name('work-orders.storeorupdate');
- Route::get('work-orders-unit', [WorkOrderController::class, 'index_unit']);
- Route::get('work-orders-unit/{id}', [WorkOrderController::class, 'unit_detail'])->name('work-unit.get');
Added / After Commit
+ use App\Http\Controllers\GrantController;
+ use App\Http\Controllers\StoreInventoryMasterController;
+ use App\Http\Controllers\PeopleGatePassController;
+ use App\Http\Controllers\CrcReportController;
+ use App\Http\Controllers\CodControlController;
+ /*
+ |--------------------------------------------------------------------------
+ | Web Routes
+ Route::get('work-orders', [WorkOrderController::class, 'index'])->name('work-orders.listing');
+ Route::get('work-orders/create', [WorkOrderController::class,'create'])
+ ->name('work-orders.create');
+         Route::get('/check-unit-wo-no', [WorkOrderController::class,'checkUnitWoNo']);
+         Route::get('/work-orders/add-unit/{id}', [WorkOrderController::class,'addunitcreate']);
+ 
+ // Edit
+ Route::get('work-orders/{id}/edit', [WorkOrderController::class,'create'])
+ ->name('work-orders.edit');
+          Route::post('work-orders-storeorupdate', [WorkOrderController::class,'storeorupdate'])