Md.Mostafijur Rahman 1 year ago
parent
commit
04ee9b39d9

+ 3 - 0
app/Http/Controllers/Admin/SubContentController.php

@@ -97,6 +97,9 @@ class SubContentController extends Controller
 			$data['departments'] =Department::where('status',1)->orderBy('name','ASC')->get();
             $data['universities'] =University::orderBy('name','ASC')->get();
 			$data['edit_data'] =User::find($req->edit_id);
+		}elseif($name=="edit_research_form"){
+			$data['edit_research'] =ResearchInterest::find($req->res_id);
+
 		}else $name='default';
 		//$data['page_sl']=new PageSL($data['chapter_details']);
 		return view("admin.sub_contents.{$name}", $data);

+ 24 - 0
app/Http/Controllers/AjaxController.php

@@ -677,6 +677,30 @@ class AjaxController extends Controller
             );
 
 
+        }elseif($name=="delete_research_info"){
+            $user=Auth::guard('teacher')->user();
+            $data =ResearchInterest::find($req->delete_id);
+            $data->delete();
+            return response([
+                'msg'=>'Successfully Deleted'
+            ]);
+        }elseif($name=="edit_research_save"){
+            $user=Auth::guard('teacher')->user();
+            $validator=\Validator::make($req->all(), [
+                'research'=>'required',
+            ]);
+
+            if($validator->fails()){
+                $errors=$validator->errors()->all();
+                return response(['msg'=>$errors[0]], 422);
+            }
+
+            $data =ResearchInterest::find($req->edit_id);
+            $data->research =$req->research;
+            $data->update();
+            return response([
+                'msg'=>'Successfully updated.'
+            ]);
         }
 	}
 }

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

@@ -100,13 +100,13 @@ class RegisterController extends Controller
             }
 
             $data['token'] = $token;
-            $data['name'] = $req->first_name .''.$req->last_name;
+            $data['name'] = $req->givenname .''.$req->familyname;
             $user_mail = $req->email;
             $from = 'asraful@revinr.com';
 
             Mail::send('email.student_signup_verify_email',$data, function ($message) use ($user_mail,$from) {
                 $message->from($from);
-                $message->to($user_mail)->subject('Signup Email Verify');
+                $message->to($user_mail)->subject('Email Verification Required: Complete your Registration');
             });
 
           return redirect()->to("/login")->with('success','Your registration successfully saved. Please check your email for verification');

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

@@ -26,7 +26,7 @@ class HomeController extends Controller
         $hash_teacher_ids=$hashids->decode($hash);
         $user =User::find($hash_teacher_ids[0]);
         if(empty($hash_teacher_ids[0])) abort(404);
-        return view('q_apply_form',compact('hash_teacher_ids','user'));
+        return view('Q_apply_form',compact('hash_teacher_ids','user'));
     }
 
     public function wishlist_student_register($hash)
@@ -49,5 +49,5 @@ class HomeController extends Controller
         return view('auth.invited_register_form',compact('hash_ids','user','departments','universities'));
     }
 
-     
+
 }

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

