This commit is contained in:
parent
f8db7b06bf
commit
09e0d9c597
|
@ -53,7 +53,7 @@ protected function authenticated(Request $request, $user)
|
|||
if ($user->role === 'admin') {
|
||||
return redirect()->intended('/dashboard');
|
||||
} else {
|
||||
return redirect()->intended('/');
|
||||
return redirect()->intended('/home');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,4 +75,7 @@ protected function create(array $data)
|
|||
'role' => 'pengguna',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,22 @@ public function getProfile(){
|
|||
return view('dashboard.user.profile',compact('hasil','riwayat'));
|
||||
}
|
||||
|
||||
public function getProfileAdmin(){
|
||||
$user = Auth::user();
|
||||
$hasil = User::where('id', $user->id)->get();
|
||||
// $riwayat = Hasil::where('nama', $user->nama)
|
||||
// ->where('alamat', $user->alamat)
|
||||
// ->get()
|
||||
// ->map(function ($item) {
|
||||
// $decoded = json_decode($item->hasil_diagnosa, true);
|
||||
// $item->nama_penyakit = $decoded['Nama_Penyakit']['nama_penyakit'] ?? 'Tidak diketahui';
|
||||
// return $item;
|
||||
// });
|
||||
|
||||
// Sesuaikan model dan kolomnya sesuai kebutuhan Anda
|
||||
return view('dashboard.user.profile-admin',compact('hasil'));
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$totalUsers = User::count();
|
||||
|
@ -56,4 +72,29 @@ public function dashboard()
|
|||
|
||||
return view('dashboard.dashboard', compact('totalUsers', 'totalGejala', 'totalPenyakit', 'totalHasil'));
|
||||
}
|
||||
|
||||
public function updateProfile(Request $request, $id)
|
||||
{
|
||||
// Validate the request data
|
||||
$request->validate([
|
||||
'nama' => 'required|string|max:255',
|
||||
'email' => 'required|string|email|max:255',
|
||||
'alamat' => 'nullable|string|max:255',
|
||||
'no_telpon' => 'nullable|string|max:15',
|
||||
]);
|
||||
|
||||
// Get the authenticated user
|
||||
$user = Auth::user();
|
||||
|
||||
// Update user data
|
||||
$user->nama = $request->input('nama');
|
||||
$user->email = $request->input('email');
|
||||
$user->alamat = $request->input('alamat', 'Belum diisi');
|
||||
$user->no_telpon = $request->input('no_telpon', 'Belum diisi');
|
||||
$user->save();
|
||||
|
||||
// Return success response
|
||||
return response()->json(['success' => 'Profile updated successfully.']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
use App\Models\Diagnosa;
|
||||
use App\Models\Aturan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class KonsultasiController extends Controller
|
||||
{
|
||||
|
@ -78,6 +79,7 @@ public function hitungKonsultasi(Request $request)
|
|||
|
||||
$arrHasilUser = $request->input('resultGejala');
|
||||
|
||||
//pengecekan apakah user sudah memilih 2 gejala apa belum
|
||||
if ($arrHasilUser == null) {
|
||||
return back()->withInput()->with('error', 'Anda belum memilih gejala');
|
||||
} else {
|
||||
|
@ -119,9 +121,11 @@ public function hitungKonsultasi(Request $request)
|
|||
$hasil = new Hasil();
|
||||
$hasil->nama = $validateReq['nama'];
|
||||
$hasil->alamat = $validateReq['alamat'];
|
||||
$hasil->tanggal = Carbon::now()->toDateString();
|
||||
// $hasil->jenis_sapi = $validateReq['jenis_sapi'];
|
||||
$hasil->hasil_diagnosa = json_encode($variabelTampilan);
|
||||
$hasil->solusi = $variabelTampilan['Solusi_Penyakit']['solusi'];
|
||||
|
||||
$hasil->save();
|
||||
$idHasil = $hasil->id_hasil;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ class Hasil extends Model
|
|||
'alamat',
|
||||
'jenis_sapi',
|
||||
'hasil_diagnosa',
|
||||
'solusi'
|
||||
'solusi',
|
||||
'waktu'
|
||||
];
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.3 MiB |
|
@ -49,7 +49,7 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ 'aturan' }}">
|
||||
<i class="fas fa-fw fa-chart-area"></i>
|
||||
<span>Rules</span>
|
||||
<span>Aturan</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
|
@ -63,7 +63,7 @@
|
|||
Akun
|
||||
</div>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ 'profile' }}">
|
||||
<a class="nav-link" href="{{ 'profile-admin' }}">
|
||||
<i class="fas fa-fw fa-chart-area"></i>
|
||||
<span>Profile</span>
|
||||
</a>
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
<th>Alamat</th>
|
||||
<th>Penyakit</th>
|
||||
<th>Solusi</th>
|
||||
<th>Action</th>
|
||||
<th>Tanggal</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
|
@ -60,19 +61,10 @@
|
|||
<td>{{ $data->alamat }}</td>
|
||||
<td>{{ $data->nama_penyakit }}</td>
|
||||
<td>{{ $data->solusi }}</td>
|
||||
<td>{{ $data->tanggal }}</td>
|
||||
|
||||
|
||||
<td>
|
||||
{{-- <a href="#" class="edit-button" data-bs-toggle="modal" data-bs-target="#edit-aturan"
|
||||
data-id_aturan="{{ $data->id_aturan }}" data-kode_penyakit="{{ $data->kode_penyakit }}"
|
||||
data-kode_gejala="{{ $data->kode_gejala }}">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a href="{{ route('delete-aturan', $data->id_aturan) }}" onclick="return confirm('Apakah Anda yakin ingin menghapus produk ini?')">
|
||||
<i class="fas fa-trash-alt" style="color: red"></i>
|
||||
</a> --}}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
@extends('dashboard.navigasi.master')
|
||||
@section('content')
|
||||
|
||||
@auth
|
||||
<body id="page-top" style="background-color: #6F4E37;">
|
||||
<div id="content-wrapper" class="d-flex flex-column align-items-center">
|
||||
<!-- Main Content -->
|
||||
<div id="content" class="w-100 d-flex justify-content-center">
|
||||
<!-- Begin Page Content -->
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<!-- Profile Column -->
|
||||
<div class="col-lg-6">
|
||||
<div class="card shadow mb-4" style="background-color: #D2B48C; border: none;">
|
||||
<div class="card-header py-3" style="background-color: #8B5A2B; color: #fff;">
|
||||
<h6 class="m-0 font-weight-bold ">Detail Profile</h6>
|
||||
</div>
|
||||
<div class="card-body" style="color: #6F4E37;">
|
||||
<form id="updateProfileForm" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="form-group">
|
||||
<label for="name">Nama</label>
|
||||
<input type="text" class="form-control" name="nama" id="name" value="{{ Auth::user()->nama }}" style="background-color: #F5DEB3; border: 1px solid #6F4E37;">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" class="form-control" name="email" id="email" value="{{ Auth::user()->email }}" style="background-color: #F5DEB3; border: 1px solid #6F4E37;">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="address">Alamat</label>
|
||||
<input type="text" class="form-control" id="alamat" name="alamat" value="{{ Auth::user()->alamat ?? 'Belum diisi' }}" style="background-color: #F5DEB3; border: 1px solid #6F4E37;">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="phone">Telepon</label>
|
||||
<input type="text" class="form-control" id="no_telpon" name="no_telpon" value="{{ Auth::user()->no_telpon ?? 'Belum diisi' }}" style="background-color: #F5DEB3; border: 1px solid #6F4E37;">
|
||||
</div>
|
||||
<button type="button" id="submitProfileForm" class="btn btn-primary w-100" style="background-color: #8B5A2B; border-color: #8B5A2B; color: #fff;">Update Profil</button>
|
||||
</form>
|
||||
|
||||
<!-- Alert Message -->
|
||||
<div id="alertMessage" style="display:none;" class="alert alert-success">Profile updated successfully.</div>
|
||||
|
||||
<!-- Back Button -->
|
||||
<a href="{{ route('dashboard') }}" class="btn btn-secondary mt-3 w-100" style="background-color: #6F4E37; border-color: #8B5A2B; color: #fff;">Back to Dashboard</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- End of Main Content -->
|
||||
</div>
|
||||
<!-- Scroll to Top Button-->
|
||||
<a class="scroll-to-top rounded" href="#page-top" style="background-color: #8B5A2B;">
|
||||
<i class="fas fa-angle-up"></i>
|
||||
</a>
|
||||
<!-- Logout Modal-->
|
||||
<div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content" style="background-color: #F5DEB3; color: #6F4E37;">
|
||||
<div class="modal-header" style="background-color: #8B5A2B; color: #fff;">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>
|
||||
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">Select "Logout" below if you are ready to end your current session.</div>
|
||||
<div class="modal-footer" style="background-color: #8B5A2B; color: #fff;">
|
||||
<button class="btn btn-secondary" type="button" data-bs-dismiss="modal">Cancel</button>
|
||||
<a class="btn btn-primary" href="login.html">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#submitProfileForm').click(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var formData = new FormData($('#updateProfileForm')[0]);
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('update-profile', Auth::user()->id) }}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
$('#alertMessage').show().delay(3000).fadeOut();
|
||||
},
|
||||
error: function(response) {
|
||||
alert('There was an error updating the profile. Please try again.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
@endauth
|
||||
|
||||
@guest
|
||||
<div class="container">
|
||||
<div class="alert alert-warning" role="alert" style="background-color: #D2B48C; border-color: #6F4E37; color: #6F4E37;">
|
||||
Anda harus login untuk mengakses halaman ini.
|
||||
</div>
|
||||
</div>
|
||||
@endguest
|
||||
|
||||
@endsection
|
|
@ -19,7 +19,9 @@
|
|||
<h6 class="m-0 font-weight-bold text-primary">Detail Profil</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form>
|
||||
<form id="updateProfileForm" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="form-group">
|
||||
<label for="name">Nama</label>
|
||||
<input type="text" class="form-control" name="nama" id="name" value="{{ Auth::user()->nama }}" >
|
||||
|
@ -36,8 +38,13 @@
|
|||
<label for="phone">Telepon</label>
|
||||
<input type="text" class="form-control" id="no_hp" value="{{ Auth::user()->no_telpon ?? 'Belum diisi' }}">
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary">Update Profil</button>
|
||||
<button type="button" id="submitProfileForm" class="btn btn-primary w-100" style="background-color: #8B5A2B; border-color: #8B5A2B; color: #fff;">Update Profil</button>
|
||||
|
||||
</form>
|
||||
<div id="alertMessage" style="display:none;" class="alert alert-success">Profile updated successfully.</div>
|
||||
|
||||
<!-- Back Button -->
|
||||
<a href="{{'home'}}" class="btn btn-secondary mt-3 w-100" style="background-color: #6F4E37; border-color: #8B5A2B; color: #fff;">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -62,6 +69,7 @@
|
|||
<th>Alamat</th>
|
||||
<th>Penyakit</th>
|
||||
<th>Solusi</th>
|
||||
<th>Tanggal</th>
|
||||
{{-- <th>Action</th> --}}
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -75,7 +83,17 @@
|
|||
<td>{{ $item->nama }}</td>
|
||||
<td>{{ $item->alamat }}</td>
|
||||
<td>{{ $item->nama_penyakit }}</td>
|
||||
<td>{{ $item->solusi }}</td>
|
||||
<td>
|
||||
@php
|
||||
$solusiArray = json_decode($item->solusi, true);
|
||||
@endphp
|
||||
<ol>
|
||||
@foreach ($solusiArray as $solusi)
|
||||
<li>{{ $solusi }}</li>
|
||||
@endforeach
|
||||
</ol>
|
||||
</td>
|
||||
<td>{{$item->tanggal}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
|
@ -114,6 +132,29 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#submitProfileForm').click(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var formData = new FormData($('#updateProfileForm')[0]);
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('update-profile', Auth::user()->id) }}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
$('#alertMessage').show().delay(3000).fadeOut();
|
||||
},
|
||||
error: function(response) {
|
||||
alert('There was an error updating the profile. Please try again.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
@endauth
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
<nav class="navbar navbar-expand-lg navbar-light ">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#"><img class="me-3" src="img/Logo3.1.png" alt="" width="40" height="30"> Sistem Pakar</a>
|
||||
<a class="navbar-brand" href="#"><img class="me-3" src="/img/Logo3.1.png" alt="" width="40" height="30"> Sistem Pakar</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
|
@ -78,7 +78,7 @@
|
|||
<ul class="navbar-nav mx-auto">
|
||||
|
||||
<li class="nav-item mx-2">
|
||||
<a class="nav-link @if(request()->is('/')) active @endif" href="/">Home</a>
|
||||
<a class="nav-link @if(request()->is('/home')) active @endif" href="/home">Home</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
<h1>Sistem Pakar Deteksi Dini Penyakit Mulut dan Kuku Pada Sapi</h1>
|
||||
<p > Deteksi Cepat Penyakit pada Sapi untuk Kesehatan Ternak yang Lebih Baik </p>
|
||||
<a href="/diagnosa" class="btn btn-success">Mulai</a>
|
||||
|
||||
</div>
|
||||
<div class="imgBox">
|
||||
<img src="img/gambarSapi2.png" alt="" style="width: 470px; height:500px" class="gambarSapi">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<h3 @style('text-align:center')>Gejala Penyakit Mulut dan Kuku Pada Sapi</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<img src="img/gejala/gejalaPMK.png" @style('margin-left:300px') alt="Gejala PMK" class="img-fluid mb-4">
|
||||
<img src="img/gejala/gejalaPMK.png" @style('margin-left:400px') alt="Gejala PMK" class="img-fluid mb-4">
|
||||
<h2 class="mb-3">Daftar Gejala:</h2>
|
||||
<ol class="list-group list-group-numbered">
|
||||
@foreach ($gejala as $gejalaItem)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
@section('konten')
|
||||
<div class="container">
|
||||
<h1 id="h1Gejala"> Penyakit Mulut dan Kuku Pada Sapi </h1>
|
||||
<img src="img/gejala/gejalaPMK.png" alt="" id="gambarGejala">
|
||||
<img src="img/sapi tertular pmk.png" alt="" id="gambarGejala">
|
||||
</div>
|
||||
<div id="listGejala">
|
||||
<ol>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
use App\Http\Controllers\RiwayatController;
|
||||
use App\Http\Controllers\Auth\LoginController;
|
||||
use App\Http\Controllers\HomeController;
|
||||
use App\Http\Controllers\Auth\RegisterController;
|
||||
/*
|
||||
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -21,8 +22,11 @@
|
|||
*/
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('main');
|
||||
return view('auth.login');
|
||||
})->name('/');
|
||||
Route::get('/home', function () {
|
||||
return view('main');
|
||||
})->name('/home');
|
||||
|
||||
|
||||
|
||||
|
@ -54,7 +58,11 @@
|
|||
//Riwayat
|
||||
Route::get('riwayat',[RiwayatController::class,'index'])->name('riwayat');
|
||||
Route::get('profile',[HomeController::class,'getProfile'])->name('profile');
|
||||
Route::get('profile-admin',[HomeController::class,'getProfileAdmin'])->name('profile-admin');
|
||||
Route::get('dashboard',[HomeController::class,'dashboard'])->name('dashboard');
|
||||
|
||||
Route::put('update-profile/{id}',[HomeController::class,'updateProfile'])->name('update-profile');
|
||||
|
||||
// Route::post('add-gejala', [GejalaController::class, 'store'])->name("add-gejala");
|
||||
// Route::get('delete-produk/{id_gejala}', [App\Http\Controllers\GejalaController::class,'destroy'])->name('delete-gejala');
|
||||
// Route::put('update-gejala/{id_gejala}',[GejalaController::class,'update'])->name('update-gejala');
|
||||
|
|
Loading…
Reference in New Issue