Browse Source

Preferred Start date

Mostafijur Rahman 1 year ago
parent
commit
1603388377

+ 11 - 0
app/Http/Controllers/Admin/AdminController.php

@@ -38,6 +38,16 @@ class AdminController extends Controller
                 'id','DESC'
             )->get();
 
+        $pending_student_list =User::where(
+            'user_type',1
+        )->where(
+            'sign_up',0
+        )->where(
+            'register_type',4
+        )->orderBy(
+            'id','DESC'
+        )->get();
+
         $register_student_list =User::where(
                 'user_type',1
             )->where(
@@ -89,6 +99,7 @@ class AdminController extends Controller
           'invited_registered_list'=>$invited_registered_list,
           'application'=>$application,
           'landing_wishlist'=>$landing_wishlist,
+          'pending_student_list'=>$pending_student_list,
           'admin'=>$admin
         ];
         return view('admin.admin_profile',$data);

+ 7 - 2
app/Http/Controllers/AjaxController.php

@@ -596,12 +596,17 @@ class AjaxController extends Controller
 
         }elseif($name=="invitation_register_save"){
 
-            $validator=\Validator::make($req->all(), [
+            $new_rules=[
+                'others_department'=>'required',
+            ];
+
+            $validator=\Validator::make($req->all(),$new_rules, [
                 'first_name'=>'required',
                 'last_name'=>'required',
                 'email'=>'required',
                 'university'=>'required',
-                'others_department'=>'required',
+                'others_department.required'=>'Department field is required.',
+                'website'=>'required',
                 'designation'=>'required',
                 'password_confirmation'=>'required',
                 'password'=>[

+ 1 - 1
app/Http/Controllers/Auth/LoginController.php

@@ -64,7 +64,7 @@ class LoginController extends Controller
             return redirect('/login')->with('error','Unknown Email address!');
         }else{
             if($student->email_verification == 0){
-                return redirect('/login')->with('error', 'Account is not verified!. Please check your email.');
+                return redirect('/login')->with('error', 'Your e-mail is not verified!. Please check your email.');
             }else{
                 $credentials = [
                     'email' => $request->email,

+ 1 - 1
app/Http/Controllers/Auth/RegisterController.php

@@ -146,7 +146,7 @@ class RegisterController extends Controller
         $data->email_verified_at=now();
         $data->status=1;
         $data->update(); 
-        return Redirect('/login')->with('success','Your mail is activated successfully. Login here ');
+        return Redirect('/login')->with('success','Your e-mail has been verified successfully. Please login to your account');
         
      }
 }

+ 35 - 5
app/Http/Controllers/ModalController.php

@@ -21,6 +21,7 @@ use DB;
 use Session;
 use Auth;
 use Mail;
+Use Carbon\Carbon;
 
 class ModalController extends Controller{
 
@@ -153,7 +154,13 @@ class ModalController extends Controller{
                 return response(['msg'=>'Application you have submitted that are approved'],403);
             }
 
-           
+            $currentYear = date('Y');
+            $currentMonth = date('m');
+            $selectedMonth =$req->startmonth;
+
+            if($currentYear ==$req->startdate && $currentMonth >= $selectedMonth){ 
+                return response(['msg'=>'Current or previous month is not supported'],403);
+            } 
 
             $student_proposal =new StudentProposal;
             $student_proposal->student_id =$req->student_id;
@@ -161,6 +168,7 @@ class ModalController extends Controller{
             $student_proposal->proposal_id =$req->proposal_id;
             $student_proposal->start_year =$req->startdate;
             $student_proposal->start_month =$req->startmonth;
+            $student_proposal->preferred_start_date =$req->startdate.'-'.$req->startmonth.'-'.'01'; 
             $student_proposal->student_apply_ref =studentRefNoGenerate();
             $student_proposal->proposal_submit_status = 1;
             $student_proposal->submitted_date = now();
@@ -216,7 +224,7 @@ class ModalController extends Controller{
 
             return response(['msg'=>'Proposal send successfully.']);
 
-        }elseif($name=="update_student_proposal"){
+        }elseif($name=="update_student_proposal"){  
 
             $new_rules=[
                 'proposal_id'=>'required',
@@ -266,10 +274,20 @@ class ModalController extends Controller{
                 return response(['msg'=>'Application you have submitted that are currently awaiting decisions'],403);
             }
 
+            $currentYear = date('Y');
+            $currentMonth = date('m');
+            $selectedMonth =$req->startmonth;
+
+            if($currentYear ==$req->startdate && $currentMonth >= $selectedMonth){ 
+                return response(['msg'=>'Current or previous month is not supported'],403);
+            } 
+
+
             $student_proposal =StudentProposal::find($req->id);
             $student_proposal->proposal_id =$req->proposal_id;
             $student_proposal->start_year =$req->startdate;
             $student_proposal->start_month =$req->startmonth;
+            $student_proposal->preferred_start_date =$req->startdate.'-'.$req->startmonth.'-'.'01'; 
             $student_proposal->student_apply_ref =studentRefNoGenerate();
             $student_proposal->proposal_submit_status = 1;
             $student_proposal->submitted_date = now();
@@ -385,7 +403,19 @@ class ModalController extends Controller{
                 $refer->teacher_id =$teacher->id;
                 $refer->save();
 
-                $user_notify =User::where('email',$req->email)->where('user_type',1)->first();
+                $teacher =User::where('email',$req->email)->where('user_type',1)->first();
+
+                if($teacher->others_department){
+                    $department =$teacher->others_department;
+                }else{
+                    $department = cn($teacher,'department_name.name','');
+                }
+
+                if($teacher->university_name){
+                    $university =$teacher->university_name;
+                }else{
+                    $university = cn($teacher,'university.name','');
+                }
 
                 $data['name'] = $refer->name;
                 $data['teacher_id'] = $refer->teacher_id;
@@ -394,8 +424,8 @@ class ModalController extends Controller{
                 $data['teacher'] = $teacher->first_name.' '.$teacher->last_name;
                 $data['arn'] = $teacher->ref_no;
                 $data['designation'] = $teacher->designation;
-                $data['department'] = $teacher->others_department;
-                $data['university'] = $teacher->university_name;
+                $data['department'] = $department;
+                $data['university'] =  $university;
                 $data['receive_email']=$refer->email;
                 $user_mail = $refer->email;
                 $from = 'asraful@revinr.com';

+ 15 - 15
app/Http/Controllers/TeacherHomeController.php

@@ -91,29 +91,29 @@ class TeacherHomeController extends Controller
         }
 
         if($request->submitted_date){
-            $date_array = explode("to",$request->submitted_date);
+            $date_array = explode("to",$request->submitted_date); 
 
-            $from_month_year = date('m-Y', strtotime($date_array[0]));
-            $to_month_year = date('m-Y', strtotime($date_array[1]));
-            dd($to_month_year);
+            $from_date = date('d-m-Y', strtotime($date_array[0]));
+            $to_date = date('d-m-Y', strtotime($date_array[1])); 
 
-            $start_date=$carbon->parse('01-'.$from_month_year)->toDateString();
-            $end_date=$carbon->parse('01-'.$to_month_year)->toDateString();
+            $start_date=$carbon->parse($from_date)->toDateString();
+            $end_date=$carbon->parse($to_date)->toDateString();
+             
 
             $students->whereRaw("DATE(submitted_date) >= ? AND DATE(submitted_date) <= ?", [$start_date, $end_date]);
         }
 
-        // if($request->preffered_start_date){
-        //     $date_array = explode("to",$request->preffered_start_date);
-
-        //     $from_month_year = date('m-Y', strtotime($date_array[0]));
-        //     $to_month_year = date('m-Y', strtotime($date_array[1]));
+        if($request->preffered_start_date){
+            $date_array = explode("to",$request->preffered_start_date);
 
-        //     $start_date=$carbon->parse('01-'.$from_month_year)->toDateString();
-        //     $end_date=$carbon->parse('01-'.$to_month_year)->toDateString();
+            $from_month_year = date('m-Y', strtotime($date_array[0])); //01-06-2023
+            $to_month_year = date('m-Y', strtotime($date_array[1]));//31-07-2023
+            
+            $start_date=$carbon->parse('01-'.$from_month_year)->toDateString();
+            $end_date=$carbon->parse('01-'.$to_month_year)->toDateString();
 
-        //     $students->whereRaw("DATE(submitted_date) >= ? AND DATE(submitted_date) <= ?", [$start_date, $end_date]);
-        // }
+            $students->whereRaw("DATE(preferred_start_date) >= ? AND DATE(preferred_start_date) <= ?", [$start_date, $end_date]);
+        }
 
         $data=[
             'students' => $students->get(),

BIN
public/uploads/proposal/1685870399documentfile_.pdf


+ 78 - 7
resources/views/admin/admin_profile.blade.php

@@ -621,7 +621,12 @@ tbody, td, tfoot, th, thead, tr {
                                 <div class="col-md-12 mb-4" style="padding: 0px; margin-top: -2.4rem; ">
                                     <ul class="nav nav-pills flex-column flex-sm-row d-md-inline-flex nav-justified mb-0 rounded-top position-relative overflow-hidden" id="pills-tab" role="tablist">
                                         <li class="nav-item m-1 ms-2 tech">
-                                            <a class="nav-link  active rounded" id="student-register" data-bs-toggle="pill" href="#registers" role="tab" aria-controls="registers" aria-selected="false" style="width:114px;">
+                                            <a class="nav-link  active rounded" id="student-pending" data-bs-toggle="pill" href="#student_pending" role="tab" aria-controls="student_pending" aria-selected="false" style="width:114px;">
+                                                Pending
+                                            </a>
+                                        </li>
+                                        <li class="nav-item m-1 ms-2 tech">
+                                            <a class="nav-link  rounded" id="student-register" data-bs-toggle="pill" href="#registers" role="tab" aria-controls="registers" aria-selected="false" style="width:114px;">
                                                 Registered
                                             </a>
                                         </li>
@@ -638,7 +643,73 @@ tbody, td, tfoot, th, thead, tr {
 
                                             <div class="row">
                                                 <div class="tab-content" id="pills-tabContent">
-                                                    <div class="card border-0 tab-pane fade show active" id="registers" role="tabpanel" aria-labelledby="student-register">
+
+                                                    <div class="card border-0 tab-pane fade show active" id="student_pending" role="tabpanel" aria-labelledby="student-pending">
+                                                        <div class="row align-items-center">
+                                                            <div class="col-md-12">
+                                                                <div class="table-responsive">
+                                                                    <table class="table table-bordered list_table" style="margin: 0px;">
+                                                                        <thead>
+                                                                            <tr>
+                                                                                <th>Sl</th>
+                                                                                <th>Name</th>
+                                                                                <th>Email</th>
+                                                                                {{-- <th>Signed Up</th>
+                                                                                <th class="text-center">Application</th> --}}
+                                                                                <th class="text-center" style="width: 12%;">Action</th>
+                                                                            </tr>
+                                                                        </thead>
+                                                                        <tbody>
+                                                                            @if(count($pending_student_list) > 0)
+                                                                                @foreach($pending_student_list as $key=>$row)
+                                                                                    <tr>
+                                                                                        <td style="font-size: 11px;">{{++$key}}</td>
+                                                                                        <td style="font-size: 11px;">
+                                                                                            <div class="scrolled_content_part">
+                                                                                                <div class="single_ad_pref_item">
+                                                                                                    <div class="left" style="width:50%;">
+                                                                                                        <div class="uni_details" style="display:flex;"> 
+                                                                                                            {{-- @if($row->nationality)
+                                                                                                                <img class="img-responsive listFlag" style="border-radius: 20px; padding: 0px;height: 35px;width: 35px;" src="{{ asset('/assets/img/flags/4x3').'/'.strtolower(cn($row,'country_name.iso_3166_2','')).'.svg' }}" alt="Flag" data-toggle="tooltip" title="" data-placement="top">
+                                                                                                            @endif --}}
+                                                                                                            <div class="inner_right ms-2 mt-1">
+                                                                                                                <strong style="font-size:13px;">{{$row->first_name}} {{$row->last_name }}</strong></br>
+                                                                                                                @if(!empty($row->invitation_date)){{utc_to_ltz($row->invitation_date, 'd M Y g:i A', local_tz($admin))}} @else @endif
+                                                                                                            </div>
+                                                                                                        </div>
+                                                                                                    </div>
+                                                                                                </div>
+                                                                                            </div>
+                                                                                        </td>
+                                                                                        <td style="font-size: 11px;">{{$row->email}}
+                                                                                            <div class="mt-1">
+                                                                                                {{-- @if($row->email_verification ==1)
+                                                                                                    <span class="label_badge_radius" style="background-color: #d8fdd8; color: green;">verified</span>
+                                                                                                @else
+                                                                                                <span class="label_badge_radius" style="background-color: #f9edc7; color: rgb(228, 139, 38);">pending</span>
+                                                                                                @endif --}}
+                                                                                            </div> 
+                                                                                        </td>
+                                                                                       
+                                                                                    </tr>
+                                                                                @endforeach
+                                                                            @else
+                                                                            <tr>
+                                                                                <td colspan="6" class="text-center">
+                                                                                    <span class="text-danger">No data found!</span>
+                                                                                </td>
+                                                                            </tr>
+                                                                            @endif
+                                                                        </tbody>
+                                                                    </table>
+                                                                    <div class="text-center mt-1" id="pagination">
+                                                                        {{-- {{ $register_student_list->appends(request()->all())->links('pagination::bootstrap-4') }} --}}
+                                                                    </div>
+                                                                </div>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                    <div class="card border-0 tab-pane fade show" id="registers" role="tabpanel" aria-labelledby="student-register">
                                                         <div class="row align-items-center">
                                                             <div class="col-md-12">
                                                                 <div class="table-responsive">
@@ -692,7 +763,7 @@ tbody, td, tfoot, th, thead, tr {
                                                                                                 @endif
                                                                                             </div> 
                                                                                         </td>
-                                                                                        <td style="font-size: 11px;">@if(!empty($row->registered_date)){{date('d M Y h:i A', strtotime($row->registered_date))}} @else @endif</td>
+                                                                                        <td style="font-size: 11px;">@if(!empty($row->registered_date)){{utc_to_ltz($row->registered_date, 'd M Y g:i A', local_tz($admin))}} @else @endif</td>
                                                                                         <td style="font-size: 11px; text-align:center;">
                                                                                             @php
                                                                                                $total_draft =\DB::table(
@@ -1005,8 +1076,8 @@ tbody, td, tfoot, th, thead, tr {
                                                                                                 </div>
                                                                                             </div>
                                                                                         </td>
-                                                                                        <td class="text-center" style="font-size: 11px;">@if(!empty($row->invitation_date)) {{ date('d M Y H:i:A', strtotime($row->invitation_date)) }} @else -- @endif</td>
-                                                                                        <td class="text-center" style="font-size: 11px;">@if(!empty($row->registered_date)) {{ date('d M Y H:i:A', strtotime($row->registered_date)) }} @else -- @endif</td>
+                                                                                        <td class="text-center" style="font-size: 11px;">@if(!empty($row->invitation_date)) {{utc_to_ltz($row->invitation_date, 'd M Y g:i A', local_tz($admin))}} @else -- @endif</td>
+                                                                                        <td class="text-center" style="font-size: 11px;">@if(!empty($row->registered_date)) {{utc_to_ltz($row->registered_date, 'd M Y g:i A', local_tz($admin))}} @else -- @endif</td>
                                                                                         <td class="text-center" style="font-size: 11px;">
                                                                                             <span class="invitation hand tooltips" data-id="{{ $row->id }}" data-email="{{$row->email}}" title="Sent Invitation"><i class="fa fa-paper-plane"></i></span>
                                                                                         </td>
@@ -1050,8 +1121,8 @@ tbody, td, tfoot, th, thead, tr {
                                                                                                 <td style="font-size: 11px; width: 30%;">
                                                                                                     {{ $row->email }}
                                                                                                 </td>
-                                                                                                <td style="font-size: 11px;">@if(!empty($row->invitation_date)) {{ date('d M Y H:i:A', strtotime($row->invitation_date)) }} @else -- @endif</td>
-                                                                                                <td style="font-size: 11px;">@if(!empty($row->registered_date)) {{ date('d M Y H:i:A', strtotime($row->registered_date)) }} @else -- @endif</td>
+                                                                                                <td style="font-size: 11px;">@if(!empty($row->invitation_date)) {{utc_to_ltz($row->invitation_date, 'd M Y g:i A', local_tz($admin))}} @else -- @endif</td>
+                                                                                                <td style="font-size: 11px;">@if(!empty($row->registered_date)) {{utc_to_ltz($row->registered_date, 'd M Y g:i A', local_tz($admin))}} @else -- @endif</td>
                                                                                                 {{-- <td class="text-center">
                                                                                                     @php
                                                                                                       $user_invited_count = \DB::table('refer_users')->where('email',$row->email)->count();

+ 1 - 1
resources/views/application.blade.php

@@ -100,7 +100,7 @@
                                     <div class="left" style="width:50%;">
                                         <div class="uni_details" style="display:flex;">
                                             <div class="inner_right ms-5">
-                                                <span style="font-size:12px;">Preferred Start Date : <br><strong style="font-size:13px;">@if(!empty($row->submitted_date)){{ date('M Y', strtotime($row->submitted_date))}} @else {{'N/A'}} @endif</strong></span><br>
+                                                <span style="font-size:12px;">Preferred Start Date : <br><strong style="font-size:13px;">@if(!empty($row->preferred_start_date)){{ date('M Y', strtotime($row->preferred_start_date))}} @else {{'N/A'}} @endif</strong></span><br>
                                             </div>
                                         </div>
                                     </div>

+ 1 - 1
resources/views/email/wishlist_email.blade.php

@@ -95,7 +95,7 @@
                                     <h5>{{ $teacher }}</h5>
                                     <h5>{{ $designation }}</h5>
                                     <h5>{{ $department }}</h5>
-                                    {{-- <h5>{{ $university }}</h5> --}}
+                                    <h5>{{ $university }}</h5>
                                 </div>
                                 <div style="background-color: #eee; border-radius: 0px 0px 5px 5px;">
                                     <p class="mt-5 tmail">This email was sent to {{$receive_email}}</p>

+ 7 - 1
resources/views/teacher/load_application.blade.php

@@ -147,4 +147,10 @@
             </table>
         </div>
     </div><!--end col-->
-@endif
+    @else
+    <div class="col-md-12 bg-white" style="padding:10px;">
+        <div class="alert  mt-1 mb-3" style="border-color: #e9f0f3; font-size: 12px !important; color: #dc3545; border-radius: 30px; padding: 8px 15px; text-align: center;">
+            <span>No data available.</span>
+        </div>
+    </div>
+@endif

+ 5 - 1
sql/update.sql

@@ -235,4 +235,8 @@ ALTER TABLE `users`
 	CHANGE COLUMN `is_work_experience` `is_work_experience` TINYINT(4) NULL DEFAULT '0' COMMENT '1=yes, 2=no' AFTER `apply_status`,
 	CHANGE COLUMN `is_test_score` `is_test_score` TINYINT(4) NULL DEFAULT '0' COMMENT '1=yes, 2=no' AFTER `is_work_experience`,
 	CHANGE COLUMN `is_publication` `is_publication` TINYINT(4) NULL DEFAULT '0' COMMENT '1=yes, 2=no' AFTER `is_test_score`,
-	CHANGE COLUMN `is_education` `is_education` TINYINT(4) NULL DEFAULT '0' COMMENT '1=yes, 2=no' AFTER `is_publication`;
+	CHANGE COLUMN `is_education` `is_education` TINYINT(4) NULL DEFAULT '0' COMMENT '1=yes, 2=no' AFTER `is_publication`;
+
+
+ALTER TABLE `student_proposals`
+	ADD COLUMN `preferred_start_date` DATE NULL DEFAULT NULL AFTER `proposal_id`;