@@ -72,11 +72,14 @@ class ModalController extends Controller{
 
         if($name=='apply_student_proposal'){
 
-            $validator=\Validator::make($req->all(), [
+            $new_rules=[
                 'proposal_id'=>'required',
+            ];
+
+            $validator=\Validator::make($req->all(),$new_rules,[
+                'proposal_id.required'=>'No Proposal is selected.',
                 'startdate'=>'required',
                 'startmonth'=>'required',
-
             ]);
 
             if($validator->fails()){

+ 5 - 5
app/User.php

@@ -58,18 +58,18 @@ class User extends Authenticatable
     public function country_name()
     {
         return $this->belongsTo(Country::class, 'nationality', 'id');
-    } 
+    }
 
     public function department_name()
     {
         return $this->belongsTo('App\Models\Department', 'department');
-    } 
+    }
 
     public function university()
     {
         return $this->belongsTo('App\Models\University', 'university_name');
-    } 
+    }
+
+
 
-    
-     
 }

+ 44 - 0
resources/views/admin/sub_contents/edit_research_form.blade.php

@@ -0,0 +1,44 @@
+
+<form method="POST" action="{{route('ajax-post', ['name'=>'edit_research_save'])}}" class="edit_res_info_form">
+    <input type="hidden" name="_token" value="{{ csrf_token() }}" />
+    <input type="hidden" name="edit_id" value="{{$edit_research->id}}">
+    <div class="col-md-12">
+        <div class="mb-2">
+            <label class="form-label config"></label>
+            <div class="form-icon position-relative">
+                <input type="text" class="form-control" placeholder="Research" name="research" value="{{$edit_research->research}}" required="" style="font-size: 13px;">
+            </div>
+        </div>
+    </div>
+    <div class="col-md-12">
+        <div class="text-end">
+            <button type="button" class="btn cancel_button mr-1 btn-cancel close_form" >
+                <i aria-hidden="true" class="fa fa-refresh"></i>
+            </button>
+            <button class="btn btn2">Update</button>
+        </div>
+    </div>
+
+</form>
+
+
+<script>
+    $(function(){
+        $('.edit_res_info_form').on('submit', function(event){
+            event.preventDefault();
+            var self = $(this);
+            ajax_form(self, function(self){
+                $('#load_research_interest').empty();
+                fetch_sub_content(
+                    '#load_research_interest',
+                    "{{ route('sub-content', ['name'=>'load_research_interest']) }}"
+                );
+            });
+        });
+
+
+        $('.btn-cancel').on('click', function(){
+            $('.open_research_edit_info_div_inner').addClass('d-none')
+        });
+    });
+</script>

+ 29 - 29
resources/views/admin/sub_contents/load_department.blade.php

@@ -1,5 +1,5 @@
-@extends('admin.sub_contents.base')  
-@section('main') 
+@extends('admin.sub_contents.base')
+@section('main')
 @foreach($departments as $row)
 <div class="mt-2 single_edit_item" style="border-bottom: 1px solid #e8eef1;">
 <div style="display: flex; margin-top:2px;">
@@ -7,54 +7,54 @@
         <span class="title" style="font-size:11px;">{{$row->name}}</span>
     </div>
     <div class="right" style="width: 20%;">
-        <span class="title" style="font-size:11px; font-weight: 600;"> 
+        <span class="title" style="font-size:11px; font-weight: 600;">
             <button type="button" class="btn btn2 edit_department mb-1" data-id="{{$row->id}}" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-pencil"></i></button>
-           
+
         </span>
         <span class="title" style="font-size:11px; font-weight: 600;">
             <button type="button" class="btn btn2 delete_department mb-1" data-id="{{$row->id}}" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-trash" style="margin-left:2px;"></i></button>
         </span>
     </div>
-</div>      
-</div>      
-@endforeach  
- 
+</div>
+</div>
+@endforeach
+
 @endsection
 
 <script>
     $(function(){
-        
+
         var form_row_added=false;
 
-        $('.edit_department').on('click', function(){ 
-            if(form_row_added){ 
+        $('.edit_department').on('click', function(){
+            if(form_row_added){
                 $('.open_department_info_div').remove();
                 form_row_added=false;
-            } 
-            var self=$(this);  
+            }
+            var self=$(this);
             var self_tr=self.closest('.single_edit_item');
 
             var dep_id=self.data('id');
 
             form_row_added=true;
 
-            self_tr.after( 
+            self_tr.after(
              "<div class='open_department_info_div'><div class='open_department_edit_info_div_inner'></div></div>"
             );
 
             fetch_sub_content(
                 '.open_department_edit_info_div_inner',
                 "{{ route('sub-content', ['name'=>'edit_department_form']) }}?dep_id="+dep_id
-            ); 
-             
+            );
+
         });
 
-        $('.delete_department').on('click', function(){ 
-            var id = $(this).attr("data-id"); 
+        $('.delete_department').on('click', function(){
+            var id = $(this).attr("data-id");
             var form_data={
-                _token: "{{ csrf_token() }}",  
+                _token: "{{ csrf_token() }}",
                 delete_id: id,
-            }  
+            }
             swal({
                 title: "Are you sure?",
                 text: "You will not be able to recover this data!",
@@ -67,24 +67,24 @@
 
             }, function(isConfirm){
 
-                if(isConfirm){  
+                if(isConfirm){
                     $.post("{{ route('ajax-post', ['name'=>'delete_department_info']) }}",form_data
                     ).done(function(res){
 
                         pop_up_msg(res.msg);
-                        
+
                         $('#load_department').empty();
                         fetch_sub_content(
                             '#load_department',
                             "{{ route('sub-content', ['name'=>'load_department']) }}"
                         );
 
-                    }).fail(function(err){ 
-                        pop_up_msg(err_msg(err), 'error'); 
-                    }); 
-                } 
-            }); 
-                        
+                    }).fail(function(err){
+                        pop_up_msg(err_msg(err), 'error');
+                    });
+                }
+            });
+
         });
     });
