Browse Source

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

Israat Zarin 1 year ago
parent
commit
cb3b80fb3b

+ 3 - 3
app/Http/Controllers/AjaxController.php

@@ -473,7 +473,7 @@ class AjaxController extends Controller
                 $user_data->save();
 
                 $student_proposal =new StudentProposal;
-                $student_proposal->student_id =$user->id;
+                $student_proposal->student_id =$user_data->id;
                 $student_proposal->teacher_id =$req->id;
                 $student_proposal->draft_status =1;
                 $student_proposal->save();
@@ -481,7 +481,7 @@ class AjaxController extends Controller
                 $refer =new ReferUser;
                 $refer->name =$req->name;
                 $refer->email =$req->email;
-                $refer->refer_by =$user->id;
+                $refer->refer_by =$user_data->id;
                 $refer->teacher_id =$req->id;
                 $refer->q_form_status =1;
                 $refer->save();
@@ -503,7 +503,7 @@ class AjaxController extends Controller
 
 
                     $data['name'] = $refer->name;
-                    $data['student_id'] = $user->id;
+                    $data['student_id'] = $user_data->id;
                     $data['teacher'] = $teacher->first_name.' '.$teacher->last_name;
                     $data['arn'] = $teacher->ref_no;
                     $data['designation'] = $teacher->designation;

+ 98 - 37
app/Http/Controllers/ModalController.php

