Browse Source

Email ‰Invaitation

Mostafijur Rahman 1 year ago
parent
commit
380103d475

+ 13 - 4
app/Http/Controllers/Admin/AdminController.php

@@ -33,13 +33,13 @@ class AdminController extends Controller
             )->where(
                 'user_type',2
             )->orderBy(
-                'name','ASC'
+                'id','DESC'
             )->get();
 
         $register_student_list =User::where(
                 'user_type',1
             )->orderBy(
-                'name','ASC'
+                'id','DESC'
             )->get();
 
         $invited_registered_list =User::where(
@@ -47,7 +47,15 @@ class AdminController extends Controller
         )->whereNotNull(
             'admin_invite_id'
         )->orderBy(
-            'name','ASC'
+            'id','DESC'
+        )->get();
+
+        $landing_wishlist =User::where(
+            'user_type',2
+        )->where(
+            'landing_register',1
+        )->orderBy(
+            'id','DESC'
         )->get();
 
 
@@ -67,7 +75,8 @@ class AdminController extends Controller
           'market_countries'=>$market_countries,
           'refer_users'=>$refer_users,
           'invited_registered_list'=>$invited_registered_list,
-          'application'=>$application
+          'application'=>$application,
+          'landing_wishlist'=>$landing_wishlist
         ];
         return view('admin.admin_profile',$data);
     }

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

@@ -530,7 +530,7 @@ class AjaxController extends Controller
                 $user_data->uni_website =$req->website;
                 $user_data->password =Hash::make($req->password);
                 $user_data->status =1;
-                $user_data->invited_registered_at = now();
+                $user_data->registered_date = now();
                 $user_data->update();
 
                 if($user_data->update()){
@@ -655,6 +655,28 @@ class AjaxController extends Controller
             return response(
                 ['msg'=>'Successfully updated.']
             );
+        }elseif($name=="landing_invitation_email_send"){
+            $user_data =User::find($req->id);
+            $user_data->invitation_date =now();
+            $user_data->update();
+
+            if($user_data->update()){
+                $data['name'] = $user_data->first_name .''.$user_data->last_name;  
+                $user_mail = $user_data->email;
+                $data['teacher_id'] = $user_data->id;
+                $from = 'test@mail.com';
+
+                Mail::send('email.teacher_invited_email',$data, function ($message) use ($user_mail,$from) {
+                    $message->from($from);
+                    $message->to($user_mail)->subject('We’re excited to have you as a member of our community');
+                });
+            }
+
+            return response(
+                ['msg'=>'Registration successfully saved.You can login now.']
+            );
+
+
         }
 	}
 }

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

@@ -7,9 +7,11 @@ use App\Http\Controllers\Controller;
 use App\Proposal;
 use App\User;
 use App\StudentProposal;
+use App\Country;
 use App\Models\ReferUser;
 use App\Models\Admin;
 use App\Models\Requirement;
+use App\Models\University;
 use Hash;
 use DB;
 use Session;
@@ -54,8 +56,9 @@ class ModalController extends Controller{
             $data['std_proposal']=StudentProposal::find($req->id);
         }elseif($name=="edit_doc_required"){
             $data['requirements']=Requirement::find($req->id);
-        }elseif($name=="landing_ragister"){
-
+        }elseif($name=="landing_ragister_your_interest"){
+            $data['countries'] =Country::where('status',1)->orderBy('name','ASC')->get();
+            $data['universities'] =University::orderBy('name','ASC')->get();
         }else $name='default';
 
 
@@ -274,6 +277,37 @@ class ModalController extends Controller{
             return response([
                 'msg'=>'Successfully updated.'
             ]);
+        }elseif($name=="landing_ragister_your_interest"){
+
+            $validator=\Validator::make($req->all(), [
+                'name'=>'required',
+                'email'=>'required|email|max:255|unique:users'
+            ]);
+
+            if($validator->fails()){
+                $errors=$validator->errors()->all();
+                return response(['msg'=>$errors[0]], 422);
+            }
+
+            $already_exists =User::where('email',$req->email)->exists();
+
+            if($already_exists){
+                return response(['msg'=>'Sorry! this email is already exists!.'],403);
+            }
+
+            $user_data =new User;
+            $user_data->first_name =$req->name;
+            $user_data->email =$req->email;
+            $user_data->nationality =$req->country_id;
+            $user_data->university_name =$req->university_id;
+            $user_data->uni_website =$req->uni_website;
+            $user_data->user_type =2;
+            $user_data->landing_register =1;
+            $user_data->save();  
+ 
+            return response(
+                ['msg'=>'Successfully saved.']
+            );
         }
 
         return response(['msg'=>'No name argument found.'], 403);

