Skip to content

Commit

Permalink
feat: implement SDGs data collection
Browse files Browse the repository at this point in the history
  • Loading branch information
keenthekeen committed Sep 15, 2024
1 parent 1aa6c40 commit 79ff0b7
Show file tree
Hide file tree
Showing 27 changed files with 973 additions and 18 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public function index(Request $request): Response {
$keyword = $request->input('search');

return Inertia::render('ProjectIndex', [
'list' => Project::searchQuery($keyword)->orderByDesc('year')->orderByDesc('number')->with([
'list' => Project::searchQuery($keyword)->addSelect(['sdgs'])->orderByDesc('year')->orderByDesc('number')
->with([
'documents' => function ($query) {
$query->select('id', 'tag', 'project_id');
$query->whereNotNull('tag');
Expand All @@ -53,7 +54,7 @@ public function indexOfYear(Request $request): Response {
$keyword = $request->input('search');

return Inertia::render('ProjectYearIndex', [
'list' => Project::searchQuery($keyword)->addSelect(['advisor'])->with([
'list' => Project::searchQuery($keyword)->addSelect(['advisor', 'sdgs'])->with([
'documents' => function ($query) {
$query->select('id', 'year', 'number', 'number_to', 'title', 'tag', 'project_id');
$query->whereNotNull('tag');
Expand Down Expand Up @@ -207,6 +208,7 @@ public function update(Request $request, Project $project) {
'organizers' => 'required|array',
'staff' => 'nullable|array',
'attendees' => 'nullable|array',
'sdgs' => 'nullable|array',
]);
$this->authorize('update-project', $project);

Expand Down
1 change: 1 addition & 0 deletions app/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Project extends Model {
'expense' => 'array',
'closure_submitted_at' => 'datetime',
'closure_approved_at' => 'datetime',
'sdgs' => 'array',
];
protected $hidden = ['user_id'];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
public function up(): void {
Schema::table('projects', function (Blueprint $table) {
$table->json('sdgs')->nullable();
});
}
};
43 changes: 43 additions & 0 deletions public/assets/sdgs/01.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions public/assets/sdgs/02.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions public/assets/sdgs/03.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 79ff0b7

Please sign in to comment.