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

Added employee profitability list #3525

Merged
merged 26 commits into from
Apr 16, 2024
Merged
Changes from 24 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
4 changes: 2 additions & 2 deletions Modules/Report/Resources/views/finance/dashboard.blade.php
Original file line number Diff line number Diff line change
@@ -70,8 +70,8 @@
</div>

<div class="col-md-3">
<div class="card h-75 bg-theme-gray-lighter">
<a class="card-body text-decoration-none" href="#">
<div class="card h-75">
<a class="card-body no-transition" href="{{ route('report.employees.profitibality',['staff_type'=>'Employee', 'status'=>'current']) }}">
<h2 class="text-center">Employees</h2><br>
</a>
</div>
5 changes: 5 additions & 0 deletions Modules/Report/Routes/web.php
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
| contains the "web" middleware group. Now create something great!
|
*/
use Modules\HR\Http\Controllers\EmployeeController;

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

Route::prefix('employee')->group(function () {
Route::get('/profitibality', [EmployeeController::class, 'index'])->name('report.employees.profitibality');
});

Route::prefix('monthly-sales-register')->group(function () {
Route::get('/', 'MonthlySalesRegisterController@index')->name('reports.finance.monthly-sales-register.index');
Route::get('/export', 'MonthlySalesRegisterController@exportReport')->name('reports.finance.monthly-sales-register.export');
2 changes: 2 additions & 0 deletions Modules/User/Database/Seeders/UserPermissionsTableSeeder.php
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@ public function run()
Permission::updateOrCreate(['name' => 'user_role_management.update']);
Permission::updateOrCreate(['name' => 'user_role_management.delete']);

Permission::updateOrCreate(['name' => 'employee_profitability_list.view']);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be in this seeder file. Please check if there are any seeder for employee. Add it there.

$userManagementPermissions = [
['name' => 'user_management.create'],
['name' => 'user_management.view'],
27 changes: 27 additions & 0 deletions app/Http/Controllers/Settings/ProfitabilityController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Http\Controllers\Settings;

use App\Http\Controllers\Controller;
use App\Models\Setting;
use Illuminate\Http\Request;

class ProfitabilityController extends Controller
{
public function index()
{
$employeeEarningThreshold = Setting::where('setting_key', 'employee_earning_threshold')->value('setting_value');

return view('settings.employee-earning-threshold.index', ['employeeEarningThreshold' => $employeeEarningThreshold]);
}

public function update(Request $request)
{
Setting::updateOrCreate(
['module' => 'setting', 'setting_key' => 'employee_earning_threshold'],
['setting_value' => $request->employee_earning_threshold]
);

return redirect()->back()->with('status', 'Saved Successfully!');
}
}
1 change: 1 addition & 0 deletions public/icons/green-tick.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/warning-symbol.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
@@ -83,6 +83,10 @@ Vue.component(
"user-dashboard-library",
require("./components/Dashboard/UserDashboardLibrary.vue").default
);
Vue.component(
"employee-profitability-list",
require("./components/Dashboard/EmployeeProfitabilityList.vue").default
);
Vue.component(
"user-dashboard-infrastructure",
require("./components/Dashboard/UserDashboardInfrastructure.vue").default
21 changes: 21 additions & 0 deletions resources/js/components/Dashboard/EmployeeProfitabilityList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<div class = "media">
<div class="card">
<div class="card-header p-1">
<h3 class="text-center"><a href="/report/finance/employee/profitibality?staff_type=Employee&status=current">Employee Profitability List</a></h3>
</div>
<div class="md-0">
<div class="card-body pt-3 h-325 w-md-389 w-389 overflow-y-scroll">
<ul class="list list-group unstyled-list">
<li class="d-flex justify-content-between">
<div class="text-secondary"> Fetching latest data... </div>
<h4 v-text="sentInvoiceCount"></h4>
</li>
<hr class="mt-1" />
</ul>
</div>
</div>
</div>
</div>
</template>

6 changes: 6 additions & 0 deletions resources/views/home.blade.php
Original file line number Diff line number Diff line change
@@ -44,6 +44,12 @@
<user-dashboard-library />
</div>
@endcan

@can('employee_profitability_list.view')
<div class="pr-5 mb-4 min-w-389">
<employee-profitability-list />
</div>
@endcan

@can('projects.view')
<div class="pr-5 mb-4 min-w-389">
33 changes: 32 additions & 1 deletion resources/views/hr/employees/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
@extends('layouts.app')

@section('content')

<!-- As of now we have hardCoded the earningValue until we unable to fetch the real data -->
@php
$routeName = Route::getCurrentRoute()->getName();
$earningValue = 0;
@endphp
<div class="container">
<br>
@include('hr.employees.menu')
@@ -30,6 +35,7 @@
<thead class="thead-dark">
<tr class="sticky-top">
<th>Name</th>
@if($routeName === "employee")
<th>Active Projects Count</th>
<th>
Overall FTE
@@ -43,6 +49,14 @@
<i class="fa fa-info-circle" aria-hidden="true"></i>
</span>
</th>
@else
<th>
Employee Earning
<span class="tooltip-wrapper" data-html="true" data-toggle="tooltip" title="Rate">
<i class="fa fa-info-circle" aria-hidden="true"></i>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than tooltip we need to use alert symbol here

</span>
</th>
@endif
</tr>
@foreach ($employees as $employee)
<tr>
@@ -66,6 +80,7 @@ class="{{ config('constants.review-tags.completed.class') }} badge-pill mr-1 mb-
@endif
</a>
</td>
@if($routeName === "employee")
<td>
@if ($employee->user == null)
0
@@ -80,6 +95,7 @@ class="{{ config('constants.review-tags.completed.class') }} badge-pill mr-1 mb-
{{ $totalFTE }}
@endif
</td>
if
<td>
<span class="text-success">
{{ $user->total_hours['billable'] }}
@@ -89,6 +105,21 @@ class="{{ config('constants.review-tags.completed.class') }} badge-pill mr-1 mb-
{{ $user->total_hours['non_billable'] }}
</span>
</td>
@else
<td>
@if($earningValue >= 0)
<span class="text-success">
{{$earningValue}}
<span class="d-inline-block pr-2 h-30 w-30">{!! file_get_contents(public_path('icons/green-tick.svg')) !!}</span>
</span>
@else
<span class="text-secondary pl-2">
{{$earningValue}}
<span class="d-inline-block h-30 w-30">{!! file_get_contents(public_path('icons/warning-symbol.svg')) !!}</span>
</span>
@endif
</td>
@endif
</tr>
@endforeach
</table>
12 changes: 7 additions & 5 deletions resources/views/hr/employees/menu.blade.php
Original file line number Diff line number Diff line change
@@ -2,31 +2,33 @@
<li class="nav-item">
@php
$params = array_merge(['staff_type' => 'Employee'], ['status' => 'current']);
$route_name = Route::getCurrentRoute()->getName();
@endphp
<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>

<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>
</li>
<li class="nav-item">
@php
$params = array_merge(['staff_type' => 'Intern'], ['status' => 'current']);
@endphp
<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>
<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>
</li>

<li class="nav-item">
@php
$params = array_merge(['staff_type' => 'Contractor'], ['status' => 'current']);
@endphp
<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>
<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>
</li>

<li class="nav-item">
@php
$params = array_merge(['staff_type' => 'Support Staff'], ['status' => 'current']);
@endphp
<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>
<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>
</li>

<li class="nav-item">
<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>
<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>
</li>
</ul>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@extends('user::layouts.master')

@section('content')

<form action="{{ route('settings.update-employee-earning-threshold') }}" method="POST">
@csrf
<div class="container">
<div class="row justify-content-start">
<div class="col-6">
<label class="user-settings fz-24">Config Variable</label>
</div>
</div>
<div class="col" id="user-settings-content">
<div class="card-body">
<h5 class="max-interview-heading fz-20"> Threshold value
<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) }}">
</h5>
<input type="submit" class="btn btn-primary" value="Save">
</div>
</div>
</div>
</form>
@endsection
8 changes: 8 additions & 0 deletions resources/views/settings/index.blade.php
Original file line number Diff line number Diff line change
@@ -57,6 +57,14 @@
</a>
</div>
</div>
<div class="col-md-4">
<div class="card h-75 mx-4 mt-3 mb-5 ">
<a class="card-body no-transition" href="{{ route('settings.employee-earning-threshold') }}">
<br>
<h2 class="text-center">Config Variable</h2><br>
</a>
</div>
</div>
</div>
</div>
@endsection
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -99,6 +99,8 @@

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

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