Skip to content

Commit

Permalink
Merge pull request #147 from byterays/muniraj_new
Browse files Browse the repository at this point in the history
Candidate profile #105
  • Loading branch information
Bishal-Khatri committed Apr 21, 2022
2 parents 82066fa + 46ea33c commit 1dcbdbe
Show file tree
Hide file tree
Showing 32 changed files with 1,303 additions and 159 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Candidates/DashController.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public function applyjob($id)
$employ = Employe::where('user_id', auth()->user()->id)->first();
// $employ = \DB::table('employes')->where('user_id', auth()->user()->id)->first();
$is_exist = \DB::table("job_applications")->where('job_id', $id)->where('employ_id', $employ->id)->first();
if ($employ->calculateProfileCompletion() > 80) {
if ($employ->calculateProfileCompletion() > 50) {
if (!$is_exist) {
\DB::table("job_applications")->insert([
"job_id" => $id,
Expand All @@ -294,7 +294,7 @@ public function applyjob($id)
return redirect()->route('candidate.dashboard')->with(notifyMsg('warning', 'You have already applied for this job'));
}
} else {
return redirect()->route('candidate.profile.get_personal_information')->with(notifyMsg('warning', 'You are not eligible to apply for job. Please Complete your profile first.x'));
return redirect()->route('candidate.profile.get_personal_information')->with(notifyMsg('warning', 'You are not eligible to apply for job. Please Complete your profile first'));
}

}
Expand Down
26 changes: 26 additions & 0 deletions app/Http/Controllers/Candidates/JobSettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public function get_job_preference()

}

public function get_job_alert()
{
return $this->client_view($this->page."get_job_alert");

}

public function post_job_preference(Request $request)
{
// $validator = Validator::make($request->all(),[
Expand Down Expand Up @@ -83,5 +89,25 @@ public function post_job_preference(Request $request)
}
}


public function updateJobNotification(Request $request)
{
if($request->notify == 'job_notify'){
$this->employe()->update([
'job_notify' => $request->name == 1 ? 0 : 1,
]);
$job_notify = $this->employe()->refresh()->job_notify;
$msg = $job_notify == 1 ? 'Job notification for preferred job enabled' : 'Job notification for preferred job disabled';
return response()->json(['msg' => $msg, 'value' => $job_notify]);
}
if($request->notify == 'all_job_notify'){
$this->employe()->update([
'all_job_notify' => $request->name == 1 ? 0 : 1,
]);
$all_job_notify = $this->employe()->all_job_notify;
$msg = $all_job_notify == 1 ? 'All job notification enabled' : 'All job notification disabled';
return response()->json(['msg' => $msg, 'value' => $all_job_notify]);
}
}

}
61 changes: 60 additions & 1 deletion app/Http/Controllers/Candidates/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public function post_personal_information(Request $request)
'first_name' => $request->first_name,
'middle_name' => $request->middle_name,
'last_name' => $request->last_name,
'dob_in_bs' => $request->nepali_dob,
'dob' => $request->english_dob,
'gender' => $request->gender,
'marital_status' => $request->marital_status,
Expand Down Expand Up @@ -295,14 +296,72 @@ public function post_experience(Request $request)
$employe->update($fields);
$this->__updateExperience($employe->id, $request);
DB::commit();
$redirectTo = route('candidate.profile.get_preview');
$redirectTo = route('candidate.profile.get_preferred_jobs');
// $redirectTo = route('candidate.profile.get_preview');
return response()->json(['redirectRoute' => $redirectTo]);
} catch (\Exception $e) {
DB::rollBack();
return response()->json(['db_error' => $e->getMessage()]);
}
}

public function get_preferred_jobs()
{
$employ = $this->employe();
return $this->client_view('candidates.profile.get_preferred_jobs',[
'employ' => $employ
]);
}

