Skip to content

Commit

Permalink
Merge pull request #7 from lighthouse-na/main
Browse files Browse the repository at this point in the history
Fork Sync: Update from parent repository
  • Loading branch information
aaron-muti-420 authored Mar 28, 2024
2 parents 10093d2 + 96304b5 commit a73788a
Show file tree
Hide file tree
Showing 61 changed files with 34,537 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ yarn-error.log
/.vscode
/storage/framework/views/*.php
```
/storage/*
/storage/*/*/*
!/storage/.gitkeep
8 changes: 6 additions & 2 deletions app/Http/Controllers/Assessment/AssessmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public function show(User $user, assessment $assessment)
{
$jcp = $user->jcp()
->with('skills.category') // Eager load skills and their categories
->where('assessment_id', $assessment->id)->get();
->where('assessment_id', $assessment->id)
->where('is_active', 1) // Only load jcp where is_active is 1
->get();



return view('assessments.show', compact('jcp', 'user', 'assessment'));
}
Expand All @@ -46,7 +50,7 @@ public function storeEmployee(User $user, assessment $assessment, jcp $jcp)
$mean = (array_sum($data['questions']) / $maxScore) * 100;

//Update enroll status
$user->assessments()->updateExistingPivot($assessment->id, ['status' => 1]);
// $user->assessments()->updateExistingPivot($assessment->id, ['status' => 1]);

$user->update(['competency_rating' => $mean]);

Expand Down
15 changes: 15 additions & 0 deletions app/Livewire/System/Jcps/JCPTable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Livewire\System\Jcps;

use App\Models\Audit\jcp;
use Livewire\Component;

class JCPTable extends Component
{
public $search = '';
public function render()
{
return view('livewire.system.jcps.j-c-p-table',['jcps' => jcp::search(request('search'))->paginate(10)]);
}
}
24 changes: 24 additions & 0 deletions app/Livewire/System/Org/OrgTable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Livewire\System\Org;

use App\Models\User;
use Livewire\Component;

class OrgTable extends Component
{
public $search = '';

public function index(){

return view('directories.org.index');

}
public function render()
{
$users = User::with(['jcp' => function ($query) {
$query->where('is_active', 1);
}])->search($this->search)->paginate(10);
return view('livewire.system.org.org-table', ['users' => $users]);
}
}
16 changes: 16 additions & 0 deletions app/Livewire/System/Qualifications/QualificationsTable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Livewire\System\Qualifications;

use App\Models\Audit\qualification;
use Livewire\Component;

class QualificationsTable extends Component
{

public $search = '';
public function render()
{
return view('livewire.system.qualifications.qualifications-table',['qualifications' => qualification::search($this->search)->paginate(10)]);
}
}
3 changes: 3 additions & 0 deletions app/Models/Audit/assessment.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ public function jcp()
return $this->hasMany(jcp::class, 'assessment_id');

}

public function scopeSearch($query, $search)
{
return $query->where('assessment_title', 'like', '%' . $search . '%');
}


}
12 changes: 9 additions & 3 deletions app/Models/Audit/jcp.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ public function skills()
return $this->belongsToMany(skill::class)->withPivot('user_rating', 'supervisor_rating');
}

public function qualifications(){
return $this->belongsToMany(qualification::class, 'jcp_qualification');
public function qualifications(){
return $this->belongsToMany(qualification::class, 'jcp_qualification');

}
}

public function scopeSearch($query, $val)
{
return $query->where('position_title', 'like', '%'.$val.'%')
->orWhere('job_description', 'like', '%'.$val.'%');
}
}
5 changes: 5 additions & 0 deletions app/Models/Audit/qualification.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ public function user()
{
return $this->belongsToMany(User::class, 'qualification_user');
}

public function scopeSearch($query, $val)
{
$query->where('qualification_title', 'like', '%'.$val.'%');
}
}
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"php": "^8.2",
"andreiio/blade-iconoir": "^4.1",
"blade-ui-kit/blade-icons": "^1.6",
"codeat3/blade-google-material-design-icons": "^1.19",
"codeat3/blade-iconpark": "^1.6",
"laravel/framework": "^11.0",
"laravel/jetstream": "^5.0",
"laravel/sanctum": "^4.0",
Expand Down
146 changes: 145 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion database/factories/Audit/categoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ class categoryFactory extends Factory
*/
public function definition(): array
{
$categories = [
"Behavioral",
"Knowledge",
"Basic Digital",
"Advanced Digital",
];
return [
//
'category_title' => $this->faker->name(),
'category_title' => $this->faker->unique()->randomElement($categories),
];
}
}
3 changes: 2 additions & 1 deletion database/factories/Audit/jcpFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ public function definition(): array
return [
//This populates the jcp model fields
'assessment_id' => $this->faker->randomElement($assessment_ids),
'user_id' => $this->faker->randomElement($user_ids),
'user_id' => $this->faker->unique()->randomElement($user_ids),
'position_title' => $this->faker->jobTitle(),
'job_grade' => $this->faker->numerify('B-#'),
'duty_station' => $this->faker->city(),
'job_purpose' => $this->faker->realText($maxNbChars = 200, $indexSize = 2),
'is_active' => 1,
];
}
}
2 changes: 1 addition & 1 deletion database/factories/Audit/qualificationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function definition(): array

return [
//
'qualification_title' => $this->faker->randomElement($qualifications),
'qualification_title' => $this->faker->unique()->randomElement($qualifications),
];
}
}
37 changes: 36 additions & 1 deletion database/factories/Audit/skillFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,46 @@ class skillFactory extends Factory
public function definition(): array
{
$category_ids = category::select('id')->get();
$skills = [
"Programming Languages",
"Web Development",
"Mobile App Development",
"Database Management",
"Data Analysis",
"Machine Learning",
"Artificial Intelligence",
"Cybersecurity",
"Cloud Computing",
"Network Administration",
"UI/UX Design",
"Graphic Design",
"Project Management",
"Agile Methodologies",
"DevOps",
"Quality Assurance",
"Technical Writing",
"Content Writing",
"Digital Marketing",
"Search Engine Optimization (SEO)",
"Social Media Management",
"Video Editing",
"Photography",
"Content Management Systems (CMS)",
"E-commerce Platforms",
"Customer Relationship Management (CRM)",
"Salesforce",
"Business Intelligence",
"Blockchain Development",
"Virtual Reality (VR) Development",
"Augmented Reality (AR) Development"
];


return [
//
'skill_category_id' => $this->faker->randomElement($category_ids),
'skill_title' => $this->faker->name(),
'skill_title' => $this->faker->unique()->randomElement($skills),
'skill_description' => $this->faker->realText($maxNbChars = 200, $indexSize = 2),
];
}
}
1 change: 1 addition & 0 deletions database/factories/UserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class UserFactory extends Factory
public function definition(): array
{
return [
'salary_ref_number' => $this->faker->unique()->randomNumber(8),
'first_name' => fake()->firstName(),
'last_name' => fake()->lastName(),
'email' => fake()->unique()->safeEmail(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function up(): void
$table->string('job_grade');
$table->string('duty_station');
$table->string('job_purpose');
$table->integer('is_active')->default(1);

// Add a unique constraint
$table->unique(['user_id', 'assessment_id']);
Expand Down
Loading

0 comments on commit a73788a

Please sign in to comment.