Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard hiring activity #3496

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace App\Http\Controllers\HR\Applications;

use Illuminate\Support\Facades\Request;
use Modules\HR\Entities\Application;
use Illuminate\Routing\Controller;
use Carbon\Carbon;

class RecruitmentApplicationController extends Controller
{

/**
* Display a listing of the resource.
*/
public function index()

Check warning on line 16 in app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php

View check run for this annotation

Codecov / codecov/patch

app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php#L16

Added line #L16 was not covered by tests
{
$filter = request()->filter;

Check warning on line 18 in app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php

View check run for this annotation

Codecov / codecov/patch

app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php#L18

Added line #L18 was not covered by tests

switch ($filter) {
case 'last-week':
$startDate = Carbon::now()->startOfWeek()->subWeek();
$endDate = Carbon::now()->endOfWeek()->subWeek();
break;
case 'last-month':
$startDate = Carbon::now()->startOfMonth()->subMonth();
$endDate = Carbon::now()->endOfMonth()->subMonth();
break;
case 'last-quarter':
$startDate = Carbon::now()->startOfQuarter()->subQuarter();
$endDate = Carbon::now()->endOfQuarter()->subQuarter();
break;

Check warning on line 32 in app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php

View check run for this annotation

Codecov / codecov/patch

app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php#L21-L32

Added lines #L21 - L32 were not covered by tests
}

$rejectedApplicationCount = Application::rejected()
->whereDate('updated_at', '>=', $startDate)
->whereDate('updated_at', '<=', $endDate)
->count();

Check warning on line 38 in app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php

View check run for this annotation

Codecov / codecov/patch

app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php#L35-L38

Added lines #L35 - L38 were not covered by tests

$receivedApplicationCount = Application::whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count();

Check warning on line 42 in app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php

View check run for this annotation

Codecov / codecov/patch

app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php#L40-L42

Added lines #L40 - L42 were not covered by tests

// $introductoryApplicationCount = Application::whereDate('updated_at', '>=', $startDate)
// ->whereDate('updated_at', '<=', $endDate)
// ->applicationRounds()->introductoryCall()
// ->count();

// $newApplicationCount = Application::whereDate('updated_at', '>=', $startDate)
// ->whereDate('updated_at', '<=', $endDate)
// ->applicationRounds()->resumeScreening()
// ->count();

return [
"total_received_applications" => $receivedApplicationCount,
"total_rejected_applications" => $rejectedApplicationCount,
"total_introductory_call_applications" => 30,
"total_new_applications" => 40,
];

Check warning on line 59 in app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php

View check run for this annotation

Codecov / codecov/patch

app/Http/Controllers/HR/Applications/RecruitmentApplicationController.php#L54-L59

Added lines #L54 - L59 were not covered by tests
}
}
16 changes: 16 additions & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ Vue.component(
"user-dashboard-library",
require("./components/Dashboard/UserDashboardLibrary.vue").default
);
Vue.component(
"user-dashboard-hiring",
require("./components/Dashboard/UserDashboardHiringActivity.vue").default
);
Vue.component(
"user-hiring-last-week",
require("./components/Dashboard/UserDashboardHiringLastWeek.vue").default
);
Vue.component(
"user-hiring-last-month",
require("./components/Dashboard/UserDashboardHiringLastMonth.vue").default
);
Vue.component(
"user-hiring-last-quarter",
require("./components/Dashboard/UserDashboardHiringLastQuarter.vue").default
);
Vue.component(
"user-dashboard-infrastructure",
require("./components/Dashboard/UserDashboardInfrastructure.vue").default
Expand Down
69 changes: 69 additions & 0 deletions resources/js/components/Dashboard/UserDashboardHiringActivity.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<template>
<div class="card text-center card text-center w-xl-389 h-xl-416">
<div class="card-header p-1">
<h3><a href="/hr/recruitment/job">Hiring Activity</a></h3>
</div>
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs flex-nowrap">
<li class="nav-item">
<a
id="last-week"
class="nav-link c-pointer active"
@click="setActiveTile('last-week')"
>Last week</a
>
</li>
<li class="nav-item">
<a
id="last-month"
class="nav-link c-pointer"
@click="setActiveTile('last-month')"
>Last month</a
>
</li>

<li class="nav-item">
<a
id="last-quarter"
class="nav-link c-pointer"
@click="setActiveTile('last-quarter')"
>Last quarter</a
>
</li>
</ul>
</div>
<div class="card-body pt-3 h-318 w-md-389 w-389 overflow-y-scroll">
<div v-show="this.activeTile == 'last-week'">
<user-hiring-last-week />
</div>
<span v-show="this.activeTile == 'last-month'">
<user-hiring-last-month />
</span>
<span v-show="this.activeTile == 'last-quarter'">
<user-hiring-last-quarter />
</span>
</div>
</div>
</template>

<script>
export default {
props: [],
data() {
return {
activeTile: "last-week",
};
},

methods: {
setActiveTile(tile) {
this.activeTile = tile;
document.querySelector("#last-week").classList.remove("active");
document.querySelector("#last-month").classList.remove("active");
document.querySelector("#last-quarter").classList.remove("active");
document.querySelector(`#${tile}`).classList.add("active");
},
},
};
</script>

47 changes: 47 additions & 0 deletions resources/js/components/Dashboard/UserDashboardHiringLastMonth.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<div class="px-2 pt-2">
<div class="row text-left d-flex justify-content-between" >
<div class="text-secondary"> Total received applications </div>
<h4>{{ this.hiringData.total_received_applications }}</h4>
</div>
<hr class="mt-1">
<div class="row text-left d-flex justify-content-between mt-2" >
<div class="text-secondary"> Total rejected applications </div>
<h4>{{ this.hiringData.total_rejected_applications }}</h4>
</div>
<hr class="mt-1">
<div class="row text-left d-flex justify-content-between mt-2" >
<div class="text-secondary"> Total introductory call applications </div>
<h4>{{ this.hiringData.total_introductory_call_applications }}</h4>
</div>
<hr class="mt-1">
<div class="row text-left d-flex justify-content-between mt-2" >
<div class="text-secondary"> Total new applications </div>
<h4>{{ this.hiringData.total_new_applications }}</h4>
</div>
<hr class="mt-1">
</div>
</template>

<script>
export default {
props: [],
data() {
return {
hiringData:[]
};
},

methods: {
async getHiringData() {
let response = await axios.post("/dashboart/hiring-activity", {"filter" : "last-month"});
this.hiringData = response.data;

}
},

mounted() {
this.getHiringData();
}
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<div class="px-2 pt-2">
<div class="row text-left d-flex justify-content-between" >
<div class="text-secondary"> Total received applications </div>
<h4>{{ this.hiringData.total_received_applications }}</h4>
</div>
<hr class="mt-1">
<div class="row text-left d-flex justify-content-between mt-2" >
<div class="text-secondary"> Total rejected applications </div>
<h4>{{ this.hiringData.total_rejected_applications }}</h4>
</div>
<hr class="mt-1">
<div class="row text-left d-flex justify-content-between mt-2" >
<div class="text-secondary"> Total introductory call applications </div>
<h4>{{ this.hiringData.total_introductory_call_applications }}</h4>
</div>
<hr class="mt-1">
<div class="row text-left d-flex justify-content-between mt-2" >
<div class="text-secondary"> Total new applications </div>
<h4>{{ this.hiringData.total_new_applications }}</h4>
</div>
<hr class="mt-1">
</div>
</template>

<script>
export default {
props: [],
data() {
return {
hiringData:[]
};
},

methods: {
async getHiringData() {
let response = await axios.post("/dashboart/hiring-activity", {"filter" : "last-quarter"});
this.hiringData = response.data;

}
},

mounted() {
this.getHiringData();
}
};
</script>
47 changes: 47 additions & 0 deletions resources/js/components/Dashboard/UserDashboardHiringLastWeek.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<div class="px-2 pt-2">
<div class="row text-left d-flex justify-content-between" >
<div class="text-secondary"> Total received applications </div>
<h4>{{ this.hiringData.total_received_applications }}</h4>
</div>
<hr class="mt-1">
<div class="row text-left d-flex justify-content-between mt-2" >
<div class="text-secondary"> Total rejected applications </div>
<h4>{{ this.hiringData.total_rejected_applications }}</h4>
</div>
<hr class="mt-1">
<div class="row text-left d-flex justify-content-between mt-2" >
<div class="text-secondary"> Total introductory call applications </div>
<h4>{{ this.hiringData.total_introductory_call_applications }}</h4>
</div>
<hr class="mt-1">
<div class="row text-left d-flex justify-content-between mt-2" >
<div class="text-secondary"> Total new applications </div>
<h4>{{ this.hiringData.total_new_applications }}</h4>
</div>
<hr class="mt-1">
</div>
</template>

<script>
export default {
props: [],
data() {
return {
hiringData:[]
};
},

methods: {
async getHiringData() {
let response = await axios.post("/dashboart/hiring-activity", {"filter" : "last-week"});
this.hiringData = response.data;

}
},

mounted() {
this.getHiringData();
}
};
</script>
6 changes: 6 additions & 0 deletions resources/views/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
</div>
@endcan

@if(Module::checkStatus('HR') && auth()->user()->can('hr_recruitment_jobs.view'))
<div class="mr-5 mr-md-3 pr-md-0 pr-4 mb-4 min-w-389">
<user-dashboard-hiring />
</div>
@endif

@can('projects.view')
<div class="pr-5 mb-4 min-w-389">
<user-dashboard-projects />
Expand Down
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,5 @@
Route::get('user/read-books', 'UserBookController@index');
Route::get('user/wishlist-books', 'UserBookController@booksInWishlist');
Route::get('user/projects', 'UserController@projects');
Route::post('dashboart/hiring-activity', 'HR\Applications\RecruitmentApplicationController@index');
});
Loading