diff --git a/backend/app/Http/Controllers/UserController.php b/backend/app/Http/Controllers/UserController.php index d2f2658..022f8f5 100644 --- a/backend/app/Http/Controllers/UserController.php +++ b/backend/app/Http/Controllers/UserController.php @@ -51,9 +51,11 @@ class UserController extends Controller /** * Display the specified resource. */ - public function show(User $user) + public function show(Request $request, $id) { - // + User::where('id', $request->user()->id)->update(['last_access' => now()]); + + return response()->json(User::findOrFail($id)); } /** diff --git a/backend/app/Models/User.php b/backend/app/Models/User.php index 3abae2a..81403e9 100644 --- a/backend/app/Models/User.php +++ b/backend/app/Models/User.php @@ -24,6 +24,7 @@ class User extends Authenticatable implements LaratrustUser */ protected $fillable = [ 'name', + 'surname', 'username', 'email', 'phone_number', @@ -37,6 +38,10 @@ class User extends Authenticatable implements LaratrustUser 'banned', 'hidden', 'password', + 'birthplace', + 'birthplace_province', + 'ssn', + 'address' ]; /** @@ -58,6 +63,8 @@ class User extends Authenticatable implements LaratrustUser 'email_verified_at' => 'datetime', 'last_access' => 'datetime', 'last_availability_change' => 'datetime', + 'birthday' => 'datetime', + 'course_date' => 'datetime' ]; /** diff --git a/backend/database/migrations/2024_01_03_233238_add_more_user_data_fields.php b/backend/database/migrations/2024_01_03_233238_add_more_user_data_fields.php new file mode 100644 index 0000000..e289e44 --- /dev/null +++ b/backend/database/migrations/2024_01_03_233238_add_more_user_data_fields.php @@ -0,0 +1,40 @@ +string('surname')->nullable()->after('name'); + $table->string('birthplace')->nullable()->after('surname'); + $table->string('birthplace_province')->nullable()->after('birthplace'); + $table->string('ssn')->nullable()->after('birthplace_province'); + $table->string('address')->nullable()->after('ssn'); + $table->timestamp('birthday')->nullable()->after('last_availability_change'); + $table->timestamp('course_date')->nullable()->after('birthday'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('surname'); + $table->dropColumn('birthplace'); + $table->dropColumn('birthplace_province'); + $table->dropColumn('ssn'); + $table->dropColumn('address'); + $table->dropColumn('birthday'); + $table->dropColumn('course_date'); + }); + } +}; diff --git a/backend/routes/api.php b/backend/routes/api.php index 92908e4..ade50d5 100644 --- a/backend/routes/api.php +++ b/backend/routes/api.php @@ -45,6 +45,8 @@ Route::middleware('auth:sanctum')->group( function () { Route::get('/list', [UserController::class, 'index'])->middleware(ETag::class); + Route::get('/users/{id}', [UserController::class, 'show']); + Route::get('/schedules', [ScheduleSlotsController::class, 'index']); Route::post('/schedules', [ScheduleSlotsController::class, 'store']); diff --git a/frontend/src/app/_components/modal-user-info/modal-user-info.component.html b/frontend/src/app/_components/modal-user-info/modal-user-info.component.html new file mode 100644 index 0000000..895438c --- /dev/null +++ b/frontend/src/app/_components/modal-user-info/modal-user-info.component.html @@ -0,0 +1,117 @@ +
+ | + |
---|---|
Cognome | +{{ user.surname }} | +
Nome | +{{ user.name }} | +
Username | +{{ user.username }} | +
Data di nascita | +{{ user.birthday | date:'dd/MM/yyyy' }} | +
Luogo di nascita | +{{ user.birthplace }} |
+
Codice fiscale | +{{ user.ssn }} | +
+ + RECAPITI+ |
+ |
Indirizzo | ++ + {{ user.address }} + + | +
Telefono | +{{ user.phone_number }} | +
{{ user.email }} | +|
+ + INFORMAZIONI SERVIZIO+ |
+ |
Autista | ++ + + | +
Tipologia | +
+ ![]() ![]() |
+
Data corso | +{{ user.course_date }} | +