Skip to content

Commit

Permalink
Updates to transfer/visiting checklists
Browse files Browse the repository at this point in the history
  • Loading branch information
BMWENING committed Mar 11, 2024
1 parent 61d4b9f commit e7d5188
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
18 changes: 17 additions & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,21 @@ public function transferEligible(
}
}

// added to visiting roster in last 60 days check
$visiting = Visit::where('cid', $this->cid)
->orderBy('created_at', 'DESC')
->first();
if (!$visiting) {
$checks['60days'] = 1;
} else {
$checks['visitingDays'] = Carbon::createFromFormat('Y-m-d H:i:s', $visiting->updated_at)->diffInDays(new Carbon());
if ($checks['visitingDays'] >= 60) {
$checks['60days'] = 1;
} else {
$checks['60days'] = 0;
}
}

// S1-C1 within 90 check
$promotion = Promotions::where('cid', $this->cid)->where([
['to', '<=', Helper::ratingIntFromShort("C1")],
Expand All @@ -393,6 +408,7 @@ public function transferEligible(
$checks['promo'] = 1;
} else {
$checks['promo'] = 0;
$checks['promoDays'] = Carbon::createFromFormat('Y-m-d H:i:s', $promotion->created_at)->diffInDays(new Carbon());
}

// 50 hours consolidating current rating
Expand Down Expand Up @@ -453,7 +469,7 @@ public function transferEligible(
/* if ($this->facility == "ZAE" && !$this->flag_needbasic && !$this->selectionEligible() && !Transfers::where('cid', $this->cid)->where('status',0)->count())
return true;*/

if($checks['hasRating'] && $checks['hasHome'] && $checks['50hrs'] && $checks['needbasic'] && $checks['promo']){
if($checks ['60days'] && $checks['hasRating'] && $checks['hasHome'] && $checks['50hrs'] && $checks['needbasic'] && $checks['promo']){
$checks['visiting'] = 1;
} else {
$checks['visiting'] = 0;
Expand Down
16 changes: 10 additions & 6 deletions resources/views/mgt/controller/parts/summary.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ class="fa fa-envelope text-primary"></i></a></li>
@if($checks['is_first'] == 1)
<td><span class="text-success">N/A</span></td>
@elseif($checks['90days'])
<td><i class="fa fa-check text-success"></i>{!! (isset($checks['days']))?"(".$checks['days']." days)":"" !!}</td>
<td><i class="fa fa-check text-success"></i></td>
@else
<td><i class="fa fa-times text-danger"></i>{!! (isset($checks['days']))?"(".$checks['days']." days)":"" !!}</td>
<td><i class="fa fa-times text-danger"></i>{!! "(".$checks['days']." days)" !!}</td>
@endif
</tr>
<tr>
Expand All @@ -158,8 +158,8 @@ class="fa fa-envelope text-primary"></i></a></li>
@endif
</tr>
<tr>
<td>Has it been at least 90 days since promotion to S1, S2, S3, or C1?</td>
<td>{!! ($checks['promo'])?'<i class="fa fa-check text-success"></i>':'<i class="fa fa-times text-danger"></i>' !!}</td>
<td>90 days since promotion to S1, S2, S3, or C1?</td>
<td>{!! ($checks['promo'])?'<i class="fa fa-check text-success"></i>':'<i class="fa fa-times text-danger"></i>('.$checks['promoDays'].' days)' !!}</td>
</tr>
<tr>
<td>50 controlling hours since promotion to S1, S2, S3, or C1?</td>
Expand Down Expand Up @@ -213,8 +213,12 @@ class="fa fa-envelope text-primary"></i></a></li>
<td>{!! ($checks['hasRating'])?'<i class="fa fa-check text-success"></i>':'<i class="fa fa-times text-danger"></i>' !!}</td>
</tr>
<tr>
<td>Has it been at least 90 days since promotion to S1, S2, S3, or C1?</td>
<td>{!! ($checks['promo'])?'<i class="fa fa-check text-success"></i>':'<i class="fa fa-times text-danger"></i>' !!}</td>
<td>60 days since last addition to a visiting roster?</td>
<td>{!! ($checks['60days'])?'<i class="fa fa-check text-success"></i>':'<i class="fa fa-times text-danger"></i>('.$checks['visitingDays'].' days)' !!}</td>
</tr>
<tr>
<td>90 days since promotion to S1, S2, S3, or C1?</td>
<td>{!! ($checks['promo'])?'<i class="fa fa-check text-success"></i>':'<i class="fa fa-times text-danger"></i>('.$checks['promoDays'].' days)' !!}</td>
</tr>
<tr>
<td>50 controlling hours since promotion to S1, S2, S3, or C1?</td>
Expand Down

0 comments on commit e7d5188

Please sign in to comment.