-</script>
+</script>

+ 3 - 3
resources/views/admin/sub_contents/load_ref_no_available_info.blade.php

@@ -5,12 +5,12 @@
     <div class="col-md-12">
         <div class="row">
             <div class="col-md-10">
-                <div class="uni_details" style="display:flex;">  
-                    @if($teacher->university) 
+                <div class="uni_details" style="display:flex;">
+                    @if($teacher->university)
                     <img class="img-responsive listFlag" style="border-radius: 20px; padding: 0px;height: 37px;width: 37px;" src="{{ asset('/assets/img/flags/4x3').'/'.strtolower(cn($teacher,'university.country.iso_3166_2','')).'.svg' }}" alt="Flag" data-toggle="tooltip" title="" data-placement="top">
                     @else
                     <div class="inner_left mt-1" style="background-color: #141639c4; padding: 18px 0px 0px 0px; height: 47px; width: 56px; margin-top: 9px !important;">
-                        <p style="color:white; font-weight:600 !important; letter-spacing: 2px; text-align: center; margin-top: -8px; font-size: 17px;">DD</p>
+                        <p style="color:white; font-weight:600 !important; letter-spacing: 2px; text-align: center; margin-top: -8px; font-size: 17px;">{{ name_initials($teacher->first_name, $teacher->last_name) }}</p>
                     </div>
                     @endif
                     <div class="alert" style="background-color:white; padding: 3px 7px; margin-bottom: 0px;">

+ 91 - 5
resources/views/admin/sub_contents/load_research_interest.blade.php

@@ -1,8 +1,94 @@
-@extends('admin.sub_contents.base')  
-@section('main') 
+@extends('admin.sub_contents.base')
+@section('main')
 
 @foreach($resarch as $row)
-<span class="title" style="font-size:11px;" id="interest" contenteditable="true" style="padding: 5px;">{{$row->research}}</span></br>
+<div class="single_glance_row mt-4 single_edit_item">
+    <div style="display: flex;">
+        <div class="left" style="width: 80%;">
+            <span class="title" style="font-size:11px;">{{$row->research}}</span>
+        </div>
+        <div class="right" style="width: 20%;">
+            <span class="title" style="font-size:11px; font-weight: 600;">
+                <button type="button" class="btn btn2 edit_research mb-1" data-id="{{$row->id}}" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-pencil"></i></button>
+
+            </span>
+            <span class="title" style="font-size:11px; font-weight: 600;">
+                <button type="button" class="btn btn2 delete_research mb-1" data-id="{{$row->id}}" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-trash" style="margin-left:2px;"></i></button>
+            </span>
+        </div>
+
+    </div>
+</div>
+
 @endforeach
- 
-@endsection
+
+@endsection
+
+
+<script>
+    $(function(){
+
+        var form_row_added=false;
+
+        $('.edit_research').on('click', function(){
+            if(form_row_added){
+                $('.open_research_info_div').remove();
+                form_row_added=false;
+            }
+            var self=$(this);
+            var self_tr=self.closest('.single_edit_item');
+
+            var res_id=self.data('id');
+
+            form_row_added=true;
+
+            self_tr.after(
+             "<div class='open_research_info_div'><div class='open_research_edit_info_div_inner'></div></div>"
+            );
+
+            fetch_sub_content(
+                '.open_research_edit_info_div_inner',
+                "{{ route('sub-content', ['name'=>'edit_research_form']) }}?res_id="+res_id
+            );
+
+        });
+
+        $('.delete_research').on('click', function(){
+            var id = $(this).attr("data-id");
+            var form_data={
+                _token: "{{ csrf_token() }}",
+                delete_id: id,
+            }
+            swal({
+                title: "Are you sure?",
+                text: "You will not be able to recover this data!",
+                type: "warning",
+                showCancelButton: true,
+                confirmButtonClass: "btn-danger",
+                cancelButtonClass: "btn-info",
+                confirmButtonText: "Yes, delete!",
+                cancelButtonText: "No, cancel!",
+
+            }, function(isConfirm){
+
+                if(isConfirm){
+                    $.post("{{ route('ajax-post', ['name'=>'delete_research_info']) }}",form_data
+                    ).done(function(res){
+
+                        pop_up_msg(res.msg);
+
+                        $('#load_department').empty();
+                        fetch_sub_content(
+                            '#load_research_interest',
+                            "{{ route('sub-content', ['name'=>'load_research_interest']) }}"
+                        );
+
+                    }).fail(function(err){
+                        pop_up_msg(err_msg(err), 'error');
+                    });
+                }
+            });
+
+        });
+    });
+</script>

