|
@@ -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);
|