Explorar o código

Merge branch 'master' of https://revinr.site/mostafij-revinr/student-admission

Israat Zarin hai 1 ano
pai
achega
ab495b103f

+ 46 - 39
app/Helpers/functions.php

@@ -7,15 +7,15 @@ function dDate($date=NULL, $format='d M Y', $default='N/A'){
 	if(empty($date)) return $default;
 	return date($format, strtotime($date));
 
-} 
- 
+}
+
 
 function cn($object, $string, $if_false="N/A"){
 
     $properties=explode('.', $string);
 
     foreach($properties as $property){
-        
+
         if(empty($object->$property)) return $if_false;
         else{
             $object=$object->$property;
@@ -27,12 +27,12 @@ function cn($object, $string, $if_false="N/A"){
     return $object;
 
 }
- 
+
 function no_img($url='assets/img/placeholder.png'){
 	return asset($url);
 }
 
- 
+
 function model($name){
 
 	return "\\App\\Models\\{$name}";
@@ -45,14 +45,14 @@ function default_avatar($path="assets/img/avatar-2-64.png"){
 
 }
 
- 
+
 
 function nf($value, $decimal=2){
     if(empty($value)) $value=0.00;
     return number_format($value, $decimal);
 }
 
- 
+
 function die_log($value){
 	die(\Log::info($value));
 }
@@ -60,16 +60,16 @@ function die_log($value){
 function fDate($date, $format='d-m-Y'){
 	if(empty($date)) return '';
 	return \Carbon\Carbon::parse($date)->format($format);
-} 
- 
+}
+
 // function auth_user(){
 // 	return \Auth::user();
-// } 
+// }
 
 function auth_user($guard='teacher'){
 	return \Auth::guard($guard)->user();
 }
-  
+
 
 if(!function_exists('teacherRefNoGenerate')){
 
@@ -79,12 +79,12 @@ if(!function_exists('teacherRefNoGenerate')){
 	    do{
 	    	++$currentId;
 	    	$currentIdExist =\DB::table('users')->where('user_type',2)->where('id',$currentId)->exists();
-	    }while($currentIdExist); 
-	     
+	    }while($currentIdExist);
+
 	    return date('y').intval(date('m')).str_pad($currentId, 3, "0", STR_PAD_LEFT).'R';
 	}
 
-}  
+}
 
 
 if(!function_exists('studentRefNoGenerate')){
@@ -95,12 +95,12 @@ if(!function_exists('studentRefNoGenerate')){
 	    do{
 	    	++$currentId;
 	    	$currentIdExist =\DB::table('student_proposals')->where('id',$currentId)->exists();
-	    }while($currentIdExist); 
-	     
+	    }while($currentIdExist);
+
 	    return date('y').intval(date('m')).str_pad($currentId, 2, "0", STR_PAD_LEFT);
 	}
 
-}  
+}
 
 if(!function_exists('proposalRefNoGenerate')){
 
@@ -110,24 +110,24 @@ if(!function_exists('proposalRefNoGenerate')){
 	    do{
 	    	++$currentId;
 	    	$currentIdExist =\DB::table('proposal')->where('id',$currentId)->exists();
-	    }while($currentIdExist); 
-	     
+	    }while($currentIdExist);
+
 	    return str_pad($currentId, 3, "10", STR_PAD_LEFT);
 	}
 