+ 81 - 16
resources/views/admin/admin_profile.blade.php

@@ -659,9 +659,12 @@ tbody, td, tfoot, th, thead, tr {
                                                                                                 <div class="single_ad_pref_item">
                                                                                                     <div class="left" style="width:50%;">
                                                                                                         <div class="uni_details" style="display:flex;">
-                                                                                                            <div class="inner_left mt-1" style="border: 1px solid black; border-radius: 20px; padding: 9px 4px 5px 8px; height: 37px; width: 37px;">
+                                                                                                            {{-- <div class="inner_left mt-1" style="border: 1px solid black; border-radius: 20px; padding: 9px 4px 5px 8px; height: 37px; width: 37px;">
                                                                                                                 <i class="fa fa fa-university ms-1"></i>
-                                                                                                            </div>
+                                                                                                            </div> --}}
+                                                                                                            @if($row->nationality) 
+                                                                                                                <img class="img-responsive listFlag" style="border-radius: 20px; padding: 0px;height: 35px;width: 35px;" src="{{ asset('/assets/img/flags/4x3').'/'.strtolower(cn($row,'country_name.iso_3166_2','')).'.svg' }}" alt="Flag" data-toggle="tooltip" title="" data-placement="top">
+                                                                                                            @endif
                                                                                                             <div class="inner_right ms-2 mt-1">
                                                                                                                 <strong style="font-size:13px;">{{$row->first_name}} {{$row->last_name }}</strong></br>
                                                                                                                 <strong style="font-size:10px !important; font-weight:100 !important;"><i class="fa fa-birthday-cake" style="color: #908f8f;"></i><span class="ms-1">@if($row->dob){{date('d M Y',strtotime($row->dob))}} @endif</span></strong>
@@ -681,19 +684,29 @@ tbody, td, tfoot, th, thead, tr {
                                                                                         </td>
                                                                                         <td style="font-size: 11px;">{{$row->email}}
                                                                                             <div class="mt-1">
-                                                                                                <span class="label_badge_radius" style="background-color: #d8fdd8; color: green;">verified</span>
+                                                                                                @if($row->email_verification ==1)
+                                                                                                    <span class="label_badge_radius" style="background-color: #d8fdd8; color: green;">verified</span>
+                                                                                                @else
+                                                                                                <span class="label_badge_radius" style="background-color: #f9edc7; color: rgb(228, 139, 38);">pending</span>
+                                                                                                @endif
                                                                                             </div>
                                                                                             <!-- <div>
                                                                                                 <span class="label_badge_radius" style="background-color: #ffbd5978; color: #ff9a00;">pending</span>
                                                                                             </div> -->
                                                                                         </td>
-                                                                                        <td style="font-size: 11px;">{{date('d M Y', strtotime($row->created_at))}}</td>
+                                                                                        <td style="font-size: 11px;">{{date('d M Y h:i A', strtotime($row->created_at))}}</td>
                                                                                         <td style="font-size: 11px; text-align:center;">
+                                                                                            @php
+                                                                                               $total_std_proposal =\DB::table('proposal')->where('student_id',$row->id)->count();
+                                                                                               $total_submitted_proposal =\DB::table('student_proposals')->where('student_id',$row->id)->count();
+                                                                                            @endphp
                                                                                             <div>
-                                                                                                <span class="label_badge_radius" style="background-color: #ffbd5978; color: #ff9a00;">4</span>
+                                                                                                <span class="label_badge_radius" style="background-color: #ffbd5978; color: #ff9a00;">
+                                                                                                    {{$total_std_proposal}}
+                                                                                                </span>
                                                                                             </div>
                                                                                             <div class="mt-1">
-                                                                                                <span class="label_badge_radius" style="background-color: #d8fdd8; color: green;">4</span>
+                                                                                                <span class="label_badge_radius" style="background-color: #d8fdd8; color: green;">{{$total_submitted_proposal}}</span>
                                                                                             </div>
                                                                                         </td>
                                                                                         <td style="font-size: 11px; text-align:center;">
@@ -710,6 +723,9 @@ tbody, td, tfoot, th, thead, tr {
                                                                             @endif
                                                                         </tbody>
                                                                     </table>
+                                                                    <div class="text-center mt-1" id="pagination">
+                                                                        {{-- {{ $register_student_list->appends(request()->all())->links('pagination::bootstrap-4') }} --}}
+                                                                    </div>
                                                                 </div>
                                                             </div>
                                                         </div>
@@ -910,21 +926,28 @@ tbody, td, tfoot, th, thead, tr {
                                                                                     </tr>
                                                                                 </thead>
                                                                                 <tbody>
+                                                                                    @if(count($landing_wishlist) >0)
+                                                                                    @foreach($landing_wishlist as $key=>$row)
                                                                                     <tr>
-                                                                                        <td style="font-size: 11px;">1</td>
-                                                                                        <td style="font-size: 11px;"><span style="font-weight: bold !important;">name</span>
+                                                                                        <td style="font-size: 11px;">{{++$key}}</td>
+                                                                                        <td style="font-size: 11px;"><span style="font-weight: bold !important;">
+                                                                                            {{ $row->first_name }}  {{ $row->last_name }}
+                                                                                        </span>
                                                                                         </td>
                                                                                         <td style="font-size: 11px;">
                                                                                             <div class="scrolled_content_part">
                                                                                                 <div class="single_ad_pref_item">
                                                                                                     <div class="left" style="width:50%;">
                                                                                                         <div class="uni_details" style="display:flex;">
-                                                                                                            <div class="inner_left mt-1" style="border: 1px solid black; border-radius: 20px; padding: 9px 4px 5px 8px; height: 37px; width: 37px;">
+                                                                                                            {{-- <div class="inner_left mt-1" style="border: 1px solid black; border-radius: 20px; padding: 9px 4px 5px 8px; height: 37px; width: 37px;">
                                                                                                                 <i class="fa fa fa-university ms-1"></i>
-                                                                                                            </div>
+                                                                                                            </div> --}}
+                                                                                                            @if($row->nationality) 
+                                                                                                                <img class="img-responsive listFlag" style="border-radius: 20px; padding: 0px;height: 35px;width: 35px;" src="{{ asset('/assets/img/flags/4x3').'/'.strtolower(cn($row,'country_name.iso_3166_2','')).'.svg' }}" alt="Flag" data-toggle="tooltip" title="" data-placement="top">
+                                                                                                            @endif
                                                                                                             <div class="inner_right ms-2">
-                                                                                                                <strong style="font-size:13px;">university_name</strong></br>
-                                                                                                                <strong style="font-size:10px !important; font-weight:100 !important;">uni_website</strong>
+                                                                                                                <strong style="font-size:13px;">{{$row->university->name}}</strong></br>
+                                                                                                                <strong style="font-size:10px !important; font-weight:100 !important;">{{$row->uni_website}}</strong>
                                                                                                             </div>
                                                                                                         </div>
                                                                                                     </div>
@@ -933,13 +956,18 @@ tbody, td, tfoot, th, thead, tr {
                                                                                         </td>
                                                                                         <td class="text-center" style="font-size: 11px;">invitation date</td>
                                                                                         <td class="text-center" style="font-size: 11px;">signedup date</td>
-                                                                                        <td class="text-center" style="font-size: 11px;">mail sd icn</td>
+                                                                                        <td class="text-center" style="font-size: 11px;">
+                                                                                            <span class="invitation hand" data-id="{{ $row->id }}"><i class="fa fa-paper-plane"></i></span>
+                                                                                        </td>
                                                                                     </tr>
-                                                                                     <!-- <tr>
-                                                                                        <td colspan="5" class="text-center">
+                                                                                    @endforeach
+                                                                                    @else
+                                                                                    <tr>
+                                                                                        <td colspan="6" class="text-center">
                                                                                             <span class="text-danger">No data found!</span>
                                                                                         </td>
-                                                                                     </tr> -->
+                                                                                     </tr>
+                                                                                     @endif
                                                                                 </tbody>
                                                                             </table>
                                                                         </div>
@@ -1326,6 +1354,43 @@ tbody, td, tfoot, th, thead, tr {
             });
 
 
+            $('.invitation').on('click', function(e){
+                var self =$(this);
+                var id =$(this).data('id'); 
+
+                var form_data={
+                _token:"{{ csrf_token() }}",
+                'id':id, 
+                }
+                swal({
+                    title: "Are you sure?",
+                    text: "Do you want to send invaitation?",
+                    type: "warning",
+                    showCancelButton: true,
+                    confirmButtonClass: "btn btn-md btn-success",
+                    cancelButtonClass: 'btn btn-md btn-danger',
+                    confirmButtonText: "Yes"
+                }, function(isConfirm){
+
+                    if(isConfirm) {
+                        $.post("{{ route('ajax-post', ['name'=>'landing_invitation_email_send'])}}" ,form_data).done(function(res){
+
+                                pop_up_msg(res.msg); 
+                        }).fail(function(error){
+
+                                let msg='Sorry!, form submission failed try again later.';
+
+                                if(error.responseJSON.msg){
+                                    msg=error.responseJSON.msg;
+                                }
+
+                            pop_up_msg(msg, 'error');
+                        });
+                    }
+                });
+            });
+
+
             fetch_sub_content(
                 '#country_wise_university',
                 "{{ route('sub-content', ['name'=>'country_wise_university']) }}"

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

@@ -322,7 +322,7 @@
                                         <p class="text-muted1 mt-4 text-left" style="font-size: 14px !important;">"Pre-screening proposals can optimize the application process for supervisors and candidates. By using a tool to collect and organize information, including the proposal, Education Profile, English Proficiency, and Work Experience, supervisors can filter out unqualified applicants and provide feedback to candidates before they invest more time."</p>
                                         <p class="text-muted1 mt-4 text-left" style="font-size: 14px !important;">"The tool's centralized communication system saves time and enhances the applicant experience. Utilizing this efficient tool improves the quality of the candidate pool and allows supervisors to spend more time evaluating and nurturing potential candidates."</p>
                                         <div style="display: flex; justify-content: center;">
-                                            <p class="mt-4 mb-4"><span class="master-link secondary open_modal_page" data-title="Register Your Interest" data-url="{{route('modal-get',['name'=>'landing_ragister'])}}"><strong style="font-weight: bolder !important;">Register Your Interest <i class="fa fa-arrow-right fea icon-sm"></i> </strong> </span></p>    
+                                            <p class="mt-4 mb-4"><span class="master-link secondary open_modal_page hand" data-title="Register Your Interest" data-url="{{route('modal-get',['name'=>'landing_ragister_your_interest'])}}"><strong style="font-weight: bolder !important; cursor:pointer;">Register Your Interest <i class="fa fa-arrow-right fea icon-sm"></i> </strong> </span></p>    
                                         </div>
                                     </div>
                                 </div>

+ 12 - 5
resources/views/modal_pages/landing_ragister.blade.php → resources/views/modal_pages/landing_ragister_your_interest.blade.php

@@ -46,24 +46,31 @@
                         <div class="col-lg-12">
                             <div>
                                 <label class="form-label"></label>
-                                <select class="form-control" name="">
+                                <select class="form-control" name="country_id">
                                     <option selected disabled>Select Country</option>
+                                    @foreach($countries as $row)
+                                        <option value="{{$row->id}}">{{$row->name}}</option>
+                                    @endforeach
                                 </select>
                             </div>
                         </div><!--end col-->
                         <div class="col-lg-6">
                             <div class="mb-3">
                                 <label class="form-label"></label>
-                                <div class="form-icon position-relative">
-                                    <input type="text" class="form-control" placeholder="University Name" name="" required="">
-                                </div>
+                                <select class="form-control" name="university_id">
+                                    <option selected disabled>Select University</option>
+                                    @foreach($universities as $row)
+                                        <option value="{{$row->id}}">{{$row->name}}</option>
+                                    @endforeach
+                                </select>
+                                
                             </div>
                         </div><!--end col-->
                         <div class="col-lg-6">
                             <div class="mb-3">
                                 <label class="form-label"></label>
                                 <div class="form-icon position-relative">
-                                    <input type="text" class="form-control" placeholder="University Website" name="" required="">
+                                    <input type="text" class="form-control" placeholder="University Website" name="uni_website" required="">
                                 </div>
                             </div>
                         </div><!--end col-->

+ 7 - 0
sql/update.sql

@@ -139,3 +139,10 @@ CREATE TABLE `requirements` (
 COLLATE='utf8mb4_general_ci'
 ENGINE=InnoDB
 ;
+
+ALTER TABLE `users`
+	ADD COLUMN `landing_register` TINYINT(4) NULL DEFAULT '0' AFTER `admin_invite_id`;
+
+ALTER TABLE `users`
+	ADD COLUMN `invitation_date` DATETIME NULL DEFAULT NULL AFTER `landing_register`,
+	ADD COLUMN `registered_date` DATETIME NULL DEFAULT NULL AFTER `invitation_date`;