From 52b8aad4c00d94f8632f3d5f35085bde970dc828 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Mon, 17 Jun 2024 15:49:18 +0530 Subject: [PATCH 01/21] Created migration for the project stages --- Modules/Project/Entities/ProjectStages.php | 18 +++ .../Project/Entities/ProjectStagesListing.php | 14 ++ .../Http/Controllers/ProjectController.php | 23 ++- .../Project/Resources/assets/sass/app.scss | 152 ++++++++++++++++++ .../Resources/views/layouts/master.blade.php | 1 + .../Resources/views/project-stages.blade.php | 98 +++++++++++ .../Project/Resources/views/show.blade.php | 6 +- Modules/Project/Routes/web.php | 3 + ..._142418_update_project_old_stage_table.php | 46 ++++++ ...04_create_project_stages_listing_table.php | 32 ++++ 10 files changed, 390 insertions(+), 3 deletions(-) create mode 100644 Modules/Project/Entities/ProjectStages.php create mode 100644 Modules/Project/Entities/ProjectStagesListing.php create mode 100644 Modules/Project/Resources/views/project-stages.blade.php create mode 100644 database/migrations/2024_06_15_142418_update_project_old_stage_table.php create mode 100644 database/migrations/2024_06_15_143304_create_project_stages_listing_table.php diff --git a/Modules/Project/Entities/ProjectStages.php b/Modules/Project/Entities/ProjectStages.php new file mode 100644 index 0000000000..342f17ca32 --- /dev/null +++ b/Modules/Project/Entities/ProjectStages.php @@ -0,0 +1,18 @@ +belongsTo(Project::class, 'project_id', 'id'); + } +} diff --git a/Modules/Project/Entities/ProjectStagesListing.php b/Modules/Project/Entities/ProjectStagesListing.php new file mode 100644 index 0000000000..5136c81199 --- /dev/null +++ b/Modules/Project/Entities/ProjectStagesListing.php @@ -0,0 +1,14 @@ + $contractName, ]; } -} + + public function addStage(Request $request) + { + $request->validate([ + 'project_id' => 'required|integer|exists:projects,id', + 'stage_name' => 'required|string', + 'comment' => 'nullable|string', + 'status' => 'nullable|string', + ]); + + ProjectStages::create([ + 'project_id' => $request->project_id, + 'stage_name' => $request->stage_name, + 'comments' => $request->comment, + 'status' => $request->status ?? 'pending', + ]); + + return response()->json(['success' => 'Stage added successfully!']); + } +} \ No newline at end of file diff --git a/Modules/Project/Resources/assets/sass/app.scss b/Modules/Project/Resources/assets/sass/app.scss index e69de29bb2..42fb95257b 100644 --- a/Modules/Project/Resources/assets/sass/app.scss +++ b/Modules/Project/Resources/assets/sass/app.scss @@ -0,0 +1,152 @@ + + .checkbox-wrapper-19 { + box-sizing: border-box; + --background-color: #fff; + --checkbox-height: 15px; + } + + @-moz-keyframes dothabottomcheck-19 { + 0% { + height: 0; + } + 100% { + height: calc(var(--checkbox-height) / 2); + } + } + + @-webkit-keyframes dothabottomcheck-19 { + 0% { + height: 0; + } + 100% { + height: calc(var(--checkbox-height) / 2); + } + } + + @keyframes dothabottomcheck-19 { + 0% { + height: 0; + } + 100% { + height: calc(var(--checkbox-height) / 2); + } + } + + @keyframes dothatopcheck-19 { + 0% { + height: 0; + } + 50% { + height: 0; + } + 100% { + height: calc(var(--checkbox-height) * 1.2); + } + } + + @-webkit-keyframes dothatopcheck-19 { + 0% { + height: 0; + } + 50% { + height: 0; + } + 100% { + height: calc(var(--checkbox-height) * 1.2); + } + } + + @-moz-keyframes dothatopcheck-19 { + 0% { + height: 0; + } + 50% { + height: 0; + } + 100% { + height: calc(var(--checkbox-height) * 1.2); + } + } + + .checkbox-wrapper-19 input[type=checkbox] { + display: none; + } + + .checkbox-wrapper-19 .check-box { + height: var(--checkbox-height); + width: var(--checkbox-height); + background-color: transparent; + border: calc(var(--checkbox-height) * .1) solid #000; + border-radius: 5px; + position: relative; + display: inline-block; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -moz-transition: border-color ease 0.2s; + -o-transition: border-color ease 0.2s; + -webkit-transition: border-color ease 0.2s; + transition: border-color ease 0.2s; + cursor: pointer; + } + .checkbox-wrapper-19 .check-box::before, + .checkbox-wrapper-19 .check-box::after { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + position: absolute; + height: 0; + width: calc(var(--checkbox-height) * .2); + background-color: #34b93d; + display: inline-block; + -moz-transform-origin: left top; + -ms-transform-origin: left top; + -o-transform-origin: left top; + -webkit-transform-origin: left top; + transform-origin: left top; + border-radius: 5px; + content: " "; + -webkit-transition: opacity ease 0.5; + -moz-transition: opacity ease 0.5; + transition: opacity ease 0.5; + } + .checkbox-wrapper-19 .check-box::before { + top: calc(var(--checkbox-height) * .72); + left: calc(var(--checkbox-height) * .41); + box-shadow: 0 0 0 calc(var(--checkbox-height) * .05) var(--background-color); + -moz-transform: rotate(-135deg); + -ms-transform: rotate(-135deg); + -o-transform: rotate(-135deg); + -webkit-transform: rotate(-135deg); + transform: rotate(-135deg); + } + .checkbox-wrapper-19 .check-box::after { + top: calc(var(--checkbox-height) * .37); + left: calc(var(--checkbox-height) * .05); + -moz-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + -o-transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + } + + .checkbox-wrapper-19 input[type=checkbox]:checked + .check-box, + .checkbox-wrapper-19 .check-box.checked { + border-color: #34b93d; + } + .checkbox-wrapper-19 input[type=checkbox]:checked + .check-box::after, + .checkbox-wrapper-19 .check-box.checked::after { + height: calc(var(--checkbox-height) / 2); + -moz-animation: dothabottomcheck-19 0.2s ease 0s forwards; + -o-animation: dothabottomcheck-19 0.2s ease 0s forwards; + -webkit-animation: dothabottomcheck-19 0.2s ease 0s forwards; + animation: dothabottomcheck-19 0.2s ease 0s forwards; + } + .checkbox-wrapper-19 input[type=checkbox]:checked + .check-box::before, + .checkbox-wrapper-19 .check-box.checked::before { + height: calc(var(--checkbox-height) * 1.2); + -moz-animation: dothatopcheck-19 0.4s ease 0s forwards; + -o-animation: dothatopcheck-19 0.4s ease 0s forwards; + -webkit-animation: dothatopcheck-19 0.4s ease 0s forwards; + animation: dothatopcheck-19 0.4s ease 0s forwards; + } \ No newline at end of file diff --git a/Modules/Project/Resources/views/layouts/master.blade.php b/Modules/Project/Resources/views/layouts/master.blade.php index ed4b265e74..eaa1a8fb1d 100644 --- a/Modules/Project/Resources/views/layouts/master.blade.php +++ b/Modules/Project/Resources/views/layouts/master.blade.php @@ -4,4 +4,5 @@ @endsection @section('css_scripts') + @endsection diff --git a/Modules/Project/Resources/views/project-stages.blade.php b/Modules/Project/Resources/views/project-stages.blade.php new file mode 100644 index 0000000000..0431e977c8 --- /dev/null +++ b/Modules/Project/Resources/views/project-stages.blade.php @@ -0,0 +1,98 @@ +
+

Project Stages

+ +
+
+
+
+ + Add +
+
+ @csrf +
+ +
+
+ +
+
+
+ + +
+
+ +
+ + +
+ + + + + +
\ No newline at end of file diff --git a/Modules/Project/Resources/views/show.blade.php b/Modules/Project/Resources/views/show.blade.php index d54c4da754..1fcdf2d617 100644 --- a/Modules/Project/Resources/views/show.blade.php +++ b/Modules/Project/Resources/views/show.blade.php @@ -294,7 +294,7 @@

@can('finance_reports.view') -
+

Contract History

@@ -320,7 +320,9 @@

-
@endcan +@include('project::project-stages'); +
+
@endsection diff --git a/Modules/Project/Routes/web.php b/Modules/Project/Routes/web.php index 79c151a686..6db152af4b 100644 --- a/Modules/Project/Routes/web.php +++ b/Modules/Project/Routes/web.php @@ -23,4 +23,7 @@ Route::post('/project-fte-export', 'ProjectController@projectFTEExport')->name('project.fte.export'); Route::get('/project-resource', 'ProjectController@projectResource')->name('project.resource-requirement'); //Route::get('/', 'ProjectController@edit')->name('project.edit'); + + Route::post('/projects/add-stage-listing', 'ProjectController@addStageListing')->name('projects.add-stage-listing'); + Route::post('/projects/add-stage', 'ProjectController@addStage')->name('projects.add-stage'); }); diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php new file mode 100644 index 0000000000..13dede4dce --- /dev/null +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -0,0 +1,46 @@ +text('comments')->nullable(); + $table->text('stage_name')->after('project_id'); + $table->text('status')->after('stage_name')->nullable(); + $table->dropColumn(['name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date', 'end_date']); + }); + Schema::table('project_old_stages', function (Blueprint $table) { + $table->foreign('project_id')->references('id')->on('projects'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('project_old_stages', function (Blueprint $table) { + $table->dropColumn('comments'); + $table->dropColumn('stage_name'); + $table->dropColumn('status'); + + $table->string('name')->nullable(); + $table->decimal('cost', 8, 2)->nullable(); + $table->string('currency_cost')->nullable(); + $table->date('start_date')->nullable(); + $table->date('end_date')->nullable(); + }); + } +} diff --git a/database/migrations/2024_06_15_143304_create_project_stages_listing_table.php b/database/migrations/2024_06_15_143304_create_project_stages_listing_table.php new file mode 100644 index 0000000000..0fe110e2e4 --- /dev/null +++ b/database/migrations/2024_06_15_143304_create_project_stages_listing_table.php @@ -0,0 +1,32 @@ +increments('id'); + $table->string('name'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('project_stages_listing'); + } +} From e3f4a9891494aab3e0ae8d1405efc89a3103a846 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Wed, 19 Jun 2024 18:52:19 +0530 Subject: [PATCH 02/21] Created CRUD operation of the project stages --- Modules/Project/Entities/ProjectStages.php | 2 +- .../Http/Controllers/ProjectController.php | 52 +++++++--- .../Project/Resources/assets/sass/app.scss | 2 +- .../Resources/views/project-stages.blade.php | 98 ------------------- .../Project/Resources/views/show.blade.php | 80 ++++++++++++++- .../views/subviews/project-stages.blade.php | 69 +++++++++++++ Modules/Project/Routes/web.php | 4 +- Modules/Project/Services/ProjectService.php | 43 +++++++- ..._142418_update_project_old_stage_table.php | 7 +- 9 files changed, 234 insertions(+), 123 deletions(-) delete mode 100644 Modules/Project/Resources/views/project-stages.blade.php create mode 100644 Modules/Project/Resources/views/subviews/project-stages.blade.php diff --git a/Modules/Project/Entities/ProjectStages.php b/Modules/Project/Entities/ProjectStages.php index 342f17ca32..351e671d24 100644 --- a/Modules/Project/Entities/ProjectStages.php +++ b/Modules/Project/Entities/ProjectStages.php @@ -9,7 +9,7 @@ class ProjectStages extends Model protected $table = 'project_old_stages'; protected $guarded = []; - protected $fillables = ['project_id', 'stage_name', 'status', 'created_at', 'updated_at', 'comments']; + protected $fillables = ['project_id', 'stage_name', 'status', 'created_at', 'updated_at', 'end_date', 'comments']; public function project() { diff --git a/Modules/Project/Http/Controllers/ProjectController.php b/Modules/Project/Http/Controllers/ProjectController.php index dfadb7beba..8ebf8c9a9e 100644 --- a/Modules/Project/Http/Controllers/ProjectController.php +++ b/Modules/Project/Http/Controllers/ProjectController.php @@ -14,19 +14,20 @@ use Modules\Project\Entities\ProjectContract; use Modules\Project\Http\Requests\ProjectRequest; use Modules\Project\Rules\ProjectNameExist; -use Modules\Project\Entities\ProjectStages; - +use Modules\Project\Services\ProjectService; class ProjectController extends Controller { use AuthorizesRequests; protected $service; + protected $projectService; - public function __construct(ProjectServiceContract $service) + public function __construct(ProjectServiceContract $service, ProjectService $projectService) { $this->authorizeResource(Project::class); $this->service = $service; + $this->projectService = $projectService; } /** @@ -111,6 +112,7 @@ public function show(Request $request, Project $project) 'effortData' => $effortData, 'totalEffort' => json_encode($totalEffort), 'dailyEffort' => $dailyEffort, + 'stages' => $this->projectService->getProjectStages($project), ]); } @@ -213,22 +215,42 @@ private function getContractData(Project $project) ]; } - public function addStage(Request $request) + public function manageStage(Request $request) { - $request->validate([ + $validatedData = $request->validate([ 'project_id' => 'required|integer|exists:projects,id', - 'stage_name' => 'required|string', - 'comment' => 'nullable|string', - 'status' => 'nullable|string', + 'newStages' => 'nullable|array', + 'newStages.*.stage_name' => 'required|string', + 'newStages.*.comments' => 'nullable|string', + 'newStages.*.status' => 'nullable|string', + 'deletedStages' => 'nullable|array', + 'deletedStages.*' => 'required|integer|exists:project_old_stages,id', + 'updatedStages' => 'nullable|array', + 'updatedStages.*.id' => 'required|integer|exists:project_old_stages,id', ]); - ProjectStages::create([ - 'project_id' => $request->project_id, - 'stage_name' => $request->stage_name, - 'comments' => $request->comment, - 'status' => $request->status ?? 'pending', - ]); + if (empty($validatedData['deletedStages']) && empty($validatedData['newStages']) && empty($validatedData['updatedStages'])) { + return response()->json([ + 'status' => 400, + 'error' => 'No New Changes Detected' + ], 400); + } + + if (! empty($validatedData['deletedStages'])) { + $this->projectService->removeStage($validatedData['deletedStages']); + } - return response()->json(['success' => 'Stage added successfully!']); + if (! empty($validatedData['newStages'])) { + $this->projectService->storeStage($validatedData['newStages'], $validatedData['project_id']); + } + + if (! empty($validatedData['updatedStages'])) { + $this->projectService->updateStage($validatedData['updatedStages']); + } + + return response()->json([ + 'status' => 200, + 'success' => 'Stages managed successfully!' + ]); } } \ No newline at end of file diff --git a/Modules/Project/Resources/assets/sass/app.scss b/Modules/Project/Resources/assets/sass/app.scss index 42fb95257b..3f0a5b5d34 100644 --- a/Modules/Project/Resources/assets/sass/app.scss +++ b/Modules/Project/Resources/assets/sass/app.scss @@ -2,7 +2,7 @@ .checkbox-wrapper-19 { box-sizing: border-box; --background-color: #fff; - --checkbox-height: 15px; + --checkbox-height: 20px; } @-moz-keyframes dothabottomcheck-19 { diff --git a/Modules/Project/Resources/views/project-stages.blade.php b/Modules/Project/Resources/views/project-stages.blade.php deleted file mode 100644 index 0431e977c8..0000000000 --- a/Modules/Project/Resources/views/project-stages.blade.php +++ /dev/null @@ -1,98 +0,0 @@ -
-

Project Stages

- -
-
-
-
- - Add -
-
- @csrf -
- -
-
- -
-
-
- - -
-
- -
- - -
- - - - - -
\ No newline at end of file diff --git a/Modules/Project/Resources/views/show.blade.php b/Modules/Project/Resources/views/show.blade.php index 1fcdf2d617..32ea1f5724 100644 --- a/Modules/Project/Resources/views/show.blade.php +++ b/Modules/Project/Resources/views/show.blade.php @@ -321,8 +321,84 @@

@endcan -@include('project::project-stages'); + +
+ @include('project::subviews.project-stages') +


@endsection - +@section('vue_scripts') + +@endsection \ No newline at end of file diff --git a/Modules/Project/Resources/views/subviews/project-stages.blade.php b/Modules/Project/Resources/views/subviews/project-stages.blade.php new file mode 100644 index 0000000000..6bb9d3a746 --- /dev/null +++ b/Modules/Project/Resources/views/subviews/project-stages.blade.php @@ -0,0 +1,69 @@ +
+
+

Project Stages

+ +
+
+
+
+ @csrf +
+
+
+
S. No.
+
Stage Name
+
Comment
+
Start Date
+
End Date
+
Status
+
+
+
+
+
@{{ index + 1 }}
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+ +
+
+
+
+
+ +
+
+
+
+ + +
+
+
+
+ Loading... +
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/Modules/Project/Routes/web.php b/Modules/Project/Routes/web.php index 6db152af4b..131dc14a95 100644 --- a/Modules/Project/Routes/web.php +++ b/Modules/Project/Routes/web.php @@ -22,8 +22,6 @@ Route::delete('client/{project}/edit', 'ProjectController@destroy')->name('project.destroy'); Route::post('/project-fte-export', 'ProjectController@projectFTEExport')->name('project.fte.export'); Route::get('/project-resource', 'ProjectController@projectResource')->name('project.resource-requirement'); + Route::post('/projects/manage-stage', 'ProjectController@manageStage')->name('projects.manage-stage'); //Route::get('/', 'ProjectController@edit')->name('project.edit'); - - Route::post('/projects/add-stage-listing', 'ProjectController@addStageListing')->name('projects.add-stage-listing'); - Route::post('/projects/add-stage', 'ProjectController@addStage')->name('projects.add-stage'); }); diff --git a/Modules/Project/Services/ProjectService.php b/Modules/Project/Services/ProjectService.php index e6b7850287..befbb147da 100644 --- a/Modules/Project/Services/ProjectService.php +++ b/Modules/Project/Services/ProjectService.php @@ -21,6 +21,7 @@ use Modules\Project\Entities\ProjectTeamMembersEffort; use Modules\Project\Exports\ProjectFTEExport; use Modules\User\Entities\User; +use Modules\Project\Entities\ProjectStages; class ProjectService implements ProjectServiceContract { @@ -584,4 +585,44 @@ private function formatProjectFTEFOrExportAll($employees, $startDate, $endDate) return $teamMembers; } -} + + public function getProjectStages(Project $project) + { + $project_id = $project->id; + $stages = ProjectStages::where('project_id', $project_id)->orderBy('id')->get(); + return $stages; + } + + public function storeStage(array $newStages, int $projectId) + { + foreach ($newStages as $stage) { + ProjectStages::create([ + 'project_id' => $projectId, + 'stage_name' => $stage['stage_name'], + 'comments' => $stage['comments'] ?? null, + 'status' => $stage['status'] ?? 'pending', + 'created_at' => now(), + 'updated_at' => now(), + 'end_date' => $stage['status'] !== 'pending' ? now() : null + ]); + } + } + + public function updateStage(array $updatedStages) + { + foreach ($updatedStages as $stage) { + $existingStage = ProjectStages::find($stage['id']); + $existingStage->update([ + 'stage_name' => $stage['stage_name'], + 'comments' => $stage['comments'] ?? null, + 'status' => $stage['status'] ?? 'pending', + 'end_date' => $stage['status'] !== 'pending' ? now() : null + ]); + } + } + + public function removeStage(array $idArr) + { + ProjectStages::whereIn('id', $idArr)->delete(); + } +} \ No newline at end of file diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index 13dede4dce..5848c3f868 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -17,7 +17,8 @@ public function up() $table->text('comments')->nullable(); $table->text('stage_name')->after('project_id'); $table->text('status')->after('stage_name')->nullable(); - $table->dropColumn(['name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date', 'end_date']); + $table->datetime('end_date')->nullable()->change(); + $table->dropColumn(['name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); }); Schema::table('project_old_stages', function (Blueprint $table) { $table->foreign('project_id')->references('id')->on('projects'); @@ -39,8 +40,10 @@ public function down() $table->string('name')->nullable(); $table->decimal('cost', 8, 2)->nullable(); $table->string('currency_cost')->nullable(); + $table->string('type')->nullable(); + $table->string('cost_include_gst')->nullable(); $table->date('start_date')->nullable(); - $table->date('end_date')->nullable(); + $table->date('end_date')->nullable()->change(); }); } } From 2032451bce95384a6816b246a1f0afa174ab7ef7 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Wed, 19 Jun 2024 19:27:57 +0530 Subject: [PATCH 03/21] CI Fixes --- Modules/Project/Entities/ProjectStages.php | 1 - Modules/Project/Http/Controllers/ProjectController.php | 1 + Modules/Project/Services/ProjectService.php | 1 + .../2024_06_15_142418_update_project_old_stage_table.php | 2 +- 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Modules/Project/Entities/ProjectStages.php b/Modules/Project/Entities/ProjectStages.php index 351e671d24..c7a18c4c28 100644 --- a/Modules/Project/Entities/ProjectStages.php +++ b/Modules/Project/Entities/ProjectStages.php @@ -6,7 +6,6 @@ class ProjectStages extends Model { - protected $table = 'project_old_stages'; protected $guarded = []; protected $fillables = ['project_id', 'stage_name', 'status', 'created_at', 'updated_at', 'end_date', 'comments']; diff --git a/Modules/Project/Http/Controllers/ProjectController.php b/Modules/Project/Http/Controllers/ProjectController.php index 8ebf8c9a9e..fd8537775f 100644 --- a/Modules/Project/Http/Controllers/ProjectController.php +++ b/Modules/Project/Http/Controllers/ProjectController.php @@ -253,4 +253,5 @@ public function manageStage(Request $request) 'success' => 'Stages managed successfully!' ]); } + } \ No newline at end of file diff --git a/Modules/Project/Services/ProjectService.php b/Modules/Project/Services/ProjectService.php index befbb147da..17bdaba266 100644 --- a/Modules/Project/Services/ProjectService.php +++ b/Modules/Project/Services/ProjectService.php @@ -625,4 +625,5 @@ public function removeStage(array $idArr) { ProjectStages::whereIn('id', $idArr)->delete(); } + } \ No newline at end of file diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index 5848c3f868..a21682bcef 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -21,7 +21,7 @@ public function up() $table->dropColumn(['name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); }); Schema::table('project_old_stages', function (Blueprint $table) { - $table->foreign('project_id')->references('id')->on('projects'); + $table->foreign('project_id')->references('id')->on('projects')->change(); }); } From 55775f642a3e3da9540132efc708a944d8fd263b Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Wed, 19 Jun 2024 19:40:31 +0530 Subject: [PATCH 04/21] CI Fixes --- Modules/Project/Http/Controllers/ProjectController.php | 3 +-- Modules/Project/Services/ProjectService.php | 3 +-- .../2024_06_15_142418_update_project_old_stage_table.php | 7 +++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Modules/Project/Http/Controllers/ProjectController.php b/Modules/Project/Http/Controllers/ProjectController.php index fd8537775f..f81ef1dc79 100644 --- a/Modules/Project/Http/Controllers/ProjectController.php +++ b/Modules/Project/Http/Controllers/ProjectController.php @@ -253,5 +253,4 @@ public function manageStage(Request $request) 'success' => 'Stages managed successfully!' ]); } - -} \ No newline at end of file +} diff --git a/Modules/Project/Services/ProjectService.php b/Modules/Project/Services/ProjectService.php index 17bdaba266..c14141a1b8 100644 --- a/Modules/Project/Services/ProjectService.php +++ b/Modules/Project/Services/ProjectService.php @@ -625,5 +625,4 @@ public function removeStage(array $idArr) { ProjectStages::whereIn('id', $idArr)->delete(); } - -} \ No newline at end of file +} diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index a21682bcef..02017322ee 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -14,14 +14,16 @@ class UpdateProjectOldStageTable extends Migration public function up() { Schema::table('project_old_stages', function (Blueprint $table) { + $table->dropForeign(['project_id']); + + $table->dropColumn(['name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); $table->text('comments')->nullable(); $table->text('stage_name')->after('project_id'); $table->text('status')->after('stage_name')->nullable(); $table->datetime('end_date')->nullable()->change(); - $table->dropColumn(['name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); }); Schema::table('project_old_stages', function (Blueprint $table) { - $table->foreign('project_id')->references('id')->on('projects')->change(); + $table->foreign('project_id')->references('id')->on('projects'); }); } @@ -36,6 +38,7 @@ public function down() $table->dropColumn('comments'); $table->dropColumn('stage_name'); $table->dropColumn('status'); + $table->dropColumn('project_id'); $table->string('name')->nullable(); $table->decimal('cost', 8, 2)->nullable(); From 74f0b08fc072f9ce0dea3f70ae7f2e51c7c2ee35 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Thu, 20 Jun 2024 11:41:53 +0530 Subject: [PATCH 05/21] CI Fixes --- .../2024_06_15_142418_update_project_old_stage_table.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index 02017322ee..f9bb1b5fef 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -14,10 +14,9 @@ class UpdateProjectOldStageTable extends Migration public function up() { Schema::table('project_old_stages', function (Blueprint $table) { - $table->dropForeign(['project_id']); - $table->dropColumn(['name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); $table->text('comments')->nullable(); + $table->unsignedInteger('project_id')->after('id'); $table->text('stage_name')->after('project_id'); $table->text('status')->after('stage_name')->nullable(); $table->datetime('end_date')->nullable()->change(); From 592fe992ee61b457a2f130d50f5fa328ef9f5d75 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Thu, 20 Jun 2024 12:18:04 +0530 Subject: [PATCH 06/21] Migratin CI fixes --- .../2024_06_15_142418_update_project_old_stage_table.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index f9bb1b5fef..ceeb7919f4 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -14,14 +14,15 @@ class UpdateProjectOldStageTable extends Migration public function up() { Schema::table('project_old_stages', function (Blueprint $table) { - $table->dropColumn(['name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); + $table->dropColumn(['project_id', 'name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); $table->text('comments')->nullable(); - $table->unsignedInteger('project_id')->after('id'); $table->text('stage_name')->after('project_id'); $table->text('status')->after('stage_name')->nullable(); $table->datetime('end_date')->nullable()->change(); }); + Schema::table('project_old_stages', function (Blueprint $table) { + $table->unsignedInteger('project_id')->after('id'); $table->foreign('project_id')->references('id')->on('projects'); }); } From 2c3a1e7eb1230d3396dc52fcdf12a9d64271d951 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Thu, 20 Jun 2024 12:21:50 +0530 Subject: [PATCH 07/21] Migration fixes --- .../2024_06_15_142418_update_project_old_stage_table.php | 1 + 1 file changed, 1 insertion(+) diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index ceeb7919f4..c5f3740b0d 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -14,6 +14,7 @@ class UpdateProjectOldStageTable extends Migration public function up() { Schema::table('project_old_stages', function (Blueprint $table) { + $table->dropForeign('project_id'); $table->dropColumn(['project_id', 'name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); $table->text('comments')->nullable(); $table->text('stage_name')->after('project_id'); From 1a2d463dc58a36636da75fb47fd5c0bdf30fa9be Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Thu, 20 Jun 2024 12:51:27 +0530 Subject: [PATCH 08/21] Migration fixes --- ..._142418_update_project_old_stage_table.php | 6 ++-- ...04_create_project_stages_listing_table.php | 32 ------------------- 2 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 database/migrations/2024_06_15_143304_create_project_stages_listing_table.php diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index c5f3740b0d..e317cbb7d4 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -14,16 +14,16 @@ class UpdateProjectOldStageTable extends Migration public function up() { Schema::table('project_old_stages', function (Blueprint $table) { - $table->dropForeign('project_id'); + $table->dropForeign(['project_id']); + $table->dropColumn(['project_id', 'name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); $table->text('comments')->nullable(); $table->text('stage_name')->after('project_id'); $table->text('status')->after('stage_name')->nullable(); $table->datetime('end_date')->nullable()->change(); }); - Schema::table('project_old_stages', function (Blueprint $table) { - $table->unsignedInteger('project_id')->after('id'); + $table->unsignedBigInteger('project_id')->after('id'); $table->foreign('project_id')->references('id')->on('projects'); }); } diff --git a/database/migrations/2024_06_15_143304_create_project_stages_listing_table.php b/database/migrations/2024_06_15_143304_create_project_stages_listing_table.php deleted file mode 100644 index 0fe110e2e4..0000000000 --- a/database/migrations/2024_06_15_143304_create_project_stages_listing_table.php +++ /dev/null @@ -1,32 +0,0 @@ -increments('id'); - $table->string('name'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('project_stages_listing'); - } -} From adb34569988adab77d811f3570e890fdbc8c3296 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Thu, 20 Jun 2024 13:13:42 +0530 Subject: [PATCH 09/21] Ci fixes --- .../Http/Controllers/ProjectController.php | 31 +++---- Modules/Project/Services/ProjectService.php | 82 +++++++++---------- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/Modules/Project/Http/Controllers/ProjectController.php b/Modules/Project/Http/Controllers/ProjectController.php index f81ef1dc79..8b901cc132 100644 --- a/Modules/Project/Http/Controllers/ProjectController.php +++ b/Modules/Project/Http/Controllers/ProjectController.php @@ -201,19 +201,6 @@ public function projectResource() 'jobName' => $jobName, ]); } - // storing Contract related data here - private function getContractData(Project $project) - { - $contract = ProjectContract::where('project_id', $project->id)->first(); - $contractFilePath = $contract ? storage_path('app/' . $contract->contract_file_path) : null; - $contractName = basename($contractFilePath); - - return [ - 'contract' => $contract, - 'contractFilePath' => $contractFilePath, - 'contractName' => $contractName, - ]; - } public function manageStage(Request $request) { @@ -232,7 +219,7 @@ public function manageStage(Request $request) if (empty($validatedData['deletedStages']) && empty($validatedData['newStages']) && empty($validatedData['updatedStages'])) { return response()->json([ 'status' => 400, - 'error' => 'No New Changes Detected' + 'error' => 'No New Changes Detected', ], 400); } @@ -250,7 +237,21 @@ public function manageStage(Request $request) return response()->json([ 'status' => 200, - 'success' => 'Stages managed successfully!' + 'success' => 'Stages managed successfully!', ]); } + + // storing Contract related data here + private function getContractData(Project $project) + { + $contract = ProjectContract::where('project_id', $project->id)->first(); + $contractFilePath = $contract ? storage_path('app/' . $contract->contract_file_path) : null; + $contractName = basename($contractFilePath); + + return [ + 'contract' => $contract, + 'contractFilePath' => $contractFilePath, + 'contractName' => $contractName, + ]; + } } diff --git a/Modules/Project/Services/ProjectService.php b/Modules/Project/Services/ProjectService.php index c14141a1b8..2a1474a309 100644 --- a/Modules/Project/Services/ProjectService.php +++ b/Modules/Project/Services/ProjectService.php @@ -17,11 +17,11 @@ use Modules\Project\Entities\ProjectMeta; use Modules\Project\Entities\ProjectRepository; use Modules\Project\Entities\ProjectResourceRequirement; +use Modules\Project\Entities\ProjectStages; use Modules\Project\Entities\ProjectTeamMember; use Modules\Project\Entities\ProjectTeamMembersEffort; use Modules\Project\Exports\ProjectFTEExport; use Modules\User\Entities\User; -use Modules\Project\Entities\ProjectStages; class ProjectService implements ProjectServiceContract { @@ -401,6 +401,46 @@ private function getListTabCounts($filters, $showAllProjects, $userId) return $counts; } + public function getProjectStages(Project $project) + { + $project_id = $project->id; + $stages = ProjectStages::where('project_id', $project_id)->orderBy('id')->get(); + return $stages; + } + + public function storeStage(array $newStages, int $projectId) + { + foreach ($newStages as $stage) { + ProjectStages::create([ + 'project_id' => $projectId, + 'stage_name' => $stage['stage_name'], + 'comments' => $stage['comments'] ?? null, + 'status' => $stage['status'] ?? 'pending', + 'created_at' => now(), + 'updated_at' => now(), + 'end_date' => $stage['status'] !== 'pending' ? now() : null + ]); + } + } + + public function updateStage(array $updatedStages) + { + foreach ($updatedStages as $stage) { + $existingStage = ProjectStages::find($stage['id']); + $existingStage->update([ + 'stage_name' => $stage['stage_name'], + 'comments' => $stage['comments'] ?? null, + 'status' => $stage['status'] ?? 'pending', + 'end_date' => $stage['status'] !== 'pending' ? now() : null + ]); + } + } + + public function removeStage(array $idArr) + { + ProjectStages::whereIn('id', $idArr)->delete(); + } + private function updateProjectDetails($data, $project) { $isProjectUpdated = $project->update([ @@ -585,44 +625,4 @@ private function formatProjectFTEFOrExportAll($employees, $startDate, $endDate) return $teamMembers; } - - public function getProjectStages(Project $project) - { - $project_id = $project->id; - $stages = ProjectStages::where('project_id', $project_id)->orderBy('id')->get(); - return $stages; - } - - public function storeStage(array $newStages, int $projectId) - { - foreach ($newStages as $stage) { - ProjectStages::create([ - 'project_id' => $projectId, - 'stage_name' => $stage['stage_name'], - 'comments' => $stage['comments'] ?? null, - 'status' => $stage['status'] ?? 'pending', - 'created_at' => now(), - 'updated_at' => now(), - 'end_date' => $stage['status'] !== 'pending' ? now() : null - ]); - } - } - - public function updateStage(array $updatedStages) - { - foreach ($updatedStages as $stage) { - $existingStage = ProjectStages::find($stage['id']); - $existingStage->update([ - 'stage_name' => $stage['stage_name'], - 'comments' => $stage['comments'] ?? null, - 'status' => $stage['status'] ?? 'pending', - 'end_date' => $stage['status'] !== 'pending' ? now() : null - ]); - } - } - - public function removeStage(array $idArr) - { - ProjectStages::whereIn('id', $idArr)->delete(); - } } From e39f55ebb26a15c8bc2e6242a701a2e876327c80 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Thu, 20 Jun 2024 13:18:56 +0530 Subject: [PATCH 10/21] CI fixes --- Modules/Project/Services/ProjectService.php | 42 ++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Modules/Project/Services/ProjectService.php b/Modules/Project/Services/ProjectService.php index 2a1474a309..0f755bae51 100644 --- a/Modules/Project/Services/ProjectService.php +++ b/Modules/Project/Services/ProjectService.php @@ -382,25 +382,6 @@ public function getProjectApprovedPipelineHour($project) ]; } - private function getListTabCounts($filters, $showAllProjects, $userId) - { - $counts = [ - 'mainProjectsCount' => array_merge($filters, ['status' => 'active', 'is_amc' => false]), - 'AMCProjectCount' => array_merge($filters, ['status' => 'active', 'is_amc' => true]), - 'haltedProjectsCount' => array_merge($filters, ['status' => 'halted', 'is_amc' => false]), - 'inactiveProjectsCount' => array_merge($filters, ['status' => 'inactive', 'is_amc' => false]), - ]; - - foreach ($counts as $key => $tabFilters) { - $query = Project::query()->applyFilter($tabFilters); - $counts[$key] = $showAllProjects - ? $query->count() - : $query->linkedToTeamMember($userId)->count(); - } - - return $counts; - } - public function getProjectStages(Project $project) { $project_id = $project->id; @@ -418,7 +399,7 @@ public function storeStage(array $newStages, int $projectId) 'status' => $stage['status'] ?? 'pending', 'created_at' => now(), 'updated_at' => now(), - 'end_date' => $stage['status'] !== 'pending' ? now() : null + 'end_date' => $stage['status'] !== 'pending' ? now() : null, ]); } } @@ -431,7 +412,7 @@ public function updateStage(array $updatedStages) 'stage_name' => $stage['stage_name'], 'comments' => $stage['comments'] ?? null, 'status' => $stage['status'] ?? 'pending', - 'end_date' => $stage['status'] !== 'pending' ? now() : null + 'end_date' => $stage['status'] !== 'pending' ? now() : null, ]); } } @@ -441,6 +422,25 @@ public function removeStage(array $idArr) ProjectStages::whereIn('id', $idArr)->delete(); } + private function getListTabCounts($filters, $showAllProjects, $userId) + { + $counts = [ + 'mainProjectsCount' => array_merge($filters, ['status' => 'active', 'is_amc' => false]), + 'AMCProjectCount' => array_merge($filters, ['status' => 'active', 'is_amc' => true]), + 'haltedProjectsCount' => array_merge($filters, ['status' => 'halted', 'is_amc' => false]), + 'inactiveProjectsCount' => array_merge($filters, ['status' => 'inactive', 'is_amc' => false]), + ]; + + foreach ($counts as $key => $tabFilters) { + $query = Project::query()->applyFilter($tabFilters); + $counts[$key] = $showAllProjects + ? $query->count() + : $query->linkedToTeamMember($userId)->count(); + } + + return $counts; + } + private function updateProjectDetails($data, $project) { $isProjectUpdated = $project->update([ From fdfef9c66a53375f5a14fcb0b5743dab9609a1fb Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Thu, 20 Jun 2024 13:21:42 +0530 Subject: [PATCH 11/21] CI fixes --- Modules/Project/Services/ProjectService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Project/Services/ProjectService.php b/Modules/Project/Services/ProjectService.php index 0f755bae51..d9369e1e0f 100644 --- a/Modules/Project/Services/ProjectService.php +++ b/Modules/Project/Services/ProjectService.php @@ -386,6 +386,7 @@ public function getProjectStages(Project $project) { $project_id = $project->id; $stages = ProjectStages::where('project_id', $project_id)->orderBy('id')->get(); + return $stages; } From 527ec4fdc719d01cfeac67fcf29892fe8f2f16af Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Thu, 20 Jun 2024 13:40:17 +0530 Subject: [PATCH 12/21] Minor fixes in migration --- Modules/Project/Entities/ProjectStagesListing.php | 14 -------------- ...06_15_142418_update_project_old_stage_table.php | 9 ++++++--- 2 files changed, 6 insertions(+), 17 deletions(-) delete mode 100644 Modules/Project/Entities/ProjectStagesListing.php diff --git a/Modules/Project/Entities/ProjectStagesListing.php b/Modules/Project/Entities/ProjectStagesListing.php deleted file mode 100644 index 5136c81199..0000000000 --- a/Modules/Project/Entities/ProjectStagesListing.php +++ /dev/null @@ -1,14 +0,0 @@ -dropColumn(['project_id', 'name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); $table->text('comments')->nullable(); - $table->text('stage_name')->after('project_id'); - $table->text('status')->after('stage_name')->nullable(); $table->datetime('end_date')->nullable()->change(); }); Schema::table('project_old_stages', function (Blueprint $table) { - $table->unsignedBigInteger('project_id')->after('id'); + $table->unsignedBigInteger('project_id')->nullable()->after('id'); + $table->text('stage_name')->after('project_id'); + $table->text('status')->after('stage_name')->nullable(); $table->foreign('project_id')->references('id')->on('projects'); }); } @@ -41,6 +41,8 @@ public function down() $table->dropColumn('status'); $table->dropColumn('project_id'); + }); + Schema::table('project_old_stages', function (Blueprint $table) { $table->string('name')->nullable(); $table->decimal('cost', 8, 2)->nullable(); $table->string('currency_cost')->nullable(); @@ -48,6 +50,7 @@ public function down() $table->string('cost_include_gst')->nullable(); $table->date('start_date')->nullable(); $table->date('end_date')->nullable()->change(); + $table->unsignedInteger('project_id'); }); } } From 7a669a190f7afa7274350ecf8c1f1648cb637107 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Thu, 20 Jun 2024 13:41:28 +0530 Subject: [PATCH 13/21] Minor fixes in migration --- .../2024_06_15_142418_update_project_old_stage_table.php | 1 - 1 file changed, 1 deletion(-) diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index cbb6e94b5d..15bffb067f 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -40,7 +40,6 @@ public function down() $table->dropColumn('stage_name'); $table->dropColumn('status'); $table->dropColumn('project_id'); - }); Schema::table('project_old_stages', function (Blueprint $table) { $table->string('name')->nullable(); From ebdda52942df533d1bd14d13dc233e8f694aa13e Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Sat, 22 Jun 2024 14:42:44 +0530 Subject: [PATCH 14/21] Added start date + duration column in the table + action items in frontend + updateStatus funtion to toggle status as per need --- .../Project/Resources/views/show.blade.php | 183 +++++++++++------- .../views/subviews/project-stages.blade.php | 42 ++-- Modules/Project/Services/ProjectService.php | 50 +++-- ..._142418_update_project_old_stage_table.php | 7 +- 4 files changed, 188 insertions(+), 94 deletions(-) diff --git a/Modules/Project/Resources/views/show.blade.php b/Modules/Project/Resources/views/show.blade.php index 32ea1f5724..01fee7c900 100644 --- a/Modules/Project/Resources/views/show.blade.php +++ b/Modules/Project/Resources/views/show.blade.php @@ -329,76 +329,127 @@
@endsection @section('vue_scripts') - + }, + mounted() { + this.stages = @json($stages) || []; + this.stages.forEach(stage => { + stage.started = stage.status === 'started' || stage.status === 'completed' ? stage.status : false; + stage.completed = stage.status === 'completed' ? stage.status : false; + }); + } + }); + + @endsection \ No newline at end of file diff --git a/Modules/Project/Resources/views/subviews/project-stages.blade.php b/Modules/Project/Resources/views/subviews/project-stages.blade.php index 6bb9d3a746..3df7e80d2d 100644 --- a/Modules/Project/Resources/views/subviews/project-stages.blade.php +++ b/Modules/Project/Resources/views/subviews/project-stages.blade.php @@ -12,41 +12,55 @@
S. No.
Stage Name
-
Comment
Start Date
End Date
-
Status
+
Status
+
Comment
+
Action
-
+
@{{ index + 1 }}
- -
-
- +
- +
-
+
- - +
Mark to Start
+ +
+
+
Check to End
+ + +
+
+
+ +
+
+ +
-
- +
+
+
+ Duration +
- +
diff --git a/Modules/Project/Services/ProjectService.php b/Modules/Project/Services/ProjectService.php index d9369e1e0f..50891e8c18 100644 --- a/Modules/Project/Services/ProjectService.php +++ b/Modules/Project/Services/ProjectService.php @@ -393,31 +393,57 @@ public function getProjectStages(Project $project) public function storeStage(array $newStages, int $projectId) { foreach ($newStages as $stage) { - ProjectStages::create([ + $stageData = $this->prepareStageData($stage); + + ProjectStages::create(array_merge($stageData, [ 'project_id' => $projectId, - 'stage_name' => $stage['stage_name'], - 'comments' => $stage['comments'] ?? null, - 'status' => $stage['status'] ?? 'pending', 'created_at' => now(), 'updated_at' => now(), - 'end_date' => $stage['status'] !== 'pending' ? now() : null, - ]); + ])); } } public function updateStage(array $updatedStages) { foreach ($updatedStages as $stage) { + $stageData = $this->prepareStageData($stage); + $existingStage = ProjectStages::find($stage['id']); - $existingStage->update([ - 'stage_name' => $stage['stage_name'], - 'comments' => $stage['comments'] ?? null, - 'status' => $stage['status'] ?? 'pending', - 'end_date' => $stage['status'] !== 'pending' ? now() : null, - ]); + if ($existingStage) { + $existingStage->update(array_merge($stageData, [ + 'updated_at' => now(), + ])); + } } } + private function prepareStageData(array $stage): array + { + $startDate = null; + $endDate = null; + $duration = null; + + if ($stage['start_date']) { + $formattedStartDate = Carbon::parse($stage['start_date']); + $startDate = $formattedStartDate->setTimezone(config('app.timezone'))->format(config('constants.datetime_format')); + } + + if ($stage['end_date']) { + $formattedEndDate = Carbon::parse($stage['end_date']); + $endDate = $formattedEndDate->setTimezone(config('app.timezone'))->format(config('constants.datetime_format')); + $duration = Carbon::parse($stage['start_date'])->diffInSeconds($formattedEndDate); + } + + return [ + 'stage_name' => $stage['stage_name'], + 'comments' => $stage['comments'] ?? null, + 'status' => $stage['status'] ?? 'pending', + 'start_date' => $startDate, + 'end_date' => $endDate, + 'duration' => $duration, + ]; + } + public function removeStage(array $idArr) { ProjectStages::whereIn('id', $idArr)->delete(); diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index 15bffb067f..1077e104e4 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -16,14 +16,16 @@ public function up() Schema::table('project_old_stages', function (Blueprint $table) { $table->dropForeign(['project_id']); - $table->dropColumn(['project_id', 'name', 'cost', 'currency_cost', 'type', 'cost_include_gst', 'start_date']); + $table->dropColumn(['project_id', 'name', 'cost', 'currency_cost', 'type', 'cost_include_gst']); $table->text('comments')->nullable(); + $table->datetime('start_date')->nullable()->change(); $table->datetime('end_date')->nullable()->change(); }); Schema::table('project_old_stages', function (Blueprint $table) { $table->unsignedBigInteger('project_id')->nullable()->after('id'); $table->text('stage_name')->after('project_id'); $table->text('status')->after('stage_name')->nullable(); + $table->Integer('duration')->after('status')->nullable(); $table->foreign('project_id')->references('id')->on('projects'); }); } @@ -40,6 +42,7 @@ public function down() $table->dropColumn('stage_name'); $table->dropColumn('status'); $table->dropColumn('project_id'); + $table->dropColumn('duration'); }); Schema::table('project_old_stages', function (Blueprint $table) { $table->string('name')->nullable(); @@ -47,7 +50,7 @@ public function down() $table->string('currency_cost')->nullable(); $table->string('type')->nullable(); $table->string('cost_include_gst')->nullable(); - $table->date('start_date')->nullable(); + $table->date('start_date')->nullable()->change(); $table->date('end_date')->nullable()->change(); $table->unsignedInteger('project_id'); }); From 10afc656fb4c210b6356546d67f669f656f69d1c Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Sat, 22 Jun 2024 14:48:20 +0530 Subject: [PATCH 15/21] Minor changes --- Modules/Project/Services/ProjectService.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/Project/Services/ProjectService.php b/Modules/Project/Services/ProjectService.php index 50891e8c18..5fcfe32353 100644 --- a/Modules/Project/Services/ProjectService.php +++ b/Modules/Project/Services/ProjectService.php @@ -417,6 +417,11 @@ public function updateStage(array $updatedStages) } } + public function removeStage(array $idArr) + { + ProjectStages::whereIn('id', $idArr)->delete(); + } + private function prepareStageData(array $stage): array { $startDate = null; @@ -444,11 +449,6 @@ private function prepareStageData(array $stage): array ]; } - public function removeStage(array $idArr) - { - ProjectStages::whereIn('id', $idArr)->delete(); - } - private function getListTabCounts($filters, $showAllProjects, $userId) { $counts = [ From c751f3d94dd8fa98db6f6b948b58017d1581a2ff Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Sat, 22 Jun 2024 15:30:15 +0530 Subject: [PATCH 16/21] Minor fixes --- Modules/Project/Resources/views/show.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Project/Resources/views/show.blade.php b/Modules/Project/Resources/views/show.blade.php index 01fee7c900..794e6ffbe9 100644 --- a/Modules/Project/Resources/views/show.blade.php +++ b/Modules/Project/Resources/views/show.blade.php @@ -445,8 +445,8 @@ mounted() { this.stages = @json($stages) || []; this.stages.forEach(stage => { - stage.started = stage.status === 'started' || stage.status === 'completed' ? stage.status : false; - stage.completed = stage.status === 'completed' ? stage.status : false; + stage.started = stage.status === 'started' || stage.status === 'completed' ? true : false; + stage.completed = stage.status === 'completed' ? true : false; }); } }); From c6d6f0a9bff96889165416f53c8254d280a81455 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Mon, 24 Jun 2024 18:40:06 +0530 Subject: [PATCH 17/21] Created a table to store the new list of the project stages --- .../Project/Entities/ProjectStagesListing.php | 14 ++++++++ Modules/Project/Services/ProjectService.php | 11 +++++++ ...reate_project_stages_new_listing_table.php | 32 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 Modules/Project/Entities/ProjectStagesListing.php create mode 100644 database/migrations/2024_06_24_181032_create_project_stages_new_listing_table.php diff --git a/Modules/Project/Entities/ProjectStagesListing.php b/Modules/Project/Entities/ProjectStagesListing.php new file mode 100644 index 0000000000..6e21265416 --- /dev/null +++ b/Modules/Project/Entities/ProjectStagesListing.php @@ -0,0 +1,14 @@ +delete(); } + public function createProjectStageList(string $stageName) + { + $formattedStageName = strtolower($stageName); + ProjectStagesListing::firstOrCreate( + ['name' => $formattedStageName] + ); + } + private function prepareStageData(array $stage): array { $startDate = null; @@ -439,6 +448,8 @@ private function prepareStageData(array $stage): array $duration = Carbon::parse($stage['start_date'])->diffInSeconds($formattedEndDate); } + $this->createProjectStageList($stage['stage_name']); + return [ 'stage_name' => $stage['stage_name'], 'comments' => $stage['comments'] ?? null, diff --git a/database/migrations/2024_06_24_181032_create_project_stages_new_listing_table.php b/database/migrations/2024_06_24_181032_create_project_stages_new_listing_table.php new file mode 100644 index 0000000000..969b1bbf31 --- /dev/null +++ b/database/migrations/2024_06_24_181032_create_project_stages_new_listing_table.php @@ -0,0 +1,32 @@ +increments('id'); + $table->string('name'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('project_stages_listing'); + } +} \ No newline at end of file From a6f3200a222bf927e9a49d63a45f70a579a9ca8f Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Mon, 24 Jun 2024 18:45:39 +0530 Subject: [PATCH 18/21] CI fixes --- Modules/Project/Entities/ProjectStagesListing.php | 2 +- ...024_06_24_181032_create_project_stages_new_listing_table.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Project/Entities/ProjectStagesListing.php b/Modules/Project/Entities/ProjectStagesListing.php index 6e21265416..5136c81199 100644 --- a/Modules/Project/Entities/ProjectStagesListing.php +++ b/Modules/Project/Entities/ProjectStagesListing.php @@ -11,4 +11,4 @@ class ProjectStagesListing extends Model protected $table = 'project_stages_listing'; protected $guarded = []; protected $fillables = ['name', 'created_at', 'updated_at']; -} \ No newline at end of file +} diff --git a/database/migrations/2024_06_24_181032_create_project_stages_new_listing_table.php b/database/migrations/2024_06_24_181032_create_project_stages_new_listing_table.php index 969b1bbf31..0c80f5fcc9 100644 --- a/database/migrations/2024_06_24_181032_create_project_stages_new_listing_table.php +++ b/database/migrations/2024_06_24_181032_create_project_stages_new_listing_table.php @@ -29,4 +29,4 @@ public function down() { Schema::dropIfExists('project_stages_listing'); } -} \ No newline at end of file +} From 6464667e961f12883b624439b592cce37ef866cb Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Tue, 2 Jul 2024 16:56:06 +0530 Subject: [PATCH 19/21] Created expected end date column + displayed delay for overdie status + added richeditor for comments --- .../Http/Controllers/ProjectController.php | 1 + .../Project/Resources/assets/sass/app.scss | 152 ---------------- .../Project/Resources/views/show.blade.php | 169 ++++++++++++------ .../views/subviews/project-stages.blade.php | 106 +++++------ Modules/Project/Services/ProjectService.php | 1 + ..._142418_update_project_old_stage_table.php | 16 +- 6 files changed, 181 insertions(+), 264 deletions(-) diff --git a/Modules/Project/Http/Controllers/ProjectController.php b/Modules/Project/Http/Controllers/ProjectController.php index 8b901cc132..07cd4340e8 100644 --- a/Modules/Project/Http/Controllers/ProjectController.php +++ b/Modules/Project/Http/Controllers/ProjectController.php @@ -210,6 +210,7 @@ public function manageStage(Request $request) 'newStages.*.stage_name' => 'required|string', 'newStages.*.comments' => 'nullable|string', 'newStages.*.status' => 'nullable|string', + 'newStages.*.expected_end_date' => 'required|date', 'deletedStages' => 'nullable|array', 'deletedStages.*' => 'required|integer|exists:project_old_stages,id', 'updatedStages' => 'nullable|array', diff --git a/Modules/Project/Resources/assets/sass/app.scss b/Modules/Project/Resources/assets/sass/app.scss index 3f0a5b5d34..e69de29bb2 100644 --- a/Modules/Project/Resources/assets/sass/app.scss +++ b/Modules/Project/Resources/assets/sass/app.scss @@ -1,152 +0,0 @@ - - .checkbox-wrapper-19 { - box-sizing: border-box; - --background-color: #fff; - --checkbox-height: 20px; - } - - @-moz-keyframes dothabottomcheck-19 { - 0% { - height: 0; - } - 100% { - height: calc(var(--checkbox-height) / 2); - } - } - - @-webkit-keyframes dothabottomcheck-19 { - 0% { - height: 0; - } - 100% { - height: calc(var(--checkbox-height) / 2); - } - } - - @keyframes dothabottomcheck-19 { - 0% { - height: 0; - } - 100% { - height: calc(var(--checkbox-height) / 2); - } - } - - @keyframes dothatopcheck-19 { - 0% { - height: 0; - } - 50% { - height: 0; - } - 100% { - height: calc(var(--checkbox-height) * 1.2); - } - } - - @-webkit-keyframes dothatopcheck-19 { - 0% { - height: 0; - } - 50% { - height: 0; - } - 100% { - height: calc(var(--checkbox-height) * 1.2); - } - } - - @-moz-keyframes dothatopcheck-19 { - 0% { - height: 0; - } - 50% { - height: 0; - } - 100% { - height: calc(var(--checkbox-height) * 1.2); - } - } - - .checkbox-wrapper-19 input[type=checkbox] { - display: none; - } - - .checkbox-wrapper-19 .check-box { - height: var(--checkbox-height); - width: var(--checkbox-height); - background-color: transparent; - border: calc(var(--checkbox-height) * .1) solid #000; - border-radius: 5px; - position: relative; - display: inline-block; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - -moz-transition: border-color ease 0.2s; - -o-transition: border-color ease 0.2s; - -webkit-transition: border-color ease 0.2s; - transition: border-color ease 0.2s; - cursor: pointer; - } - .checkbox-wrapper-19 .check-box::before, - .checkbox-wrapper-19 .check-box::after { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - position: absolute; - height: 0; - width: calc(var(--checkbox-height) * .2); - background-color: #34b93d; - display: inline-block; - -moz-transform-origin: left top; - -ms-transform-origin: left top; - -o-transform-origin: left top; - -webkit-transform-origin: left top; - transform-origin: left top; - border-radius: 5px; - content: " "; - -webkit-transition: opacity ease 0.5; - -moz-transition: opacity ease 0.5; - transition: opacity ease 0.5; - } - .checkbox-wrapper-19 .check-box::before { - top: calc(var(--checkbox-height) * .72); - left: calc(var(--checkbox-height) * .41); - box-shadow: 0 0 0 calc(var(--checkbox-height) * .05) var(--background-color); - -moz-transform: rotate(-135deg); - -ms-transform: rotate(-135deg); - -o-transform: rotate(-135deg); - -webkit-transform: rotate(-135deg); - transform: rotate(-135deg); - } - .checkbox-wrapper-19 .check-box::after { - top: calc(var(--checkbox-height) * .37); - left: calc(var(--checkbox-height) * .05); - -moz-transform: rotate(-45deg); - -ms-transform: rotate(-45deg); - -o-transform: rotate(-45deg); - -webkit-transform: rotate(-45deg); - transform: rotate(-45deg); - } - - .checkbox-wrapper-19 input[type=checkbox]:checked + .check-box, - .checkbox-wrapper-19 .check-box.checked { - border-color: #34b93d; - } - .checkbox-wrapper-19 input[type=checkbox]:checked + .check-box::after, - .checkbox-wrapper-19 .check-box.checked::after { - height: calc(var(--checkbox-height) / 2); - -moz-animation: dothabottomcheck-19 0.2s ease 0s forwards; - -o-animation: dothabottomcheck-19 0.2s ease 0s forwards; - -webkit-animation: dothabottomcheck-19 0.2s ease 0s forwards; - animation: dothabottomcheck-19 0.2s ease 0s forwards; - } - .checkbox-wrapper-19 input[type=checkbox]:checked + .check-box::before, - .checkbox-wrapper-19 .check-box.checked::before { - height: calc(var(--checkbox-height) * 1.2); - -moz-animation: dothatopcheck-19 0.4s ease 0s forwards; - -o-animation: dothatopcheck-19 0.4s ease 0s forwards; - -webkit-animation: dothatopcheck-19 0.4s ease 0s forwards; - animation: dothatopcheck-19 0.4s ease 0s forwards; - } \ No newline at end of file diff --git a/Modules/Project/Resources/views/show.blade.php b/Modules/Project/Resources/views/show.blade.php index 794e6ffbe9..95c7737eac 100644 --- a/Modules/Project/Resources/views/show.blade.php +++ b/Modules/Project/Resources/views/show.blade.php @@ -339,114 +339,177 @@ projectId: "{{ $project->id }}", loaderVisible: false, submitButton: true, - editButtonStates: {} + editButtonStates: {}, + dropdownVisibility: {}, + currentDate: "{{ now()->toDateString() }}" }; }, methods: { - convertDuration(seconds) { - const days = Math.floor(seconds / (24 * 3600)); - seconds %= 24 * 3600; - const hours = Math.floor(seconds / 3600); - seconds %= 3600; - const minutes = Math.floor(seconds / 60); - seconds %= 60; - return `${days}d ${hours}h ${minutes}m ${seconds}s`; + convertToDateTime(seconds) { + const units = [ + { label: 'd', value: 24 * 3600 }, + { label: 'h', value: 3600 }, + { label: 'm', value: 60 }, + { label: 's', value: 1 } + ]; + return units.map(unit => { + const count = Math.floor(seconds / unit.value); + seconds %= unit.value; + return count ? `${count}${unit.label}` : ''; + }).filter(Boolean).join(' '); + }, + calculateDuration(stage) { + const duration = this.convertToDateTime(stage.duration); + const delay = this.calculateDelay(stage.end_date, stage.expected_end_date); + return delay ? `${duration} (Delay: ${delay})` : duration; + }, + calculateDelay(endDate, expectedEndDate) { + const delaySeconds = Math.floor((new Date(endDate) - new Date(expectedEndDate)) / 1000); + return delaySeconds > 0 ? this.convertToDateTime(delaySeconds) : null; }, formattedDate(dateTime) { - var date = new Date(dateTime); - if (!dateTime) return ''; - return date.toISOString().split('T')[0]; + return dateTime ? new Date(dateTime).toISOString().split('T')[0] : ''; + }, + formatDisplayDate(date) { + return new Date(date).toDateString().split(' ').slice(1).join(' '); }, addStage() { - var newIndex = this.stages.length; + const newIndex = this.stages.length; this.editStage(newIndex); this.submitButton = false; - this.stages.push({ stage_name: '', comments: '', start_date: '', end_date: '', status: 'pending' }); + this.stages.push({ + stage_name: '', + comments: '', + start_date: '', + expected_end_date: '', + end_date: '', + status: 'pending' + }); + this.$nextTick(() => this.initializeRichTextEditor(newIndex)); }, editStage(index) { this.submitButton = false; this.$set(this.editButtonStates, index, true); + this.initializeRichTextEditor(index); }, isEditing(index) { return this.editButtonStates[index] || false; }, deleteStage(stage) { this.submitButton = false; - if (!this.deletedStages.includes(stage) && (stage.id)) { + if (!this.deletedStages.includes(stage.id) && stage.id) { this.deletedStages.push(stage.id); } var index = this.stages.indexOf(stage); if (index !== -1) { this.stages.splice(index, 1); } + this.$nextTick(() => { + tinymce.remove(); + this.stages.forEach((stage, index) => { + if (this.isEditing(index)) { + this.initializeRichTextEditor(index); + } + }); + }); }, markStageAsUpdated(stage) { - if (stage.id) { - stage.isUpdated = true; - } + if (stage.id) stage.isUpdated = true; }, updateStatus(status, index) { + const stage = this.stages[index]; + stage.status = status; if (status === 'started') { - this.stages[index].started = !this.stages[index].started; - if (this.stages[index].started) { - this.stages[index].status = 'started'; - this.stages[index].start_date = new Date().toISOString(); - this.stages[index].end_date = null; - } else { - this.stages[index].status = 'pending'; - this.stages[index].start_date = null; - this.stages[index].end_date = null; - } + stage.start_date = new Date().toISOString(); + stage.end_date = null; } else if (status === 'completed') { - this.stages[index].completed = !this.stages[index].completed; - if (this.stages[index].completed) { - this.stages[index].status = 'completed'; - this.stages[index].end_date = new Date().toISOString(); - } else { - this.stages[index].status = this.stages[index].started ? 'started' : 'pending'; - this.stages[index].end_date = null; - } + stage.end_date = new Date().toISOString(); + } else if (status === 'pending') { + stage.start_date = null; + stage.end_date = null; } - this.markStageAsUpdated(this.stages[index]); + this.markStageAsUpdated(stage); }, submitForm() { - var newStages = this.stages.filter(stage => !stage.id).map(stage => this.cleanStageData(stage)); - var updatedStages = this.stages.filter(stage => stage.id && stage.isUpdated).map(stage => this.cleanStageData(stage)); + const newStages = this.stages.filter(stage => !stage.id).map(this.cleanStageData); + const updatedStages = this.stages.filter(stage => stage.id && stage.isUpdated).map(this.cleanStageData); + this.toggleLoader(); axios.post('{{ route('projects.manage-stage') }}', { - newStages: newStages, - updatedStages: updatedStages, + newStages, + updatedStages, deletedStages: this.deletedStages, project_id: this.projectId, _token: '{{ csrf_token() }}' - }).then(response => { + }).then(() => { this.toggleLoader(); this.$toast.success('Stages Managed Successfully!'); location.reload(true); }).catch(error => { this.toggleLoader(); - var errorMessage = error.response.data.message ? error.response.data.message : error.response.data.error; + const errorMessage = error.response?.data?.message || error.response?.data?.error || "An error occurred. Please check console"; + this.$toast.error(errorMessage); console.error(error.response.data); - if (errorMessage) { - this.$toast.error(errorMessage); - } else { - this.$toast.error("An error occurred. Please check console"); - } }); }, toggleLoader() { this.loaderVisible = !this.loaderVisible; }, cleanStageData(stage) { - var { comments, duration, start_date, end_date, id, project_id, stage_name, status } = stage; - return { comments, duration, start_date, end_date, id, project_id, stage_name, status }; + const { comments, duration, start_date, expected_end_date, end_date, id, project_id, stage_name, status } = stage; + return { comments, duration, start_date, expected_end_date, end_date, id, project_id, stage_name, status }; + }, + dropdownClass(status) { + const statusClasses = { + pending: 'btn btn-theme-gray', + started: 'btn btn-theme-fog', + completed: 'btn btn-success', + overdue: 'btn btn-danger' + }; + return `dropdown-content ${statusClasses[status] || 'btn btn-theme-gray'}`; + }, + checkOverdueStatus(stage) { + if (new Date(stage.expected_end_date) < new Date(this.currentDate) && stage.status !== 'completed') { + stage.status = 'overdue'; + } + }, + initializeRichTextEditor(index) { + if (!tinymce.get(`stage-comments-${index}`)) { + tinymce.init({ + selector: `#stage-comments-${index}`, + skin: "lightgray", + toolbar: "undo redo | formatselect | fontselect fontsizeselect bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image", + plugins: ["advlist lists autolink link image"], + font_formats: "Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;AkrutiKndPadmini=Akpdmi-n", + images_upload_url: "postAcceptor.php", + content_style: "body { font-size: 14pt; }", + automatic_uploads: false, + fontsize_formats: "8pt 10pt 12pt 14pt 16pt 18pt 24pt 36pt 48pt", + menubar: false, + statusbar: false, + entity_encoding: "raw", + forced_root_block: "", + force_br_newlines: true, + force_p_newlines: false, + width: 350, + convert_urls: false, + setup: editor => { + editor.on('input change keyup paste', () => { + this.stages[index].comments = editor.getContent(); + this.markStageAsUpdated(this.stages[index]); + }); + } + }); + } } }, mounted() { this.stages = @json($stages) || []; - this.stages.forEach(stage => { - stage.started = stage.status === 'started' || stage.status === 'completed' ? true : false; - stage.completed = stage.status === 'completed' ? true : false; + this.stages.forEach((stage, index) => { + stage.started = ['started', 'completed'].includes(stage.status); + stage.completed = stage.status === 'completed'; + stage.initialStatus = stage.status; + this.checkOverdueStatus(stage); }); } }); diff --git a/Modules/Project/Resources/views/subviews/project-stages.blade.php b/Modules/Project/Resources/views/subviews/project-stages.blade.php index 3df7e80d2d..b2ed7455a9 100644 --- a/Modules/Project/Resources/views/subviews/project-stages.blade.php +++ b/Modules/Project/Resources/views/subviews/project-stages.blade.php @@ -1,4 +1,4 @@ -
+

Project Stages

@@ -8,56 +8,58 @@
@csrf
-
-
-
S. No.
-
Stage Name
-
Start Date
-
End Date
-
Status
-
Comment
-
Action
-
-
-
-
-
@{{ index + 1 }}
-
- -
-
- -
-
- -
-
-
-
Mark to Start
- - -
-
-
Check to End
- - -
-
-
- -
-
- - -
-
-
-
- Duration - -
-
-
+ + + + + + + + + + + + + + + + +
@{{ index + 1 }} +

Stage Name

+ +

@{{ stage.stage_name }}

+
+

Start Date

+ +

@{{ formatDisplayDate(stage.start_date) }}

+
+

Expected End Date

+ +

@{{ formatDisplayDate(stage.expected_end_date) }}

+
+

Actual End Date

+ +

@{{ formatDisplayDate(stage.end_date) }}

+
+

Status

+ +
+

Comments

+ +

+
+

Action

+ + +
+ Duration: + +
@@ -80,4 +82,4 @@
-
\ No newline at end of file +
diff --git a/Modules/Project/Services/ProjectService.php b/Modules/Project/Services/ProjectService.php index 287c3131f3..98a137f197 100644 --- a/Modules/Project/Services/ProjectService.php +++ b/Modules/Project/Services/ProjectService.php @@ -456,6 +456,7 @@ private function prepareStageData(array $stage): array 'status' => $stage['status'] ?? 'pending', 'start_date' => $startDate, 'end_date' => $endDate, + 'expected_end_date' => $stage['expected_end_date'], 'duration' => $duration, ]; } diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index 1077e104e4..0ef363ae61 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -1,11 +1,11 @@ -dropForeign(['project_id']); $table->dropColumn(['project_id', 'name', 'cost', 'currency_cost', 'type', 'cost_include_gst']); $table->text('comments')->nullable(); $table->datetime('start_date')->nullable()->change(); $table->datetime('end_date')->nullable()->change(); + $table->date( 'expected_end_date' )->nullable()->after( 'end_date' ); }); Schema::table('project_old_stages', function (Blueprint $table) { $table->unsignedBigInteger('project_id')->nullable()->after('id'); @@ -43,6 +44,7 @@ public function down() $table->dropColumn('status'); $table->dropColumn('project_id'); $table->dropColumn('duration'); + $table->dropColumn('expected_end_date'); }); Schema::table('project_old_stages', function (Blueprint $table) { $table->string('name')->nullable(); From 3459c85e0366acd477c20615a02e7eafdf313955 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Tue, 2 Jul 2024 17:02:24 +0530 Subject: [PATCH 20/21] CI fixes --- ..._15_142418_update_project_old_stage_table.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index 0ef363ae61..b6651f91bd 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -1,11 +1,11 @@ - dropForeign(['project_id']); $table->dropColumn(['project_id', 'name', 'cost', 'currency_cost', 'type', 'cost_include_gst']); $table->text('comments')->nullable(); $table->datetime('start_date')->nullable()->change(); $table->datetime('end_date')->nullable()->change(); - $table->date( 'expected_end_date' )->nullable()->after( 'end_date' ); + $table->date( 'expected_end_date' )->nullable()->after('end_date'); }); Schema::table('project_old_stages', function (Blueprint $table) { $table->unsignedBigInteger('project_id')->nullable()->after('id'); From 3f886b6e43036e985f0db69d3073c47139447204 Mon Sep 17 00:00:00 2001 From: Anirudh Panwar Date: Tue, 2 Jul 2024 17:05:18 +0530 Subject: [PATCH 21/21] CI fixes --- .../2024_06_15_142418_update_project_old_stage_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php index b6651f91bd..ab01c5bac3 100644 --- a/database/migrations/2024_06_15_142418_update_project_old_stage_table.php +++ b/database/migrations/2024_06_15_142418_update_project_old_stage_table.php @@ -20,7 +20,7 @@ public function up() $table->text('comments')->nullable(); $table->datetime('start_date')->nullable()->change(); $table->datetime('end_date')->nullable()->change(); - $table->date( 'expected_end_date' )->nullable()->after('end_date'); + $table->date('expected_end_date')->nullable()->after('end_date'); }); Schema::table('project_old_stages', function (Blueprint $table) { $table->unsignedBigInteger('project_id')->nullable()->after('id');