-} 
- 
- 
- 
+}
+
+
+
 if(!function_exists('name_initials')){
-	function name_initials($firstName,$lastName){ 
-		return strtoupper(mb_substr($firstName, 0, 1) . mb_substr($lastName, 0, 1)); 
+	function name_initials($firstName,$lastName){
+		return strtoupper(mb_substr($firstName, 0, 1) . mb_substr($lastName, 0, 1));
 	}
-} 
+}
 
 
 if(!function_exists('student_proposal')){
-	function student_proposal($std_id,$pro_id){ 
+	function student_proposal($std_id,$pro_id){
 
 		$apply_checked = \App\StudentProposal::where('student_id',$std_id)->where('proposal_id',$pro_id)->exists();
 
@@ -136,12 +136,12 @@ if(!function_exists('student_proposal')){
 		}
 
 		return TRUE;
-		 
+
 	}
-} 
+}
 
 if(!function_exists('profile_permission')){
-	function profile_permission($std_id){ 
+	function profile_permission($std_id){
 
 		$apply_checked = \App\StudentProposal::where('student_id',$std_id)->exists();
 
@@ -150,9 +150,9 @@ if(!function_exists('profile_permission')){
 		}
 
 		return TRUE;
-		 
+
 	}
-} 
+}
 
 
 function local_tz(\App\User $user=NULL, $default='UTC'){
@@ -182,7 +182,7 @@ function lt_to_utc($time_str, $tz='Asia/Dhaka'){
     return \Carbon\Carbon::parse(
         $time_str, $tz
     )->setTimezone('UTC');
-    
+
 }
 
 
@@ -196,15 +196,15 @@ if(!function_exists('age_calculator')){
 if(!function_exists('work_experience')){
 	function work_experience($start_date =NULL,$end_date =NULL){
 		$start_date = new DateTime($start_date);
-		$end_date = new DateTime($end_date); 
-		$interval = $start_date->diff($end_date); 
-		return $interval->format('%y years'); 
+		$end_date = new DateTime($end_date);
+		$interval = $start_date->diff($end_date);
+		return $interval->format('%y years');
 	}
 }
 
 if(!function_exists('diff_in_days')){
 
-	function diff_in_days($sd, $ed){ 
+	function diff_in_days($sd, $ed){
 		$c=new \Carbon\Carbon;
 
 		if(is_string($sd)) $sd=$c->parse($sd);
@@ -217,5 +217,12 @@ if(!function_exists('diff_in_days')){
 
 }
 
- 
- 
+if(!function_exists('res_msg')){
+
+	function res_msg(String $msg, Int $code=200, Array $data=NULL){
+
+		return response(['msg'=>$msg, 'data'=>$data], $code);
+	}
+}
+
+

+ 27 - 15
app/Http/Controllers/Admin/SubContentController.php

@@ -10,47 +10,48 @@ use App\Models\MarketCountry;
 use App\Models\Department;
 use App\Models\ResearchInterest;
 use App\StudentProposal;
+use App\User;
 use Auth;
 
 class SubContentController extends Controller
 {
     public function get(Request $req, $name){
 
-		
+
 		$carbon=new \Carbon\Carbon;
 
-		$data=[ 
+		$data=[
 			'carbon'=>$carbon,
 			'name'=>$name
 		];
 
 		if($name=="load_market_countries"){
 			$user=Auth::guard('admin')->user();
-			$data['market_countries'] = MarketCountry::where( 
+			$data['market_countries'] = MarketCountry::where(
                 'status', 1
             )->select(
                 'market_countries.*', \DB::raw('(SELECT name FROM countries WHERE market_countries.country_id = countries.id ) as sort')
             )->orderBy('sort')->get();
-			
-		}elseif($name=='country_wise_university'){ 
+
+		}elseif($name=='country_wise_university'){
 			$user=Auth::guard('admin')->user();
-			$data['universities'] =University::orderBy('name','ASC')->get(); 
-		 
+			$data['universities'] =University::orderBy('name','ASC')->get();
+
 		}elseif($name=="load_profile_info"){
 			$tuser=Auth::guard('teacher')->user();
 			$data['tuser'] =$tuser;
-			$data['students'] = StudentProposal::where('teacher_id',$tuser->id)->get(); 
-			
+			$data['students'] = StudentProposal::where('teacher_id',$tuser->id)->get();
+
 		}elseif($name=="load_department"){
 			$data['departments'] =Department::where('status',1)->orderBy('name','ASC')->get();
-		 
+
 		}elseif($name=="load_research_interest"){
 			$tuser=Auth::guard('teacher')->user();
 			$data['resarch'] =ResearchInterest::where('teacher_id',$tuser->id)->orderBy('id','DESC')->get();
-		}elseif($name=="edit_university_load"){ 
+		}elseif($name=="edit_university_load"){
 			$user=Auth::guard('admin')->user();
-			$data['edit_data'] =University::find($req->edit_id); 
-			$data['market_countries'] = MarketCountry::where( 
+			$data['edit_data'] =University::find($req->edit_id);
+			$data['market_countries'] = MarketCountry::where(
                 'status', 1
             )->select(
                 'market_countries.*', \DB::raw('(SELECT name FROM countries WHERE market_countries.country_id = countries.id ) as sort')
@@ -58,8 +59,19 @@ class SubContentController extends Controller
 
 		}elseif($name=="edit_department_form"){
 			$data['edit_dept'] =Department::find($req->dep_id);
-		}else $name='default';  
-		//$data['page_sl']=new PageSL($data['chapter_details']); 
+
+		}elseif($name=="load_ref_no_available_info"){
+
+            if($req->teacher_ref_no){
+                $data['teacher'] =User::where(
+                    'ref_no',$req->teacher_ref_no
+                )->where(
+                    'is_available',1
+                )->first();
+            }
+
+        }else $name='default';
+		//$data['page_sl']=new PageSL($data['chapter_details']);
 		return view("admin.sub_contents.{$name}", $data);
 
 	}

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

@@ -20,9 +20,13 @@ class AjaxController extends Controller
 {
     public function get($name, Request $req)
 	{
-		if ($name == 'test') {
+		if($name=='available_ref_no_search') {
 
-		}
+		}elseif(empty($name)){
+            return response([
+            'msg'=>'Invalid request please insert correct value!.'
+            ], 403);
+        }
 	}
 
 	public function post($name, Request $req)
@@ -354,6 +358,20 @@ class AjaxController extends Controller
             return response([
                 'msg'=>'Updated successfully.'
             ]);
+        }elseif($name=="teacher_is_available"){
+            $user =Auth::guard('teacher')->user();
+
+            $data =User::find($user->id);
+            if($req->checked =="false"){
+                $data->is_available =1;
+            }else{
+                $data->is_available =0;
+            }
+
+            $data->update();
+            return response(
+                ['msg'=>"Updated Successfully."]
+            );
         }
 	}
 }

+ 2 - 2
app/Http/Controllers/ModalController.php

@@ -149,9 +149,9 @@ class ModalController extends Controller{
                 $user_mail = $refer->email;
                 $from = 'test@mail.com';
 
-                Mail::send('email.refer_email',$data, function ($message) use ($user_mail,$from) {
+                Mail::send('email.wishlist_email',$data, function ($message) use ($user_mail,$from) {
                     $message->from($from);
-                    $message->to($user_mail)->subject('New Email Send to you');
+                    $message->to($user_mail)->subject('Wishlist Email Send to you');
                 });
             }
 

+ 10 - 6
app/Http/Controllers/StudentHomeController.php

@@ -37,15 +37,15 @@ class StudentHomeController extends Controller
    }
 
    public function profile()
-    { 
+    {
         $user = Auth::user();
         $institution= Institution::where('student_id',Auth::user()->id)->get();
-        $work_experience= Workexperience::where('student_id',Auth::user()->id)->get(); 
-        $score= Score::where('student_id',$user->id)->get(); 
+        $work_experience= Workexperience::where('student_id',Auth::user()->id)->get();
+        $score= Score::where('student_id',$user->id)->get();
         $proposal= Proposal::where('student_id',$user->id)->orderBy('id','DESC')->get();
         $user_info= User::find($user->id);
         $academic_level= AcademicLevel::all();
-        $proposal_files= StudentProposalUpload::where('student_id',$user->id)->get(); 
+        $proposal_files= StudentProposalUpload::where('student_id',$user->id)->get();
         $departments = Department::where('status',1)->orderBy('name','ASC')->get();
         return view('profile',compact('institution','academic_level','work_experience','score','user_info','proposal','proposal_files','departments'));
     }
@@ -254,9 +254,13 @@ class StudentHomeController extends Controller
 
 
      public function ref_search(Request $req){
-         $data['teacher'] =[];
+         $data['teacher'] ="";
          if($req->teacher_ref_no){
-            $data['teacher'] =User::where('ref_no',$req->teacher_ref_no)->get();
+            $data['teacher'] =User::where(
+                'ref_no',$req->teacher_ref_no
+            )->where(
+                'is_available',1
+            )->first();
          }
 
         return view('ref_search_load',$data);

+ 40 - 0
resources/views/admin/sub_contents/load_ref_no_available_info.blade.php

@@ -0,0 +1,40 @@
+@extends('admin.sub_contents.base')
+@section('main')
+@if($teacher)
+<div class="alert mt-3 mb-3" style="border: 2px solid #e9f0f3 !important; width: 100%; display: -webkit-inline-box;  font-size: 12px !important; font-weight:bold !important; color: black; border-radius: 6px;">
+    <div class="col-md-12">
+        <div class="row">
+            <div class="col-md-10">
+                <span style="margin: 0px;">{{$teacher->first_name}} {{$teacher->last_name}}</span></br>
+                <span class="text-muted" style="font-weight: 500;">{{$teacher->designation}}</span></br>
+                @if(isset($teacher->department_name))
+                    <span class="text-muted" style="font-weight: 500;">{{cn($teacher,'department_name.name','')}}</span>
+                @else
+                    <span class="text-muted" style="font-weight: 500;">{{$teacher->others_department}}</span>
+                @endif
+
+                <span>.</span>
+                <span class="text-muted" style="font-weight: 500;">{{$teacher->university_name}}</span>
+            </div>
+
+            <div class="col-md-2 mt-3">
+                <span class="btn btn3 open_modal_page" data-url="{{route('modal-get',['name'=>'apply_student_proposal','id'=>$teacher->id])}}"  data-title="Submit your Proposal" style="margin-left: 1.1rem;">Apply</span>
+            </div>
+        </div>
+    </div>
+</div>
+@else
+<div class="alert mt-3 mb-3" style="border: 2px solid #e9f0f3 !important; width: 100%; display: -webkit-inline-box;  font-size: 12px !important; font-weight:bold !important; color: black; border-radius: 6px;">
+    <div class="col-md-12">
+        <div class="row">
+            <div class="col-md-12 text-center">
+                <i class="fa fa-exclamation-triangle" style="color: #fdad2a !important; border-color: #fdad2a;
+                "></i><span class="text-danger">This reference number is not valid or available!. Please try another reference no.</span>
+            </div>
+        </div>
+    </div>
+</div>
+
+@endif
+
+@endsection

+ 2 - 5
resources/views/email/refer_email.blade.php

@@ -81,15 +81,12 @@
                             <div class="card rounded border-0 shadow p-5" style="background-color:white;">
                                 <h3 style="text-align: center; font-family:Ubuntu !important; color: #3c4858 !important; font-size: 30px !important;">Research Admission</h3>
                                 <p class="mt-5">Dear {{$name}},</p>
-                                @php
-                                    $hashids = new \Hashids\Hashids('student_signup', 25);
-                                @endphp
                                 <p class="mt-3">I have found the Research Admission Platform incredibly helpful in my own search for a research supervisor. The platform is a free and easy-to-use tool that can help you connect with potential supervisors.</p>
                                 <p class="mt-2"> It allows you to submit your research proposal to multiple supervisors with just a few clicks. You can then track the real-time status of your application and receive a decision quickly. I found this feature particularly useful, as it allowed me to keep track of the progress of my applications without having to constantly follow up with supervisors.</p>
                                 <p class="mt-2"> I think you would find it to be a valuable resource in your own search for a research supervisor. It's free to use and can save you a lot of time and effort in finding the right match for your research interests. If you have any questions about the platform or would like some help getting started, please don't hesitate to reach out to me.</p>
-                                <a href="{{ url('std/'.$hashids->encode($teacher_id)) }}">click here</a>
+
                                 <p class="mt-2" style="margin: 0px;">Best regards,</p>
-                                <h4>{{$applicant_name}} {{ $teacher_id }}</h4>
+                                <h4>{{$applicant_name}}</h4>
                                     <div style="border-top: 1px solid #eee;">
                                     <p class="mt-3 tmail" style="font-style: italic;">This email was sent to example@gmail.com</p>
                                 </div>

+ 119 - 0
resources/views/email/wishlist_email.blade.php

@@ -0,0 +1,119 @@
+<!DOCTYPE html>
+    <html lang="en">
+        <head>
+            <meta charset="utf-8" />
+            <title>Research Admission</title>
+            <meta name="viewport" content="width=device-width, initial-scale=1.0">
+            <meta name="description" content="Information & Guidance on the PhD Process, Connect with Supervisor and Many" />
+            <meta name="keywords" content="" />
+
+            <!-- facebook tags -->
+            <meta property="og:url" content="http://www.facebook.com/researchadmission"/>
+            <meta property="og:type" content="website"/>
+            <meta property="og:title" content="Research Admission"/>
+            <meta property="og:description" content="Information & Guidance on the PhD Process, Connect with Supervisor and Many"/>
+            <!-- Linkedin tags -->
+            <meta property="og:url" content="https://www.linkedin.com/company/researchadmission"/>
+            <meta property="og:type" content="website"/>
+            <meta property="og:title" content="Research Admission"/>
+            <meta property="og:description" content="Information & Guidance on the PhD Process, Connect with Supervisor and Many"/>
+
+            <!-- favicon -->
+            <link rel="shortcut icon" href="{{asset('web/images/logo.png') }}">
+            <!-- Bootstrap -->
+            <link href="{{ asset('web/css/bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
+            <!-- tobii css -->
+            <link href="{{asset('web/css/tobii.min.css')}}" rel="stylesheet" type="text/css" />
+            <!-- Icons -->
+            <link href="{{asset('web/css/materialdesignicons.min.css')}}" rel="stylesheet" type="text/css" />
+            <link rel="stylesheet" type="text/css" href="{{ asset('web/stylesheets/font-awesome.min.css') }}" />
+            <link rel="stylesheet" href="https://unicons.iconscout.com/release/v3.0.6/css/line.css">
+            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
+
+            <!-- Slider -->
+            <link rel="stylesheet" href="{{asset('web/css/tiny-slider.css')}}"/>
+            <!-- Main Css -->
+            <link href="{{asset('web/css/style.css')}}" rel="stylesheet" type="text/css" id="theme-opt" />
+            <link href="{{asset('web/css/colors/default.css')}}" rel="stylesheet" id="color-opt">
+            <link rel="preconnect" href="https://fonts.googleapis.com">
+            <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+            <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap" rel="stylesheet">
+
+            <link rel="preconnect" href="https://fonts.googleapis.com">
+            <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+            <link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@700&display=swap" rel="stylesheet">
+            <link rel="preconnect" href="https://fonts.googleapis.com">
+            <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+            <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@200;300&display=swap" rel="stylesheet">
+            <link rel="preconnect" href="https://fonts.googleapis.com">
+            <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+            <link href="https://fonts.googleapis.com/css2?family=Montserrat+Alternates&display=swap" rel="stylesheet">
+            <link rel="stylesheet" href="{{ asset('css/pnotify/pnotify.min.css') }}">
+            <link href="{{ asset('css/noty/lib/noty.css') }}" rel="stylesheet" type="text/css">
+       </head>
+       <style>
+
+            body {
+                font-family: 'Oswald', sans-serif;
+                font-family: 'Quicksand', sans-serif;
+            }
+            h1, h2, h3, h4, h6 {
+                font-family:Ubuntu !important;
+            }
+            h5{
+                font-family: 'Montserrat Alternates', sans-serif !important;
+            }
+            .bg-half-170 {
+            padding:0px;
+            }
+            .tmail{
+                color: #a7a7a7;
+                text-align: center;
+                margin: 0px;
+            }
+       </style>
+        <section>
+            <div class="container mt-5 mb-5">
+                <div class="col-md-12">
+                    <div class="row">
+                        <div class="col-md-1"></div>
+                        <div class="col-md-9">
+                            <div class="card rounded border-0 shadow p-5" style="background-color:white;">
+                                <h3 style="text-align: center; font-family:Ubuntu !important; color: #3c4858 !important; font-size: 30px !important;">Research Admission</h3>
+                                <p class="mt-5">Dear {{$name}},</p>
+                                @php
+                                    $hashids = new \Hashids\Hashids('student_signup', 25);
+                                @endphp
+                                <p class="mt-3">I have found the Research Admission Platform incredibly helpful in my own search for a research supervisor. The platform is a free and easy-to-use tool that can help you connect with potential supervisors.</p>
+                                <p class="mt-2"> It allows you to submit your research proposal to multiple supervisors with just a few clicks. You can then track the real-time status of your application and receive a decision quickly. I found this feature particularly useful, as it allowed me to keep track of the progress of my applications without having to constantly follow up with supervisors.</p>
+                                <p class="mt-2"> I think you would find it to be a valuable resource in your own search for a research supervisor. It's free to use and can save you a lot of time and effort in finding the right match for your research interests. If you have any questions about the platform or would like some help getting started, please don't hesitate to reach out to me.</p>
+                                <a href="{{ url('std/'.$hashids->encode($teacher_id)) }}">click here</a>
+                                <p class="mt-2" style="margin: 0px;">Best regards,</p>
+                                <h4>{{$applicant_name}} {{ $teacher_id }}</h4>
+                                    <div style="border-top: 1px solid #eee;">
+                                    <p class="mt-3 tmail" style="font-style: italic;">This email was sent to example@gmail.com</p>
+                                </div>
+                                <p class="mt-3 tmail" style="font-size: 12px;">Copyright © {{date('Y')}} Research Admission</p>
+                            </div>
+                        </div>
+                    </div><!--end row-->
+                </div>
+            </div> <!--end container-->
+        </section><!--end section-->
+        <!-- Hero End -->
+
+        <!-- javascript -->
+        <script src="{{asset('web/js/bootstrap.bundle.min.js')}}"></script>
+        <!-- tobii js -->
+        <script src="{{asset('web/js/tobii.min.js')}}"></script>
+        <!-- SLIDER -->
+        <script src="{{asset('web/js/tiny-slider.js')}}"></script>
+        <!-- Icons -->
+        <script src="{{asset('web/js/feather.min.js')}}"></script>
+        <!-- Main Js -->
+        <script src="{{asset('web/js/plugins.init.js')}}"></script>
+        <script src="{{asset('web/js/app.js')}}"></script>
+        <script src="{{ asset('css/pnotify/pnotify.js') }}"></script>
+        <script src="{{ asset('css/noty/lib/noty.min.js') }}"></script>
+        </body>
+  </html>

+ 115 - 64
resources/views/home.blade.php

@@ -1,5 +1,5 @@
 @extends('web.layouts.master')
-@section('content') 
+@section('content')
         <section class="bg-half-170 d-table w-100" style="background-color: #efefef; height: 100vh;">
             <div class="container mt-5 pt-4" style="padding: 10px 20px 0px 20px;">
                 <div class="col-md-12">
@@ -7,11 +7,11 @@
                         <div class="col-md-12">
                             <div class="container">
                                 <div class="row mt-2">
-                                    <h6 style="font-weight:bold !important;">There are two methods for submitting your proposal :</h6>                            
-                                    <p style="font-size: 13px;"><strong>Method 1:</strong> Contact your supervisor and request their Account Reference Number (ARN). With this number, you can search for the supervisor's account and submit your proposal.</p>                            
-                                    <p style="font-size: 13px;"><strong>Method 2:</strong> Request your supervisor to invite you through Q apply. Once you receive the email invitation, click on the link provided in the email. This will automatically link your application with the supervisor's account, and you only need to click the Submit button</p>                            
+                                    <h6 style="font-weight:bold !important;">There are two methods for submitting your proposal :</h6>
+                                    <p style="font-size: 13px;"><strong>Method 1:</strong> Contact your supervisor and request their Account Reference Number (ARN). With this number, you can search for the supervisor's account and submit your proposal.</p>
+                                    <p style="font-size: 13px;"><strong>Method 2:</strong> Request your supervisor to invite you through Q apply. Once you receive the email invitation, click on the link provided in the email. This will automatically link your application with the supervisor's account, and you only need to click the Submit button</p>
                                 </div>
-                            </div>                                                           
+                            </div>
                         </div>
                     </div>
                     <div class="row">
@@ -20,11 +20,11 @@
                                 <div class="col-md-12">
                                     <div class="container-fluid" style="padding:0px !important;">
                                         <div class="row">
-                                            <h6 style="font-weight:bold !important; margin: 0px; color: #141639c4;">Submit your proposals with ease</h6>   
-                                            <p style="font-size: 13px; color: #141639c4;">Simplify the process and contact with potential supervisors effortlessly!</p>                            
-                                            <p class="mt-1" style="font-size: 13px; color: #141639c4;">Please input the Supervisor's Account Reference Number (ARN) in the search bar below. After verifying that the Supervisor Name, Department and University Name are accurate, click on the <strong>"Apply"</strong> button to complete your submission.</p>                            
+                                            <h6 style="font-weight:bold !important; margin: 0px; color: #141639c4;">Submit your proposals with ease</h6>
+                                            <p style="font-size: 13px; color: #141639c4;">Simplify the process and contact with potential supervisors effortlessly!</p>
+                                            <p class="mt-1" style="font-size: 13px; color: #141639c4;">Please input the Supervisor's Account Reference Number (ARN) in the search bar below. After verifying that the Supervisor Name, Department and University Name are accurate, click on the <strong>"Apply"</strong> button to complete your submission.</p>
                                         </div>
-                                    </div>                                                           
+                                    </div>
                                 </div>
                                 <div class="col-md-12">
                                     <div class="row" style="display:flex;">
@@ -34,10 +34,10 @@
                                                 <span class="search_button hand search-btn" style="margin-left: -8.8rem; "><span style="display:block; margin-left:11px; margin-top:4px; cursor: pointer;">Search</span></span>
                                                 <a href="{{url()->current()}}" class="ref_button hand search-btn ms-2" style="width: 5%; background-color: #ffbd59 !important; border: 2px solid #ffbd59;"><span style="display:block; margin-left:9px; margin-top:4px; cursor: pointer;"><i class="fa fa-refresh" style="color:#ffff !important;"></i></span></a>
                                                 <!-- <button class="btn btncl"></button>  -->
-                                            </div> 
-                                            <div id="load_data"></div> 
-                                        </div> 
-                                    </div>  
+                                            </div>
+                                            <div id="load_data"></div>
+                                        </div>
+                                    </div>
                                 </div>
                             </div>
                         </div><!--end col-->
@@ -48,8 +48,8 @@
                                         <div class="container-fluid" style="padding:0px !important;">
                                             <div class="row">
                                                 <p class="mb-1" style="font-size:14px; font-weight:bold !important; color: #141639c4;">Refer a Friend</p>
-                                                <p  style="font-size: 13px;">Earn points by referring your friends or colleagues to register and submit their first application. Once they submit their application, you will receive the points.</p>                            
-                                                    <div class="col-md-12">  
+                                                <p  style="font-size: 13px;">Earn points by referring your friends or colleagues to register and submit their first application. Once they submit their application, you will receive the points.</p>
+                                                    <div class="col-md-12">
                                                         <div class="row">
                                                             <div class="col-md-12">
                                                                 <div class="mb-3">
@@ -58,7 +58,7 @@
                                                                         <input type="text" class="form-control" id="ref_name" placeholder="Full Name" name="name" required="">
                                                                     </div>
                                                                 </div>
-                                                            </div>    
+                                                            </div>
                                                             <div class="col-lg-12" style="margin-top:-18px;">
                                                                 <div class="mb-3">
                                                                     <label class="form-label"></label>
@@ -78,10 +78,10 @@
                                                         </div>
                                                 </div>
                                             </div>
-                                        </div>                                                           
+                                        </div>
                                     </div>
                                 </div>
-                            </div>    
+                            </div>
                         </div>
                     </div><!--end row-->
                     @if(count($student_proposal) > 0 )
@@ -90,8 +90,8 @@
                             <div class="container">
                                 <div class="row mt-2">
                                     <div class="col-md-12">
-                                            <h6 style="font-weight:bold !important; color: #141639c4;">Application you have submitted that are currently awaiting decisions</h6>                            
-                                        <div class="table-responsive"> 
+                                            <h6 style="font-weight:bold !important; color: #141639c4;">Application you have submitted that are currently awaiting decisions</h6>
+                                        <div class="table-responsive">
                                             <table class="table table-bordered list_table">
                                                 <thead>
                                                     <tr>
@@ -107,11 +107,11 @@
                                                 </thead>
                                                 <tbody>
                                                     @foreach($student_proposal as $key=>$row)
-                                                    <tr> 
+                                                    <tr>
                                                         <td style="font-size: 11px;">{{++$key}}</td>
                                                         <td style="font-size: 11px;">{{$row->student_apply_ref}}</td>
                                                         <td style="font-size: 11px;"><strong>{{ cn($row,'teacher_details.first_name','')}} {{ cn($row,'teacher_details.last_name','')}}</strong><br>
-                                                        <span>{{cn($row,'teacher_details.designation','')}}</span></td> 
+                                                        <span>{{cn($row,'teacher_details.designation','')}}</span></td>
                                                         <td style="font-size: 11px;">{{cn($row,'teacher_details.university_name','')}}</br>
                                                         <span>
                                                             @if(isset($row->teacher_details->department_name))
@@ -119,29 +119,29 @@
                                                             @else
                                                             <span style="font-size: 11px; color: #868e96;">{{cn($row,'teacher_details.others_department','')}}</span>
                                                             @endif
-                                                            
-                                                        </span></td> 
+
+                                                        </span></td>
                                                         <td style="font-size: 11px; text-align:center;">
                                                             @php
                                                                $proposal =\DB::table('proposal')->where('id',$row->proposal_id)->where('student_id',$row->student_id)->first();
                                                             @endphp
-                                                            @if($proposal) 
+                                                            @if($proposal)
                                                             <strong>{{ $proposal->proposal_ref}}</strong>
                                                             @endif
                                                         </td>
-                                                        <td style="font-size: 11px; text-align:center;">{{date('d M Y', strtotime($row->created_at))}}</td> 
+                                                        <td style="font-size: 11px; text-align:center;">{{date('d M Y', strtotime($row->created_at))}}</td>
                                                         <td style="text-align:center; font-size: 11px;"><span class="label_badge_radius" style="background-color: #d8fdd8; color: green;">Applied</span></td>
                                                         <td style="text-align:center; font-size: 11px;">
-                                                           <span class="open_modal_page hand" data-toogle="tooltips" title="View" data-title="Apply Reference - {{$row->student_apply_ref}} " data-url="{{route('modal-get',['name'=>'view_apply_proposal','id'=>$row->id])}}"><i class="fa fa-eye"></i></span> 
+                                                           <span class="open_modal_page hand" data-toogle="tooltips" title="View" data-title="Apply Reference - {{$row->student_apply_ref}} " data-url="{{route('modal-get',['name'=>'view_apply_proposal','id'=>$row->id])}}"><i class="fa fa-eye"></i></span>
                                                         </td>
                                                     </tr>
                                                     @endforeach
                                                 </tbody>
-                                            </table> 
-                                        </div>                                    
+                                            </table>
+                                        </div>
                                     </div>
                                 </div>
-                            </div>                                                           
+                            </div>
                         </div>
                     </div>
                     @endif
@@ -155,7 +155,49 @@
 @push('js')
 
 <script>
-    function pop_up_msg(msg='No message specified', type='success', callback=null){ 
+    function fetch_sub_content(selector, url, args=null){
+
+        var config={
+        spinner: true
+        }
+
+        if(typeof args=='object'){
+        config=Object.assign(config, args);
+        }
+
+        if(config.spinner){
+
+        $(selector).waitMe({
+            effect: 'facebook',
+            text: 'Please! Wait ...'
+        });
+
+        }
+
+        $(selector).load(url, null, function(){
+        $(selector).waitMe('hide');
+        if(typeof args=='function') args();
+        });
+
+        }
+
+        function wait_me(selector, config=null){
+
+        if(config){
+
+            selector.waitMe(config);
+
+        }else{
+
+            selector.waitMe({
+                effect: 'facebook',
+                //color: '#000',
+                text: 'Please! Wait ...'
+            });
+        }
+    }
+
+    function pop_up_msg(msg='No message specified', type='success', callback=null){
         new Noty({
         theme:'sunset',
         text: msg,
@@ -164,7 +206,7 @@
         callbacks:{
             afterClose: callback
         }
-        }).show(); 
+        }).show();
     }
 
     function err_msg(err){
@@ -181,56 +223,65 @@
 
     $(function(){
         $('.search_button').on('click', function(){
-            get_data();
-        });
-
-        function get_data(){
-            var base = '{{url('/')}}';  
-            var teacher_ref_no = $('#teacher_ref_no').val();  
+           // get_data();
+            var teacher_ref_no = $('#teacher_ref_no').val();
             if(teacher_ref_no){
-                $.ajax({
-                    method: 'GET', 
-                    url: base+'/home/search', 
-                    data: {'teacher_ref_no' : teacher_ref_no}, 
-                    success: function(response){ // What to do if we succeed
-                        //console.log(response); 
-                        $('#load_data').html(response);
-                    },
-                    error: function(jqXHR, textStatus, errorThrown) { // What to do if we fail
-                        console.log(JSON.stringify(jqXHR));
-                        console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
-                    }
-                });
+                fetch_sub_content(
+                    '#load_data',
+                    "{!! route('sub-content', ['name'=>'load_ref_no_available_info']) !!}" +"?teacher_ref_no=" +teacher_ref_no
+                );
             }else{
-                pop_up_error_msg('Please type a Teacher Reference No.');
+                pop_up_error_msg('Please type a vaild Reference No.');
             }
-          
-        }
-        
+        });
+
+        // function get_data(){
+        //     var base = '{{url('/')}}';
+        //     var teacher_ref_no = $('#teacher_ref_no').val();
+        //     if(teacher_ref_no){
+        //         $.ajax({
+        //             method: 'GET',
+        //             url: base+'/home/search',
+        //             data: {'teacher_ref_no' : teacher_ref_no},
+        //             success: function(response){ // What to do if we succeed
+        //                 //console.log(response);
+        //                 $('#load_data').html(response);
+        //             },
+        //             error: function(jqXHR, textStatus, errorThrown) { // What to do if we fail
+        //                 console.log(JSON.stringify(jqXHR));
+        //                 console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
+        //             }
+        //         });
+        //     }else{
+        //         pop_up_error_msg('Please type a Teacher Reference No.');
+        //     }
+
+        // }
+
+
+        $('.refer_btn').on('click', function(){
 
-        $('.refer_btn').on('click', function(){ 
-                  
                 var name =$('#ref_name').val();
                 var email =$('#ref_email').val();
 
                 var form_data={
-                    _token: "{{ csrf_token() }}", 
+                    _token: "{{ csrf_token() }}",
                     name: name,
-                    email: email, 
+                    email: email,
                 }
 
-                $.post("{{ route('ajax-post', ['name'=>'add_refer_user']) }}", form_data, function(res){ 
-                    pop_up_msg(res.msg); 
+                $.post("{{ route('ajax-post', ['name'=>'add_refer_user']) }}", form_data, function(res){
+                    pop_up_msg(res.msg);
 
                 }).fail(function(err){
 
                     pop_up_msg(err_msg(err), 'error');
 
-                }); 
+                });
             });
-        
+
     });
 </script>
 
 
-@endpush
+@endpush

+ 16 - 17
resources/views/ref_search_load.blade.php

@@ -1,35 +1,34 @@
-@if(count($teacher) >0)
-@foreach($teacher as $row)
+@if($teacher)
+
 <div class="alert mt-3 mb-3" style="border: 2px solid #e9f0f3 !important; width: 100%; display: -webkit-inline-box;  font-size: 12px !important; font-weight:bold !important; color: black; border-radius: 6px;">
     <div class="col-md-12">
         <div class="row">
             <div class="col-md-10">
-                <span style="margin: 0px;">{{$row->first_name}} {{$row->last_name}}</span></br>
-                <span class="text-muted" style="font-weight: 500;">{{$row->designation}}</span></br>
-                @if(isset($row->department_name))
-                    <span class="text-muted" style="font-weight: 500;">{{cn($row,'department_name.name','')}}</span>
+                <span style="margin: 0px;">{{$teacher->first_name}} {{$teacher->last_name}}</span></br>
+                <span class="text-muted" style="font-weight: 500;">{{$teacher->designation}}</span></br>
+                @if(isset($teacher->department_name))
+                    <span class="text-muted" style="font-weight: 500;">{{cn($teacher,'department_name.name','')}}</span>
                 @else
-                    <span class="text-muted" style="font-weight: 500;">{{$row->others_department}}</span>
+                    <span class="text-muted" style="font-weight: 500;">{{$teacher->others_department}}</span>
                 @endif
-                
+
                 <span>.</span>
-                <span class="text-muted" style="font-weight: 500;">{{$row->university_name}}</span>
+                <span class="text-muted" style="font-weight: 500;">{{$teacher->university_name}}</span>
             </div>
 
-            <div class="col-md-2 mt-3"> 
-                <span class="btn btn3 open_modal_page" data-url="{{route('modal-get',['name'=>'apply_student_proposal','id'=>$row->id])}}"  data-title="Submit your Proposal" style="margin-left: 1.1rem;">Apply</span>  
+            <div class="col-md-2 mt-3">
+                <span class="btn btn3 open_modal_page" data-url="{{route('modal-get',['name'=>'apply_student_proposal','id'=>$teacher->id])}}"  data-title="Submit your Proposal" style="margin-left: 1.1rem;">Apply</span>
             </div>
         </div>
     </div>
 </div>
-@endforeach
 @else
 <div class="alert mt-3 mb-3" style="border: 2px solid #e9f0f3 !important; width: 100%; display: -webkit-inline-box;  font-size: 12px !important; font-weight:bold !important; color: black; border-radius: 6px;">
     <div class="col-md-12">
         <div class="row">
             <div class="col-md-12 text-center">
                 <span class="text-danger">No data found!</span>
-            </div> 
+            </div>
         </div>
     </div>
 </div>
@@ -38,7 +37,7 @@
 
 {{-- @include('web.layouts.modal') --}}
 <script>
-    $(function(){ 
+    $(function(){
         // $('.apply_student').on('click', function(e){
         //     e.preventDefault();
         //     var id = $(this).data('id');
@@ -61,13 +60,13 @@
         //         if(isConfirm){
         //             $.post("{{ route('ajax-post', ['name'=>'send_apply_student_teacher_email']) }}", form_data, function(res){
 
-        //             if(res.msg) pop_up_msg(res.msg); 
+        //             if(res.msg) pop_up_msg(res.msg);
 
         //             }).fail(function(err){
 
-        //             }); 
+        //             });
         //         }
         //     });
         // });
     });
-</script>
+</script>

+ 37 - 1
resources/views/teacher_profile.blade.php

@@ -327,7 +327,7 @@ tbody, td, tfoot, th, thead, tr {
                             </div>
                             <div class="col-md-2" style="display: flex; justify-content: end;">
                                 <div class="form-check form-switch mt-3 pt-1" id="">
-                                    <input class="form-check-input" type="checkbox" name="" value="">
+                                    <input class="form-check-input teacher_is_available" type="checkbox" name="is_available" value="" @if(\Auth::guard('teacher')->user()->is_available==0) checked @endif>
                                     <label class="form-check-label" for=""></label>
                                 </div>
                                 <ul class="nav navbar-nav align-items-center ml-auto header_right ps-2">
@@ -1207,6 +1207,42 @@ tbody, td, tfoot, th, thead, tr {
                 });
             });
 
+            $('.teacher_is_available').on('click', function(){
+                var self =$(this);
+                var checked =self.prop("checked");
+
+                var form_data={
+                    _token :"{{csrf_token()}}",
+                    'checked':checked,
+                 }
+
+                swal({
+                    title: "Are you sure you want to change status?",
+                    text: "Please check before submitting!",
+                    type: "warning",
+                    showCancelButton: true,
+                    confirmButtonClass: "btn-danger",
+                    cancelButtonClass: "btn-info",
+                    confirmButtonText: "Yes",
+                    cancelButtonText: "No",
+                    closeOnConfirm: true,
+                    closeOnCancel: true
+                }, function(isConfirm){
+
+                    if(isConfirm){
+                        $.post("{{ route('ajax-post', ['name'=>'teacher_is_available']) }}", form_data, function(res){
+                            pop_up_msg(res.msg);
+                            window.location.reload();
+
+                        }).fail(function(err){
+
+                            pop_up_msg(err_msg(err), 'error');
+
+                        });
+                    }
+                });
+            });
+
 
   });