diff --git a/backend/app/Http/Controllers/Api/AuthorizationTrait.php b/backend/app/Http/Controllers/Api/AuthorizationTrait.php index 862f0f85..b00fec7e 100644 --- a/backend/app/Http/Controllers/Api/AuthorizationTrait.php +++ b/backend/app/Http/Controllers/Api/AuthorizationTrait.php @@ -11,7 +11,7 @@ trait AuthorizationTrait { $loginpage = $viewpath.'/'.($this->getGuard() == 'admins' ? 'login' : 'auth'); if (Session::has($this->getGuard())) { - return redirect($viewpath.'/meeting'); + return redirect(request()->route()->action['prefix'].'/meeting'); } return view($loginpage); diff --git a/backend/app/Http/Controllers/Api/ChildrenController.php b/backend/app/Http/Controllers/Api/ChildrenController.php index c3ba41e3..e3d66988 100644 --- a/backend/app/Http/Controllers/Api/ChildrenController.php +++ b/backend/app/Http/Controllers/Api/ChildrenController.php @@ -69,7 +69,7 @@ class ChildrenController extends Controller { $message = 'KIKI承知システムの招待URLが届きました。 ▼招待URLはコチラ -https://kikikan.jp/c-account/register/'.$token.' +'.url('/').'/c-account/register/'.$token.' KIKI承知システムを使って「聞いてない!」「言ってない!」などの問題を解決しよう。'; \Notification::route('nexmo', '81'.substr($r->tel, 1))->notify(new SmsNotification($message)); @@ -208,7 +208,7 @@ KIKI承知システムを使って「聞いてない!」「言ってない! $message = 'パスワード再発行用URLです。 有効期限は8時間以内です。 -https://kikikan.jp/c-account/forgot-password/reset/'.$token; +'.url('/').'/c-account/forgot-password/reset/'.$token; \Notification::route('nexmo', '81'.substr($r->tel, 1))->notify(new SmsNotification($message)); } catch (\Throwable $e) { // 失敗 @@ -398,6 +398,12 @@ https://kikikan.jp/c-account/forgot-password/reset/'.$token; ]; Child::where('id', (int)$child_id)->update($update); + + $get = Child::where('id', (int)$child_id)->first(); + $login_user_datum = $get->toArray(); + unset($login_user_datum['password']); + // セッションに保存する + session()->put('children', $login_user_datum); } catch (\Throwable $e) { // 失敗 Log::critical($e->getMessage()); diff --git a/backend/app/Http/Controllers/Api/FathersController.php b/backend/app/Http/Controllers/Api/FathersController.php index 85177bee..21cc2867 100644 --- a/backend/app/Http/Controllers/Api/FathersController.php +++ b/backend/app/Http/Controllers/Api/FathersController.php @@ -336,6 +336,12 @@ class FathersController extends Controller { ]; Father::where('id', (int)$father_id)->update($update); + + $get = Father::where('id', (int)$father_id)->first(); + $login_user_datum = $get->toArray(); + unset($login_user_datum['password']); + // セッションに保存する + session()->put('fathers', $login_user_datum); } catch (\Throwable $e) { // 親プロフィール画像のアップロードに失敗 Log::critical($e->getMessage()); diff --git a/backend/app/Http/Controllers/Api/MeetingApprovalsController.php b/backend/app/Http/Controllers/Api/MeetingApprovalsController.php index 61c47307..5f6757cb 100644 --- a/backend/app/Http/Controllers/Api/MeetingApprovalsController.php +++ b/backend/app/Http/Controllers/Api/MeetingApprovalsController.php @@ -13,11 +13,19 @@ use App\Models\FatherRelation; class MeetingApprovalsController extends Controller { public function countNonApproval (Request $r) { - return $r->count; + return MeetingApprovals::where('child_id', session()->get('children')['id'])->whereNull('approval_at')->count(); } public function countIncomplete (Request $r) { - return $r->count; + $count = 0; + + if (null !== ($list = Meeting::select('id')->where('father_id', (int)session()->get('fathers')['id'])->get())) { + foreach ($list as $i => $l) { + $count += MeetingApprovals::where('meeting_id', (int)$l->id)->whereNull('approval_at')->count(); + } + } + + return $count; } public function register (Request $r) { diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index 4f45e87c..3ada16d1 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -236,16 +236,15 @@ class MeetingsController extends Controller { return ['status_code' => 400]; } foreach ($list as $i => $l) { - if (null !== ($l->approval = MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->first())) { - if (null === ($l->approval->child = Child::select($child_select)->where('id', (int)$l->approval->child_id)->first())) { - $l->approval->child = new \stdClass(); + if (null !== ($l->approval = MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->get())) { + foreach ($l->approval as $ii => $ll) { + if (null === ($ll->child = Child::select($child_select)->where('id', (int)$ll->child_id)->first())) { + $ll->child = []; + } } + + $result[] = $l; } - else { - $l->approval = new \stdClass(); - $l->approval->child = new \stdClass(); - } - $result[] = $l; } return ['status_code' => 200, 'params' => $result]; @@ -267,17 +266,15 @@ class MeetingsController extends Controller { } foreach ($list as $i => $l) { - if (null !== ($l->approval = MeetingApprovals::select($meeting_approvals_select)->whereNull('approval_at')->where('meeting_id', (int)$l->id)->first())) { - if (null === ($l->approval->child = Child::select($child_select)->where('id', (int)$l->approval->child_id)->first())) { - $l->approval->child = new \stdClass(); + if (null !== ($l->approval = MeetingApprovals::select($meeting_approvals_select)->whereNull('approval_at')->where('meeting_id', (int)$l->id)->get())) { + foreach ($l->approval as $ii => $ll) { + if (null === ($ll->child = Child::select($child_select)->where('id', (int)$ll->child_id)->first())) { + $ll->child = []; + } } - } - else { - $l->approval = new \stdClass(); - $l->approval->child = new \stdClass(); - } - $result[] = $l; + $result[] = $l; + } } return ['status_code' => 200, 'params' => $result]; diff --git a/backend/app/Http/Middleware/NoticeIncomplete.php b/backend/app/Http/Middleware/NoticeIncomplete.php index 1ac1b139..058ac638 100644 --- a/backend/app/Http/Middleware/NoticeIncomplete.php +++ b/backend/app/Http/Middleware/NoticeIncomplete.php @@ -21,11 +21,10 @@ class NoticeIncomplete $response = $next($request); $count = 0; - if (null === ($list = Meeting::select('id')->where('father_id', (int)session()->get('fathers')['id'])->get())) { - return ['status_code' => 400]; - } - foreach ($list as $i => $l) { - $count += MeetingApprovals::where('meeting_id', (int)$l->id)->whereNull('approval_at')->count(); + if (null !== ($list = Meeting::select('id')->where('father_id', (int)session()->get('fathers')['id'])->get())) { + foreach ($list as $i => $l) { + $count += MeetingApprovals::where('meeting_id', (int)$l->id)->whereNull('approval_at')->count(); + } } $content = json_decode($response->content(), true); diff --git a/backend/public/js/app.js b/backend/public/js/app.js index add0d2c1..d1c664f0 100644 --- a/backend/public/js/app.js +++ b/backend/public/js/app.js @@ -42663,15 +42663,34 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router/esm/react-router.js"); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); + var Notification = function Notification(_ref) { var notice = _ref.notice; + var history = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_2__.useHistory)(); + + var handleClick = function handleClick() { + var navbar_list = document.getElementsByClassName("mypage-nav-list__item"); + + for (var i = 0; i < navbar_list.length; i++) { + navbar_list[i].classList.remove('nav-active'); + } + + document.getElementsByClassName("-meeting")[0].classList.add('nav-active'); + history.push({ + pathname: "/c-account/meeting/", + state: {} + }); + }; + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("div", { className: "p-notification", + onClick: handleClick, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("div", { className: "p-notification-icon", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div", { @@ -43563,8 +43582,9 @@ var Profile = function Profile() { switch (response.data.status_code) { case 200: { - setImage(reader.result); + // setImage(reader.result); setSuccessUpdateImage(response.data.success_messages); + window.location.reload(true); break; } @@ -44612,6 +44632,17 @@ function Side() { }); }; + var handleSelected = function handleSelected(id) { + var navbar_list = document.getElementsByClassName("mypage-nav-list__item"); + + for (var i = 0; i < navbar_list.length; i++) { + navbar_list[i].classList.remove('nav-active'); + } + + document.getElementsByClassName(id)[0].classList.add('nav-active'); + setSelected(id); + }; + return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div", { className: "l-side", children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("div", { @@ -44628,10 +44659,9 @@ function Side() { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("ul", { className: "mypage-nav-list", children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("li", { - className: "mypage-nav-list__item -meeting ".concat((selected == 'meeting' || selected == '' && document.getElementById('c_router').value == 'meeting') && "nav-active"), + className: "mypage-nav-list__item -meeting ".concat(selected == '' && document.getElementById('c_router').value == 'meeting' && "nav-active"), onClick: function onClick(e) { - e.preventDefault(); - setSelected('meeting'); + return handleSelected("-meeting"); }, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(react_router_dom__WEBPACK_IMPORTED_MODULE_2__.Link, { className: "mypage-nav-list__link", @@ -44643,10 +44673,9 @@ function Side() { })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("li", { - className: "mypage-nav-list__item -search ".concat((selected == 'search' || selected == '' && document.getElementById('c_router').value == 'search') && "nav-active"), + className: "mypage-nav-list__item -search ".concat(selected == '' && document.getElementById('c_router').value == 'search' && "nav-active"), onClick: function onClick(e) { - e.preventDefault(); - setSelected('search'); + return handleSelected("-search"); }, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(react_router_dom__WEBPACK_IMPORTED_MODULE_2__.Link, { className: "mypage-nav-list__link", @@ -44658,10 +44687,9 @@ function Side() { })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("li", { - className: "mypage-nav-list__item -parentinfo ".concat((selected == 'parent' || selected == '' && document.getElementById('c_router').value == 'parent') && "nav-active"), + className: "mypage-nav-list__item -parentinfo ".concat(selected == '' && document.getElementById('c_router').value == 'parent' && "nav-active"), onClick: function onClick(e) { - e.preventDefault(); - setSelected('parent'); + return handleSelected("-parentinfo"); }, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(react_router_dom__WEBPACK_IMPORTED_MODULE_2__.Link, { className: "mypage-nav-list__link", @@ -44673,10 +44701,9 @@ function Side() { })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("li", { - className: "mypage-nav-list__item -profile ".concat((selected == 'profile' || selected == '' && document.getElementById('c_router').value == 'profile') && "nav-active"), + className: "mypage-nav-list__item -profile ".concat(selected == '' && document.getElementById('c_router').value == 'profile' && "nav-active"), onClick: function onClick(e) { - e.preventDefault(); - setSelected('profile'); + return handleSelected("-profile"); }, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(react_router_dom__WEBPACK_IMPORTED_MODULE_2__.Link, { className: "user-icon mypage-nav-list__link", @@ -44694,10 +44721,9 @@ function Side() { })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("li", { - className: "mypage-nav-list__item -logout ".concat(selected == 'logout' && "nav-active"), + className: "mypage-nav-list__item -logout ".concat(selected == '-logout' && "nav-active"), onClick: function onClick(e) { - e.preventDefault(); - setSelected('logout'); + return handleSelected("-logout"); }, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("a", { className: "mypage-nav-list__link", diff --git a/backend/resources/js/child/notification.jsx b/backend/resources/js/child/notification.jsx index f195f1b2..4b0d779f 100644 --- a/backend/resources/js/child/notification.jsx +++ b/backend/resources/js/child/notification.jsx @@ -1,9 +1,20 @@ import React, { useEffect, useState } from 'react'; +import { useHistory, Link } from 'react-router-dom'; const Notification = ({ notice }) => { + + const history = useHistory(); + + const handleClick = () => { + var navbar_list = document.getElementsByClassName("mypage-nav-list__item"); + for(let i=0; i +
{ diff --git a/backend/resources/js/child/profile/index.jsx b/backend/resources/js/child/profile/index.jsx index 1e1d0e33..a83bf12f 100644 --- a/backend/resources/js/child/profile/index.jsx +++ b/backend/resources/js/child/profile/index.jsx @@ -57,8 +57,9 @@ const Profile = () => { handleNotice(response.data.notice); switch(response.data.status_code){ case 200: { - setImage(reader.result); + // setImage(reader.result); setSuccessUpdateImage(response.data.success_messages); + window.location.reload(true); break; } case 400: set400Error(response.data.error_messages); break; diff --git a/backend/resources/js/child/side.jsx b/backend/resources/js/child/side.jsx index 1f25e7b9..0cd40086 100644 --- a/backend/resources/js/child/side.jsx +++ b/backend/resources/js/child/side.jsx @@ -11,6 +11,14 @@ export default function Side() { .then(() => location.href = '/c-account/login') } + const handleSelected = (id) => { + var navbar_list = document.getElementsByClassName("mypage-nav-list__item"); + for(let i=0; i
@@ -19,42 +27,30 @@ export default function Side() {