@@ -87,7 +87,7 @@ class ModalController extends Controller{
         $carbon=new \Carbon\Carbon;
 
         if($name=='apply_student_proposal'){
-
+            //dd($req->student_id);
             $new_rules=[
                 'proposal_id'=>'required',
             ];
@@ -104,20 +104,57 @@ class ModalController extends Controller{
                 return response(['msg'=>$errors[0]], 422);
             }
 
-            $already_exists = StudentProposal::where('student_id',$req->student_id)->where('proposal_submit_status',1)->exists();
-            if($already_exists){
-                return response(['msg'=>'Sorry! You already submitted. You can not submit proposal.'],403);
+            $student_data =User::where('id',$req->student_id)->where(function($q){
+                $q->where(
+                    'is_publication',0
+                )->orWhere(
+                    'is_work_experience',0
+                )->orWhere(
+                    'is_education',0
+                )->orWhere(
+                    'is_test_score',0
+                );
+            })->exists();
+             
+
+            if($student_data){
+                return response(['msg'=>'you didn\'t complete your profile.'],403);
             }
 
-            $publication =User::where('id',$req->student_id)->whereNull('is_publication')->exists();
-            $worK_exp =User::where('id',$req->student_id)->whereNull('is_work_experience')->exists();
-            $institution =User::where('id',$req->student_id)->whereNull('is_education')->exists();
-            $score =User::where('id',$req->student_id)->whereNull('is_test_score')->exists();
+            $awaiting = StudentProposal::where(
+                'student_id',$req->student_id
+            )->where(
+                'teacher_id',$req->teacher_id
+            )->where(
+                'proposal_id',$req->proposal_id
+            )->where(
+                'proposal_submit_status',1
+            )->whereIn(
+                'proposal_status',[1,2,3,4] // 1 =New; 2 =In Review; 3=Push; 4=Hold;
+            )->exists();
 
-            if($publication || $worK_exp || $institution || $score){
-                return response(['msg'=>'you didn\'t complete your profile.'],403);
+            if($awaiting){
+                return response(['msg'=>'Application you have submitted that are currently awaiting decisions'],403);
             }
 
+            $approved_proposal = StudentProposal::where(
+                'student_id',$req->student_id
+            )->where(
+                'teacher_id',$req->teacher_id
+            )->where(
+                'proposal_id',$req->proposal_id
+            )->where(
+                'proposal_submit_status',1
+            )->where(
+                'proposal_status',5 // 5=interest;
+            )->exists();
+
+            if($approved_proposal){
+                return response(['msg'=>'Application you have submitted that are approved'],403);
+            }
+
+           
+
             $student_proposal =new StudentProposal;
             $student_proposal->student_id =$req->student_id;
             $student_proposal->teacher_id =$req->teacher_id;
@@ -195,20 +232,38 @@ class ModalController extends Controller{
 
                 $errors=$validator->errors()->all();
                 return response(['msg'=>$errors[0]], 422);
-            }
+            }  
 
-            $already_exists = StudentProposal::where('student_id',$req->student_id)->where('proposal_submit_status',1)->exists();
-            if($already_exists){
-                return response(['msg'=>'Sorry! You already submitted. You can not submit proposal.'],403);
+            $approved_proposal = StudentProposal::where(
+                'student_id',$req->student_id
+            )->where(
+                'teacher_id',$req->teacher_id
+            )->where(
+                'proposal_id',$req->proposal_id
+            )->where(
+                'proposal_submit_status',1
+            )->where(
+                'proposal_status',5 // 5=interest;
+            )->exists();
+
+            if($approved_proposal){
+                return response(['msg'=>'Application you have submitted that are approved'],403);
             }
 
-            $publication =User::where('id',$req->student_id)->whereNull('is_publication')->exists();
-            $worK_exp =User::where('id',$req->student_id)->whereNull('is_work_experience')->exists();
-            $institution =User::where('id',$req->student_id)->whereNull('is_education')->exists();
-            $score =User::where('id',$req->student_id)->whereNull('is_test_score')->exists();
+            $awaiting = StudentProposal::where(
+                'student_id',$req->student_id
+            )->where(
+                'teacher_id',$req->teacher_id
+            )->where(
+                'proposal_id',$req->proposal_id
+            )->where(
+                'proposal_submit_status',1
+            )->whereIn(
+                'proposal_status',[1,2,3,4] // 1 =New; 2 =In Review; 3=Push; 4=Hold;
+            )->exists();
 
-            if($publication || $worK_exp || $institution || $score){
-                return response(['msg'=>'you didn\'t complete your profile.'],403);
+            if($awaiting){
+                return response(['msg'=>'Application you have submitted that are currently awaiting decisions'],403);
             }
 
             $student_proposal =StudentProposal::find($req->id);
@@ -287,24 +342,10 @@ class ModalController extends Controller{
 
             $is_user_exists=User::where('email',$req->email)->where('user_type',1)->exists();
 
-            if($is_user_exists){
+            if($is_user_exists){ 
 
                 $user_notify =User::where('email',$req->email)->where('user_type',1)->first();
-
-                // $isUserExists = User::where(
-                //     'email',$req->email
-                // )->where(
-                //     'user_type',2
-                // )->where(function($q){
-                //     $q->where('sign_up',1)->orWhere('sign_up',0);
-                // })->exists();
-    
-                // if($isUserExists){
-                //     return response([
-                //         'msg'=>'Already there is an account associated this email ID. Please login to your account.'
-                //     ],403);
-                // }
-
+ 
                 $is_student_proposal_exists =StudentProposal::where(
                     'teacher_id',$teacher->id
                 )->where(
@@ -315,7 +356,7 @@ class ModalController extends Controller{
 
                 if($is_student_proposal_exists){
                     return response(
-                        ['msg'=>'Already pending your proposal. Please  wait for approving.'],403
+                        ['msg'=>'Already there is an account associated this email ID. Please login to your account.'],403
                     );
                 }else{
                     $refer =new ReferUser;
@@ -535,6 +576,26 @@ class ModalController extends Controller{
             return response(
                 ['msg'=>'Successfully saved.']
             );
+        }elseif($name=="send_email_document_information"){
+
+            $data['teacher']=User::find($req->teacher_id);
+            $data['student']=User::find($req->student_id);
+            $data['std_proposal']=StudentProposal::find($req->id);
+            $data['doc_requirement_list']=Requirement::where('std_proposal_id',$req->id)->get();
+            $student =$data['student'];
+            $user_mail = $student->email;
+            $data['receive_email']=$student->email;
+            $from = 'asraful@revinr.com'; 
+           
+            Mail::send('email.send_email_document_information',$data, function ($message) use ($user_mail,$from) {
+                $message->from($from);
+                $message->to($user_mail)->subject('Further Information Required');
+            });
+
+            return response(
+                ['msg'=>'Send email successfully.']
+            );
+        
         }
 
         return response(['msg'=>'No name argument found.'], 403);

+ 4 - 4
app/Http/Controllers/StudentHomeController.php

@@ -38,10 +38,10 @@ class StudentHomeController extends Controller
    public function application(){
       $user = Auth::user(); 
       $proposal= Proposal::where('student_id',$user->id)->doesntExist();
-      $publication =User::where('id',$user->id)->whereNull('is_publication')->exists(); 
-      $worK_exp =User::where('id',$user->id)->whereNull('is_work_experience')->exists(); 
-      $institution =User::where('id',$user->id)->whereNull('is_education')->exists();
-      $score =User::where('id',$user->id)->whereNull('is_test_score')->exists();  
+      $publication =User::where('id',$user->id)->where('is_publication',0)->exists(); 
+      $worK_exp =User::where('id',$user->id)->where('is_work_experience',0)->exists(); 
+      $institution =User::where('id',$user->id)->where('is_education',0)->exists();
+      $score =User::where('id',$user->id)->where('is_test_score',0)->exists();  
       $student_proposal =StudentProposal::where('student_id',$user->id)->orderBy('id','DESC')->get();
       $data =[
          'proposal'=>$proposal,

+ 6 - 1
app/Http/Controllers/TeacherHomeController.php

@@ -8,6 +8,7 @@ use App\StudentProposal;
 use App\Models\Department;
 use App\Models\ReferUser;
 use App\Models\University;
+use App\Models\Requirement;
 use App\Institution;
 use App\Workexperience;
 use Auth;
@@ -58,8 +59,12 @@ class TeacherHomeController extends Controller
             $start_date = current($work_experince); 
             $end_date = end($work_experince);   
         } 
+
+        $doc_info =Requirement::where(
+            'std_proposal_id',$proposal_details->id
+        )->get();
         
-        return view('teacher.student_proposal_details',compact('proposal_details','education_history','start_date','end_date'));
+        return view('teacher.student_proposal_details',compact('proposal_details','education_history','start_date','end_date','doc_info'));
     }
 
     

BIN
public/uploads/proposal/1685604946documentfile_.pdf


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

@@ -103,7 +103,7 @@
                                             <span class="label_badge_radius" style="background-color: #d8fdd8; color: green; border-radius: 5px; font-weight: bold;">Hold</span>
                                         @elseif($row->proposal_submit_status==1 && $row->proposal_status ==5)
                                             <span class="label_badge_radius" style="background-color: #d8fdd8; color: green; border-radius: 5px; font-weight: bold;">Interested</span>
-                                        @elseif($row->proposal_submit_status==1 && $row->proposal_status ==6)
+                                        @elseif($row->proposal_submit_status==1 && $row->proposal_status ==6) 
                                             <span class="label_badge_radius" style="background-color: #d8fdd8; color: green; border-radius: 5px; font-weight: bold;">Rejected</span>
                                         @elseif($proposal =='true' || $publication =='true' || $worK_exp =='true'|| $institution =='true'|| $score =='true')   
                                           <span class="label_badge_radius" style="background-color: #d8fdd8; color: green; border-radius: 5px; font-weight: bold; cursor: pointer;">Draft</span>

+ 135 - 0
resources/views/email/send_email_document_information.blade.php

@@ -0,0 +1,135 @@
+<!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: 'Quicksand', sans-serif;
+            }
+            h5{
+                font-family: 'Montserrat Alternates', sans-serif !important;
+            }
+            .bg-half-170 {
+                padding:0px;
+            }
+            .tmail{
+                color: #6d6d6d; 
+                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" style="background-color:white;">
+                                <div class="p-5">
+                                    <h3 style="text-align: center; font-family:Ubuntu !important; color: #3c4858 !important; font-size: 30px !important;">Research Admission</h3>
+                                    <p class="mt-5">Dear {{ $student->first_name }} {{ $student->last_name }},</p>
+                                    <p class="mt-2">Thank you for submitting your research proposal.</p>
+                                    <p class="mt-2">To further evaluate your application, the following documents/information are required:</p>
+                                    
+                                    <ul>
+                                        @if(count($doc_requirement_list) > 0)
+                                        @foreach($doc_requirement_list as $row)
+                                        <li>
+                                            <div class="input-group mt-2"> 
+                                                <div class="input-group-addon">
+                                                    <div class="checkbox-bird green" style="margin: 0px;">
+                                                         {{ $row->requirement_title}}
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </li>
+                                        @endforeach
+                                        @endif
+                                    </ul> 
+                                    <p class="mt-2">I highly recommend that you provide the required documents/information as soon as possible to avoid any delays in the review process.</p>
+                                    <p class="mt-2">Looking forward to hearing from you.</p>
+                                    <h4 class="mt-3">Thanking you,</h4>
+                                    <h5>{{ $teacher->first_name }} {{ $teacher->last_name }}</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>
+                                    <p class="mt-3 tmail">Research Admission is a revolutionary platform that simplifies the application process for<br> both applicants and supervisors, thereby saving valuable time.</p>
+                                    <p class="mt-3 tmail" style="font-size: 12px;">Copyright © {{date('Y')}} Research Admission</p>
+                                </div>
+                            </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>

+ 5 - 4
resources/views/modal_pages/send_email_document_information.blade.php

@@ -55,7 +55,8 @@
     }
     </style>
 
-<form class="req-email-form" action="{{ url()->current() }}" method="POST">
+<form class="modal-form" action="{{ url()->current() }}" method="POST" enctype="multipart/form-data">
+    {{ csrf_field() }}
     <div class="form-row mb-0">
         <input type="hidden" name="teacher_id" value="{{ $std_proposal->teacher_id }}">
         <input type="hidden" name="student_id" value="{{ $std_proposal->student_id }}">
@@ -75,13 +76,13 @@
                         <p class="mb-3">
                             <span>To:</span>
                             <span class="badge badge-pill badge-sams">
-                                supervisor
+                                {{cn($std_proposal,'student_details.email','')}}
                             </span>
                         </p>
                     </div>
                 </div>
               
-                <div class="row">
+                {{-- <div class="row">
                     <div class="col">
                         <p style="margin-bottom: 6px;">
                             <span>CC:</span>
@@ -97,7 +98,7 @@
                             </span>
                         </p>
                     </div>
-                </div>     
+                </div>      --}}
             </div>
     
             <div class="box-typical box-typical-padding mb-0" id="email_holder"></div>

+ 2 - 1
resources/views/teacher/student_proposal_details.blade.php

@@ -1229,11 +1229,12 @@ element.style {
                                                                                                                         
                                                         </div>     
                                                     </div>
-
+                                                     @if(count($doc_info) > 0)
                                                     <div class="col-md-12" style="float: right; margin-top:5px;">  
                                                         <span class="btn open_modal_page submit_button" data-url="{{route('modal-get',['send_email_document_information', 'id'=>$proposal_details->id])}}" data-title="Send Email">Send Email
                                                         </span> 
                                                     </div>
+                                                    @endif
                                                 </div>
                                             </div>
                                         </div>

+ 7 - 1
sql/update.sql

@@ -229,4 +229,10 @@ ALTER TABLE `users`
 	ADD COLUMN `last_logged_at` DATETIME NULL DEFAULT NULL AFTER `last_logged_timezone`;
 
 ALTER TABLE `admins`
-	ADD COLUMN `last_logged_at` DATETIME NULL DEFAULT NULL AFTER `last_logged_timezone`;
+	ADD COLUMN `last_logged_at` DATETIME NULL DEFAULT NULL AFTER `last_logged_timezone`;
+
+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`;