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

Review Result ?

jattin01/army · 8c687fde
The commit introduces a new export class and significant additions to the APDemandController including features for handling dynamic table names, data imports/exports, and CRUD operations with pagination and filtering. The code is generally well-structured with good use of Eloquent and query builder. However, there are some areas lacking input validation, error handling, and security best practices, e.g., direct use of user inputs in queries, reliance on dynamic table names without sufficient sanitation, and no authorization checks presented here. The commit message is not descriptive and does not summarize the changes made, which reduces its usefulness.
Quality ?
75%
Security ?
40%
Business Value ?
80%
Maintainability ?
73%
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 descriptive summary of the changes to improve quality and business value scores
Potential Issue From Dynamic Table Name Co...
Where app/Exports/SparesExport.php:25
Issue / Evidence potential issue from dynamic table name construction
Suggested Fix sanitize inputs further to avoid injection risks
Missing Validation
Where app/Http/Controllers/APDemandController.php:52
Issue / Evidence lack of validation of equipment_id parameter
Suggested Fix add validation and handle cases where equipment is null to reduce bug risk
Query Filtering By Repair Class Id Using '...
Where app/Http/Controllers/APDemandController.php:57
Issue / Evidence query filtering by repair_class_id using '!=' string
Suggested Fix verify logic correctness as 'other' is a string literal, consider stricter checks or constants
Check On Dynamic Table Existence
Where app/Http/Controllers/APDemandController.php:66
Issue / Evidence check on dynamic table existence
Suggested Fix while good, further handle the fallback scenario or alert to prevent silent failures
Security Issue
Where app/Http/Controllers/APDemandController.php:54
Issue / Evidence missing authorization or permission checks before modifying or accessing sensitive resources
Suggested Fix add authorization checks to improve security
Mass Insertion Of Records Without Transact...
Where app/Http/Controllers/APDemandController.php:78
Issue / Evidence mass insertion of records without transaction wrapping
Suggested Fix wrap DB inserts in transactions to avoid partial writes and improve reliability
Findorfail Fetch Could Return 404 Error
Where app/Http/Controllers/APDemandController.php:98-99
Issue / Evidence findOrFail fetch could return 404 error
Suggested Fix consider catching exceptions or handling gracefully in UI
Use Of Eager Loading With 'With'
Where app/Http/Controllers/APDemandController.php:99
Issue / Evidence use of eager loading with 'with'
Suggested Fix continue enforcing this pattern for performance improvement on relations
Code Change Preview · app/Exports/SparesExport.php ?
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Exports;
+ 
+ use Maatwebsite\Excel\Concerns\FromCollection;
+ use Maatwebsite\Excel\Concerns\WithHeadings;
+ use Illuminate\Support\Facades\DB;
+ use Illuminate\Support\Str;
+ use Illuminate\Support\Facades\Schema;
+ 
+ class SparesExport implements FromCollection, WithHeadings
+ {
+     protected $master;
+     protected $scalenos;
+ 
+     public function __construct($master, $scalenos)
+     {
+         $this->master = $master;
Removed / Before Commit
- (object)['id' => 5, 'name' => 'Terminated'],
- (object)['id' => 6, 'name' => 'Retired'],
- ];
- $salaryGroups = [
-     (object)['id' => 1, 'name' => 'Group A'],
-     (object)['id' => 2, 'name' => 'Group B'],
-     (object)['id' => 3, 'name' => 'Group C'],
- ];
- 
- 
- return view('admin.staff.add', compact('shifts','departments','designations','reportTos','salaryGroups','employeeStatuses'
- (object)['id' => 5, 'name' => 'Terminated'],
- (object)['id' => 6, 'name' => 'Retired'],
- ];
- $salaryGroups = [
-     (object)['id' => 1, 'name' => 'Group A'],
-     (object)['id' => 2, 'name' => 'Group B'],
-     (object)['id' => 3, 'name' => 'Group C'],
Added / After Commit
+ (object)['id' => 5, 'name' => 'Terminated'],
+ (object)['id' => 6, 'name' => 'Retired'],
+ ];
+ $salaryGroups = SalaryGroup::all();
+ 
+ 
+ return view('admin.staff.add', compact('shifts','departments','designations','reportTos','salaryGroups','employeeStatuses'
+ (object)['id' => 5, 'name' => 'Terminated'],
+ (object)['id' => 6, 'name' => 'Retired'],
+ ];
+ $salaryGroups = SalaryGroup::all();
+ 
+ 
+ return view('admin.staff.add', compact(
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ namespace App\Http\Controllers;
+ 
+ use Illuminate\Http\Request;
+ use App\Models\WorkOrder;
+ use App\Models\WorkEquipment;
+ use App\Models\Group;
+ use App\Models\Equipment;
+ use App\Models\RepairClass;
+ use App\Models\EqptTarget;
+ use App\Models\APDemandMaster;
+ use App\Models\APDemand; // ✅ added
+ use App\Models\McoScale; // ✅ if not already imported
+ use Illuminate\Support\Facades\DB;
+ use Illuminate\Support\Str;
+ use Illuminate\Support\Facades\Schema;
+ use App\Exports\SparesExport;
+ use App\Imports\SparesImport;
Removed / Before Commit
- {
- public function index()
- {
-         $departments = Department::all();
- return view('departments.index', compact('departments'));
- }
Added / After Commit
+ {
+ public function index()
+ {
+         $departments = Department::latest()->paginate(10);
+ return view('departments.index', compact('departments'));
+ }
Removed / Before Commit
- {
- public function index()
- {
-         $designations = Designation::all();
- return view('designations.index', compact('designations'));
- }
Added / After Commit
+ {
+ public function index()
+ {
+         $designations = Designation::latest()->paginate(10);
+ return view('designations.index', compact('designations'));
+ }
Removed / Before Commit
- {
- public function index()
- {
-         $holidays = Holiday::all();
- return view('holidays.index', compact('holidays'));
- }
Added / After Commit
+ {
+ public function index()
+ {
+         $holidays = Holiday::latest()->paginate(10);
+ return view('holidays.index', compact('holidays'));
+ }
Removed / Before Commit
- {
- $leaves = Leave::with(['employee.department', 'employee.designation', 'leaveType'])
- ->orderBy('created_at','desc')
-             ->get();
- 
- return view('leave.approval', compact('leaves'));
- }
Added / After Commit
+ {
+ $leaves = Leave::with(['employee.department', 'employee.designation', 'leaveType'])
+ ->orderBy('created_at','desc')
+             ->paginate(20);
+ 
+ return view('leave.approval', compact('leaves'));
+ }
Removed / Before Commit
- 
- $assignedLeaveTypes = $employee->designation->leaveTypes ?? [];
- 
-         $leaves = Leave::with('leaveType')->where('employee_id', $employee->id)->orderBy('from_date', 'desc')->get();
- 
- $leaveBalance = [];
Added / After Commit
+ 
+ $assignedLeaveTypes = $employee->designation->leaveTypes ?? [];
+ 
+         $leaves = Leave::with('leaveType')->where('employee_id', $employee->id)->orderBy('from_date', 'desc')->paginate(20);
+ 
+ $leaveBalance = [];
Removed / Before Commit
- {
- public function index()
- {
-         $leaveTypes = LeaveType::all();
- return view('leave_types.index', compact('leaveTypes'));
- }
Added / After Commit
+ {
+ public function index()
+ {
+         $leaveTypes = LeaveType::latest()->paginate(10);
+ return view('leave_types.index', compact('leaveTypes'));
+ }
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use App\Models\SalaryComponent;
+ use Illuminate\Http\Request;
+ 
+ class SalaryComponentController extends Controller
+ {
+     public function index() {
+         $components = SalaryComponent::all();
+         return view('salary.components.index', compact('components'));
+     }
+ 
+     public function create() {
+         return view('salary.components.create');
+     }
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ namespace App\Http\Controllers;
+ 
+ use App\Models\SalaryGroup;
+ use App\Models\SalaryComponent;
+ use App\Models\SalaryGroupComponent;
+ use Illuminate\Http\Request;
+ 
+ class SalaryGroupController extends Controller
+ {
+     public function index() {
+         $groups = SalaryGroup::all();
+         return view('salary.groups.index', compact('groups'));
+     }
+ 
+     public function create() {
+         $components = SalaryComponent::where('is_active',true)->get();
+         return view('salary.groups.create', compact('components'));
Removed / Before Commit
- {
- public function index()
- {
-         $shifts = Shift::all();
- return view('shifts.index', compact('shifts'));
- }
Added / After Commit
+ {
+ public function index()
+ {
+         $shifts = Shift::latest()->paginate(10);
+ return view('shifts.index', compact('shifts'));
+ }
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Imports;
+ 
+ use App\Models\APDemand;
+ use Illuminate\Support\Facades\DB;
+ use Maatwebsite\Excel\Concerns\ToModel;
+ use Maatwebsite\Excel\Concerns\WithHeadingRow;
+ use Illuminate\Support\Str;
+ 
+ class SparesImport implements ToModel, WithHeadingRow
+ {
+     protected $master;
+     protected $scaleId;
+ 
+     public function __construct($master, $scaleId)
+     {
+         $this->master = $master;
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class APDemand extends Model
+ {
+     use HasFactory;
+ 
+     protected $table = 'ap_demands'; // ✅ table name
+     protected $fillable = [
+         'scale_id',
+         'item_id',
+         'master_id',
+         'prod_year',
+         'ap_demand_no',
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class APDemandMaster extends Model
+ {
+     use HasFactory;
+ 
+     protected $table = 'ap_demand_masters'; // ✅ table name
+     protected $fillable = [
+         'prod_year',
+         'target',
+         'equipment_id',
+     ];
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ use Illuminate\Support\Facades\Hash;
+ 
+ class Employee extends Model
+ {
+     use HasFactory;
+ 
+     protected $table = 'staff';
+ 
+     protected $fillable = [
+         // Profile & Personal Details
+         'profile_image', 'name', 'employee_number', 'email', 'phone', 'allow_login', 'joining_date', 'status', 'address',
+         'gender', 'dob', 'personal_email', 'personal_phone', 'is_married',
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class SalaryComponent extends Model
+ {
+     protected $fillable = [
+         'name', 'type', 'calculation_type', 'frequency', 'formula', 'is_active'
+     ];
+ 
+     public function employeeComponents() {
+         return $this->hasMany(EmployeeSalaryComponent::class);
+     }
+ }
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class SalaryGroup extends Model
+ {
+     protected $fillable = ['name','description','is_active'];
+ 
+     public function components() {
+         return $this->hasMany(SalaryGroupComponent::class);
+     }
+ }
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class SalaryGroupComponent extends Model
+ {
+     protected $fillable = ['salary_group_id','salary_component_id','value'];
+ 
+     public function component() {
+         return $this->belongsTo(SalaryComponent::class,'salary_component_id');
+     }
+ 
+     public function group() {
+         return $this->belongsTo(SalaryGroup::class,'salary_group_id');
+     }
+ }
Removed / Before Commit
- public function leaves() {
- return $this->hasMany(Leave::class, 'employee_id');
- }
- 
- 
- }
Added / After Commit
+ public function leaves() {
+ return $this->hasMany(Leave::class, 'employee_id');
+ }
+ public function salaryGroup() {
+     return $this->belongsTo(SalaryGroup::class);
+ }
+ 
+ 
+ }
Removed / Before Commit
- "laravel/framework": "^10.10",
- "laravel/sanctum": "^3.3",
- "laravel/tinker": "^2.8",
-         "maatwebsite/excel": "^3.1"
- },
- "require-dev": {
- "fakerphp/faker": "^1.9.1",
Added / After Commit
+ "laravel/framework": "^10.10",
+ "laravel/sanctum": "^3.3",
+ "laravel/tinker": "^2.8",
+         "maatwebsite/excel": "^3.1",
+         "phpoffice/phpspreadsheet": "^1.30"
+ },
+ "require-dev": {
+ "fakerphp/faker": "^1.9.1",
Removed / Before Commit
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
- "This file is @generated automatically"
- ],
-     "content-hash": "e1b45bd2ad838d68ce63a3ceef44af79",
- "packages": [
- {
- "name": "barryvdh/laravel-dompdf",
- },
- {
- "name": "phpoffice/phpspreadsheet",
-             "version": "1.29.11",
- "source": {
- "type": "git",
- "url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
-                 "reference": "05b6c4378ddf3e81b460ea645c42b46432c0db25"
- },
- "dist": {
- "type": "zip",
Added / After Commit
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+     "content-hash": "c83f2c34d99a6c12547b7d26fad7fc7e",
+ "packages": [
+ {
+ "name": "barryvdh/laravel-dompdf",
+ },
+ {
+ "name": "phpoffice/phpspreadsheet",
+             "version": "1.30.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
+                 "reference": "2f39286e0136673778b7a142b3f0d141e43d1714"
+ },
+ "dist": {
+ "type": "zip",
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         Schema::create('salary_components', function (Blueprint $table) {
+             $table->id();
+             $table->string('name'); // e.g. Basic Pay, HRA
+             $table->enum('type', ['earning', 'deduction']); 
+             $table->enum('calculation_type', ['fixed', 'percentage', 'formula']);
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration {
+     public function up(): void {
+         Schema::create('salary_groups', function (Blueprint $table) {
+             $table->id();
+             $table->string('name');
+             $table->text('description')->nullable();
+             $table->boolean('is_active')->default(true);
+             $table->timestamps();
+         });
+     }
+ 
+     public function down(): void {
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration {
+     public function up(): void {
+         Schema::create('salary_group_components', function (Blueprint $table) {
+             $table->id();
+             $table->foreignId('salary_group_id')->constrained()->onDelete('cascade');
+             $table->foreignId('salary_component_id')->constrained()->onDelete('cascade');
+             $table->decimal('value',12,2)->nullable(); // fixed amount or percentage
+             $table->timestamps();
+         });
+     }
+ 
+     public function down(): void {
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         Schema::create('ap_demand_masters', function (Blueprint $table) {
+             $table->id();
+             $table->string('prod_year');              // उत्पादन वर्ष
+             $table->integer('target')->nullable();    // Target
+             $table->unsignedBigInteger('equipment_id'); // Equipment reference
+             $table->timestamps();
+ 
+         });
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         Schema::create('ap_demands', function (Blueprint $table) {
+             $table->id();
+             $table->unsignedBigInteger('scale_id');      // McoScale table reference
+             $table->unsignedBigInteger('item_id');       // Item reference from spare table
+             $table->unsignedBigInteger('master_id');     // APDemandMaster reference
+             $table->string('prod_year');
+ 
+             // Additional fields from update() method
Removed / Before Commit
- 
- 
- {{-- Salary Details Tab --}}
-                    <div class="tab-pane fade {{ isset($activeTab) && $activeTab === 'salary' ? 'show active' : '' }}" id="salary" role="tabpanel">
- <div class="mt-3">
- 
- {{-- Salary Group --}}
- </option>
- @endforeach
- </select>
- </div>
- @error('salary_group_id') <div class="text-danger">{{ $message }}</div> @enderror
- </div>
- </div>
- </div>
- 
-                             {{-- Salary Components Header --}}
-                             <div class="row border-bottom pb-2 mb-2">
Added / After Commit
+ 
+ 
+ {{-- Salary Details Tab --}}
+                     <div class="tab-pane fade {{ isset($activeTab) && $activeTab === 'salary' ? 'show active' : '' }}" id="salary" role="tabpanel">
+ <div class="mt-3">
+ 
+ {{-- Salary Group --}}
+ </option>
+ @endforeach
+ </select>
+                                         <button type="button" class="btn btn-sm btn-primary ms-2" data-bs-toggle="modal" data-bs-target="#componentModal">
+                                             Add Component
+                                         </button>
+ </div>
+ @error('salary_group_id') <div class="text-danger">{{ $message }}</div> @enderror
+ </div>
+ </div>
+ </div>
Removed / Before Commit
- </td>
- 
- <td>
-                                     <!-- Edit Button triggers modal -->
- <a href="{{ route('admin.staff.edit', $member->id) }}" title="Edit">
- <i class="fa fa-pencil"></i>
- </a>
Added / After Commit
+ </td>
+ 
+ <td>
+                                     
+ <a href="{{ route('admin.staff.edit', $member->id) }}" title="Edit">
+ <i class="fa fa-pencil"></i>
+ </a>
Removed / Before Commit

                                                
Added / After Commit
+ {{-- resources/views/apdemands/create.blade.php --}}
+ @extends('layouts.app')
+ 
+ @section('content')
+ @if ($errors->any())
+     <div class="alert alert-danger">
+         <ul>
+             @foreach ($errors->all() as $error)
+                 <li>{{ $error }}</li>
+             @endforeach
+         </ul>
+     </div>
+ @endif
+ 
+ <div class="row">
+ 	<div class="col-lg-12">
+ 		<div class="card">
+ 			<div class="card-header py-3">
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ 
+ @if ($errors->any())
+     <div class="alert alert-danger">
+         <strong>Whoops!</strong> Please fix the following:
+         <ul>
+             @foreach ($errors->all() as $error)
+                 <li>{{ $error }}</li>
+             @endforeach
+         </ul>
+     </div>
+ @endif
+ 
+ <div class="card">
+     <div class="card-header py-3">
+         <div class="row align-items-center">
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <style>
+ .select2-container { width: 100% !important; }
+ .select2-selection { min-height: 32px; }
+ .select2-results__option { padding-left: 10px; display: flex; align-items: center; }
+ </style>
+ <style>
+ .table-fixed {
+     table-layout: fixed;   /* हर कॉलम का fixed width होगा */
+     width: 100%;           /* पूरी table फैलेगी */
+ }
+ 
+ .table-fixed th,
+ .table-fixed td {
+     width: 50px;          /* 👈 आप यहाँ px बदल सकते हो अपनी ज़रूरत के हिसाब से */
+     word-wrap: break-word; /* text overflow होने पर wrap हो जाएगा */
Removed / Before Commit
- <div class="container-fluid">
- 
- <!-- Page Header -->
-     <div class="d-flex justify-content-between align-items-center mb-3">
-         <h4 class="mb-0">Employee Attendance</h4>
- <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#uploadModal">
- <i class="fa fa-upload"></i> Upload Attendance
- </button>
- </div>
- 
-     <!-- Filter Section -->
-     <div class="card mb-3 p-3 shadow-sm">
- <form method="GET" action="{{ route('attendance.index') }}" class="row g-2 align-items-end">
- 
- <div class="col-md-2">
- <td class="d-flex gap-1">
- 
- <!-- Edit Button -->
Added / After Commit
+ <div class="container-fluid">
+ 
+ <!-- Page Header -->
+     
+ 
+     <!-- Filter Section -->
+     <div class="card mb-3 p-3 shadow-sm">
+ 
+     <div class="d-flex justify-content-between align-items-center mb-5">
+         <h4 class="mb-0"><b>Employee Attendance</b></h4>
+ <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#uploadModal">
+ <i class="fa fa-upload"></i> Upload Attendance
+ </button>
+ </div>
+     
+ 
+ <form method="GET" action="{{ route('attendance.index') }}" class="row g-2 align-items-end">
+ 
Removed / Before Commit
- @section('content')
- <style>
- /* Simple toggle style */
- .form-check-input {
-     width: 30px!important;
-     height: 15px!important;
-     cursor: pointer!important;
-     transition: all 0.3s ease;  /* smooth animation */
- }
- 
- </style>
- <div class="card">
-     <div class="card-header d-flex justify-content-between align-items-center">
-         <h4>Departments</h4>
-         <a href="{{ route('departments.create') }}" class="btn btn-primary btn-sm">Add Department</a>
- </div>
- <div class="card-body">
-         <div class="table-responsive">
Added / After Commit
+ @section('content')
+ <style>
+ /* Simple toggle style */
+     .form-check-input {
+         width: 30px !important;
+         height: 15px !important;
+         cursor: pointer !important;
+         transition: all 0.3s ease;
+         /* smooth animation */
+     }
+ </style>
+ <div class="card">
+     <div class="card-header py-3">
+         <div class="row align-items-center">
+             <div class="col-md-5">
+                 <h4><b>Departments</b></h4>
+             </div>
+             <div class="col-md-7">
Removed / Before Commit
- @extends('layouts.app')
- @section('content')
- <div class="card">
-     <div class="card-header d-flex justify-content-between align-items-center">
-         <h4>Designations</h4>
-         <a href="{{ route('designations.create') }}" class="btn btn-primary btn-sm">Add Designation</a>
- </div>
- <div class="card-body">
-         <table class="table table-bordered table-hover">
-             <thead>
-                 <tr>
-                     <th>#</th>
-                     <th>Name</th>
-                     <th>Code</th>
-                     <th>Status</th>
-                     <th>Leave Types</th>
-                     <th width="120">Actions</th>
-                 </tr>
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>Designations</b></h4>
+ 
+             </div>
+             <div class="col-md-7">
+                 <div class="d-flex justify-content-end">
+                     <a href="{{ route('designations.create') }}" class="btn btn-primary btn-sm">Add Designation</a>
+                 </div>
+             </div>
+         </div>
+ </div>
+     <hr>
Removed / Before Commit
- 
- @section('content')
- <div class="card">
-     <div class="card-header d-flex justify-content-between align-items-center">
-         <h4>Holidays</h4>
- <a href="{{ route('holidays.create') }}" class="btn btn-primary btn-sm">Add Holiday</a>
- </div>
- <div class="card-body">
- <div class="table-responsive">
- <table class="table table-bordered table-striped">
- <input class="form-check-input status-toggle" type="checkbox" id="holidaySwitch{{ $holiday->id }}" data-id="{{ $holiday->id }}" {{ $holiday->is_active ? 'checked' : '' }}>
- </div>
- <td>
-                                 <a href="{{ route('holidays.edit', $holiday->id) }}" title="Edit"><i class="fas fa-edit text-warning"></i></a>
-                                 <a href="javascript:void(0);" class="delete-holiday" data-id="{{ $holiday->id }}" title="Delete"><i class="fas fa-trash text-danger"></i></a>
- </td>
- </tr>
- @empty
Added / After Commit
+ 
+ @section('content')
+ <div class="card">
+     <div class="card-header py-3">
+         <div class="row align-items-center">
+             <div class="col-md-5">
+                 <h4><b>Holidays</b></h4>
+     </div>
+     <div class="col-md-7">
+         <div class="d-flex justify-content-end">
+             
+ <a href="{{ route('holidays.create') }}" class="btn btn-primary btn-sm">Add Holiday</a>
+      </div>
+             </div>
+         </div>
+ </div>
+     <hr>
+ <div class="card-body">
Removed / Before Commit
- 
- @section('content')
- <div class="card">
-     <div class="card-header d-flex justify-content-between align-items-center">
-         <h4>Leave Types</h4>
- <a href="{{ route('leave-types.create') }}" class="btn btn-primary">Add Leave Type</a>
- </div>
- <div class="card-body">
-         
- 
-         <div class="table-responsive">
-             <table class="table table-bordered table-hover">
-                 <thead class="table-light">
- <tr>
- <th>#</th>
- <th>Name</th>
- <td>{{ ucfirst($type->gender_restriction) }}</td>
- <td>{{ $type->remarks ?? '-' }}</td>
Added / After Commit
+ 
+ @section('content')
+ <div class="card">
+     <div class="card-header py-3">
+         <div class="row align-items-center">
+             <div class="col-md-5">
+                 <h4><b>Leave Types</b></h4>
+                 </div>
+             <div class="col-md-7">
+                 <div class="d-flex justify-content-end">
+ <a href="{{ route('leave-types.create') }}" class="btn btn-primary">Add Leave Type</a>
+    </div>
+             </div>
+         </div>
+ </div>
+     <hr>
+ <div class="card-body">
+         <div class="container-fluid">
Removed / Before Commit
- @extends('layouts.app')
- @section('content')
- <div class="container-fluid">
-     <h4 class="mb-3">Leave Approval</h4>
- 
-     <div class="card">
- <div class="card-body">
-             <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th>Employee Code</th>
- @endforelse
- </tbody>
- </table>
- </div>
- </div>
- </div>
- @endsection
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>Leave Approval</b></h4>
+     </div>
+              </div>
+              </div>
+     <hr>
+ 
+ <div class="card-body">
+            <div class="container-fluid">
+             <div aria-checked="table-responsive">
+                 <table class="table table-bordered table-hover table-striped">
+ <thead>
+ <tr>
Removed / Before Commit
- @extends('layouts.app')
- @section('content')
- <div class="container-fluid">
-     <div class="d-flex justify-content-between align-items-center mb-3">
-         <h4 class="mb-0">My Leave</h4>
-         <a href="{{ route('leave.create') }}" class="btn btn-success"><i class="fa fa-plus"></i> Apply Leave</a>
- </div>
- 
- <!-- Leave Balance -->
-     <div class="row mb-3">
- @foreach($leaveBalance as $balance)
- <div class="col-md-3">
- <div class="card p-3 text-center shadow-sm">
- </thead>
- <tbody>
- @forelse($leaves as $leave)
-                         <tr>
-                             <td>{{ $leave->subject }}</td>
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>My Leave</b></h4>
+             </div>
+             <div class="col-md-7">
+                 <div class="d-flex justify-content-end">
+                     <a href="{{ route('leave.create') }}" class="btn btn-success"><i class="fa fa-plus"></i> Apply Leave</a>                    
+                 </div>
+                 </div>
+             </div>
+         
+ </div>
+     <hr>
+ <!-- Leave Balance -->
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="card">
+     <div class="card-header">
+         <h4>Add Salary Component</h4>
+     </div>
+     <div class="card-body">
+         <form method="POST" action="{{ route('salary-components.store') }}">
+             @csrf
+             <div class="mb-3">
+                 <label>Name</label>
+                 <input type="text" name="name" class="form-control" required>
+             </div>
+             <div class="mb-3">
+                 <label>Type</label>
+                 <select name="type" class="form-control">
+                     <option value="earning">Earning</option>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="card">
+     <div class="card-header">
+         <h4>Edit Salary Component</h4>
+     </div>
+     <div class="card-body">
+         <form method="POST" action="{{ route('salary-components.update', $salaryComponent->id) }}">
+             @csrf
+             @method('PUT')
+             
+             <div class="mb-3">
+                 <label>Name</label>
+                 <input type="text" name="name" class="form-control" value="{{ $salaryComponent->name }}" required>
+             </div>
+ 
+             <div class="mb-3">
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="card">
+     <div class="card-header">
+         <h4>Salary Components</h4>
+         <a href="{{ route('salary-components.create') }}" class="btn btn-primary btn-sm float-end">+ Add Component</a>
+     </div>
+     <div class="card-body">
+         <table class="table table-bordered table-striped">
+             <thead>
+                 <tr>
+                     <th>Name</th>
+                     <th>Type</th>
+                     <th>Calculation Type</th>
+                     <th>Frequency</th>
+                     <th>Status</th>
+                     <th>Action</th>
Removed / Before Commit

                                                
Added / After Commit
+ @foreach($components as $comp)
+ <div class="row mb-2 align-items-center component-row"
+      data-calculation-type="{{ $comp->component->calculation_type }}"
+      data-frequency="{{ $comp->component->frequency }}"
+      data-value="{{ $comp->value ?? 0 }}"
+      data-type="{{ $comp->component->type }}"
+      data-formula="{{ $comp->component->formula ?? '' }}">
+      
+     <div class="col-2">
+         {{ $comp->component->name }} ({{ ucfirst($comp->component->type) }})
+     </div>
+     <div class="col-2">
+         <span class="badge bg-info">{{ ucfirst($comp->component->calculation_type) }}</span>
+         <span class="badge bg-secondary">{{ ucfirst($comp->component->frequency) }}</span>
+         <span class="badge {{ $comp->component->type === 'deduction' ? 'bg-danger' : 'bg-success' }}">
+             {{ ucfirst($comp->component->type) }}
+         </span>
+     </div>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="card">
+     <div class="card-header d-flex justify-content-between align-items-center">
+         <h4>Create Salary Group</h4>
+         <a href="{{ route('salary-groups.index') }}" class="btn btn-secondary btn-sm">Back</a>
+     </div>
+     <div class="card-body">
+         <form action="{{ route('salary-groups.store') }}" method="POST">
+             @csrf
+ 
+             <div class="mb-3">
+                 <label>Group Name <span class="text-danger">*</span></label>
+                 <input type="text" name="name" class="form-control" placeholder="Enter group name" required>
+             </div>
+ 
+             <div class="mb-3">
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="card">
+     <div class="card-header d-flex justify-content-between align-items-center">
+         <h4>Edit Salary Group</h4>
+         <a href="{{ route('salary-groups.index') }}" class="btn btn-secondary btn-sm">Back</a>
+     </div>
+     <div class="card-body">
+         <form action="{{ route('salary-groups.update', $group->id) }}" method="POST">
+             @csrf
+             @method('PUT')
+ 
+             <div class="mb-3">
+                 <label>Group Name <span class="text-danger">*</span></label>
+                 <input type="text" name="name" class="form-control" value="{{ old('name', $group->name) }}" required>
+             </div>
+ 
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="card">
+     <div class="card-header d-flex justify-content-between align-items-center">
+         <h4>Salary Groups</h4>
+         <a href="{{ route('salary-groups.create') }}" class="btn btn-success btn-sm">+ Add Group</a>
+     </div>
+ 
+     <div class="card-body">
+         @if(session('success'))
+             <div class="alert alert-success">{{ session('success') }}</div>
+         @endif
+ 
+         <table class="table table-bordered table-striped">
+             <thead>
+                 <tr>
+                     <th>Name</th>
Removed / Before Commit
- </td>
- 
- <td>
-                                 <a href="{{ route('shifts.edit', $shift->id) }}" title="Edit"><i class="fas fa-edit text-warning"></i></a>
- <form action="{{ route('shifts.destroy', $shift->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure?')">
- @csrf
- @method('DELETE')
-                                     <button class="btn btn-sm btn-link p-0" type="submit"><i class="fas fa-trash text-danger"></i></button>
- </form>
- </td>
- </tr>
- @endforelse
- </tbody>
- </table>
- </div>
- </div>
- </div>
Added / After Commit
+ </td>
+ 
+ <td>
+                                 <a href="{{ route('shifts.edit', $shift->id) }}" title="Edit"><i class="fas fa-pencil "></i></a>
+ <form action="{{ route('shifts.destroy', $shift->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure?')">
+ @csrf
+ @method('DELETE')
+                                    <i class="fas fa-trash text-dark"></i>
+ </form>
+ </td>
+ </tr>
+ @endforelse
+ </tbody>
+ </table>
+             <div class="mt-3 d-flex justify-content-end">
+     <nav>
+         {{ $shifts->links() }}
+     </nav>
Removed / Before Commit
- use App\Http\Controllers\AttendanceController;
- use App\Http\Controllers\LeaveController;
- use App\Http\Controllers\LeaveApprovalController;
- 
- 
- /*
- Route::post('leave-approve/{id}/approve', [LeaveApprovalController::class, 'approve'])->name('leave.approve');
- Route::post('leave-approve/{id}/reject', [LeaveApprovalController::class, 'reject'])->name('leave.reject');
- 
- 
- 
Added / After Commit
+ use App\Http\Controllers\AttendanceController;
+ use App\Http\Controllers\LeaveController;
+ use App\Http\Controllers\LeaveApprovalController;
+ use App\Http\Controllers\SalaryComponentController;
+ use App\Http\Controllers\SalaryGroupController;
+ use App\Http\Controllers\APDemandController;
+ 
+ 
+ /*
+ Route::post('leave-approve/{id}/approve', [LeaveApprovalController::class, 'approve'])->name('leave.approve');
+ Route::post('leave-approve/{id}/reject', [LeaveApprovalController::class, 'reject'])->name('leave.reject');
+ 
+ // routes/web.php
+ Route::resource('salary-components', SalaryComponentController::class);
+ 
+ Route::prefix('salary-groups')->group(function () {
+     Route::get('/', [SalaryGroupController::class, 'index'])->name('salary-groups.index');
+     Route::get('/create', [SalaryGroupController::class, 'create'])->name('salary-groups.create');