Md.Mostafijur Rahman 1 рік тому
батько
коміт
af66023e02

+ 54 - 1
app/Http/Controllers/AjaxController.php

@@ -362,7 +362,7 @@ class AjaxController extends Controller
             $user =Auth::guard('teacher')->user();
 
             $data =User::find($user->id);
-            if($req->checked =="false"){
+            if($req->checked =="true"){
                 $data->is_available =1;
             }else{
                 $data->is_available =0;
@@ -409,6 +409,59 @@ class AjaxController extends Controller
             return response(
                 ['msg'=>'Saved successfully.']
             );
+        }elseif($name=="add_wishlist_registration"){
+            $validator=\Validator::make($req->all(), [
+                'first_name'=>'required',
+                'last_name'=>'required',
+                'dob'=>'required',
+                'gender'=>'required',
+                'nationality'=>'required',
+                'email'=>'required|email|max:255|unique:users',
+                'password_confirmation'=>'required',
+                'password'=>[
+                    'required',
+                    'confirmed',
+                    'min:8',
+                ]
+            ]);
+
+            if($validator->fails()){
+                $errors=$validator->errors()->all();
+                return response(['msg'=>$errors[0]], 422);
+            }
+
+            $user_data = User::find($req->id);
+
+            if($user_data){
+
+                $user_exists = ReferUser::where('email',$req->email)->where('signup',1)->exists();
+
+                if($user_exists){
+                    return response(['msg'=>'You are already registered!.Please login.'], 403);
+                }
+
+                $refer_user_exists = ReferUser::where('email',$req->email)->where('signup',0)->first();
+
+                if($refer_user_exists){
+                    $refer_user_exists->signup =1;
+                    $refer_user_exists->update();
+                }
+
+                $user_data->first_name =$req->first_name;
+                $user_data->last_name =$req->last_name;
+                $user_data->first_name =$req->first_name;
+                $user_data->nationality =$req->nationality;
+                $user_data->dob =\Carbon\Carbon::parse($req->dob)->format('Y-m-d');
+                $user_data->gender =$req->gender;
+                $user_data->password =Hash::make($req->password);
+                $user_data->status =1;
+                $user_data->update();
+
+                return response(
+                    ['msg'=>'Saved successfully.']
+                );
+            }
+
         }
 	}
 }

+ 9 - 0
app/Http/Controllers/HomeController.php

@@ -26,4 +26,13 @@ class HomeController extends Controller
         if(empty($hash_teacher_ids[0])) abort(404);
         return view('q_apply_form',compact('hash_teacher_ids','user'));
     }
+
+    public function wishlist_student_register($hash)
+    {
+        $hashids=new \Hashids\Hashids('student_wishlist_signup', 25);
+        $hash_student_ids=$hashids->decode($hash);
+        if(empty($hash_student_ids[0])) abort(404);
+        $user =User::find($hash_student_ids[0]);
+        return view('auth.wishlist_register_form',compact('hash_student_ids','user'));
+    }
 }

+ 8 - 0
app/Http/Controllers/ModalController.php

@@ -134,6 +134,13 @@ class ModalController extends Controller{
                 return response(['msg'=>$errors[0]], 422);
             }
 
+            $user_data =new User;
+            $user_data->first_name =$req->name;
+            $user_data->email =$req->email;
+            $user_data->wishlist_teacher_id =$user->id;
+            $user_data->user_type =1;
+            $user_data->save();
+
             $refer =new ReferUser;
             $refer->name =$req->name;
             $refer->email =$req->email;