+ 14 - 2
resources/views/modal_pages/apply_student_proposal.blade.php

@@ -11,8 +11,12 @@
                     <input type="hidden" name="teacher_id" value="{{$teacher->id}}">
                     <input type="hidden" name="student_id" value="{{$student->id}}">
                     <div class="d-flex">
-                        @if($teacher->university) 
+                        @if($teacher->university)
                             <img class="img-responsive listFlag mt-2" style="border-radius: 2px; padding: 0px;height: 45px; width: 44px;" src="{{ asset('/assets/img/flags/4x3').'/'.strtolower(cn($teacher,'university.country.iso_3166_2','')).'.svg' }}" alt="Flag" data-toggle="tooltip" title="" data-placement="top">
+                        @else
+                        <div class="inner_left mt-1" style="background-color: #141639c4; padding: 18px 0px 0px 0px; height: 47px; width: 56px; margin-top: 9px !important;">
+                            <p style="color:white; font-weight:600 !important; letter-spacing: 2px; text-align: center; margin-top: -8px; font-size: 17px;">{{ name_initials($teacher->first_name, $teacher->last_name) }}</p>
+                        </div>
                         @endif
                         <div class="alert" style="background-color:white; padding: 3px 7px; margin-bottom: 0px;">
                             <span style="margin: 0px;">{{$teacher->first_name}} {{$teacher->last_name}}</span></br>
@@ -26,7 +30,7 @@
                             <span class="text-muted" style="font-weight: 500;">{{cn($teacher,'university.name','')}}</span>
                         </div>
                     </div>
-                    
+
                 </div>
             </div>
         </div>
@@ -35,6 +39,7 @@
             <p style="font-size: 16px; font-weight: bold; margin-bottom: 0px !important;">Please select which proposal you want to send</p>
             <div class="alert mb-3 propose" style="padding: 0px; margin-bottom: 0px">
                 <div style="width:100%;">
+                    @if(count($proposal) > 0)
                     @foreach($proposal as $row)
                     <div class="p-2" style="border-bottom: 2px solid #eee;">
                         <div class="custom-control custom-radio custom-control-inline">
@@ -46,6 +51,13 @@
                         </div>
                     </div>
                     @endforeach
+                    @else
+                    <div class="col md-4 mt-1">
+                        <div class="col-md-12">
+                            <span class="alert mt-3" role="alert" style="font-size: 12px !important; border-radius: .55rem; padding: 8px 12px; margin-top: 6px; background: #fff0d6; color: #fdad2a; border-color: #ffebca; border-width: 3px; border-style: double;"> <i class="fa fa-warning" style="font-size: 11px; margin-right: 5px; color: #fdad2a !important; top: 0px; position: relative;"></i>No proposal available!</span>
+                        </div>
+                    </div>
+                    @endif
 
                 </div>
             </div>

+ 59 - 43
resources/views/teacher_profile.blade.php

@@ -324,8 +324,8 @@ tbody, td, tfoot, th, thead, tr {
     border-radius: 5px;
 }
 .method-box{
-    width: 31.5%; 
-    background-color: #eee; 
+    width: 31.5%;
+    background-color: #eee;
     border-radius: 5px;
 }
 </style>
