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

Review Result ?

jattin01/army · 661fc392
The commit introduces multiple changes across various controllers and helpers including a function to convert numbers to Indian currency words, CRUD operations for employee categories, leave types, salary groups, and filtering attendance by group. While functional and business-relevant, the commit message is vague and does not describe what was changed or why. The number-to-words function lacks comments explaining its logic. Some input validation is present, improving security. However, absent authorization checks or input sanitization in the controllers could raise security risks. There is modest risk of bugs due to potentially missing error-handling and testing coverage details. The business value is significant due to added features, but the quality is undermined by poor commit messaging and a lack of internal documentation.
Quality ?
80%
Security ?
45%
Business Value ?
85%
Maintainability ?
78%
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 use a descriptive commit message summarizing changes and purposes clearly
Lack Of Comments
Where app/Helpers/NumberToWords.php:35
Issue / Evidence lack of comments
Suggested Fix add comments explaining the convertToIndianCurrency method's logic
Security Issue
Where app/Http/Controllers/EmployeeCategoryController.php:16
Issue / Evidence lack of authorization checks
Suggested Fix add authorization middleware to restrict access to sensitive endpoints
Missing Validation
Where app/Http/Controllers/LeaveTypeController.php:22
Issue / Evidence partial input validation
Suggested Fix ensure all request inputs are sanitized and consider deeper validation
Missing Validation
Where app/Http/Controllers/SalaryGroupController.php:52
Issue / Evidence insufficient validation on components
Suggested Fix validate all inputs to prevent injection or invalid data
Query Safety
Where app/Http/Controllers/AttendanceController.php:35
Issue / Evidence query safety
Suggested Fix ensure $request->group is validated to avoid query injection risks
Code Change Preview · app/Helpers/NumberToWords.php ?
Removed / Before Commit
- 
- return $words[$number] ?? (string) $number;
- }
- }
Added / After Commit
+ 
+ return $words[$number] ?? (string) $number;
+ }
+     public static function convertToIndianCurrency($number)
+     {
+         $no = floor($number);
+         $point = round($number - $no, 2) * 100;
+         $hundred = null;
+         $digits_1 = strlen($no);
+         $i = 0;
+         $str = [];
+         $words = [
+             0 => '', 1 => 'one', 2 => 'two',
+             3 => 'three', 4 => 'four', 5 => 'five',
+             6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine',
+             10 => 'ten', 11 => 'eleven', 12 => 'twelve',
+             13 => 'thirteen', 14 => 'fourteen',
+             15 => 'fifteen', 16 => 'sixteen',
Removed / Before Commit
- use App\Models\Designation;
- use App\Models\SalaryGroup;
- use App\Models\EmployeeStatus;
- use Illuminate\Support\Facades\Storage;
- 
- class StaffController extends Controller
- $departments = Department::all();
- $designations = Designation::all();
- $reportTos = Staff::all();
- $employeeStatuses = [
- (object)['id' => 1, 'name' => 'Probation'],
- (object)['id' => 2, 'name' => 'Active'],
- $salaryGroups = SalaryGroup::all();
- 
- 
-         return view('admin.staff.add', compact('shifts','departments','designations','reportTos','salaryGroups','employeeStatuses'
- ));
- }
Added / After Commit
+ use App\Models\Designation;
+ use App\Models\SalaryGroup;
+ use App\Models\EmployeeStatus;
+ use App\Models\EmployeeCategory;
+ use Illuminate\Support\Facades\Storage;
+ 
+ class StaffController extends Controller
+ $departments = Department::all();
+ $designations = Designation::all();
+ $reportTos = Staff::all();
+         $employeeCategories = EmployeeCategory::where('is_active', 1)->get();
+ 
+ $employeeStatuses = [
+ (object)['id' => 1, 'name' => 'Probation'],
+ (object)['id' => 2, 'name' => 'Active'],
+ $salaryGroups = SalaryGroup::all();
+ 
+ 
Removed / Before Commit
- use App\Models\Department;
- use App\Models\Designation;
- use App\Models\Shift;
- 
- 
- class AttendanceController extends Controller
- $query->whereHas('employee', fn($q) => $q->where('department_id', $request->department));
- }
- 
- // Designation
- if ($request->designation) {
- $query->whereHas('employee', fn($q) => $q->where('designation_id', $request->designation));
- $shifts = Shift::all();
- $departments = Department::all();
- $designations = Designation::all();
- 
-     return view('attendance.index', compact('attendances','shifts','departments','designations'));
- }
Added / After Commit
+ use App\Models\Department;
+ use App\Models\Designation;
+ use App\Models\Shift;
+ use App\Models\Group;
+ 
+ 
+ class AttendanceController extends Controller
+ $query->whereHas('employee', fn($q) => $q->where('department_id', $request->department));
+ }
+ 
+     if ($request->group) {
+     $query->whereHas('employee', function($q) use ($request) {
+         $q->whereIn('employee_number', function($subQuery) use ($request) {
+             $subQuery->select('employee_number')
+                      ->from('users')
+                      ->where('group_id', $request->group);
+         });
+     });
Removed / Before Commit

                                                
Added / After Commit
+ <?php 
+ 
+ namespace App\Http\Controllers;
+ 
+ use App\Models\EmployeeCategory;
+ use Illuminate\Http\Request;
+ 
+ class EmployeeCategoryController extends Controller
+ {
+     public function index()
+     {
+         $categories = EmployeeCategory::paginate(10);
+         return view('employee_categories.index', compact('categories'));
+     }
+ 
+     public function store(Request $request)
+     {
+         $request->validate([
Removed / Before Commit
- }
- 
- public function store(Request $request)
-     {
-         $request->validate([
-             'name' => 'required|string|max:255',
-             'category' => 'required|in:full_day,half_day,hourly',
-             'unit' => 'required|in:days,half_day,hours',
-             'annual_limit' => 'nullable|integer',
-             'carry_forward' => 'boolean',
-             'encashable' => 'boolean',
-             'gender_restriction' => 'required|in:male,female,both',
-         ]);
- 
-         LeaveType::create($request->all());
- 
-         return redirect()->route('leave-types.index')->with('success', 'Leave type created successfully.');
-     }
Added / After Commit
+ }
+ 
+ public function store(Request $request)
+ {
+     $request->validate([
+         'leave_name' => 'required|string|max:255',
+         'leave_category' => 'required|in:Full Day,Half Day,Hourly',
+         'eligible_for' => 'required|in:Monthly,Annual',
+         'leave_count' => 'nullable|integer|min:0',
+         'carry_forward' => 'boolean',
+         'carry_forward_max' => 'nullable|integer|min:0',
+         'is_cashable' => 'boolean',
+         'gender' => 'required|in:Male,Female,Both',
+         'applicable_to' => 'required|in:Permanent,Contract,Probation',
+         'min_service_required' => 'nullable|integer|min:0',
+         'remarks' => 'nullable|string',
+         'status' => 'required|in:Active,Inactive',
+     ]);
Removed / Before Commit
- return view('salary.groups.create', compact('components'));
- }
- 
-     public function store(Request $request) {
-         $request->validate(['name'=>'required']);
-         $group = SalaryGroup::create($request->only('name','description'));
- 
-         if($request->components){
-             foreach($request->components as $compId => $value){
-                 if($value !== null){
-                     SalaryGroupComponent::create([
-                         'salary_group_id'=>$group->id,
-                         'salary_component_id'=>$compId,
-                         'value'=>$value
-                     ]);
-                 }
-             }
-         }
Added / After Commit
+ return view('salary.groups.create', compact('components'));
+ }
+ 
+     public function store(Request $request)
+ {
+     $request->validate(['name'=>'required']);
+ 
+     $group = SalaryGroup::create($request->only('name','description'));
+ 
+     if ($request->components) {
+         foreach ($request->components as $compId) {
+             SalaryGroupComponent::create([
+                 'salary_group_id'      => $group->id,
+                 'salary_component_id'  => $compId, // ✅ अब सही ID जाएगी
+                 'value'                => $request->component_values[$compId] ?? 0
+             ]);
+         }
+ }
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use Illuminate\Http\Request;
+ use App\Models\Staff;
+ use App\Models\Employee;
+ use App\Models\SalarySlip;
+ use App\Models\SalarySlipDetail;
+ use Carbon\Carbon;
+ use App\Models\Holiday;
+ use App\Models\Attendance;
+ use App\Models\Leave;
+ use PDF;
+ 
+ class SalarySlipController extends Controller
+ {
+    
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ use Illuminate\Database\Eloquent\SoftDeletes;
+ 
+ class EmployeeCategory extends Model
+ {
+     use SoftDeletes;
+ 
+     protected $fillable = [
+         'name',
+         'is_active',
+     ];
+ 
+     public function employees()
+     {
Removed / Before Commit
- use HasFactory;
- 
- protected $fillable = [
-         'name',
-         'category',
-         'unit',
-         'annual_limit',
- 'carry_forward',
-         'encashable',
-         'deduction_rule',
-         'gender_restriction',
- 'remarks',
- ];
- 
- protected $casts = [
- 'carry_forward' => 'boolean',
-         'encashable' => 'boolean',
- 'deduction_rule' => 'array',
Added / After Commit
+ use HasFactory;
+ 
+ protected $fillable = [
+         'leave_name',
+         'leave_category',
+         'eligible_for',
+         'leave_count',
+ 'carry_forward',
+         'carry_forward_max',
+         'is_cashable',
+         'gender',
+         'applicable_to',
+         'min_service_required',
+ 'remarks',
+         'status',
+         'deduction_rule',
+ ];
+ 
Removed / Before Commit
- class SalaryComponent extends Model
- {
- protected $fillable = [
-         'name', 'type', 'calculation_type', 'frequency', 'formula', 'is_active'
- ];
- 
- public function employeeComponents() {
Added / After Commit
+ class SalaryComponent extends Model
+ {
+ protected $fillable = [
+         'name', 'type', 'calculation_type', 'frequency', 'is_active'
+ ];
+ 
+ public function employeeComponents() {
Removed / Before Commit

                                                
Added / After Commit
+ <?php 
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class SalarySlip extends Model
+ {
+     protected $fillable = ['employee_id','month','year','total_earning','total_deduction','net_salary'];
+ 
+     public function details(){
+         return $this->hasMany(SalarySlipDetail::class);
+     }
+ 
+     public function employee(){
+         return $this->belongsTo(Staff::class,'employee_id');
+     }
+ }
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class SalarySlipDetail extends Model
+ {
+     protected $fillable = ['salary_slip_id','component_name','type','monthly_amount','quarterly_amount','half_yearly_amount','annual_amount'];
+ 
+     public function salarySlip(){
+         return $this->belongsTo(SalarySlip::class);
+     }
+     public function component(){
+     return $this->belongsTo(SalaryComponent::class, 'component_id');
+ }
+ }
+ 
Removed / Before Commit
- 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',
- 
- // Job Details
- 'location_name', 'shift_id', 'department_id', 'designation_id', 'report_to', 'is_manager',
- 'probation_start_date', 'probation_end_date', 'notice_start_date', 'notice_end_date', 'end_date', 'employee_status_id',
- 
- // Salary Group Info
-         'salary_group_id', 'annual_ctc', 'basic_ctc_value',
- 
-         // Salary Components
-         'annual_salary',
-         'basic_pay', 'basic_type',
-         'da', 'da_type',
-         'hra', 'hra_type',
-         'other_allowances', 'other_allowances_type',
Added / After Commit
+ 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','employee_category_id',
+ 
+ // Job Details
+ 'location_name', 'shift_id', 'department_id', 'designation_id', 'report_to', 'is_manager',
+ 'probation_start_date', 'probation_end_date', 'notice_start_date', 'notice_end_date', 'end_date', 'employee_status_id',
+ 
+ // Salary Group Info
+         'salary_group_id'
+ ];
+ 
+ // Automatically hash password
+ }
+ 
+ 
+     public function employeeCategory()
Removed / Before Commit
- // App\Providers\BroadcastServiceProvider::class,
- App\Providers\EventServiceProvider::class,
- 	    App\Providers\RouteServiceProvider::class,
- 	])->toArray(),
- 
- /*
- */
- 
- 'aliases' => Facade::defaultAliases()->merge([
- // 'Example' => App\Facades\Example::class,
- ])->toArray(),
Added / After Commit
+ // App\Providers\BroadcastServiceProvider::class,
+ App\Providers\EventServiceProvider::class,
+ 	    App\Providers\RouteServiceProvider::class,
+         Barryvdh\DomPDF\ServiceProvider::class,
+ 
+ 	])->toArray(),
+ 
+ /*
+ */
+ 
+ 'aliases' => Facade::defaultAliases()->merge([
+         'PDF' => Barryvdh\DomPDF\Facade::class,
+ // 'Example' => App\Facades\Example::class,
+ ])->toArray(),
Removed / Before Commit
- public function up(): void
- {
- Schema::create('leave_types', function (Blueprint $table) {
-             $table->id();
-             $table->string('name'); // Earned Leave, Casual Leave, etc.
-             $table->enum('category', ['full_day', 'half_day', 'hourly']);
-             $table->enum('unit', ['days', 'half_day', 'hours']);
-             $table->integer('annual_limit')->nullable(); // Null = unlimited
-             $table->boolean('carry_forward')->default(false);
-             $table->boolean('encashable')->default(false);
-             $table->json('deduction_rule')->nullable(); // For late/short leave
-             $table->enum('gender_restriction', ['male', 'female', 'both'])->default('both');
-             $table->text('remarks')->nullable();
-             $table->timestamps();
-         });
- }
- 
- /**
Added / After Commit
+ public function up(): void
+ {
+ Schema::create('leave_types', function (Blueprint $table) {
+     $table->id();
+     $table->string('leave_name');
+     $table->enum('leave_category', ['Full Day', 'Half Day', 'Hourly'])->default('Full Day');
+     $table->enum('eligible_for', ['Monthly', 'Annual'])->default('Annual');
+     $table->boolean('is_cashable')->default(false);
+     $table->enum('gender', ['Male','Female','Both'])->default('Both');
+     $table->text('remarks')->nullable();
+     $table->integer('leave_count')->default(0);
+     $table->boolean('carry_forward')->default(false);
+     $table->integer('carry_forward_max')->default(0);
+     $table->integer('min_service_required')->default(0);
+     $table->enum('applicable_to', ['Permanent','Contract','Probation'])->default('Permanent');
+     $table->enum('status', ['Active','Inactive'])->default('Active');
+     $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
+ {
+     /**
+      * Run the migrations.
+      */
+     public function up(): void
+     {
+         Schema::create('salary_slips', function (Blueprint $table) {
+             $table->id();
+             $table->unsignedBigInteger('employee_id');
+             $table->date('month'); // salary month
+             $table->decimal('total_earning', 12, 2)->default(0);
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_slip_details', function (Blueprint $table) {
+     $table->id();
+     $table->foreignId('salary_slip_id')->constrained('salary_slips')->onDelete('cascade');
+     $table->string('component_name');
+     $table->enum('type', ['earning','deduction']);
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('employee_categories', function (Blueprint $table) {
+             $table->id();
+             $table->string('name');
+             $table->boolean('is_active')->default(true);
+             $table->softDeletes();
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('designation_leave_type', function (Blueprint $table) {
+         $table->id();
+         $table->foreignId('designation_id')->constrained()->onDelete('cascade');
+         $table->foreignId('leave_type_id')->constrained()->onDelete('cascade');
+         $table->integer('annual_limit')->nullable(); // yearly limit for this designation
Removed / Before Commit
- @error('designation_id') <div class="text-danger">{{ $message }}</div> @enderror
- </div>
- 
- {{-- Report To --}}
- <div class="col-md-6">
- <label for="report_to" class="form-label">Report To</label>
- </div>
- 
- {{-- Annual CTC / Total Salary --}}
-                             <div class="row mb-3">
- <label for="annual_salary" class="col-md-2 col-form-label text-start">Total Annual Salary</label>
- <div class="col-md-10">
- <div class="input-group">
- </div>
- <small class="form-text text-muted">(Total salary including all components.)</small>
- </div>
-                             </div>
- 
Added / After Commit
+ @error('designation_id') <div class="text-danger">{{ $message }}</div> @enderror
+ </div>
+ 
+                             {{-- Employee Category --}}
+                             <div class="col-md-6 mb-3">
+                                 <label for="employee_category" class="form-label">Employee Category</label>
+                                 <select name="employee_category_id" class="form-select">
+                                     <option value="">Select Category...</option>
+                                     @foreach($employeeCategories as $category)
+                                         <option value="{{ $category->id }}"
+                                         {{ old('employee_category_id', $staff->employee_category_id ?? '') == $category->id ? 'selected' : '' }}>
+                                     
+                                         {{ $category->name }}</option>
+                                     @endforeach
+                                 </select>
+                                 @error('employee_category_id') <div class="text-danger">{{ $message }}</div> @enderror
+                             </div>
+ 
Removed / Before Commit
- <th>Designation</th>
- <th>Department</th>
- <th>Status</th>
- <th>Action</th>
- </tr>
- </thead>
- <tbody>
- <td>{{ $member->phone }}</td>
- <td>{{ $member->designation?->name ?? '-' }}</td>
- <td>{{ $member->department?->name ?? '-' }}</td>
- <td>
- <div class="form-check form-switch">
- <input class="form-check-input toggle-status" type="checkbox" data-id="{{ $member->id }}" {{ $member->status === 'active' ? 'checked' : '' }}>
- <i class="fa fa-pencil"></i>
- </a>
- 
- <!-- Delete Form -->
- <form action="{{ route('admin.staff.destroy', $member->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure?')">
Added / After Commit
+ <th>Designation</th>
+ <th>Department</th>
+ <th>Status</th>
+                             <th>Employee Category</th>
+ <th>Action</th>
+ 
+ </tr>
+ </thead>
+ <tbody>
+ <td>{{ $member->phone }}</td>
+ <td>{{ $member->designation?->name ?? '-' }}</td>
+ <td>{{ $member->department?->name ?? '-' }}</td>
+                                 <td>{{ $member->EmployeeCategory?->name ?? '-' }}</td>
+ <td>
+ <div class="form-check form-switch">
+ <input class="form-check-input toggle-status" type="checkbox" data-id="{{ $member->id }}" {{ $member->status === 'active' ? 'checked' : '' }}>
+ <i class="fa fa-pencil"></i>
+ </a>
Removed / Before Commit
- </div>
- 
- 
-         <form method="GET" action="{{ route('attendance.index') }}" class="row g-2 align-items-end">
-             
-             <div class="col-md-2">
-                 <label class="form-label">Shift</label>
-                 <select name="shift" class="form-select">
-                     <option value="">All</option>
-                     @foreach($shifts as $shift)
-                         <option value="{{ $shift->id }}" {{ request('shift') == $shift->id ? 'selected' : '' }}>{{ $shift->name }}</option>
-                     @endforeach
-                 </select>
-             </div>
- 
-             <div class="col-md-2">
-                 <label class="form-label">Department</label>
-                 <select name="department" class="form-select">
Added / After Commit
+ </div>
+ 
+ 
+        <form id="filterForm" method="GET" action="{{ route('attendance.index') }}" class="row g-2 align-items-end">
+     <div class="col-md-2">
+         <label class="form-label">Shift</label>
+         <select name="shift" class="form-select filter-field">
+             <option value="">All</option>
+             @foreach($shifts as $shift)
+                 <option value="{{ $shift->id }}" {{ request('shift') == $shift->id ? 'selected' : '' }}>{{ $shift->name }}</option>
+             @endforeach
+         </select>
+     </div>
+ 
+     <div class="col-md-2">
+         <label class="form-label">Department</label>
+         <select name="department" class="form-select filter-field">
+             <option value="">All</option>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="row">
+     <div class="col">
+         <div class="card">
+             <div class="card-header py-3">
+                 <div class="row align-items-center">
+                     <div class="col-md-3">
+                         <h4><b>Employee Categories</b></h4>
+                     </div>
+                     <div class="col-md-9 text-end">
+                         <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#categoryModal">Add Category</button>
+                     </div>
+                 </div>
+             </div>
+             <hr>
+             <div class="card-body">
Removed / Before Commit
- @endif
- 
- <div class="row">
-                 <div class="col-md-6 mb-3">
- <label>Leave Name <span class="text-danger">*</span></label>
-                     <input type="text" name="name" class="form-control" value="{{ old('name', $leaveType->name ?? '') }}" required>
- </div>
- 
-                 <div class="col-md-3 mb-3">
- <label>Category <span class="text-danger">*</span></label>
-                     <select name="category" class="form-select" required>
- <option value="">--Select--</option>
-                         <option value="full_day" {{ old('category', $leaveType->category ?? '') == 'full_day' ? 'selected' : '' }}>Full Day</option>
-                         <option value="half_day" {{ old('category', $leaveType->category ?? '') == 'half_day' ? 'selected' : '' }}>Half Day</option>
-                         <option value="hourly" {{ old('category', $leaveType->category ?? '') == 'hourly' ? 'selected' : '' }}>Hourly</option>
- </select>
- </div>
- 
Added / After Commit
+ @endif
+ 
+ <div class="row">
+                 <div class="col-md-4 mb-3">
+ <label>Leave Name <span class="text-danger">*</span></label>
+                     <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>
+ 
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>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">
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
+ Unit	Days / Hours	For calculating leave consumption; can handle hourly leaves too
+ Annual Limit	Number of leaves per year	Covers maximum annual entitlement
+ Carry Forward	Yes/No	Whether unused leaves can be carried forward
+ Carry Forward Max	Max number of days/hours that can be carried	Prevents unlimited accumulation
+ Encashable	Yes/No	Whether the leave can be converted to cash
+ Gender Restriction	Male/Female/Both	Covers maternity/paternity or gender-specific leaves
+ Applicable To	Permanent/Contract/Probation	Restrict leave type to certain employee types
+ 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')
Removed / Before Commit
- <select name="calculation_type" class="form-control">
- <option value="fixed">Fixed</option>
- <option value="percentage">Percentage</option>
-                     <option value="formula">Formula</option>
- </select>
- </div>
- <div class="mb-3">
Added / After Commit
+ <select name="calculation_type" class="form-control">
+ <option value="fixed">Fixed</option>
+ <option value="percentage">Percentage</option>
+ </select>
+ </div>
+ <div class="mb-3">
Removed / Before Commit
- </tr>
- </thead>
- <tbody>
- @foreach($components as $comp)
- <tr>
- <td>{{ $comp->name }}</td>
- <td>{{ ucfirst($comp->frequency) }}</td>
- <td>{{ $comp->is_active ? 'Active' : 'Inactive' }}</td>
- <td>
-                         <a href="{{ route('salary-components.edit', $comp->id) }}" class="btn btn-sm btn-warning">Edit</a>
-                         <form action="{{ route('salary-components.destroy', $comp->id) }}" method="POST" style="display:inline">
-                             @csrf @method('DELETE')
-                             <button class="btn btn-sm btn-danger" onclick="return confirm('Delete?')">Delete</button>
-                         </form>
-                     </td>
- </tr>
- @endforeach
- </tbody>
Added / After Commit
+ </tr>
+ </thead>
+ <tbody>
+                 @php
+     $govtFixedComponents = [
+         'Basic Pay',
+         'Dearness Allowance',
+         'House Rent Allowance',
+         'Transport Allowance',
+         'Medical Allowance',
+         'Provident Fund',
+         'Professional Tax',
+         'Income Tax',
+         'Pension Contribution'
+     ];
+ @endphp
+ @foreach($components as $comp)
+ <tr>
Removed / Before 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">
Added / After Commit
+ <div class="row fw-bold mb-2">
+     <div class="col-2">Component</div>
+     <div class="col-2">Type</div>
+     <div class="col-2">Monthly</div>
+     <div class="col-2">Quarterly</div>
+     <div class="col-2">Half-Yearly</div>
+     <div class="col-2">Annual</div>
+ </div>
+ 
+ @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-name="{{ $comp->component->name }}"
+ data-formula="{{ $comp->component->formula ?? '' }}">
+ 
Removed / Before Commit
- </div>
- 
- <h5>Assign Components</h5>
-             @foreach($components as $comp)
- <div class="mb-2 row align-items-center">
-                 <div class="col-1">
-                     <input type="checkbox" class="component-check" id="comp_{{ $comp->id }}" data-type="{{ $comp->calculation_type }}">
-                 </div>
- <div class="col-4">
-                     <label for="comp_{{ $comp->id }}">{{ $comp->name }} ({{ ucfirst($comp->type) }})</label>
- </div>
- <div class="col-3">
- <span class="badge bg-info">{{ ucfirst($comp->calculation_type) }}</span>
- <span class="badge bg-secondary">{{ ucfirst($comp->frequency) }}</span>
- </div>
- <div class="col-4">
-                     <input type="number" step="0.01" name="components[{{ $comp->id }}]" class="form-control component-input" placeholder="Value" disabled>
- </div>
Added / After Commit
+ </div>
+ 
+ <h5>Assign Components</h5>
+             @php
+     $govtFixedComponents = [
+         'Basic Pay',
+         'Dearness Allowance',
+         'House Rent Allowance',
+         'Transport Allowance',
+         'Medical Allowance',
+         'Provident Fund',
+         'Professional Tax',
+         'Income Tax',
+         'Pension Contribution'
+     ];
+ @endphp
+            @foreach($components as $comp)
+ <div class="mb-2 row align-items-center">
Removed / Before Commit
- </div>
- 
- <h5>Assign Components</h5>
-             @foreach($components as $comp)
-             @php
-                 $assigned = $group->components->where('salary_component_id', $comp->id)->first();
-                 $value = $assigned ? $assigned->value : '';
- @endphp
-             <div class="mb-2 row align-items-center">
-                 <div class="col-1">
-                     <input type="checkbox" class="component-check" id="comp_{{ $comp->id }}" data-type="{{ $comp->calculation_type }}" {{ $assigned ? 'checked' : '' }}>
-                 </div>
-                 <div class="col-4">
-                     <label for="comp_{{ $comp->id }}">{{ $comp->name }} ({{ ucfirst($comp->type) }})</label>
-                 </div>
-                 <div class="col-3">
-                     <span class="badge bg-info">{{ ucfirst($comp->calculation_type) }}</span>
-                     <span class="badge bg-secondary">{{ ucfirst($comp->frequency) }}</span>
Added / After Commit
+ </div>
+ 
+ <h5>Assign Components</h5>
+            @php
+                 $govtFixedComponents = [
+                     'Basic Pay',
+                     'Dearness Allowance',
+                     'House Rent Allowance',
+                     'Transport Allowance',
+                     'Medical Allowance',
+                     'Provident Fund',
+                     'Professional Tax',
+                     'Income Tax',
+                     'Pension Contribution'
+                 ];
+ @endphp
+ 
+             @foreach($components as $comp)
Removed / Before Commit
- @endforeach
- </td>
- <td>
-                         <a href="{{ route('salary-groups.edit', $group->id) }}" class="btn btn-sm btn-info">Edit</a>
-                         <form action="{{ route('salary-groups.destroy', $group->id) }}" method="POST" style="display:inline-block;">
-                             @csrf
-                             @method('DELETE')
-                             <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Delete this group?')">Delete</button>
-                         </form>
- </td>
- </tr>
- @endforeach
- </div>
- </div>
- @endsection
Added / After Commit
+ @endforeach
+ </td>
+ <td>
+                         <a href="{{ route('salary-groups.edit', $group->id) }}"><i class="fa fa-edit"></i></a>
+                         <a href="javascript:void(0)" class="delete-group"
+                         data-id="{{ $group->id }}">
+                             <i class="fa fa-trash"></i>
+                         </a>
+ </td>
+ </tr>
+ @endforeach
+ </div>
+ </div>
+ @endsection
+ @section('scripts')
+ <script>
+ $(document).on('click', '.delete-group', function(e) {
+     e.preventDefault();
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ @section('title', 'Create Salary Slip - ' . $employee->name)
+ 
+ @section('content')
+ <div class="container">
+     <h3 class="mb-4">Create Salary Slip for {{ $employee->name }} ({{ \Carbon\Carbon::createFromDate($currentYear ?? now()->year, $currentMonth ?? now()->month, 1)->format('F Y') }})</h3>
+ 
+     <div class="mb-3">
+         <p>
+             <strong>Days in Month:</strong> {{ $daysInMonth }} |
+             <strong>Working Days (excluding Sundays & Holidays):</strong> {{ $workingDays }} |
+             <strong>Present Days:</strong> {{ $presentDays }} |
+             <strong>Leave Days:</strong> {{ $leaveDays }} |
+             <strong>Holidays:</strong> {{ $holidayDays }} |
+             <strong>Sundays:</strong> {{ $sundays ?? 0 }} |
+             <strong>Payable Days:</strong> {{ $payableDays }}
+         </p>
+     </div>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ @section('title', 'Salary Slips - ' . $employee->name)
+ 
+ @section('content')
+ <div class="container">
+     <h3 class="mb-4">Salary Slips of {{ $employee->name }}</h3>
+ 
+     {{-- Create Current Month Salary --}}
+     <div class="mb-3">
+        <form action="{{ route('salary-slips.createsalary', $employee->id) }}" method="get">
+     @csrf
+             <button type="submit" class="btn btn-primary">
+                 <i class="fas fa-plus"></i> Create Current Month Salary Slip
+             </button>
+         </form>
+     </div>
+ 
+     <table class="table table-bordered table-striped">
Removed / Before Commit

                                                
Added / After Commit
+ <!DOCTYPE html>
+ <html>
+ <head>
+     <meta charset="utf-8">
+     <title>Salary Slip</title>
+     <style>
+         body {
+             font-family: DejaVu Sans, sans-serif;
+             font-size: 13px;
+             margin: 20px;
+             color: #000;
+         }
+         .salary-slip {
+             border: 2px solid #000;
+             padding: 20px;
+             border-radius: 5px;
+         }
+         .header {
Removed / Before Commit
- use App\Http\Controllers\SalaryComponentController;
- use App\Http\Controllers\SalaryGroupController;
- use App\Http\Controllers\APDemandController;
- 
- 
- /*
- |--------------------------------------------------------------------------
- Route::post('/store', [QCInspectionController::class, 'store'])->name('store');
- });
- 
- Route::post('/user-approved-toggle', [UserController::class, 'toggleApproved']);
- Route::get('/timeallotment/print/{id}', [WorkOrderController::class, 'print'])->name('timeallotment.print');
- 
- // APDemand update
- Route::post('apdemands/update', [APDemandController::class, 'update'])->name('apdemands.update');
- 
Added / After Commit
+ use App\Http\Controllers\SalaryComponentController;
+ use App\Http\Controllers\SalaryGroupController;
+ use App\Http\Controllers\APDemandController;
+ use App\Http\Controllers\SalarySlipController;
+ use App\Http\Controllers\EmployeeCategoryController;
+ 
+ /*
+ |--------------------------------------------------------------------------
+ Route::post('/store', [QCInspectionController::class, 'store'])->name('store');
+ });
+ 
+     // Employee Category Start
+     Route::get('employee-categories', [EmployeeCategoryController::class, 'index'])->name('employee-categories.index');
+     Route::post('employee-categories/store', [EmployeeCategoryController::class, 'store']);
+     Route::post('employee-categories/update/{id}', [EmployeeCategoryController::class, 'update']);
+     Route::delete('employee-categories/delete/{id}', [EmployeeCategoryController::class, 'destroy']);
+     Route::post('employee-categories/toggle-status', [EmployeeCategoryController::class, 'toggleStatus'])->name('employee-categories.toggleStatus');
+