@@ -144,6 +151,7 @@ class ModalController extends Controller{
             if($refer->save()){
                 $data['name'] = $refer->name;
                 $data['teacher_id'] = $refer->teacher_id;
+                $data['student_id'] = $user_data->id;
                 $data['std_email'] = $refer->email;
                 $data['applicant_name'] = $user->first_name.' '.$user->last_name;
                 $user_mail = $refer->email;

+ 308 - 0
resources/views/auth/wishlist_register_form.blade.php

@@ -0,0 +1,308 @@
+<!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 href="{{ asset('css/flatpickr/dist/flatpickr.min.css') }}" rel="stylesheet" type="text/css">
+        <link rel="stylesheet" href="{{ asset('css/pnotify/pnotify.min.css') }}">
+        <link href="{{ asset('css/noty/lib/noty.css') }}" rel="stylesheet" type="text/css">
+        <link href="{{ asset('css/noty/lib/themes/sunset.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;
+    }
+    .form-control:focus {
+        box-shadow: 0 0 0 0.25rem rgb(13 110 253 / 25%) !important;
+    }
+    .btn1{
+        background-color: #141639c4 !important;
+        color:white !important;
+        border-radius: 20px;
+        box-shadow:none !important;
+    }
+    .btn1:hover{
+        background: #fff !important;
+        color: #141639c4 !important;
+        border-radius: 20px;
+        border: 1px solid #141639c4;
+    }
+    .tns-nav button {
+        background: #141639c4 !important;
+    }
+    .tns-nav button.tns-nav-active{
+        background-color: #ffff !important;
+    }
+    .bg-left{
+        background-color:#141639c4;
+        border:none;
+        padding:8.37rem;
+    }
+    .head-line{
+        font-size: 39px !important;
+        font-weight: bold;
+        line-height: 1.2;
+        color:#ffff;
+    }
+    .sub-line1{
+        font-size: 18px !important;
+        font-weight: 400;
+        color:#ffff !important;
+    }
+    .sub-line2{
+        font-size: 17px !important;
+        font-weight: bold;
+        font-family: poppins !important;
+        color:#ffff !important;
+    }
+    .bg-white{
+        background-color: #72809f33 !important;
+        height: 160px;
+        border: 1px solid #ffff;
+    }
+    .box-head{
+        font-size:15px !important;
+        color:#ffff;
+    }
+    .box-sub{
+        font-size:14px;
+        color:#ffff;
+    }
+    .d-flex{
+        display: grid !important;
+    }
+    </style>
+    <body>
+        @php
+           $countries=DB::table('countries')->get();
+        @endphp
+        <section class="cover-user">
+            <div class="container-fluid px-0">
+                <div class="row g-0 position-relative">
+                    <div class="col-lg-8 padding-less bg-left">
+                        <div>
+                            <h3 class="ps-4 mt-5 pt-4 head-line">Accelerate your research journey with ease</h3>
+                            <h2 class="ps-4 sub-line1">Connect with supervisor through our streamlined platform featuring real-time updates, a wide network, and effortless user experience.</h2>
+                            <p class="ps-4 mt-5 sub-line1" style="color:white; font-family: poppins !important;">With just a few clicks, you can submit your proposal to multiple supervisors, saving you hours of searching and contacting potential supervisors individually. Our user-friendly interface makes it easy for anyone to navigate and use, regardless of their technical skills. The platform provides real-time updates on the status of your application, so you don't have to constantly follow up with supervisors, giving you more time to focus on your research. </p>
+                            <h2 class="ps-4 mt-5 sub-line1" style="color:white; font-family: poppins !important;">Our wide network of potential supervisors means you have access to a large pool of experts in your field, increasing your chances of finding the right supervisor for your project.</h2>
+
+                        </div>
+                    </div>
+                    <div class="col-lg-4 cover-my-30 ">
+                        <div class="cover-user-img d-flex align-items-center p-5">
+                            <div class="row">
+                                <div class="col-12">
+                                    <div class="card login-page border-0" style="z-index: 1">
+                                        <div class="card border-0">
+                                            <div class="card-body" style="padding: 0px;">
+                                                <h1 class="mb-4 pb-1 mt-2" style="color: #141639c4; font-size:48px !important;">Register, To Start</h1>
+                                                <input type="hidden" name="student_id" value="{{ $hash_student_ids[0] }}" id="student_id">
+                                                <div class="row mb-4">
+                                                    <div class="col-md-6">
+                                                        <input type="text" class="form-control" name="first_name" value="{{ $user->first_name }}" id="first_name" required  autofocus placeholder="Given Name">
+                                                    </div>
+                                                    <div class="col-md-6">
+                                                        <input type="text" class="form-control" name="last_name" value="{{ old('last_name') }}" id ="last_name" required  placeholder="Family Name">
+                                                    </div>
+                                                </div>
+
+                                                <div class="row mb-4">
+                                                    <div class="col-md-12">
+                                                        <input type="email" class="form-control " name="email" value="{{ $user->email}}" id="email" required placeholder="Email">
+
+                                                    </div>
+                                                </div>
+
+                                                <div class="row mb-4">
+                                                    <div class="col-md-12">
+                                                        <select class="form-control" name="nationality" id="nationality">
+                                                            <option>Nationality</option>
+                                                            @foreach($countries as $item)
+                                                                <option value="{{$item->id}}">{{$item->name}}</option>
+                                                            @endforeach
+                                                        </select>
+                                                    </div>
+                                                </div>
+
+                                                <div class="row mb-3">
+                                                    <div class="col-md-12 back">
+                                                        <div>
+                                                            <input name="dob" type="text" class="form-control start" id="u_dob" placeholder="Select your Date of Birth" autocomplete="off">
+                                                        </div>
+                                                    </div>
+                                                </div>
+
+                                                <div class="mb-3">
+                                                    <label class="form-label">Select Your Gender</label>
+                                                    <div class="form-check-inline ps-3">
+                                                        <label class="form-check-label" for="radio1">
+                                                            <input type="radio" class="form-check-input gender" name="optradio" value="male"> Male
+                                                        </label>
+                                                    </div>
+                                                    <div class="form-check-inline">
+                                                        <label class="form-check-label" for="radio2">
+                                                            <input type="radio" class="form-check-input gender" name="optradio" value="female"> Female
+                                                        </label>
+                                                    </div>
+                                                 </div>
+                                                <div class="row mb-4">
+                                                    <div class="col-md-12">
+                                                        <input id="password" type="password" class="form-control " name="password" id="password" required autocomplete="new-password" placeholder="Set a password">
+                                                    </div>
+                                                </div>
+
+                                                <div class="row mb-4">
+                                                    <div class="col-md-12">
+                                                        <input id="password-confirm" type="password" class="form-control" name="password_confirmation" id="password_confirmation" required autocomplete="new-password" placeholder="Confirm password">
+                                                    </div>
+                                                </div>
+
+                                                <div class="row mb-0">
+                                                    <div class="col-md-12">
+                                                        <button type="submit" class="btn btn1 pull-right wishlist_reg_submit">
+                                                            {{ __('Submit') }}
+                                                        </button>
+                                                    </div>
+                                                </div>
+                                                <p class="text-center mt-2 pb-4"><span> Already registered ?</span><a href="{{ url('login') }}" class="ps-2"><span>Login Here</span></a></p>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </section>
+      <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('css/jquery.min.js') }}"></script>
+      <script src="{{asset('web/js/tiny-slider.js')}}"></script>
+      <!-- Icons -->
+      <script src="{{asset('web/js/feather.min.js')}}"></script>
+      <!-- Main Js -->
+      {{-- <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.slim.min.js"></script> --}}
+      {{-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script> --}}
+      <script src="{{asset('web/js/plugins.init.js')}}"></script>
+      <script src="{{asset('web/js/app.js')}}"></script>
+      <script src="{{ asset('css/jquery-form/dist/jquery.form.min.js') }}"></script>
+      <script src="{{ asset('css/pnotify/pnotify.js') }}"></script>
+      <script src="{{ asset('css/noty/lib/noty.min.js') }}"></script>
+      <script src="{{ asset('css/flatpickr/dist/flatpickr.min.js') }}"></script>
+      <script>
+
+          function pop_up_msg(msg='No message specified', type='success', callback=null){
+              new Noty({
+              theme:'sunset',
+              text: msg,
+              type: type,
+              timeout:1500,
+              callbacks:{
+                  afterClose: callback
+              }
+              }).show();
+          }
+
+          function err_msg(err){
+
+              var msg="Request failed to process, try again later.";
+
+              if(err.responseJSON && err.responseJSON.msg){
+              msg=err.responseJSON.msg;
+              }
+
+              return msg;
+
+          }
+
+        $(function(){
+
+            $("#u_dob").flatpickr({
+                dateFormat: "d M Y",
+            });
+
+            $('.wishlist_reg_submit').on('click', function(){
+                  var id =$('#student_id').val();
+                  var first_name =$('#first_name').val();
+                  var last_name =$('#last_name').val();
+                  var email =$('#email').val();
+                  var nationality =$('#nationality').val();
+                  var dob =$('#u_dob').val();
+                  //var gender =$('.gender').prop("checked");
+                  var password_confirmation =$('#password_confirmation').val();
+
+
+                  var form_data={
+                      _token: "{{ csrf_token() }}",
+                      id: id,
+                      first_name: first_name,
+                      last_name: last_name,
+                      email: email,
+                      nationality: nationality,
+                      dob: dob,
+                      //gender: gender,
+                      password: password,
+                      password_confirmation: password_confirmation,
+                  }
+
+                  $.post("{{ route('ajax-post', ['name'=>'add_wishlist_registration']) }}", form_data, function(res){
+                      pop_up_msg(res.msg);
+
+                  }).fail(function(err){
+
+                      pop_up_msg(err_msg(err), 'error');
+
+                  });
+              });
+        });
+    </script>
+</body>
+</html>

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

@@ -82,12 +82,12 @@
                                 <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);
+                                    $hashids = new \Hashids\Hashids('student_wishlist_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>
+                                <a href="{{ url('register/'.$hashids->encode($student_id)) }}">click here</a>
                                 <p class="mt-2" style="margin: 0px;">Best regards,</p>
                                 <h4>{{$applicant_name}} </h4>
                                     <div style="border-top: 1px solid #eee;">

+ 42 - 2
resources/views/teacher_profile.blade.php

@@ -331,10 +331,14 @@ tbody, td, tfoot, th, thead, tr {
                                 </div>
                             </div>
                             <div class="col-md-3" style="display: flex; justify-content: end;">
-                            <p class="form-check-label mt-3 pt-1" style="font-size: 11px;">I'm not available</p>
+                                @if(\Auth::guard('teacher')->user()->is_available ==0)
+                                    <p class="form-check-label mt-3 pt-1" style="font-size: 11px;">I'm not available</p>
+                                @endif
                                 <div class="form-check form-switch mt-3 ms-2" 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 ==1) checked @endif>
+                                    @if(\Auth::guard('teacher')->user()->is_available ==1)
                                     <label class="form-check-label" for="" style="font-size: 11px; margin-top: -1px;">I'm available</label>
+                                    @endif
                                 </div>
                                 <ul class="nav navbar-nav align-items-center ml-auto header_right ps-2">
                                     <li class="nav-item dropdown dropdown-notification">
@@ -1245,6 +1249,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');
+
+                });
+            }
+        });
+    });
+
   });
 
 