@@ -502,8 +502,8 @@ tbody, td, tfoot, th, thead, tr {
                                         <p style="font-size: 13px;">You can log in to your account, include the student's name and email address in Q Apply, and send them an invitation. This way, their application will be automatically tagged with your reference.</p>
                                     </div>
                                     <div class="col-md-4 mt-3 ms-3 method-box">
-                                        <h6 class="method"> Option 3:</h6> 
-                                        <p style="font-size: 13px; margin-bottom: 0px;">You can share the Q Apply link with the student and ask them to fill out the form using their name and email. An invitation email will be sent to them, and then they can proceed with method 2.</p> 
+                                        <h6 class="method"> Option 3:</h6>
+                                        <p style="font-size: 13px; margin-bottom: 0px;">You can share the Q Apply link with the student and ask them to fill out the form using their name and email. An invitation email will be sent to them, and then they can proceed with method 2.</p>
                                     </div>
                                 </div>
                             </div>
@@ -991,47 +991,11 @@ tbody, td, tfoot, th, thead, tr {
                                                     <button class="btn btn2 research_interest" style="margin-left: -3.4rem; border-radius: 0px 6px 6px 0px">Add</button>
                                                 </div>
                                             </div>
-                                            <div class="single_glance_row mt-4">
-                                                <div style="display: flex;">
-                                                    <div class="left" style="width: 90%;">
-                                                        <div id="load_research_interest"></div>
-                                                        {{-- <span class="title" style="font-size:11px;" id="interest" contenteditable="true" style="padding: 5px;">Business 1</span> --}}
-                                                    </div>
-                                                    <!-- <div class="right" style="width: 10%;">
-                                                        <span class="title" style="font-size:11px;">
-                                                            <a role="button" data-bs-toggle="collapse" data-bs-parent="#collapse" href="#collapse1" aria-expanded="true" aria-controls="collapse1">
-                                                                <button type="button" class="btn btn2" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-pencil"></i></button>
-                                                            </a>
-                                                        </span>
-                                                    </div> -->
-                                                </div>
-                                                <!-- <div class="col-md-12">
-                                                    <div id="demo17" class="collapse mt-2">
-                                                        <div class="panel-body" style="padding:10px; background-color: #4b4c6824; border: 1px solid #e9e5e5; border-radius: 5px;">
-                                                            <form method="POST" action="">
-                                                                <div class="row">
-                                                                    <div class="col-md-12">
-                                                                        <div class="mb-2">
-                                                                            <label class="form-label config">Department</label>
-                                                                            <div class="form-icon position-relative">
-                                                                                <input type="text" class="form-control" placeholder="Department" name="department" required="" style="font-size: 13px;">
-                                                                            </div>
-                                                                        </div>
-                                                                    </div>
-                                                                    <div class="col-md-12">
-                                                                        <div class="text-end">
-                                                                            <button class="btn btn2">Update</button>
-                                                                        </div>
-                                                                    </div>
-                                                                </div>
-                                                            </form>
-                                                        </div>
-                                                    </div>
-                                                </div>  -->
-                                            </div>
+
+                                            <div id="load_research_interest"></div>
                                         </div>
                                     </div>
-                                </div>   
+                                </div>
                             </div>
                         </div>
                         </div>
@@ -1140,6 +1104,58 @@ tbody, td, tfoot, th, thead, tr {
 
         }
 
+        function ajax_form(form, cllback=null, config={spinner: true}){
+
+            $('.btn-submit').prop('disabled', true);
+            var redirect=$(form).data('redirect');
+
+            if(typeof config=='object'){
+
+            if(config.spinner) wait_me($(form));
+
+            }
+
+            $(form).ajaxSubmit({
+            success:function(res){
+
+                wait_me($(form), 'hide');
+
+                if(res.msg){
+
+                pop_up_msg(res.msg, 'success', function(){
+
+                    $('.btn-submit').prop('disabled', false);
+
+                    if(redirect) window.location.replace(redirect);
+                    else if(typeof cllback=='function'){
+                    cllback(form, res);
+                    }
+
+                });
+
+                }
+
+                //$.notify(res.msg, 'success');
+            },
+            error:function(res){
+
+                wait_me($(form), 'hide');
+
+                var msg="Request failed to process, try again later.";
+
+                if(res.responseJSON && res.responseJSON.msg){
+                msg=res.responseJSON.msg;
+                }
+
+                pop_up_msg(msg, 'error');
+                $('.btn-submit').prop('disabled', false);
+
+            }
+
+            });
+
+            } //End of ajax form definition
+
 
         $(function(){