From 37d74a775902b4f94b0b7f2dc5e8ab5c20637e02 Mon Sep 17 00:00:00 2001 From: rizkyilhampra Date: Fri, 2 Jun 2023 03:49:08 +0800 Subject: [PATCH 1/7] change condition when included profile modal --- resources/views/user/user.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/user/user.blade.php b/resources/views/user/user.blade.php index daf9224..7796306 100644 --- a/resources/views/user/user.blade.php +++ b/resources/views/user/user.blade.php @@ -135,7 +135,7 @@ class="img-fluid chocolat-image" - @if (auth()->check()) + @can('asUser') @section('title', 'User ' . html_entity_decode('—')) @include('user.profile-modal') @push('scriptPerPage') @@ -285,7 +285,7 @@ class="img-fluid chocolat-image" @push('stylePerPage') @endpush - @endif + @endcan @endsection @push('scriptPerPage') From b2dcf33556963a64778a3086e81921a5d1b2c181 Mon Sep 17 00:00:00 2001 From: rizkyilhampra Date: Sun, 4 Jun 2023 00:11:54 +0800 Subject: [PATCH 2/7] add stack stylelibraries on user layout --- resources/views/layouts/user/app.blade.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/views/layouts/user/app.blade.php b/resources/views/layouts/user/app.blade.php index a00f898..3143cbd 100644 --- a/resources/views/layouts/user/app.blade.php +++ b/resources/views/layouts/user/app.blade.php @@ -16,6 +16,8 @@ + @stack('styleLibraries') + From bfa21f6317df84f2e3fc608e8c832cd031201209 Mon Sep 17 00:00:00 2001 From: rizkyilhampra Date: Sun, 4 Jun 2023 00:12:16 +0800 Subject: [PATCH 3/7] select2 handled --- public/spesified-assets/user/profile-modal.js | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 public/spesified-assets/user/profile-modal.js diff --git a/public/spesified-assets/user/profile-modal.js b/public/spesified-assets/user/profile-modal.js new file mode 100644 index 0000000..226253d --- /dev/null +++ b/public/spesified-assets/user/profile-modal.js @@ -0,0 +1,180 @@ +const modalEditProfile = document.getElementById('editProfileModal'); +const modalEditProfileInstance = bootstrap.Modal.getOrCreateInstance(modalEditProfile); +modalEditProfile.addEventListener('shown.bs.modal', async () => { + const btnSubmitEditProfile = document.getElementById('btnSubmitEditProfile'); + btnSubmitEditProfile.addEventListener('click', async (e) => { + e.preventDefault(); + Swal.fire({ + title: 'Mohon tunggu', + html: 'Sedang memproses data', + allowOutsideClick: false, + didOpen: () => { + Swal.showLoading() + }, + }); + try { + const response = await ajaxPostEditProfile(); + await new Promise(resolve => setTimeout(resolve, 1000)); // Delay selama 1 detik + await Swal.fire({ + icon: 'success', + title: 'Berhasil', + text: response.message, + showConfirmButton: false, + timer: 1500 + }); + return window.location.reload(); + } catch (error) { + swalError(error.responseJSON); + } + }); + + const setElementAttributes = (element, value, disabled = false) => { + element.value = value; + element.disabled = disabled; + }; + + const elements = { + nameInput: document.querySelector('input[name="name"]'), + emailInput: document.querySelector('input[name="email"]'), + addressTextarea: document.querySelector('textarea[name="address"]'), + provinsiSelect: document.querySelector('#provinsi'), + profesiInput: document.querySelector('#profesi'), + kotaSelect: document.querySelector('#kota') + }; + + setElementAttributes(elements.nameInput, 'Mohon Tunggu...', true); + setElementAttributes(elements.emailInput, 'Mohon Tunggu...', true); + setElementAttributes(elements.addressTextarea, 'Mohon Tunggu...', true); + let optionProvinsi = new Option('Mohon Tunggu', null, false, false); + let optionKota = new Option('Mohon Tunggu', null, false, false); + let optionProfesi = new Option('Mohon Tunggu', null, false, false); + $(elements.provinsiSelect).append(optionProvinsi).attr('disabled', true); + $(elements.kotaSelect).append(optionKota).attr('disabled', true); + $(elements.profesiInput).append(optionProfesi).attr('disabled', true); + + $(elements.provinsiSelect).select2({ + theme: 'bootstrap-5', + dropdownParent: $('#editProfileModal'), + }); + + $(elements.kotaSelect).select2({ + theme: 'bootstrap-5', + dropdownParent: $('#editProfileModal'), + }); + $(elements.profesiInput).select2({ + theme: 'bootstrap-5', + dropdownParent: $('#editProfileModal'), + }); + + try { + const response = await ajaxRequestEditProfile(); + $(elements.kotaSelect).empty(); + + if (response.user.profile == null) { + response.user.profile = { + address: '', + province: '', + city: '', + profession: '' + } + optionKota = new Option('Pilih Provinsi terlebih dahulu', null, false, true); + } else { + optionKota = new Option('Pilih Kota', null, false, true); + } + setElementAttributes(elements.nameInput, response.user.name); + setElementAttributes(elements.emailInput, response.user.email); + setElementAttributes(elements.addressTextarea, response.user.profile.address); + + $(elements.kotaSelect).append(optionKota).attr('disabled', false); + optionKota.disabled = true; + + $(elements.provinsiSelect).empty(); + optionProvinsi = new Option('Pilih Provinsi', null, false, true); + $(elements.provinsiSelect).append(optionProvinsi).attr('disabled', false); + optionProvinsi.disabled = true; + + $(elements.profesiInput).empty(); + optionProfesi = new Option('Pilih Profesi', null, false, true); + $(elements.profesiInput).append(optionProfesi).attr('disabled', false); + optionProfesi.disabled = true; + + + response.provinsi.forEach((value) => { + if (value.province_id == response.user.profile.province) { + const option = new Option(value.province, value.province_id, true, true); + $(elements.provinsiSelect).append(option); + } else { + const option = new Option(value.province, value.province_id, false, false); + $(elements.provinsiSelect).append(option); + } + }); + response.profesi.forEach(value => { + if (value == response.user.profile.profession) { + const option = new Option(value, value, true, true); + $(elements.profesiInput).append(option); + } else { + const option = new Option(value, value, false, false); + $(elements.profesiInput).append(option); + } + }); + try { + const response2 = await ajaxCityRequest($(elements.provinsiSelect).val()); + response2.forEach(value => { + if (value.city_id == response.user.profile.city) { + const option = new Option(value.city_name, value.city_id, true, + true); + $(elements.kotaSelect).append(option); + } else { + const option = new Option(value.city_name, value.city_id, false, + false); + $(elements.kotaSelect).append(option); + } + }); + } catch (error) { + if (!error.status == 404) { + swalError(error.responseJSON); + } + } + + } catch (error) { + swalError(error.responseJSON); + } + + + $(elements.provinsiSelect).on('select2:select', async (e) => { + $(elements.kotaSelect).empty(); + optionKota = new Option('Mohon Tunggu', null, false, false); + $(elements.kotaSelect).append(optionKota).attr('disabled', true); + try { + const response = await ajaxCityRequest(e.params.data.id); + $(elements.kotaSelect).empty(); + optionKota = new Option('Pilih Kota', null, false, true); + optionKota.disabled = true; + $(elements.kotaSelect).append(optionKota).attr('disabled', false); + response.forEach(value => { + const option = new Option(value.city_name, value.city_id, + false, + false); + $(elements.kotaSelect).append(option); + }); + } catch (error) { + if (error.status == 404) { + console.log(error); + } else { + swalError(error.responseJSON); + } + } + }); + await drawHistoriDiagnosisTable(); +}); + +$(document).on('select2:open', () => { + window.addEventListener('keydown', function (e) { + let dropdown = $('.select2-hidden-accessible'); + if ((e.key === 'Escape' || e.key === 'Esc') && $('.select2-container--open').length) { + e.stopPropagation(); + dropdown.select2('close'); + return false; + } + }, true); +}); From 0351452eb647e70e3ac0c9e87f8c7623d0b1aed3 Mon Sep 17 00:00:00 2001 From: rizkyilhampra Date: Sun, 4 Jun 2023 00:12:47 +0800 Subject: [PATCH 4/7] add class select2 --- resources/views/user/profile-modal.blade.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/resources/views/user/profile-modal.blade.php b/resources/views/user/profile-modal.blade.php index 4404e72..2435a61 100644 --- a/resources/views/user/profile-modal.blade.php +++ b/resources/views/user/profile-modal.blade.php @@ -39,8 +39,8 @@
-
@@ -48,7 +48,7 @@
-
@@ -56,9 +56,8 @@ class="form-label font-medium">Kota/Kabupaten
-
From fc31955fa5b6732f0da4ccdbc7f9dbb991b378a9 Mon Sep 17 00:00:00 2001 From: rizkyilhampra Date: Sun, 4 Jun 2023 00:13:49 +0800 Subject: [PATCH 5/7] remove script in blade and add js intstead --- resources/views/user/user.blade.php | 151 ++-------------------------- 1 file changed, 8 insertions(+), 143 deletions(-) diff --git a/resources/views/user/user.blade.php b/resources/views/user/user.blade.php index 7796306..fd2ec94 100644 --- a/resources/views/user/user.blade.php +++ b/resources/views/user/user.blade.php @@ -138,152 +138,17 @@ class="img-fluid chocolat-image" @can('asUser') @section('title', 'User ' . html_entity_decode('—')) @include('user.profile-modal') + @push('styleLibraries') + + + + @endpush @push('scriptPerPage') - - @endpush - @push('stylePerPage') - + + @endpush @endcan @endsection From 3e3f782cce52e6a29ca286d119edbd73974b15d2 Mon Sep 17 00:00:00 2001 From: rizkyilhampra Date: Wed, 7 Jun 2023 03:56:53 +0800 Subject: [PATCH 6/7] sort by number desc historiDiagnosis modal --- app/Http/Controllers/UserController.php | 49 ++++++++++++------------- public/spesified-assets/user/script.js | 12 ++++-- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index c6c8008..c6660fd 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -5,7 +5,6 @@ use App\Models\Diagnosis; use App\Models\Gejala; use App\Models\Penyakit; -use GdImage; use Illuminate\Http\Request; class UserController extends Controller @@ -30,9 +29,6 @@ public function historiDiagnosis(Request $request) $user = auth()->user(); - $start = $request->input('start', 0); - $length = $request->input('length', 5); - $query = Diagnosis::with(['penyakit' => function ($query) { $query->select('id', 'name'); }])->where('user_id', $user->id ?? null); @@ -50,33 +46,36 @@ public function historiDiagnosis(Request $request) $totalData = $query->count(); - $historiDiagnosis = $query->offset($start) + $start = $request->input('start', 0); + $length = $request->input('length', 5); + + $orderColumn = $request->input('order.0.column', 0); + $orderDirection = $request->input('order.0.dir', 'asc'); + + $orderColumns = [ + 0 => 'id', + 1 => 'created_at', + ]; + + if (array_key_exists($orderColumn, $orderColumns)) { + $orderBy = $orderColumns[$orderColumn]; + $query->orderBy($orderBy, $orderDirection); + + $no = ($orderDirection == 'asc') ? $start + 1 : $totalData - $start; + } + + $historiDiagnosis = $query + ->offset($start) ->limit($length) ->get(['id', 'created_at', 'penyakit_id']); - $data = $historiDiagnosis->map(function ($item) { - $item->penyakit = Penyakit::find($item->penyakit_id, ['name']) ?? ['name' => 'Tidak Diketahui']; - return $item; - }); - - $no = $start + 1; - $data = $data->map(function ($item) use (&$no) { - $item->no = $no++; + $data = $historiDiagnosis->map(function ($item) use (&$no, $orderDirection) { + $penyakit = Penyakit::find($item->penyakit_id, ['name']); + $item->penyakit = $penyakit ? $penyakit->name : 'Tidak Diketahui'; + $item->no = ($orderDirection == 'asc') ? $no++ : $no--; return $item; }); - if ($request->has('order.0.column') && $request->has('order.0.dir')) { - $orderColumn = $request->input('order.0.column'); - $orderDirection = $request->input('order.0.dir'); - if ($orderColumn == 0) { - $data = $data->sortBy('no', SORT_REGULAR, $orderDirection == 'desc')->values(); - } else if ($orderColumn == 1) { - $data = $data->sortBy('created_at', SORT_REGULAR, $orderDirection == 'desc')->values(); - } else if ($orderColumn == 2) { - $data = $data->sortBy('penyakit.name', SORT_REGULAR, $orderDirection == 'desc')->values(); - } - } - return response()->json([ 'draw' => $request->input('draw'), 'recordsTotal' => $totalData, diff --git a/public/spesified-assets/user/script.js b/public/spesified-assets/user/script.js index a920cb8..972929f 100644 --- a/public/spesified-assets/user/script.js +++ b/public/spesified-assets/user/script.js @@ -15,12 +15,18 @@ async function drawHistoriDiagnosisTable() { processing: true, lengthMenu: [5, 10, 25, 50], pageLength: 5, + order: [0, 'desc'], + columnDefs: [{ + targets: 2, + orderable: false + }, + { + targets: 3, + orderable: false + }], ajax: { url: "histori-diagnosis-user", type: "GET", - data: function (data) { // Menggunakan "data" sebagai argumen - return data; // Mengembalikan "data" yang diterima - }, error: function (xhr, error, thrown) { swalError(xhr.responseJSON); } From 253521067a190179e78ec9216ab533df459b4a34 Mon Sep 17 00:00:00 2001 From: rizkyilhampra Date: Fri, 9 Jun 2023 02:45:02 +0800 Subject: [PATCH 7/7] revisi done --- app/Http/Controllers/DiagnosisController.php | 19 +-- app/Http/Controllers/UserController.php | 26 +++- .../user/detail-diagnosis-modal.js | 131 ++++++++++++++++++ public/spesified-assets/user/script.js | 74 ++-------- .../user/detail-diagnosis-modal.blade.php | 86 ++++++++++++ resources/views/user/profile-modal.blade.php | 23 --- resources/views/user/user.blade.php | 5 + routes/web.php | 16 +-- 8 files changed, 264 insertions(+), 116 deletions(-) create mode 100644 public/spesified-assets/user/detail-diagnosis-modal.js create mode 100644 resources/views/user/detail-diagnosis-modal.blade.php diff --git a/app/Http/Controllers/DiagnosisController.php b/app/Http/Controllers/DiagnosisController.php index 1783de9..ee9add5 100644 --- a/app/Http/Controllers/DiagnosisController.php +++ b/app/Http/Controllers/DiagnosisController.php @@ -10,7 +10,7 @@ class DiagnosisController extends Controller { - public function Diagnosis(Request $request) + public function diagnosis(Request $request) { $allGejala = Gejala::get('id')->count(); @@ -69,26 +69,21 @@ public function Diagnosis(Request $request) $modelDiagnosis->penyakit_id = $penyakitId; $modelDiagnosis->save(); } - $penyakit = Penyakit::where('id', $modelDiagnosis->penyakit_id)->first(['name', 'reason', 'solution', 'image']); + $penyakit = Penyakit::where('id', $modelDiagnosis->penyakit_id)->first('id'); $terdeteksi = true; } } - // Tidak ada penyakit yang terdeteksi if (!$terdeteksi && $request->idgejala == $allGejala) { - return response()->json(['penyakitUndentified' => 'Tidak ada penyakit yang cocok dengan gejala yang anda masukkan.']); + return response()->json([ + 'penyakitUndentified' => true + ]); } return response()->json([ - $modelDiagnosis->answer_log, - $penyakit ?? null + 'idDiagnosis' => $modelDiagnosis->id, + 'idPenyakit' => $penyakit ?? null ]); } - - public function getGejala(Request $request) - { - $gejala = Gejala::get(['id', 'name']); - return response()->json($gejala); - } } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index c6660fd..5278d89 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -84,29 +84,41 @@ public function historiDiagnosis(Request $request) ]); } - public function historiDiagnosisDetail(Request $request) + public function detailDiagnosis(Request $request) { - $diagnosis = Diagnosis::find($request->id, ['answer_log']); + $penyakit = Penyakit::find( + Diagnosis::find($request->id_diagnosis, ['penyakit_id'])->penyakit_id, + ['name', 'reason', 'solution', 'image'] + ); + + $diagnosis = Diagnosis::find($request->id_diagnosis, ['answer_log']); $answerLog = json_decode($diagnosis->answer_log, true); foreach ($answerLog as $key => $value) { $answerLog[$key] = $value == 1 ? 'Ya' : 'Tidak'; } $gejala = Gejala::whereIn('id', array_keys($answerLog))->get(['id', 'name']); foreach ($gejala as $item) { - $item->answer = $answerLog[$item->id]; } $answerLog = $gejala->map(function ($item) use ($request) { return [ - 'no' => $request->no, 'id' => $item->id, 'name' => $item->name, 'answer' => $item->answer, ]; }); - return response()->json([ - 'answerLog' => $answerLog, - ]); + return response()->json( + [ + 'penyakit' => $penyakit, + 'answerLog' => $answerLog, + ] + ); + } + + public function getGejala() + { + $gejala = Gejala::get(['id', 'name']); + return response()->json($gejala); } } diff --git a/public/spesified-assets/user/detail-diagnosis-modal.js b/public/spesified-assets/user/detail-diagnosis-modal.js new file mode 100644 index 0000000..7b84bcd --- /dev/null +++ b/public/spesified-assets/user/detail-diagnosis-modal.js @@ -0,0 +1,131 @@ +const detailDiagnosisModal = document.querySelector('#detailDiagnosisModal'); +const titleDetailDiagnosisModal = detailDiagnosisModal.querySelector('.modal-title'); +const instanceDetailDiagnosisModal = bootstrap.Modal.getOrCreateInstance(detailDiagnosisModal); +const headerDetailDiagnosis = document.getElementById('headerDetailDiagnosis'); +const subheaderDetailDiagnosis = document.getElementById('subheaderDetailDiagnosis'); +const containerImagePenyakitDetailDiagnosisModal = document.getElementById('containerImagePenyakitDetailDiagnosisModal'); +const headerPenyakitSolution = document.getElementById('headerPenyakitSolution'); +const rowDetailPenyakit = document.getElementById('rowDetailPenyakit'); +const detailJawabanDiagnosisTable = document.getElementById('detailJawabanDiagnosisTable'); +const tableBody = detailJawabanDiagnosisTable.querySelector('tbody'); + +let idPenyakit = null; +let idDiagnosis = null; +let noHistoriDiagnosis = null; +let diagnosed = false; +let penyakitUndentified = false; + +function getPenyakitIdFromHistori(data, no) { + idDiagnosis = data; + noHistoriDiagnosis = no; + diagnosed = false; + instanceDetailDiagnosisModal.show(); +} + +function getPenyakitFromDiagnose(data, wasDiagnosed) { + idPenyakit = data.idPenyakit; + idDiagnosis = data.idDiagnosis; + diagnosed = wasDiagnosed; + instanceDetailDiagnosisModal.show(); +} + +function getUndentifiedPenyakit(data) { + penyakitUndentified = data; + instanceDetailDiagnosisModal.show(); +} + +function ajaxRequestDetailDiagnosis() { + return $.ajax({ + url: '/detail-diagnosis', + method: 'GET', + data: { + id_penyakit: idPenyakit, + id_diagnosis: idDiagnosis, + }, + }); +} + +detailDiagnosisModal.addEventListener('show.bs.modal', async () => { + try { + let response = await ajaxRequestDetailDiagnosis(); + drawDetailDiagnosis(response, diagnosed); + drawDetailJawabanDiagnosis(response.answerLog); + } catch (error) { + swalError(error.responseJSON); + } +}); + + +function drawDetailDiagnosis(response, wasDiagnosed) { + if (wasDiagnosed) { + titleDetailDiagnosisModal.innerText = 'Detail Diagnosis'; + headerDetailDiagnosis.innerText = "Penyakit Ditemukan!"; + subheaderDetailDiagnosis.innerHTML = "Penyakit yang diderita adalah " + `${response.penyakit.name}`; + headerDetailDiagnosis.classList.remove('d-none'); + subheaderDetailDiagnosis.classList.remove('d-none'); + } + titleDetailDiagnosisModal.innerText = 'Detail Diagnosis No. ' + noHistoriDiagnosis; + if (response.penyakit == null || penyakitUndentified) { + headerDetailDiagnosis.innerText = "Penyakit Tidak Ditemukan!"; + subheaderDetailDiagnosis.innerHTML = 'Tidak ada penyakit yang cocok dengan gejala yang anda masukkan.'; + headerDetailDiagnosis.classList.remove('d-none'); + subheaderDetailDiagnosis.classList.remove('d-none'); + rowDetailPenyakit.classList.add('d-none'); + } else { + if (rowDetailPenyakit.classList.contains('d-none')) { + rowDetailPenyakit.classList.remove('d-none'); + } + const penyakitName = document.getElementById('penyakitName'); + const penyakitReason = document.getElementById('penyakitReason'); + penyakitName.innerHTML = response.penyakit.name; + penyakitReason.innerHTML = response.penyakit.reason; + + let penyakitSolution = response.penyakit.solution; + let regex = /(\d+\.)\s*(.*?)(?=(\d+\.|$))/gs; + let matches = [...penyakitSolution.matchAll(regex)]; + let nomorAsOlTag = '
    '; + for (let i = 0; i < matches.length; i++) { + nomorAsOlTag += '
  1. ' + matches[i][2] + '
  2. '; + } + nomorAsOlTag += '
'; + headerPenyakitSolution.insertAdjacentHTML('afterend', nomorAsOlTag); + + const imagePenyakit = new Image(); + imagePenyakit.src = assetImageUrl + '/' + response.penyakit.image; + imagePenyakit.alt = response.penyakit.name; + imagePenyakit.classList.add('img-fluid'); + containerImagePenyakitDetailDiagnosisModal.appendChild(imagePenyakit); + } +} + +function drawDetailJawabanDiagnosis(data) { + const response = data; + response.forEach((item, index) => { + const tableRow = document.createElement('tr'); + const tableData = document.createElement('td'); + const tableData2 = document.createElement('td'); + const tableData3 = document.createElement('td'); + let number = index + 1; + tableData.innerHTML = number; + tableData2.innerHTML = item.name; + tableData3.innerHTML = item.answer; + tableRow.appendChild(tableData); + tableRow.appendChild(tableData2); + tableRow.appendChild(tableData3); + tableBody.appendChild(tableRow); + }); +} + +detailDiagnosisModal.addEventListener('hide.bs.modal', function (event) { + containerImagePenyakitDetailDiagnosisModal.innerHTML = ''; + if (headerPenyakitSolution.nextElementSibling) { + headerPenyakitSolution.nextElementSibling.remove(); + } + headerDetailDiagnosis.classList.add('d-none'); + subheaderDetailDiagnosis.classList.add('d-none'); + + //remove all child element in table body + while (tableBody.firstChild) { + tableBody.removeChild(tableBody.firstChild); + } +}); \ No newline at end of file diff --git a/public/spesified-assets/user/script.js b/public/spesified-assets/user/script.js index 972929f..7b4a9a6 100644 --- a/public/spesified-assets/user/script.js +++ b/public/spesified-assets/user/script.js @@ -60,7 +60,7 @@ async function drawHistoriDiagnosisTable() { { data: 'id', render: function (data, type, row, meta) { - return ` +
+ + + + diff --git a/resources/views/user/profile-modal.blade.php b/resources/views/user/profile-modal.blade.php index 2435a61..c2d74ca 100644 --- a/resources/views/user/profile-modal.blade.php +++ b/resources/views/user/profile-modal.blade.php @@ -95,29 +95,6 @@ class="btn btn-success">Simpan -
-
-

-

-
-
-
- - - - - - - - - - -
NoGejalaBobot
-
-
-
-
-
diff --git a/resources/views/user/user.blade.php b/resources/views/user/user.blade.php index fd2ec94..c23d0b7 100644 --- a/resources/views/user/user.blade.php +++ b/resources/views/user/user.blade.php @@ -138,6 +138,7 @@ class="img-fluid chocolat-image" @can('asUser') @section('title', 'User ' . html_entity_decode('—')) @include('user.profile-modal') + @include('user.detail-diagnosis-modal') @push('styleLibraries') @@ -149,6 +150,10 @@ class="img-fluid chocolat-image" + + @endpush @endcan @endsection diff --git a/routes/web.php b/routes/web.php index fd4adf7..9260990 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,9 +1,7 @@ group(function () { - Route::post('diagnosis', [DiagnosisController::class, 'Diagnosis']) + Route::post('diagnosis', [DiagnosisController::class, 'diagnosis']) ->middleware('can:hasUserProfile') ->name('user.diagnosis'); + Route::put('edit-profile', [\App\Http\Controllers\UserProfileController::class, 'updateUser'])->name('update-profile'); + Route::delete('histori-diagnosis-user', [\App\Http\Controllers\UserController::class, 'historiDiagnosis'])->name('histori-diagnosis-user.delete'); Route::middleware('check.direct.access')->group(function () { - Route::put('edit-profile', [\App\Http\Controllers\UserProfileController::class, 'updateUser'])->name('update-profile'); + Route::middleware('can:hasUserProfile')->group(function () { + Route::get('get-gejala', [UserController::class, 'getGejala'])->name('get-gejala'); + Route::get('histori-diagnosis-user', [\App\Http\Controllers\UserController::class, 'historiDiagnosis'])->name('histori-diagnosis-user'); + Route::get('detail-diagnosis', [UserController::class, 'detailDiagnosis'])->name('detail-diagnosis'); + }); Route::get('edit-profile', [\App\Http\Controllers\UserProfileController::class, 'index'])->name('edit-profile'); - Route::get('get-gejala', [DiagnosisController::class, 'getGejala'])->name('get-gejala')->middleware('can:hasUserProfile'); Route::get('provinsi', [\App\Http\Controllers\KotaProvinsiController::class, 'indexProvince'])->name('provinsi'); Route::get('edit-profile/lokasi/kota/{id}', [\App\Http\Controllers\KotaProvinsiController::class, 'indexCity'])->name('kota'); - Route::get('histori-diagnosis-user', [\App\Http\Controllers\UserController::class, 'historiDiagnosis'])->name('histori-diagnosis-user'); - Route::get('histori-diagnosis-user/detail', [\App\Http\Controllers\UserController::class, 'historiDiagnosisDetail'])->name('histori-diagnosis-user.detail'); }); - Route::delete('histori-diagnosis-user', [\App\Http\Controllers\UserController::class, 'historiDiagnosis'])->name('histori-diagnosis-user.delete'); }); });