Browse Source

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

Israat Zarin 2 years ago
parent
commit
d0b082a9f6

+ 33 - 1
app/Helpers/functions.php

@@ -81,10 +81,42 @@ if(!function_exists('teacherRefNoGenerate')){
 	    	$currentIdExist =\DB::table('users')->where('user_type',2)->where('id',$currentId)->exists();
 	    }while($currentIdExist); 
 	     
-	    return date('y').intval(date('m')).'00'.$currentId.'R';
+	    return date('y').intval(date('m')).str_pad($currentId, 3, "0", STR_PAD_LEFT).'R';
 	}
 
 }  
+
+
+if(!function_exists('studentRefNoGenerate')){
+
+	function studentRefNoGenerate(){
+	    $currentId = \DB::table('student_proposals')->count();
+
+	    do{
+	    	++$currentId;
+	    	$currentIdExist =\DB::table('student_proposals')->where('id',$currentId)->exists();
+	    }while($currentIdExist); 
+	     
+	    return date('y').intval(date('m')).str_pad($currentId, 2, "0", STR_PAD_LEFT);
+	}
+
+}  
+
+if(!function_exists('proposalRefNoGenerate')){
+
+	function proposalRefNoGenerate(){
+	    $currentId = \DB::table('proposal')->count();
+
+	    do{
+	    	++$currentId;
+	    	$currentIdExist =\DB::table('proposal')->where('id',$currentId)->exists();
+	    }while($currentIdExist); 
+	     
+	    return str_pad($currentId, 3, "10", STR_PAD_LEFT);
+	}
+
+} 
+ 
  
  
 if(!function_exists('name_initials')){

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

@@ -56,7 +56,7 @@ class AjaxController extends Controller
             }else{
 
                 return response(
-                    ['msg'=>'Sorry!, old password does not matched with login credential.'],
+                    ['msg'=>'Sorry!, old password does not match with login credential.'],
                     403
                 );
 

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

@@ -28,6 +28,9 @@ class ModalController extends Controller{
             $data['teacher'] = User::find($req->id); 
             $data['student'] = User::find($user->id); 
             $data['proposal']= Proposal::where('student_id',$user->id)->get(); 
+        }elseif($name=="view_apply_proposal"){
+            $data['std_proposal'] =StudentProposal::find($req->id); 
+
         } else $name='default';
 
         return view("modal_pages.{$name}", $data);
@@ -60,6 +63,7 @@ class ModalController extends Controller{
             $student_proposal->start_year =$req->startdate;
             $student_proposal->start_month =$req->startmonth;
             $student_proposal->created_by =$user->id;
+            $student_proposal->student_apply_ref =studentRefNoGenerate();
             $student_proposal->save(); 
 
             $user =User::find($req->id);

+ 2 - 1
app/Http/Controllers/StudentHomeController.php

@@ -24,7 +24,7 @@ class StudentHomeController extends Controller
 
    public function index(){
       $user = Auth::user();
-      $student_proposal =StudentProposal::where('student_id',$user->id)->get();
+      $student_proposal =StudentProposal::where('student_id',$user->id)->orderBy('id','DESC')->get();
       return view('home',compact('student_proposal'));
    }
 
@@ -82,6 +82,7 @@ class StudentHomeController extends Controller
      {
          $proposal= New  Proposal;
          $proposal->student_id= Auth::user()->id;
+         $proposal->proposal_ref= proposalRefNoGenerate();
          $proposal->title= $request->title;
          $proposal->methology= $request->methology;
          $proposal->department= $request->department;

+ 5 - 5
app/StudentProposal.php

@@ -7,19 +7,19 @@ use Illuminate\Database\Eloquent\Model;
 class StudentProposal extends Model
 {
     public function teacher_details(){
-        return $this->belongsTo('App\User','teacher_id');
+        return $this->belongsTo(User::class,'teacher_id');
     }
     public function student_details(){
-        return $this->belongsTo('App\User','student_id');
+        return $this->belongsTo(User::class,'student_id');
     }
 
     public function institutes()
     {
-        return $this->belongsTo('App\Institution', 'student_id','student_id');
+        return $this->belongsTo(Institution::class, 'student_id','student_id');
     } 
     public function scores()
     {
-        return $this->belongsTo('App\Score', 'student_id','student_id');
+        return $this->belongsTo(Score::class, 'student_id','student_id');
     } 
     public function work_experience()
     {
@@ -27,6 +27,6 @@ class StudentProposal extends Model
     } 
     public function proposal()
     {
-        return $this->belongsTo(Proposal::class, 'student_id','student_id');
+        return $this->belongsTo(Proposal::class, 'proposal_id','id');
     } 
 }

+ 15 - 6
resources/views/home.blade.php

@@ -109,15 +109,24 @@
                                                     @foreach($student_proposal as $key=>$row)
                                                     <tr> 
                                                         <td style="font-size: 11px;">{{++$key}}</td>
-                                                        <td style="font-size: 11px;">23301</td>
+                                                        <td style="font-size: 11px;">{{$row->student_apply_ref}}</td>
                                                         <td style="font-size: 11px;"><strong>{{ cn($row,'teacher_details.first_name','')}} {{ cn($row,'teacher_details.last_name','')}}</strong><br>
-                                                        <span>designation</span></td> 
+                                                        <span>{{cn($row,'teacher_details.designation','')}}</span></td> 
                                                         <td style="font-size: 11px;">{{cn($row,'teacher_details.university_name','')}}</br>
-                                                        <span>department</span></td> 
-                                                        <td style="font-size: 11px;"><strong>10{{$key+1}}</strong></td>
-                                                        <td style="font-size: 11px;">20 March 2023</td> 
+                                                        <span>{{cn($row,'teacher_details.department','')}}</span></td> 
+                                                        <td style="font-size: 11px;">
+                                                            @php
+                                                               $proposal =\DB::table('proposal')->where('id',$row->proposal_id)->where('student_id',$row->student_id)->first();
+                                                            @endphp
+                                                            @if($proposal) 
+                                                            <strong>{{ $proposal->proposal_ref}}</strong>
+                                                            @endif
+                                                        </td>
+                                                        <td style="font-size: 11px;">{{date('d M Y', strtotime($row->created_at))}}</td> 
                                                         <td style="text-align:center; font-size: 11px;">Applied</td>
-                                                        <td style="text-align:center; font-size: 11px;"><i class="fa fa-eye"></i></td>
+                                                        <td style="text-align:center; font-size: 11px;">
+                                                           <span class="open_modal_page hand" data-url="{{route('modal-get',['name'=>'view_apply_proposal','id'=>$row->id])}}"><i class="fa fa-eye"></i></span> 
+                                                        </td>
                                                     </tr>
                                                     @endforeach
                                                 </tbody>

+ 1 - 1
resources/views/modal_pages/apply_student_proposal.blade.php

@@ -26,7 +26,7 @@
                         <div class="custom-control custom-radio custom-control-inline">
                             <div class="form-check mb-0">
                                 <input class="form-check-input" type="radio" name="proposal_id" value="{{$row->id}}" id="flexRadioDefault1">
-                                <label class="form-check-label" for="flexRadioDefault1">{{$row->title}}</label>
+                                <label class="form-check-label" for="flexRadioDefault1">({{ $row->proposal_ref}})-{{$row->title}}</label>
                             </div>
                         </div>
                     </div>

+ 63 - 0
resources/views/modal_pages/view_apply_proposal.blade.php

@@ -0,0 +1,63 @@
+@extends('modal_pages.base')
+
+@section('main')
+ 
+    <div class="container mt-3">
+        <div class="col-md-12">
+            <div class="alert p-3" style="background-color:white;"> 
+                <span style="margin: 0px;">{{cn($std_proposal,'teacher_details.first_name','')}} {{cn($std_proposal,'teacher_details.last_name','')}}</span></br>
+                <span class="text-muted" style="font-weight: 500;">{{cn($std_proposal,'teacher_details.designation','')}}</span></br>
+                <span class="text-muted" style="font-weight: 500;">{{cn($std_proposal,'teacher_details.department','')}}</span>
+                <span>.</span>
+                <span class="text-muted" style="font-weight: 500;">{{cn($std_proposal,'teacher_details.university_name','')}} </span>
+            </div>
+        </div>
+
+        <div class="middle p-3" style="background-color:white; border-radius:6px;">
+            <p class="mb-3" style="font-size:14px;">Please select which proposal you want to send</p>
+            <div class="alert mt-1 mb-3 propose" style="padding: 0px;">
+                <div style="width:100%;">
+                    
+                    <div class="mt-2 p-2" style="border-bottom:2px solid #eee;">
+                        <div class="custom-control custom-radio custom-control-inline">
+                            <div class="form-check mb-0"> 
+                                <label class="form-check-label" for="flexRadioDefault1">({{cn($std_proposal,'proposal.proposal_ref','')}})-{{cn($std_proposal,'proposal.title','')}}</label>
+                            </div>
+                        </div>
+                    </div>
+                  
+                   
+                </div>
+            </div> 
+        </div>
+    </div>
+    <div class="container mt-4">
+        <div class="col-md-12 p-3" style="background-color:white; border-radius:6px;"> 
+            <div class="row">
+                <div class="col-md-6">
+                    <div class="mb-1"> 
+                        <div class="form-icon position-relative">
+                            Start Year : {{date("M", mktime(0, 0, 0, $std_proposal->start_month, 10))}} {{ $std_proposal->start_year}}
+                        </div>
+                    </div>
+                </div>
+                {{-- <div class="col-md-6">
+                    <div class="mb-1">
+                           
+                        <div class="form-icon position-relative">
+                             Start Month : 
+                        </div>
+                    </div>
+                </div> --}}
+            </div>
+        </div> 
+    </div>
+ 
+
+<script>
+    $(function(){
+        // $('.select2').select2();
+        $('#modal_page_footer').hide(); 
+    });
+    </script>
+@endsection

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

@@ -108,7 +108,7 @@
                                                                 @foreach($proposal as $key=>$row)    
                                                                     <div class="single_ad_pref_item2">
                                                                         <div class="student mt-2 pt-1" style="width: 7.9%;">                                                                                                                                    
-                                                                            <strong style="font-size:13px; margin-left: 20px;">10{{$key+1}}</strong>                                                               
+                                                                            <strong style="font-size:13px; margin-left: 20px;">{{$row->proposal_ref}}</strong>                                                               
                                                                         </div>
                                                                         <div class="pro_title mb-2" style="width: 69%;">
                                                                             <h6 style="font-size:13px !important;; font-weight:600 !important;">{{$row->title}}</h6>