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

Review Result ?

jattin01/army · ff84cb5b
The commit introduces multiple new features including filters for queries in UrgencyController, validations in rejectsaveDraftBid, and improvements in the FinancialPowerController regarding assignment and validation. The overall code changes increase business value substantially by adding filtering, validation, and data integrity. Validation helps to reduce bug risk, although there remain some bug risks where type checking or error handling may be improved. Security considerations are addressed partially through validations but could be improved further, especially around input sanitization and authorization checks. The commit message and formatting are extremely poor and uninformative.
Quality ?
80%
Security ?
70%
Business Value ?
85%
Maintainability ?
80%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Lacks Meaningful Description
Where commit message
Issue / Evidence lacks meaningful description
Suggested Fix provide a clear, descriptive commit message explaining purpose and scope of changes
No Explicit Error Handling If 'Amount' Is...
Where app/Http/Controllers/FinancialPowerController.php:116
Issue / Evidence no explicit error handling if 'amount' is missing or invalid
Suggested Fix add error handling or validation to ensure 'amount' exists and is valid float
Missing Validation
Where app/Http/Controllers/FinancialPowerController.php:123
Issue / Evidence business logic validation error message is constructed directly
Suggested Fix consider localization and safer string formatting for user-facing messages
Missing Validation
Where app/Http/Controllers/UrgencyController.php:849
Issue / Evidence input validation is present but no authorization checks
Suggested Fix add authorization checks to protect sensitive data update actions
Direct Mass Assignment Used
Where app/Http/Controllers/UrgencyController.php:919
Issue / Evidence direct mass assignment used
Suggested Fix ensure model fills or guarded properties are appropriately set to avoid mass assignment vulnerabilities
Long Function
Where app/Http/Controllers/UrgencyController.php:862
Issue / Evidence complex query with relation check
Suggested Fix add error handling if no matched records found or handle edge cases
Generating Case Numbers In A Non Transacti...
Where app/Http/Controllers/UrgencyController.php:709
Issue / Evidence generating case numbers in a non-transactional way may cause race conditions
Suggested Fix implement locking or atomic increment for case number generation
Missing Validation
Where app/Http/Controllers/UrgencyController.php:913
Issue / Evidence inconsistency in input validation type (e.g. 'case_id' as string)
Suggested Fix confirm correct types and strong validation rules
Code Change Preview · app/Http/Controllers/FinancialPowerController.php ?
Removed / Before Commit
- 
- // Create a mapping: fund_id => assigned_amount
- $assignedAmounts = [];
- foreach ($fp->funds as $fund) {
- $assignedAmounts[$fund->id] = $fund->pivot->assigned_amount; // assuming pivot table
- }
- 
- $allFunds = LpoFund::all(); // or whichever funds should appear in modal
- 'fp' => $fp,
- 'funds' => $allFunds,
- 'assigned' => $assigned,
-         'assignedAmounts' => $assignedAmounts
- ]);
- }
- 
- {
- $fp = FinancialPower::findOrFail($id);
- $funds = $request->input('funds', []);
Added / After Commit
+ 
+ // Create a mapping: fund_id => assigned_amount
+ $assignedAmounts = [];
+     $powerassignedAmounts = [];
+ foreach ($fp->funds as $fund) {
+ $assignedAmounts[$fund->id] = $fund->pivot->assigned_amount; // assuming pivot table
+         $powerassignedAmounts[$fund->id] = $fund->pivot->power_in_consultation_with_isa; // assuming pivot table
+ }
+ 
+ $allFunds = LpoFund::all(); // or whichever funds should appear in modal
+ 'fp' => $fp,
+ 'funds' => $allFunds,
+ 'assigned' => $assigned,
+         'assignedAmounts' => $assignedAmounts,
+         'powerassignedAmounts' => $powerassignedAmounts
+ ]);
+ }
+ 
Removed / Before Commit
- use App\Models\FinancialPower;
- use App\Models\CaseMaster;
- use App\Models\LpoFund;
- use Illuminate\Support\Collection;
- use Carbon\Carbon;
- 
- class UrgencyController extends Controller
- {
- 'supplier_delivery_date' => 'supplier_delivery_date',
- 'delivery_extend'      => 'delivery_extend',
- 'delivery_extend_date' => 'delivery_extend_date',
- 'final_delivery_date'  => 'final_delivery_date',
- 'inspection_note'      => 'inspection_note',
- 'group_stability_date' => 'group_stability_date',
- }
- 
- 
- // Step 1: LPR + NAC summary
Added / After Commit
+ use App\Models\FinancialPower;
+ use App\Models\CaseMaster;
+ use App\Models\LpoFund;
+ use App\Models\GemsDetail;
+ use Illuminate\Support\Collection;
+ use Carbon\Carbon;
+ use App\Models\UrgencyReject;
+ 
+ class UrgencyController extends Controller
+ {
+ 'supplier_delivery_date' => 'supplier_delivery_date',
+ 'delivery_extend'      => 'delivery_extend',
+ 'delivery_extend_date' => 'delivery_extend_date',
+             'challan_no'           => 'challan_no',
+ 'final_delivery_date'  => 'final_delivery_date',
+ 'inspection_note'      => 'inspection_note',
+ 'group_stability_date' => 'group_stability_date',
+ }
Removed / Before Commit
- 
- protected $fillable = [
- 'case_no',
-         'draft_bid_no',
-         'draft_bid_date',
-         'aone_no',
-         'bid_publishing_date',
-         'bid_opening_date',
-         'technical_evaluation_start_date',
-         'technical_evaluation_end_date',
-         'cfa_approval_date',
-         'commercial_bid_date',
-         'ra_date',
-         'ra_bid_number',
- 'fund_id',
- ];
Added / After Commit
+ 
+ protected $fillable = [
+ 'case_no',
+ 'fund_id',
+         'fund_procedure',
+ ];
Removed / Before Commit
- {
- return $this->belongsToMany(LpoFund::class, 'financial_power_funds')
- ->withPivot('assigned_amount')
- ->withTimestamps();
- }
- }
Added / After Commit
+ {
+ return $this->belongsToMany(LpoFund::class, 'financial_power_funds')
+ ->withPivot('assigned_amount')
+                 ->withPivot('power_in_consultation_with_isa')
+ ->withTimestamps();
+ }
+ 
+ }
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class GemsDetail extends Model
+ {
+     use HasFactory;
+ 
+     // Table name
+     protected $table = 'gems_details';
+ 
+     // Fillable columns
+     protected $fillable = [
+         'vendor_names',
+         'vendor_no',
Removed / Before Commit
- 'reason',
- 'estimate_amount',
- 'nac_id',
- 'lpr_no',
- 'qty_approved',
- // new fields
- ->where('mco_demands.item_id', $this->item_id);
- }
- 
- public function demand()
- {
- return $this->belongsTo(Demand::class, 'req_no', 'req_no')
- {
- return $this->belongsTo(NacMaster::class, 'nac_id');
- }
- 
- public function lpr()
- {
Added / After Commit
+ 'reason',
+ 'estimate_amount',
+ 'nac_id',
+         'gems_id',
+ 'lpr_no',
+ 'qty_approved',
+ // new fields
+ ->where('mco_demands.item_id', $this->item_id);
+ }
+ 
+ public function MCODemandDetail()
+ {
+     return $this->hasOne(McoDemand::class, 'req_no', 'req_no');
+ }
+ 
+ public function demand()
+ {
+ return $this->belongsTo(Demand::class, 'req_no', 'req_no')
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class UrgencyReject extends Model
+ {
+     use HasFactory;
+ 
+     protected $fillable = [
+         'urgency_id',
+         'case_id',
+         'gem_id',
+         'remark',
+     ];
+ 
+     public function urgency()
Removed / Before Commit
- <input type="text" id="next_higher_cfa" class="form-control">
- </div>
- 
-                                     <div class="col-12">
- <label class="form-label">Inherit power</label>
-                                         <textarea id="inherit_power" class="form-control" rows="3"></textarea>
- </div>
- 
-                                     <div class="col-12">
- <label class="form-label">Power in consultation with IFA</label>
-                                         <textarea id="power_in_consultation_with_isa" class="form-control" rows="3"></textarea>
- </div>
- </div>
- </div>
- 
- let html = '';
- res.funds.forEach(fund => {
- const assignedAmount = res.assignedAmounts && res.assignedAmounts[fund.id] ? res.assignedAmounts[fund.id] : '';
Added / After Commit
+ <input type="text" id="next_higher_cfa" class="form-control">
+ </div>
+ 
+                                     <div class="col-md-6">
+ <label class="form-label">Inherit power</label>
+                                         <input type="number" id="inherit_power" class="form-control" placeholder="Enter inherit power">
+ </div>
+ 
+                                     <div class="col-md-6">
+ <label class="form-label">Power in consultation with IFA</label>
+                                         <input type="number" id="power_in_consultation_with_isa" class="form-control" placeholder="Enter power in consultation with IFA">
+ </div>
+ 
+ </div>
+ </div>
+ 
+ let html = '';
+ res.funds.forEach(fund => {
Removed / Before Commit
- <div class="card-body">
- 
- <!-- Total Estimate & Fund -->
-         <div class="d-flex align-items-center mb-3">
-             <div class="total-estimate me-3">Total Estimate: <span id="totalEstimate">0</span></div>
-             <select id="fundSelect" class="form-select w-auto me-3">
- <option value="">Select Fund</option>
- @foreach($funds as $fund)
- <option value="{{ $fund->id }}" data-power="{{ $fund->amount_allotted }}">{{ $fund->name_of_fund }}</option>
- @endforeach
- </select>
-             <div id="financialPower" style="font-weight:bold;"></div>
- </div>
- 
- <!-- Create Case Button -->
- <button id="createCaseBtn" class="btn btn-success mb-3" style="display:none">Create Case No</button>
- 
- <thead class="table-light text-center">
Added / After Commit
+ <div class="card-body">
+ 
+ <!-- Total Estimate & Fund -->
+         <div class="estimate-fund-section d-flex align-items-center flex-wrap mb-3 p-3 rounded shadow-sm">
+             <div class="total-estimate me-3 mb-2">
+                 <label class="text-muted fw-semibold me-1">Total Estimate:</label>
+                 <span id="totalEstimate" class="fw-bold text-primary fs-5">0</span>
+             </div>
+ 
+             <select id="fundSelect" class="form-select fund-select me-3 mb-2">
+ <option value="">Select Fund</option>
+ @foreach($funds as $fund)
+ <option value="{{ $fund->id }}" data-power="{{ $fund->amount_allotted }}">{{ $fund->name_of_fund }}</option>
+ @endforeach
+ </select>
+ 
+             <select id="fundProcedure" class="form-select fund-select me-3 mb-2">
+                 <option value="">Select Procedure</option>
Removed / Before Commit
- <strong>Financial Power:</strong> {{ $fundPowerName }}
- </div>
- <div>
-                 @if($case->draft_bid_no && $case->draft_bid_date)
-                     <h5 class="fw-bold">Draft Bid No: {{$case->draft_bid_no }}</h5>
-                     <h5 class="fw-bold">Draft Bid Date: {{ $case->draft_bid_date }}</h5>
- @endif
- </div>
- </div>
- </div>
- 
- <!-- Draft Bid Form -->
-          @if(!$case->draft_bid_no && !$case->draft_bid_date)
- <div class="card mb-3 p-3">
-             <form action="{{ route('cases.saveDraftBid',  $case->id) }}"  method="POST" class="mb-3">
- @csrf
- <div class="row">
- <div class="col-md-4">
Added / After Commit
+ <strong>Financial Power:</strong> {{ $fundPowerName }}
+ </div>
+ <div>
+                 @if($items[0]?->gemsMaster?->draft_bid_no && $items[0]?->gemsMaster?->draft_bid_date)
+                     <h5 class="fw-bold">Draft Bid No: {{$items[0]?->gemsMaster?->draft_bid_no }}</h5>
+                     <h5 class="fw-bold">Draft Bid Date: {{ $items[0]?->gemsMaster?->draft_bid_date }}</h5>
+ @endif
+ </div>
+ </div>
+ </div>
+ 
+ <!-- Draft Bid Form -->
+          @if(!$items[0]?->gemsMaster?->draft_bid_no && !$items[0]?->gemsMaster?->draft_bid_date)
+ <div class="card mb-3 p-3">
+             <form action="{{ route('cases.saveDraftBid', $case->id) }}"  method="POST" class="mb-3">
+ @csrf
+ <div class="row">
+ <div class="col-md-4">
Removed / Before Commit
- <div class="card">
- <div class="card-header d-flex justify-content-between">
- <h4>Case Summary</h4>
- </div>
- <div class="card-body">
-         <table class="table table-bordered">
-             <thead class="table-primary">
-                 <tr>
-                     <th>Case No</th>
-                     <th>LPR No</th>
-                     <th>Urgency No</th>
-                     <th>Action</th>
-                 </tr>
-             </thead>
-             <tbody>
-                 @foreach($cases as $case)
-                 <tr>
-                     <td>{{ $case->case_no }}</td>
Added / After Commit
+ <div class="card">
+ <div class="card-header d-flex justify-content-between">
+ <h4>Case Summary</h4>
+         <form method="GET" action="{{ route('urgencies.case.summary') }}" id="filterForm" class="d-flex gap-2 flex-wrap">
+             <div class="row g-2 mb-3">
+ 
+                 <div class="col-md-2">
+                 <select name="case_no" class="form-select select2-auto">
+                     <option value="">Case No</option>
+                     @foreach($caseNos as $case)
+                     <option value="{{ $case }}" {{ request('case_no') == $case ? 'selected' : '' }}>{{ $case }}</option>
+                     @endforeach
+                 </select>
+                 </div>
+ 
+                 <div class="col-md-2">
+                 <select name="lpr_no" class="form-select select2-auto">
+                     <option value="">LPR No</option>
Removed / Before Commit
- @section('content')
- <div class="card">
- <div class="card-header d-flex justify-content-between">
-         <h4>Create Case No</h4>
- </div>
- 
- <div class="card-body">
- <div class="table-responsive">
- <table class="table table-bordered table-striped table-fixed">
- <thead class="table-danger text-center">
- <tr>
-                     <th>Select</th><th>LPR No</th><th>Job No</th><th>Req No</th><th>Urgency No</th>
- </tr>
- </thead>
- <tbody class="text-center">
- <td>{{ $items->first()->mcodemand->job_no ?? '-' }}</td>
- <td>{{ $items->first()->req_no }}</td>
- <td>{{ $items->first()->id }}</td>
Added / After Commit
+ @section('content')
+ <div class="card">
+ <div class="card-header d-flex justify-content-between">
+         <h4>Pending Case No</h4>
+          <form method="GET" action="{{ route('urgency.lprnac.summary') }}" id="filterForm" class="d-flex gap-2 flex-wrap">
+ 
+             <div>
+                 <label for="job_no" class="form-label mb-0">Job No</label>
+                 <select name="job_no" id="job_no" class="form-select form-select-sm select2-auto">
+                     <option value="">Select Job No</option>
+                     @foreach($jobNos as $job)
+                         <option value="{{ $job }}" {{ request('job_no') == $job ? 'selected' : '' }}>{{ $job }}</option>
+                     @endforeach
+                 </select>
+             </div>
+ 
+             <div>
+                 <label for="lpr_no" class="form-label mb-0">LPR No</label>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="card">
+     <div class="card mb-3">
+         <div class="card-header d-flex justify-content-between align-items-center">
+             <div>
+                 <span class="fw-bold">
+                     Job No: {{$nac?->urgencies[0]?->demand?->job_no}} ||
+                     NAC No: {{ $nac->nac_no }} ||
+                     NAC Date: {{ $nac->nac_date }} ||
+                     NAC Validity Date: {{ $nac->validity_date }} ||
+                     Case No: {{ $caseNo }}
+                 </span>
+             </div>
+         </div>
+         <div class="card-header d-flex justify-content-between align-items-center">
+             <div>
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="card">
+     <div class="card-header d-flex justify-content-between">
+         <h4>Rejected Case Summary</h4>
+         <form method="GET" action="{{ route('urgencies.rejected.case.summary') }}" id="filterForm" class="d-flex gap-2 flex-wrap">
+             <div class="row g-2 mb-3">
+                 {{-- Same filter inputs as case_summary --}}
+                 <div class="col-md-2">
+                     <select name="case_no" class="form-select select2-auto">
+                         <option value="">Case No</option>
+                         @foreach($caseNos as $case)
+                             <option value="{{ $case }}" {{ request('case_no') == $case ? 'selected' : '' }}>{{ $case }}</option>
+                         @endforeach
+                     </select>
+                 </div>
+                 <div class="col-md-2">
Removed / Before Commit
- Route::post('/urgency/case-bid/{caseNo}', [UrgencyController::class, 'storeBid'])->name('urgencies.case.bid.store');
- // Draft Bid save
- Route::post('/cases/{case}/draft-bid', [UrgencyController::class, 'saveDraftBid'])->name('cases.saveDraftBid');
- 
- // Gems Details save
- Route::post('/cases/{case}/gems-details', [UrgencyController::class, 'saveGemsDetails'])->name('cases.saveGemsDetails');
Added / After Commit
+ Route::post('/urgency/case-bid/{caseNo}', [UrgencyController::class, 'storeBid'])->name('urgencies.case.bid.store');
+ // Draft Bid save
+ Route::post('/cases/{case}/draft-bid', [UrgencyController::class, 'saveDraftBid'])->name('cases.saveDraftBid');
+ Route::post('/cases/{case}/rejectdraft-bid', [UrgencyController::class, 'rejectsaveDraftBid'])->name('cases.rejectsaveDraftBid');
+ // web.php
+ Route::post('/urgency/reject', [UrgencyController::class, 'reject'])->name('urgency.reject');
+ Route::get('/urgency/rejected-case-summary', [UrgencyController::class, 'rejectedCaseSummary'])
+     ->name('urgencies.rejected.case.summary');
+ Route::get('/urgency/rejected-case-items/{caseNo}', [UrgencyController::class, 'rejectedCaseItems'])
+     ->name('urgencies.rejected.case.items');
+ 
+ // Gems Details save
+ Route::post('/cases/{case}/gems-details', [UrgencyController::class, 'saveGemsDetails'])->name('cases.saveGemsDetails');