+ 1 - 0
routes/web.php

@@ -53,6 +53,7 @@ Route::get('register', [App\Http\Controllers\Auth\RegisterController::class,'sho
 Route::post('student-register', [App\Http\Controllers\Auth\RegisterController::class,'create'])->name('student-register');
 
 Route::get('student-q-form/{hash}', [App\Http\Controllers\HomeController::class,'student_q_form']);
+Route::get('register/{hash}', [App\Http\Controllers\HomeController::class,'wishlist_student_register']);
 
 Route::group(['middleware' => ['auth']], function() {
 

+ 18 - 6
sql/update.sql

@@ -13,7 +13,7 @@ CREATE TABLE `refer_users` (
 	PRIMARY KEY (`id`) USING BTREE
 )
 COLLATE='utf8mb4_general_ci'
-ENGINE=InnoDB 
+ENGINE=InnoDB
 ;
 
 CREATE TABLE `research_interests` (
@@ -23,7 +23,7 @@ CREATE TABLE `research_interests` (
 	PRIMARY KEY (`id`) USING BTREE
 )
 COLLATE='utf8mb4_general_ci'
-ENGINE=InnoDB 
+ENGINE=InnoDB
 ;
 
 CREATE TABLE `student_proposals` (
@@ -46,7 +46,7 @@ CREATE TABLE `student_proposals` (
 	PRIMARY KEY (`id`) USING BTREE
 )
 COLLATE='utf8mb4_general_ci'
-ENGINE=InnoDB 
+ENGINE=InnoDB
 ;
 
 CREATE TABLE `universities` (
@@ -63,7 +63,7 @@ CREATE TABLE `universities` (
 	PRIMARY KEY (`id`) USING BTREE
 )
 COLLATE='latin1_swedish_ci'
-ENGINE=InnoDB 
+ENGINE=InnoDB
 ;
 
 CREATE TABLE `market_countries` (
@@ -78,7 +78,7 @@ CREATE TABLE `market_countries` (
 	PRIMARY KEY (`id`) USING BTREE
 )
 COLLATE='latin1_swedish_ci'
-ENGINE=InnoDB 
+ENGINE=InnoDB
 ;
 
 CREATE TABLE `proposal` (
@@ -96,6 +96,18 @@ CREATE TABLE `proposal` (
 	PRIMARY KEY (`id`) USING BTREE
 )
 COLLATE='utf8mb4_unicode_ci'
-ENGINE=InnoDB 
+ENGINE=InnoDB
 ;
 
+ALTER TABLE `users`
+	CHANGE COLUMN `teacher_id` `wishlist_teacher_id` INT(11) NULL DEFAULT NULL AFTER `user_type`;
+
+ALTER TABLE `users`
+	CHANGE COLUMN `last_name` `last_name` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci' AFTER `first_name`;
+
+
+ALTER TABLE `users`
+	CHANGE COLUMN `password` `password` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci' AFTER `dob`;
+
+ALTER TABLE `refer_users`
+	ADD COLUMN `q_form_status` TINYINT(2) NULL DEFAULT '0' AFTER `email`;