public function post_preferred_jobs(Request $request)
{
try{
DB::beginTransaction();
if(in_array(!null, $request->categories) || in_array(!null, $request->countries) || in_array(!null, $request->job_title)){
$preferences = EmployJobPreference::where('employ_id', $this->employe()->id);
if($preferences->exists()){
$preferences->delete();
}

$this->employe()->update([
'job_notify' => $request->has('job_notify') ? 1 : 0,
]);


foreach($request->categories as $key => $category){
if($category != null){
EmployJobPreference::create([
'employ_id' => $this->employe()->id,
'job_category_id' => $category,
]);
}
}
foreach($request->countries as $key => $country){
if($country != null){
EmployJobPreference::create([
'country_id' => $country,
'employ_id' => $this->employe()->id,
]);
}
}
foreach($request->job_title as $key => $job_title){
if($job_title != null){
EmployJobPreference::create([
'job_title' => $job_title,
'employ_id' => $this->employe()->id,
]);
}
}
}

DB::commit();
return response()->json(['msg' => 'Job Preference updated successfully', 'redirectRoute' => route('candidate.profile.get_preview')]);
} catch(\Exception $e){
DB::rollBack();
return response()->json(['db_error' => $e->getMessage()]);
}
}

public function get_preview()
{
$employ = Employe::where('user_id', Auth::user()->id)->with(['user:id,email', 'country:id,name', 'state:id,name', 'city:id,name', 'education_level:id,title', 'employeeSkills.skill:id,title', 'employeeLanguage.language:id,lang', 'experience.country:id,name', 'experience.job_category:id,functional_area', 'experience.job:id,title'])->first();
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Company/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function updateJob(Request $request, $id)
$oldStatus = $job->status;
$oldDraftStatus = $job->draft_status;
$this->__saveOrUpdateJob($job, $request, $oldImage, $oldPicture);
$job->status = $request->status != null ? $request->status : $oldStatus;
$job->status = $request->status != null ? $request->status : ($oldStatus == null ? 'Draft' : $oldStatus);
if($request->status == 'Published'){
$job->publish_status = date('Y-m-d H:i:s');
}
Expand Down
12 changes: 12 additions & 0 deletions app/Http/Helper/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,16 @@ function parseDate($date){
function getFormattedDate($date, $format){
return !($date != null) ?: date($format, strtotime($date));
}
}

if(!function_exists('getYearForm')){
function getYearForm($year){
return $year > 1 ? 'years' : 'year';
}
}

if(!function_exists('getMonthForm')){
function getMonthForm($month){
return $month > 1 ? 'months' : 'month';
}
}
3 changes: 2 additions & 1 deletion app/Models/Employe.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class Employe extends Model
'city_street',
'bio',
'website',
'job_notify'
'job_notify',
'all_job_notify'
];


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddAllJobNotifyToEmployesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('employes', function (Blueprint $table) {
$table->tinyInteger('all_job_notify')->default(0)->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('employes', function (Blueprint $table) {
//
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<div class="form-group">
<label for="" class="form-label">Experience</label>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-4">
<label for="">Country</label>
</div>
<div class="col-md-8">
<select name="country_id[]" class="form-control select2-show-search" data-placeholder="Select Country" id="">
<option value="">Select Country</option>
@foreach ($countries as $country)
<option value="{{ $country->id }}">{{ $country->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-4">
<label for="">Job Category</label>
</div>
<div class="col-md-8">
<select name="job_category_id[]" class="form-control select2-show-search"
data-placeholder="Select Job Category" id="">
<option value="">Select Job Category</option>
@foreach ($job_categories as $job_category)
<option value="{{ $job_category->id }}">
{{ $job_category->functional_area }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-4">
<label for="">Job Title</label>
</div>
<div class="col-md-8">
<select name="job_title[]" class="form-control select2-show-search" data-placeholder="Select Job Title"
id="">
<option value="">Select Job Title</option>
@foreach ($jobs as $job)
<option value="{{ $job->id }}">{{ $job->title }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-4">
<label for="">Working Duration</label>
</div>
<div class="col-md-4">
<select name="working_year[]" class="form-control select2" id="">
<option value="">Year</option>
<?php
$dyear = old('year');
$year = date('Y');
$min = $year - 250;
$max = $year;
for ($i = $max; $i >= $min; $i--) {
$selected = $dyear == $i ? 'selected' : '';
echo "<option value='$i' $selected>$i</option>";
}
?>
</select>
</div>
<div class="col-md-4">
<select name="working_month[]" class="form-control select2" id="">
<option value="">Month</option>
<?php
$dmonth = old('month');
?>
<?php for( $m = 1; $m <= 12; ++$m ) {
$month_label = date('F', mktime(0, 0, 0, $m, 1));
$selected_month = $dmonth == $month_label ? 'selected' : '';
?>
<option value="<?php echo $month_label; ?>" <?php echo $selected_month; ?>>
<?php echo $month_label; ?>
</option>
<?php } ?>
</select>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -57,32 +57,19 @@
<div class="col-md-4">
<select name="working_year[]" class="form-control select2" id="">
<option value="">Year</option>
<?php
$dyear = old('year');
$year = date('Y');
$min = $year - 250;
$max = $year;
for ($i = $max; $i >= $min; $i--) {
$selected = $dyear == $i ? 'selected' : '';
echo "<option value='$i' $selected>$i</option>";
}
?>
@for ($i = 0; $i <= 10; $i++)
<option value="{{ $i }}">
{{ $i }}</option>
@endfor
</select>
</div>
<div class="col-md-4">
<select name="working_month[]" class="form-control select2" id="">
<option value="">Month</option>
<?php
$dmonth = old('month');
?>
<?php for( $m = 1; $m <= 12; ++$m ) {
$month_label = date('F', mktime(0, 0, 0, $m, 1));
$selected_month = $dmonth == $month_label ? 'selected' : '';
?>
<option value="<?php echo $month_label; ?>" <?php echo $selected_month; ?>>
<?php echo $month_label; ?>
</option>
<?php } ?>
@for ($i = 0; $i <= 12; $i++)
<option value="{{ $i }}">
{{ $i }}</option>
@endfor
</select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div class="row">
<div class="col-md-6">
<select name="language[]" class="form-control select2">
<select name="language[]" class="form-control select2-show-search" data-placeholder="Select Language">
<option value="">Select Language</option>
@foreach ($languages as $language)
<option value="{{ $language->id }}">{{ $language->lang }}</option>
@endforeach
</select>
</div>
<div class="col-md-6">
<select name="language_level[]" class="form-control select2">
<select name="language_level[]" class="form-control select2-show-search" data-placeholder="Select Level">
<option value="">Select Level</option>
<option value="Very Good">Very Good</option>
<option value="Good">Good</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="tabs-menu ">
<!-- Tabs -->
<ul class="nav panel-tabs">
<li class=""><a href="{{ route('candidate.account_setting.index') }}" class="{{ !$_editProfile ?: 'active' }}">{{ strtoupper(__('Edit Profile')) }}</a></li>
{{-- <li class=""><a href="{{ route('candidate.account_setting.index') }}" class="{{ !$_editProfile ?: 'active' }}">{{ strtoupper(__('Edit Profile')) }}</a></li> --}}
<li><a href="{{ route('candidate.account_setting.get_change_password') }}" class="{{ !$_changePassword ?: 'active' }}">{{ strtoupper(__('Change Password')) }}</a></li>
<li><a href="{{ route('candidate.account_setting.get_account_setting') }}" class="{{ !$_deleteAccount ?: 'active' }}">{{ strtoupper(__('Deactivate My Account')) }}</a></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
$route = 'candidate.';
$RouteName = Route::currentRouteName();
$_preferJob = $RouteName == $route . 'job_setting.index';
$_jobalert = $RouteName == $route . 'account_setting.get_change_password';
$_jobalert = $RouteName == $route . 'job_setting.get_job_alert';
?>
<div class="tab-menu-heading">
<div class="tabs-menu ">
<!-- Tabs -->
<ul class="nav panel-tabs">
<li class=""><a href="{{ route('candidate.account_setting.index') }}" class="{{ !$_preferJob ?: 'active' }}">{{ strtoupper(__('Preferred Job')) }}</a></li>
<li><a href="{{ route('candidate.account_setting.get_change_password') }}" class="{{ !$_jobalert ?: 'active' }}">{{ strtoupper(__('Job Alert')) }}</a></li>
{{-- <li class=""><a href="{{ route('candidate.job_setting.index') }}" class="{{ !$_preferJob ?: 'active' }}">{{ strtoupper(__('Preferred Job')) }}</a></li> --}}
<li><a href="{{ route('candidate.job_setting.get_job_alert') }}" class="{{ !$_jobalert ?: 'active' }}">{{ strtoupper(__('Job Alert')) }}</a></li>
</ul>
</div>
</div>
Loading

0 comments on commit 1dcbdbe

Please sign in to comment.