Skip to content

Commit

Permalink
Merge pull request #3428 from ColoredCow/feat/approved_hours_col
Browse files Browse the repository at this point in the history
Approved hrs column added to the project details
  • Loading branch information
P4NK4J authored Feb 28, 2024
2 parents c4beb4f + b8c20e3 commit 35dcd24
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
1 change: 1 addition & 0 deletions Modules/EffortTracking/Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
],
'default_last_column_in_effort_sheet' => 'G',
'default_start_column_in_effort_sheet' => 'C',
'default_monthly_approved_pipeline_column_in_effort_sheet' => 'B6',
];
20 changes: 19 additions & 1 deletion Modules/EffortTracking/Services/EffortTrackingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,18 @@ public function getEffortForProject($project)
$sheet = $sheets->spreadsheet($sheetId)
->range($range)
->get();

foreach ($sheet as $rows) {
if (count($rows) == 0) {
break;
}
$projectMembersCount++;
}

$approvedPipelineRange = config('efforttracking.default_monthly_approved_pipeline_column_in_effort_sheet');
$approvedPipelineSheet = $sheets->spreadsheet($sheetId)
->range($approvedPipelineRange)
->get();

try {
while (true) {
$lastColumn++;
Expand Down Expand Up @@ -296,6 +300,8 @@ public function getEffortForProject($project)
try {
$effortData['sheet_project'] = $sheetProject;
$this->updateEffort($effortData);
$approvedPipelineSheetEffort = ! empty($approvedPipelineSheet[0][0]) ? $approvedPipelineSheet[0][0] : 0;
$this->updateApprovedPipelineEffort($approvedPipelineSheetEffort, $effortData);
ProjectMeta::updateOrCreate(
[
'key' => config('project.meta_keys.last_updated_at.key'),
Expand Down Expand Up @@ -331,6 +337,18 @@ public function getColumnIndex($columnName, $sheetColumns)
return false;
}

public function updateApprovedPipelineEffort($approvedPipelineSheet, $effortData)
{
Project::updateOrCreate(
[
'id' => $effortData['sheet_project']['id'],
],
[
'monthly_approved_pipeline' => $approvedPipelineSheet,
]
);
}

public function updateEffort(array $effortData)
{
$currentDate = now(config('constants.timezone.indian'))->today();
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 AddApprovedPiplineColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('projects', function (Blueprint $table) {
$table->string('monthly_approved_pipeline')->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('projects', function (Blueprint $table) {
$table->dropColumn('monthly_approved_pipeline');
});
}
}
18 changes: 13 additions & 5 deletions Modules/Project/Resources/views/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,19 @@
<span class="text-capitalize ml-2 fz-lg-22">{{ $project->total_estimated_hours }}
</div>
</div>
<div class="form-group col-md-6 pl-4">
<h4 class="d-inline-block">
<label for="name" class="font-weight-bold">Start Date:</label>
</h4>
<span class="text-capitalize ml-2 fz-lg-22">{{ optional($project->start_date)->format('d M Y')}}</span>
<div class="form-row">
<div class="form-group col-md-6 pl-4">
<h4 class="d-inline-block">
<label for="name" class="font-weight-bold">Start Date:</label>
</h4>
<span class="text-capitalize ml-2 fz-lg-22">{{ optional($project->start_date)->format('d M Y')}}</span>
</div>
<div class="form-group offset-md-1 pl-4 col-md-5">
<h4 class="d-inline-block">
<label for="name" class="font-weight-bold">Monthly Approved Pipeline:</label>
</h4>
<span class="text-capitalize ml-2 fz-lg-22">{{ $project->monthly_approved_pipeline }}
</div>
</div>
<div class="form-group col-md-6 pl-4">
<h4 class="d-inline-block">
Expand Down

0 comments on commit 35dcd24

Please sign in to comment.