From e7d5188061acf533649fe991c771b18ff270749d Mon Sep 17 00:00:00 2001 From: Brandon Wening Date: Mon, 11 Mar 2024 14:21:12 -0400 Subject: [PATCH] Updates to transfer/visiting checklists --- app/Models/User.php | 18 +++++++++++++++++- .../mgt/controller/parts/summary.blade.php | 16 ++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index 6c35b081..60fb34d5 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -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")], @@ -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 @@ -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; diff --git a/resources/views/mgt/controller/parts/summary.blade.php b/resources/views/mgt/controller/parts/summary.blade.php index 7ed0d519..fab50a76 100644 --- a/resources/views/mgt/controller/parts/summary.blade.php +++ b/resources/views/mgt/controller/parts/summary.blade.php @@ -142,9 +142,9 @@ class="fa fa-envelope text-primary"> @if($checks['is_first'] == 1) N/A @elseif($checks['90days']) - {!! (isset($checks['days']))?"(".$checks['days']." days)":"" !!} + @else - {!! (isset($checks['days']))?"(".$checks['days']." days)":"" !!} + {!! "(".$checks['days']." days)" !!} @endif @@ -158,8 +158,8 @@ class="fa fa-envelope text-primary"> @endif - Has it been at least 90 days since promotion to S1, S2, S3, or C1? - {!! ($checks['promo'])?'':'' !!} + 90 days since promotion to S1, S2, S3, or C1? + {!! ($checks['promo'])?'':'('.$checks['promoDays'].' days)' !!} 50 controlling hours since promotion to S1, S2, S3, or C1? @@ -213,8 +213,12 @@ class="fa fa-envelope text-primary"> {!! ($checks['hasRating'])?'':'' !!} - Has it been at least 90 days since promotion to S1, S2, S3, or C1? - {!! ($checks['promo'])?'':'' !!} + 60 days since last addition to a visiting roster? + {!! ($checks['60days'])?'':'('.$checks['visitingDays'].' days)' !!} + + + 90 days since promotion to S1, S2, S3, or C1? + {!! ($checks['promo'])?'':'('.$checks['promoDays'].' days)' !!} 50 controlling hours since promotion to S1, S2, S3, or C1?