forked from eatvio/eatvio-infra
119 lines
4.8 KiB
PHP
Executable File
119 lines
4.8 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\UserDetailz;
|
|
use Illuminate\Contracts\View\Factory as ViewFactory;
|
|
use Illuminate\Contracts\View\View;
|
|
|
|
class UserDetailzController extends Controller
|
|
{
|
|
public function show(UserDetailz $userDetailz): View|ViewFactory
|
|
{
|
|
$regFormKeys = [
|
|
'first_name' => __('reg_form.first_name'),
|
|
'last_name' => __('reg_form.last_name'),
|
|
'birthdate' => __('reg_form.date_of_birth'),
|
|
'gender' => __('reg_form.gender'),
|
|
'country' => __('reg_form.country'),
|
|
'city' => __('reg_form.city'),
|
|
'lang' => __('reg_form.talk_lang'),
|
|
'weight' => __('reg_form.your_weight'),
|
|
'height' => __('reg_form.your_height'),
|
|
'chest_circumference' => __('reg_form.chest_circumference'),
|
|
'waist_circumference' => __('reg_form.waist_circumference'),
|
|
'hip_circumference' => __('reg_form.hip_circumference'),
|
|
'blood_pressure_up' => __('reg_form.pressure_up'),
|
|
'blood_pressure_down' => __('reg_form.pressure_down'),
|
|
'has_hypo' => __('reg_form.tendency_to_be_hypo'),
|
|
'has_hyper' => __('reg_form.prone_to_hypertension'),
|
|
'about_alergy' => __('reg_form.has_alergy'),
|
|
'about_taking_pils' => __('reg_form.take_pils'),
|
|
'about_sport_hobbies' => __('reg_form.sport_hobbies'),
|
|
'favorite_foods' => __('reg_form.favorite_foods'),
|
|
'unfavorite_foods' => __('reg_form.unfavorite_foods'),
|
|
'additional_info' => __('reg_form.optional_info'),
|
|
];
|
|
|
|
$userAttributes = json_decode(json_encode($userDetailz->user), true);
|
|
$userDetailzAttributes = json_decode(json_encode($userDetailz), true);
|
|
|
|
return view(
|
|
'profile.detailz_show',
|
|
[
|
|
'user' => $userDetailz->user,
|
|
'userDetailz' => $userDetailz,
|
|
'regFormKeys' => $regFormKeys,
|
|
'userAttributes' => $userAttributes,
|
|
'userDetailzAttributes' => $userDetailzAttributes,
|
|
]
|
|
);
|
|
}
|
|
|
|
public function edit(UserDetailz $userDetailz): View|ViewFactory
|
|
{
|
|
$regFormKeys = [
|
|
'first_name' => __('reg_form.first_name'),
|
|
'last_name' => __('reg_form.last_name'),
|
|
'birthdate' => __('reg_form.date_of_birth'),
|
|
'gender' => __('reg_form.gender'),
|
|
'country' => __('reg_form.country'),
|
|
'city' => __('reg_form.city'),
|
|
'lang' => __('reg_form.talk_lang'),
|
|
'weight' => __('reg_form.your_weight'),
|
|
'chest_circumference' => __('reg_form.chest_circumference'),
|
|
'waist_circumference' => __('reg_form.waist_circumference'),
|
|
'hip_circumference' => __('reg_form.hip_circumference'),
|
|
'blood_pressure_up' => __('reg_form.pressure_up'),
|
|
'blood_pressure_down' => __('reg_form.pressure_down'),
|
|
'has_hypo' => __('reg_form.tendency_to_be_hypo'),
|
|
'has_hyper' => __('reg_form.prone_to_hypertension'),
|
|
'about_alergy' => __('reg_form.has_alergy'),
|
|
'about_taking_pils' => __('reg_form.take_pils'),
|
|
'about_sport_hobbies' => __('reg_form.sport_hobbies'),
|
|
'favorite_foods' => __('reg_form.favorite_foods'),
|
|
'unfavorite_foods' => __('reg_form.unfavorite_foods'),
|
|
'additional_info' => __('reg_form.optional_info'),
|
|
];
|
|
|
|
$regFormTypes = [
|
|
'first_name' => 'text',
|
|
'last_name' => 'text',
|
|
'birthdate' => 'date',
|
|
'gender' => 'text',
|
|
'country' => 'text',
|
|
'city' => 'text',
|
|
'lang' => 'text',
|
|
'weight' => 'number',
|
|
'chest_circumference' => 'number',
|
|
'waist_circumference' => 'number',
|
|
'hip_circumference' => 'number',
|
|
'blood_pressure_up' => 'number',
|
|
'blood_pressure_down' => 'number',
|
|
'has_hypo' => 'text',
|
|
'has_hyper' => 'text',
|
|
'about_alergy' => 'text',
|
|
'about_taking_pils' => 'text',
|
|
'about_sport_hobbies' => 'text',
|
|
'favorite_foods' => 'text',
|
|
'unfavorite_foods' => 'text',
|
|
'additional_info' => 'text',
|
|
];
|
|
|
|
$userAttributes = json_decode(json_encode($userDetailz->user), true);
|
|
$userDetailzAttributes = json_decode(json_encode($userDetailz), true);
|
|
|
|
return view(
|
|
'profile.detailz_edit',
|
|
[
|
|
'user' => $userDetailz->user,
|
|
'userDetailz' => $userDetailz,
|
|
'regFormKeys' => $regFormKeys,
|
|
'userAttributes' => $userAttributes,
|
|
'userDetailzAttributes' => $userDetailzAttributes,
|
|
'regFormTypes' => $regFormTypes,
|
|
]
|
|
);
|
|
}
|
|
}
|