Skip to content

Commit 35a2f91

Browse files
authored
Merge pull request #3525 from ColoredCow/feat/profitability-employee-list
Added employee profitability list
2 parents 40dfef8 + e59722a commit 35a2f91

File tree

14 files changed

+144
-8
lines changed

14 files changed

+144
-8
lines changed

Modules/HR/Database/Seeders/HRPermissionsTableSeeder.php

+5
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ public function run()
119119
['name' => 'hr_job_requisition.update'],
120120
['name' => 'hr_job_requisition.delete'],
121121
];
122+
$employeePermission = [
123+
['name' => 'employee_profitability_list.view'],
124+
];
125+
122126
$allHrPermissions = array_merge(
123127
$hrUniversitiesPermissions,
124128
$hrApplicantsPermissions,
@@ -136,6 +140,7 @@ public function run()
136140
$hrSettingsPermissions,
137141
$hrDesignationPermissions,
138142
$jobRequistionPermissions,
143+
$employeePermission,
139144
);
140145
foreach ($allHrPermissions as $permission) {
141146
Permission::updateOrCreate($permission);

Modules/Report/Resources/views/finance/dashboard.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
</div>
7171

7272
<div class="col-md-3">
73-
<div class="card h-75 bg-theme-gray-lighter">
74-
<a class="card-body text-decoration-none" href="#">
73+
<div class="card h-75">
74+
<a class="card-body no-transition" href="{{ route('report.employees.profitibality',['staff_type'=>'Employee', 'status'=>'current']) }}">
7575
<h2 class="text-center">Employees</h2><br>
7676
</a>
7777
</div>

Modules/Report/Routes/web.php

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
| contains the "web" middleware group. Now create something great!
1111
|
1212
*/
13+
use Modules\HR\Http\Controllers\EmployeeController;
1314

1415
Route::prefix('report')->group(function () {
1516
Route::get('/', 'ReportController@index');
@@ -38,6 +39,10 @@
3839
Route::get('client-revenue-report-export', 'ClientRevenueReportController@clientRevenueReportExport')->name('reports.finance.client-revenue.report.export');
3940
});
4041

42+
Route::prefix('employee')->group(function () {
43+
Route::get('/profitibality', [EmployeeController::class, 'index'])->name('report.employees.profitibality');
44+
});
45+
4146
Route::prefix('monthly-sales-register')->group(function () {
4247
Route::get('/', 'MonthlySalesRegisterController@index')->name('reports.finance.monthly-sales-register.index');
4348
Route::get('/export', 'MonthlySalesRegisterController@exportReport')->name('reports.finance.monthly-sales-register.export');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Settings;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Models\Setting;
7+
use Illuminate\Http\Request;
8+
9+
class ProfitabilityController extends Controller
10+
{
11+
public function index()
12+
{
13+
$employeeEarningThreshold = Setting::where('setting_key', 'employee_earning_threshold')->value('setting_value');
14+
15+
return view('settings.employee-earning-threshold.index', ['employeeEarningThreshold' => $employeeEarningThreshold]);
16+
}
17+
18+
public function update(Request $request)
19+
{
20+
Setting::updateOrCreate(
21+
['module' => 'setting', 'setting_key' => 'employee_earning_threshold'],
22+
['setting_value' => $request->employee_earning_threshold]
23+
);
24+
25+
return redirect()->back()->with('status', 'Saved Successfully!');
26+
}
27+
}

public/icons/green-tick.svg

+1
Loading

public/icons/warning-symbol.svg

+1
Loading

resources/js/app.js

+4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ Vue.component(
8383
"user-dashboard-library",
8484
require("./components/Dashboard/UserDashboardLibrary.vue").default
8585
);
86+
Vue.component(
87+
"employee-profitability-list",
88+
require("./components/Dashboard/EmployeeProfitabilityList.vue").default
89+
);
8690
Vue.component(
8791
"user-dashboard-infrastructure",
8892
require("./components/Dashboard/UserDashboardInfrastructure.vue").default
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div class = "media">
3+
<div class="card">
4+
<div class="card-header p-1">
5+
<h3 class="text-center"><a href="/report/finance/employee/profitibality?staff_type=Employee&status=current">Employee Profitability List</a></h3>
6+
</div>
7+
<div class="md-0">
8+
<div class="card-body pt-3 h-325 w-md-389 w-389 overflow-y-scroll">
9+
<ul class="list list-group unstyled-list">
10+
<li class="d-flex justify-content-between">
11+
<div class="text-secondary"> Fetching latest data... </div>
12+
<h4 v-text="sentInvoiceCount"></h4>
13+
</li>
14+
<hr class="mt-1" />
15+
</ul>
16+
</div>
17+
</div>
18+
</div>
19+
</div>
20+
</template>
21+

resources/views/home.blade.php

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
<user-dashboard-library />
4545
</div>
4646
@endcan
47+
48+
@can('employee_profitability_list.view')
49+
<div class="pr-5 mb-4 min-w-389">
50+
<employee-profitability-list />
51+
</div>
52+
@endcan
4753

4854
@can('projects.view')
4955
<div class="pr-5 mb-4 min-w-389">

resources/views/hr/employees/index.blade.php

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
@extends('layouts.app')
2-
32
@section('content')
3+
4+
<!-- As of now we have hardCoded the earningValue until we unable to fetch the real data -->
5+
@php
6+
$routeName = Route::getCurrentRoute()->getName();
7+
$earningValue = 0;
8+
@endphp
49
<div class="container">
510
<br>
611
@include('hr.employees.menu')
@@ -30,6 +35,7 @@
3035
<thead class="thead-dark">
3136
<tr class="sticky-top">
3237
<th>Name</th>
38+
@if($routeName === "employee")
3339
<th>Active Projects Count</th>
3440
<th>
3541
Overall FTE
@@ -43,6 +49,14 @@
4349
<i class="fa fa-info-circle" aria-hidden="true"></i>
4450
</span>
4551
</th>
52+
@else
53+
<th>
54+
Employee Earning
55+
<span class="tooltip-wrapper" data-html="true" data-toggle="tooltip" title="Rate">
56+
<i class="fa fa-info-circle" aria-hidden="true"></i>
57+
</span>
58+
</th>
59+
@endif
4660
</tr>
4761
@foreach ($employees as $employee)
4862
<tr>
@@ -66,6 +80,7 @@ class="{{ config('constants.review-tags.completed.class') }} badge-pill mr-1 mb-
6680
@endif
6781
</a>
6882
</td>
83+
@if($routeName === "employee")
6984
<td>
7085
@if ($employee->user == null)
7186
0
@@ -80,6 +95,7 @@ class="{{ config('constants.review-tags.completed.class') }} badge-pill mr-1 mb-
8095
{{ $totalFTE }}
8196
@endif
8297
</td>
98+
if
8399
<td>
84100
<span class="text-success">
85101
{{ $user->total_hours['billable'] }}
@@ -89,6 +105,21 @@ class="{{ config('constants.review-tags.completed.class') }} badge-pill mr-1 mb-
89105
{{ $user->total_hours['non_billable'] }}
90106
</span>
91107
</td>
108+
@else
109+
<td>
110+
@if($earningValue >= 0)
111+
<span class="text-success">
112+
{{$earningValue}}
113+
<span class="d-inline-block pr-2 h-30 w-30">{!! file_get_contents(public_path('icons/green-tick.svg')) !!}</span>
114+
</span>
115+
@else
116+
<span class="text-secondary pl-2">
117+
{{$earningValue}}
118+
<span class="d-inline-block h-30 w-30">{!! file_get_contents(public_path('icons/warning-symbol.svg')) !!}</span>
119+
</span>
120+
@endif
121+
</td>
122+
@endif
92123
</tr>
93124
@endforeach
94125
</table>

resources/views/hr/employees/menu.blade.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,33 @@
22
<li class="nav-item">
33
@php
44
$params = array_merge(['staff_type' => 'Employee'], ['status' => 'current']);
5+
$route_name = Route::getCurrentRoute()->getName();
56
@endphp
6-
<a class="nav-item nav-link {{ request()->input('staff_type') === 'Employee' ? 'active' : '' }}" href="{{ route('employees',$params) }}"><i class="fa fa-users"></i>&nbsp; Employees </a>
7+
8+
<a class="nav-item nav-link {{ request()->input('staff_type') === 'Employee' ? 'active' : '' }}" href="{{ route($route_name,$params) }}"><i class="fa fa-users"></i>&nbsp; Employees </a>
79
</li>
810
<li class="nav-item">
911
@php
1012
$params = array_merge(['staff_type' => 'Intern'], ['status' => 'current']);
1113
@endphp
12-
<a class="nav-item nav-link {{ request()->input('staff_type') === 'Intern' ? 'active' : '' }}" href="{{ route('employees', $params) }}"><i class="fa fa-users"></i>&nbsp;Intern</a>
14+
<a class="nav-item nav-link {{ request()->input('staff_type') === 'Intern' ? 'active' : '' }}" href="{{ route($route_name, $params) }}"><i class="fa fa-users"></i>&nbsp;Intern</a>
1315
</li>
1416

1517
<li class="nav-item">
1618
@php
1719
$params = array_merge(['staff_type' => 'Contractor'], ['status' => 'current']);
1820
@endphp
19-
<a class="nav-item nav-link {{ request()->input('staff_type') === 'Contractor' ? 'active' : '' }}" href="{{ route('employees', $params) }}"><i class="fa fa-users"></i>&nbsp;Contractor</a>
21+
<a class="nav-item nav-link {{ request()->input('staff_type') === 'Contractor' ? 'active' : '' }}" href="{{ route($route_name, $params) }}"><i class="fa fa-users"></i>&nbsp;Contractor</a>
2022
</li>
2123

2224
<li class="nav-item">
2325
@php
2426
$params = array_merge(['staff_type' => 'Support Staff'], ['status' => 'current']);
2527
@endphp
26-
<a class="nav-item nav-link {{ request()->input('staff_type') === 'Support Staff' ? 'active' : '' }}" href="{{ route('employees', $params) }}"><i class="fa fa-users"></i>&nbsp;Support Staff</a>
28+
<a class="nav-item nav-link {{ request()->input('staff_type') === 'Support Staff' ? 'active' : '' }}" href="{{ route($route_name, $params) }}"><i class="fa fa-users"></i>&nbsp;Support Staff</a>
2729
</li>
2830

2931
<li class="nav-item">
30-
<a class="nav-item nav-link {{ Request::is('hr/employee-reports*') ? 'active' : '' }}" href="{{ route('employees.reports') }}"><i class="fa fa-pie-chart"></i>&nbsp;Reports</a>
32+
<a class="nav-item nav-link {{ Request::is('hr/employee-reports*') ? 'active' : '' }}" href="{{ route($route_name) }}"><i class="fa fa-pie-chart"></i>&nbsp;Reports</a>
3133
</li>
3234
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@extends('user::layouts.master')
2+
3+
@section('content')
4+
5+
<form action="{{ route('settings.update-employee-earning-threshold') }}" method="POST">
6+
@csrf
7+
<div class="container">
8+
<div class="row justify-content-start">
9+
<div class="col-6">
10+
<label class="user-settings fz-24">Config Variable</label>
11+
</div>
12+
</div>
13+
<div class="col" id="user-settings-content">
14+
<div class="card-body">
15+
<h5 class="max-interview-heading fz-20"> Threshold value
16+
<input type="number" class="col-xs text-center outline-none h-40 w-auto rounded-12 quantity" id="quantity" name="employee_earning_threshold" value="{{ old('employee_earning_threshold', $employeeEarningThreshold) }}">
17+
</h5>
18+
<input type="submit" class="btn btn-primary" value="Save">
19+
</div>
20+
</div>
21+
</div>
22+
</form>
23+
@endsection

resources/views/settings/index.blade.php

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
</a>
5858
</div>
5959
</div>
60+
<div class="col-md-4">
61+
<div class="card h-75 mx-4 mt-3 mb-5 ">
62+
<a class="card-body no-transition" href="{{ route('settings.employee-earning-threshold') }}">
63+
<br>
64+
<h2 class="text-center">Config Variable</h2><br>
65+
</a>
66+
</div>
67+
</div>
6068
</div>
6169
</div>
6270
@endsection

routes/web.php

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999

100100
Route::prefix('settings')->namespace('Settings')->group(function () {
101101
Route::get('/', 'SettingController@index')->name('settings.index');
102+
Route::get('/employee-earning-threshold', 'profitabilityController@index')->name('settings.employee-earning-threshold');
103+
Route::post('/employee-earning-threshold', 'profitabilityController@update')->name('settings.update-employee-earning-threshold');
102104

103105
Route::prefix('permissions')->group(function () {
104106
Route::get('/', function () {

0 commit comments

Comments
 (0)