penambahan makanan

This commit is contained in:
Alfiansyahp2 2025-04-14 10:54:01 +07:00
parent 63d6e60a02
commit 4ff69210ed
23 changed files with 138 additions and 122 deletions

View File

@ -1,6 +1,7 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Controllers\Controller\view;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
@ -89,7 +90,6 @@ public function deleteuser(User $user) {
public function role(){ public function role(){
$roles = Role::all(); $roles = Role::all();

View File

@ -39,10 +39,10 @@ public function storemakanan(MakananRequest $request)
// dd($validatedData); // dd($validatedData);
// Ganti koma dengan titik untuk input desimal // Ganti koma dengan titik untuk input desimal
$validatedData['lemak_jenuh'] = str_replace(',', '.', $validatedData['lemak_jenuh']);
$validatedData['natrium'] = str_replace(',', '.', $validatedData['natrium']);
$validatedData['kolesterol'] = str_replace(',', '.', $validatedData['kolesterol']);
$validatedData['kalori'] = str_replace(',', '.', $validatedData['kalori']); $validatedData['kalori'] = str_replace(',', '.', $validatedData['kalori']);
$validatedData['protein'] = str_replace(',', '.', $validatedData['protein']);
$validatedData['lemak'] = str_replace(',', '.', $validatedData['lemak']);
$validatedData['karbohidrat'] = str_replace(',', '.', $validatedData['karbohidrat']);
// Simpan relasi kategori_id ke database // Simpan relasi kategori_id ke database
$validatedData['kategori_id'] = $request->input('kategori_id'); $validatedData['kategori_id'] = $request->input('kategori_id');
@ -59,10 +59,10 @@ public function updatemakanan(UpdateMakananRequest $request, Makanan $makanan)
$validatedData = $request->validated(); $validatedData = $request->validated();
// Ganti koma dengan titik untuk input desimal // Ganti koma dengan titik untuk input desimal
$validatedData['lemak_jenuh'] = str_replace(',', '.', $validatedData['lemak_jenuh']);
$validatedData['natrium'] = str_replace(',', '.', $validatedData['natrium']);
$validatedData['kolesterol'] = str_replace(',', '.', $validatedData['kolesterol']);
$validatedData['kalori'] = str_replace(',', '.', $validatedData['kalori']); $validatedData['kalori'] = str_replace(',', '.', $validatedData['kalori']);
$validatedData['protein'] = str_replace(',', '.', $validatedData['protein']);
$validatedData['lemak'] = str_replace(',', '.', $validatedData['lemak']);
$validatedData['karbohidrat'] = str_replace(',', '.', $validatedData['karbohidrat']);
// Simpan relasi kategori_id ke database // Simpan relasi kategori_id ke database
$validatedData['kategori_id'] = $request->input('kategori_id'); $validatedData['kategori_id'] = $request->input('kategori_id');

View File

@ -23,7 +23,7 @@ public function rules(): array
{ {
return [ return [
// //
'name' => 'required|string|max:255', 'nama' => 'required|string|max:255',
]; ];
} }
} }

View File

@ -22,20 +22,20 @@ public function rules(): array
return [ return [
'nama' => 'required|string|max:100', 'nama' => 'required|string|max:100',
'kategori_id' => 'required|exists:kategoris,id', // Ensures role_id exists in the 'roles' table 'kategori_id' => 'required|exists:kategoris,id', // Ensures role_id exists in the 'roles' table
'kalori' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma 'lemak_jenuh' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma
'protein' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma 'natrium' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma
'lemak' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma 'kolesterol' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma
'karbohidrat' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma 'kalori' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma
]; ];
} }
public function messages() public function messages()
{ {
return [ return [
'lemak_jenuh.regex' => 'Lemak jenuh harus berupa angka atau desimal dengan koma (contoh: 1,5).',
'natrium.regex' => 'Natrium harus berupa angka atau desimal dengan koma (contoh: 1,5).',
'kolesterol.regex' => 'kolesterol harus berupa angka atau desimal dengan koma (contoh: 1,5).',
'kalori.regex' => 'Kalori harus berupa angka atau desimal dengan koma (contoh: 1,5).', 'kalori.regex' => 'Kalori harus berupa angka atau desimal dengan koma (contoh: 1,5).',
'protein.regex' => 'Protein harus berupa angka atau desimal dengan koma (contoh: 1,5).',
'lemak.regex' => 'Lemak harus berupa angka atau desimal dengan koma (contoh: 1,5).',
'karbohidrat.regex' => 'Karbohidrat harus berupa angka atau desimal dengan koma (contoh: 1,5).',
]; ];
} }

View File

@ -23,7 +23,7 @@ public function rules(): array
{ {
return [ return [
// //
'name' => 'required|string|max:255', 'nama' => 'required|string|max:255',
]; ];
} }
} }

View File

@ -22,20 +22,20 @@ public function rules(): array
return [ return [
'nama' => 'required|string|max:100', 'nama' => 'required|string|max:100',
'kategori_id' => 'required|exists:kategoris,id', // Ensures role_id exists in the 'roles' table 'kategori_id' => 'required|exists:kategoris,id', // Ensures role_id exists in the 'roles' table
'kalori' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma 'lemak_jenuh' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma
'protein' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma 'natrium' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma
'lemak' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma 'kolesterol' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma
'karbohidrat' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma 'kalori' => 'required|regex:/^\d+(\,\d{1,2})?$/', // Mendukung desimal dengan koma
]; ];
} }
public function messages() public function messages()
{ {
return [ return [
'kalori.regex' => 'Kalori harus berupa angka atau desimal dengan koma (contoh: 1,5).', 'lemak_jenuh.regex' => 'lemak jenuh harus berupa angka atau desimal dengan koma (contoh: 1,5).',
'protein.regex' => 'Protein harus berupa angka atau desimal dengan koma (contoh: 1,5).', 'natrium.regex' => 'natrium harus berupa angka atau desimal dengan koma (contoh: 1,5).',
'lemak.regex' => 'Lemak harus berupa angka atau desimal dengan koma (contoh: 1,5).', 'kolesterol.regex' => 'kolesterol harus berupa angka atau desimal dengan koma (contoh: 1,5).',
'karbohidrat.regex' => 'Karbohidrat harus berupa angka atau desimal dengan koma (contoh: 1,5).', 'kalori.regex' => 'kalori harus berupa angka atau desimal dengan koma (contoh: 1,5).',
]; ];
} }

13
app/Models/Alternatif.php Normal file
View File

@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Alternatif extends Model
{
use HasFactory;
protected $fillable = ['name', 'nilai']; // ganti dengan kolom yang sesuai dengan tabelmu
}

View File

@ -8,4 +8,6 @@
class Kriteria extends Model class Kriteria extends Model
{ {
use HasFactory; use HasFactory;
protected $fillable = ['nama'];
} }

View File

@ -16,10 +16,10 @@ class Makanan extends Model
protected $fillable = [ protected $fillable = [
'nama', 'nama',
'kategori_id', // Tambahkan kategori_id untuk relasi 'kategori_id', // Tambahkan kategori_id untuk relasi
'lemak_jenuh',
'natrium',
'kolesterol',
'kalori', 'kalori',
'protein',
'lemak',
'karbohidrat',
]; ];
// Menentukan kolom yang tidak boleh diisi massal (jika ada) // Menentukan kolom yang tidak boleh diisi massal (jika ada)

View File

@ -16,10 +16,10 @@ public function up(): void
$table->id(); // id sebagai primary key $table->id(); // id sebagai primary key
$table->string('nama', 100); // Kolom nama dengan panjang 100 $table->string('nama', 100); // Kolom nama dengan panjang 100
$table->unsignedBigInteger('kategori_id'); // Foreign key $table->unsignedBigInteger('kategori_id'); // Foreign key
$table->float('kalori'); // Kolom kalori $table->float('lemak_jenuh'); // Kolom kalori
$table->float('protein'); // Kolom protein $table->float('natrium'); // Kolom protein
$table->float('lemak'); // Kolom lemak $table->float('kolesterol'); // Kolom lemak
$table->float('karbohidrat'); // Kolom karbohidrat $table->float('kalori'); // Kolom karbohidrat
$table->timestamps(); $table->timestamps();
// Menambahkan foreign key constraint // Menambahkan foreign key constraint

View File

@ -14,7 +14,6 @@ public function up(): void
Schema::create('kriterias', function (Blueprint $table) { Schema::create('kriterias', function (Blueprint $table) {
$table->id(); // Kolom id BIGINT Primary Key $table->id(); // Kolom id BIGINT Primary Key
$table->string('nama', 100); // Kolom nama VARCHAR(100) $table->string('nama', 100); // Kolom nama VARCHAR(100)
$table->text('deskripsi'); // Kolom deskripsi TEXT
$table->timestamps(); // Kolom created_at dan updated_at TIMESTAMP $table->timestamps(); // Kolom created_at dan updated_at TIMESTAMP
}); });
} }

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('alternatifs', function (Blueprint $table) {
$table->id(); // Kolom id BIGINT Primary Key
$table->string('nama', 100); // Kolom nama VARCHAR(100)
$table->text('deskripsi'); // Kolom deskripsi TEXT
$table->timestamps(); // Kolom created_at dan updated_at TIMESTAMP
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('alternatifs');
}
};

View File

@ -20,7 +20,7 @@
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<h5 class="card-title mb-2">Alternatif</h5> <h5 class="card-title mb-2">Alternatif</h5>
<div class="text-center"> <div class="text-center">
{{-- <a href="{{ route('tambahuser') }}" class="btn btn-primary">Tambah</a> --}} <a href="{{ route('tambahalternatif') }}" class="btn btn-primary">Tambah</a>
</div> </div>
</div> </div>
@ -33,16 +33,14 @@
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
{{-- <tbody> <tbody>
@foreach ($users as $usr) @foreach ($alternatifs as $alter)
<tr> <tr>
<td class="text-center">{{ $loop->iteration }}</td> <td class="text-center">{{ $loop->iteration }}</td>
<td class="text-center">{{ $usr->name }}</td> <td class="text-center">{{ $alter->name }}</td>
<td class="text-center">{{ $usr->email }}</td>
<td class="text-center">{{ $usr->no_telp }}</td>
<td class="text-center"> <td class="text-center">
<a href="{{ route('edituser', $usr->id) }}" class="btn btn-sm btn-warning">Edit</a> <a href="{{ route('editalternatif', $alter->id) }}" class="btn btn-sm btn-warning">Edit</a>
<form action="{{ url('/user', $usr->id) }}" method="POST" style="display: inline;"> <form action="{{ url('/alternatif', $alter->id) }}" method="POST" style="display: inline;">
@csrf @csrf
@method('DELETE') @method('DELETE')
<button type="submit" class="btn btn-sm btn-danger">Hapus</button> <button type="submit" class="btn btn-sm btn-danger">Hapus</button>
@ -50,7 +48,7 @@
</td> </td>
</tr> </tr>
@endforeach @endforeach
</tbody> --}} </tbody>
</table> </table>
<!-- End Table with stripped rows --> <!-- End Table with stripped rows -->
</div> </div>

View File

@ -27,34 +27,6 @@
<input type="text" class="form-control" name="name" value="{{ $alternatif->name }}"> <input type="text" class="form-control" name="name" value="{{ $alternatif->name }}">
</div> </div>
</div> </div>
{{-- <div class="row mb-3">
<label for="inputEmail" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email" value="{{ $user->email }}">
</div>
</div>
<div class="row mb-3">
<label for="inputNumber" class="col-sm-2 col-form-label">No Telp</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="no_telp" value="{{ $user->no_telp }}">
</div>
</div> --}}
{{-- <div class="row mb-3">
<label for="inputPassword" class="col-sm-2 col-form-label">Address</label>
<div class="col-sm-10">
<textarea class="form-control" style="height: 100px" name="address">{{ $admin->address }}</textarea>
</div>
</div> --}}
{{-- <div class="row mb-3">
<label for="inputPassword" class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-8">
<input type="password" class="form-control" name="password" value="{{ $user->password }}"
id="passwordField">
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary" onclick="togglePasswordVisibility()">Show</button>
</div>
</div> --}}
<div class="row mb-3"> <div class="row mb-3">
<div class="col-sm-12 text-center"> <div class="col-sm-12 text-center">
<a href="{{ route('alternatif') }}" class="btn btn-secondary mx-3">Back</a> <a href="{{ route('alternatif') }}" class="btn btn-secondary mx-3">Back</a>

View File

@ -20,7 +20,6 @@
<!-- General Form Elements --> <!-- General Form Elements -->
<form id="AddUserForm" method="POST" action="{{ url('/alternatif/storealternatif') }}"> <form id="AddUserForm" method="POST" action="{{ url('/alternatif/storealternatif') }}">
@csrf <!-- Add this to include CSRF token --> @csrf <!-- Add this to include CSRF token -->
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Name</label> <label for="inputText" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -28,25 +27,7 @@
aria-describedby="basic-addon1" name="name"> aria-describedby="basic-addon1" name="name">
</div> </div>
</div> </div>
{{-- <div class="row mb-3">
<label for="inputEmail" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email">
</div>
</div>
<div class="row mb-3">
<label for="inputEmail" class="col-sm-2 col-form-label">No. Telp</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="no_telp">
</div>
</div>
<div class="row mb-3">
<label for="inputPassword" class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" placeholder="input min 4 character"
aria-label="input min 4 character" aria-describedby="basic-addon1" name="password">
</div>
</div> --}}
<div class="row mb-3"> <div class="row mb-3">
<div class="col-sm-12 text-center"> <div class="col-sm-12 text-center">
<a href="{{ route('alternatif') }}" class="btn btn-secondary mx-3">Back</a> <a href="{{ route('alternatif') }}" class="btn btn-secondary mx-3">Back</a>

View File

@ -24,7 +24,7 @@
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Name</label> <label for="inputText" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" name="name" value="{{ $kriteria->name }}"> <input type="text" class="form-control" name="nama" value="{{ $kriteria->nama }}">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">

View File

@ -37,7 +37,7 @@
@foreach ($kriterias as $krt) @foreach ($kriterias as $krt)
<tr> <tr>
<td class="text-center">{{ $loop->iteration }}</td> <td class="text-center">{{ $loop->iteration }}</td>
<td class="text-center">{{ $krt->name }}</td> <td class="text-center">{{ $krt->nama }}</td>
<td class="text-center"> <td class="text-center">
<a href="{{ route('editkriteria', $krt->id) }}" class="btn btn-sm btn-warning">Edit</a> <a href="{{ route('editkriteria', $krt->id) }}" class="btn btn-sm btn-warning">Edit</a>
<form action="{{ url('/kriteria', $krt->id) }}" method="POST" style="display: inline;"> <form action="{{ url('/kriteria', $krt->id) }}" method="POST" style="display: inline;">

View File

@ -6,8 +6,8 @@
<nav> <nav>
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ route('admindash') }}">Home</a></li> <li class="breadcrumb-item"><a href="{{ route('admindash') }}">Home</a></li>
<li class="breadcrumb-item active"><a href="{{ route('kriteria') }}">User</a></li> <li class="breadcrumb-item active"><a href="{{ route('kriteria') }}">Kriteria</a></li>
<li class="breadcrumb-item active"><a href="{{ route('tambahkriteria') }}">Tambah User</a></li> <li class="breadcrumb-item active"><a href="{{ route('tambahkriteria') }}">Tambah Kriteria</a></li>
</ol> </ol>
</nav> </nav>
@ -22,10 +22,10 @@
@csrf <!-- Add this to include CSRF token --> @csrf <!-- Add this to include CSRF token -->
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Name</label> <label for="inputText" class="col-sm-2 col-form-label">Kriteria</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" placeholder="Your name" aria-label="Your Name" <input type="text" class="form-control" placeholder="kriteria yang mau dipakai" aria-label="Your Name"
aria-describedby="basic-addon1" name="name"> aria-describedby="basic-addon1" name="nama">
</div> </div>
</div> </div>

View File

@ -40,25 +40,25 @@
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Kalori</label> <label for="inputText" class="col-sm-2 col-form-label">Kalori</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" name="kalori" value="{{ $makanan->kalori }}"> <input type="text" class="form-control" name="kalori" value="{{ $makanan->lemak_jenuh }}">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Protein</label> <label for="inputText" class="col-sm-2 col-form-label">Protein</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" name="protein" value="{{ $makanan->protein }}"> <input type="text" class="form-control" name="protein" value="{{ $makanan->natrium }}">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Lemak</label> <label for="inputText" class="col-sm-2 col-form-label">Lemak</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" name="lemak" value="{{ $makanan->lemak }}"> <input type="text" class="form-control" name="lemak" value="{{ $makanan->kolesterol }}">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Karbohidrat</label> <label for="inputText" class="col-sm-2 col-form-label">Karbohidrat</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" name="karbohidrat" value="{{ $makanan->karbohidrat }}"> <input type="text" class="form-control" name="karbohidrat" value="{{ $makanan->kalori }}">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">

View File

@ -49,10 +49,10 @@
<th class="text-center">No</th> <th class="text-center">No</th>
<th class="text-center">Name</th> <th class="text-center">Name</th>
<th class="text-center">Kategori</th> <th class="text-center">Kategori</th>
<th class="text-center">Lemak Jenuh</th>
<th class="text-center">Natrium</th>
<th class="text-center">Kolesterol</th>
<th class="text-center">Kalori</th> <th class="text-center">Kalori</th>
<th class="text-center">Protein</th>
<th class="text-center">Lemak</th>
<th class="text-center">Karbohidrat</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@ -62,10 +62,10 @@
<td class="text-center">{{ $loop->iteration }}</td> <td class="text-center">{{ $loop->iteration }}</td>
<td class="text-center">{{ $mknn->nama }}</td> <td class="text-center">{{ $mknn->nama }}</td>
<td class="text-center">{{ $mknn->kategori->kategori }}</td> <td class="text-center">{{ $mknn->kategori->kategori }}</td>
<td class="text-center">{{ $mknn->lemak_jenuh }}</td>
<td class="text-center">{{ $mknn->natrium }}</td>
<td class="text-center">{{ $mknn->kolesterol }}</td>
<td class="text-center">{{ $mknn->kalori }}</td> <td class="text-center">{{ $mknn->kalori }}</td>
<td class="text-center">{{ $mknn->protein }}</td>
<td class="text-center">{{ $mknn->lemak }}</td>
<td class="text-center">{{ $mknn->karbohidrat }}</td>
<td class="text-center"> <td class="text-center">
<a href="{{ route('editmakanan', $mknn->id) }}" class="btn btn-sm btn-warning">Edit</a> <a href="{{ route('editmakanan', $mknn->id) }}" class="btn btn-sm btn-warning">Edit</a>
<form action="{{ url('/makanan', $mknn->id) }}" method="POST" style="display: inline;"> <form action="{{ url('/makanan', $mknn->id) }}" method="POST" style="display: inline;">

View File

@ -40,31 +40,31 @@
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Kalori</label> <label for="inputText" class="col-sm-2 col-form-label">Lemak Jenuh</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" placeholder="kalori" aria-label="Your Name" <input type="text" class="form-control" placeholder="lemak jenuh" aria-label="Your Name"
aria-describedby="basic-addon1" name="kalori"> aria-describedby="basic-addon1" name="lemak_jenuh">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Protein</label> <label for="inputText" class="col-sm-2 col-form-label">Natrium</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" placeholder="protein" aria-label="Your Name" <input type="text" class="form-control" placeholder="natrium" aria-label="Your Name"
aria-describedby="basic-addon1" name="protein"> aria-describedby="basic-addon1" name="natrium">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Lemak</label> <label for="inputText" class="col-sm-2 col-form-label">Kolesterol</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" placeholder="lem" aria-label="Your Name" <input type="text" class="form-control" placeholder="kolesterol" aria-label="Your Name"
aria-describedby="basic-addon1" name="lemak"> aria-describedby="basic-addon1" name="kolesterol">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label for="inputText" class="col-sm-2 col-form-label">Karbohidrat</label> <label for="inputText" class="col-sm-2 col-form-label">Kalori</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" placeholder="karbo" aria-label="Your Name" <input type="text" class="form-control" placeholder="kalori" aria-label="Your Name"
aria-describedby="basic-addon1" name="karbohidrat"> aria-describedby="basic-addon1" name="kalori">
</div> </div>
</div> </div>
</div> </div>

View File

@ -17,7 +17,7 @@
</li> --}} </li> --}}
<li class="nav-item"> {{-- <li class="nav-item">
<a class="nav-link" data-bs-target="#users-nav" data-bs-toggle="collapse" href="#"> <a class="nav-link" data-bs-target="#users-nav" data-bs-toggle="collapse" href="#">
<i class="bi bi-layout-text-window-reverse"></i><span>User</span><i class="bi bi-chevron-down ms-auto"></i> <i class="bi bi-layout-text-window-reverse"></i><span>User</span><i class="bi bi-chevron-down ms-auto"></i>
</a> </a>
@ -35,13 +35,33 @@
</a> </a>
</li> </li>
</ul> </ul>
</li> </li> --}}
<li class="nav-item">
<a class="nav-link {{ request()->routeIs(['tables-general', 'tables-data']) ? '' : 'collapsed' }}" data-bs-target="#users-nav" data-bs-toggle="collapse" href="#">
<i class="ri-admin-line"></i><span>User</span><i class="bi bi-chevron-down ms-auto"></i>
</a>
<ul id="users-nav" class="nav-content collapse {{ request()->routeIs(['tables-general', 'tables-data']) ? 'show' : '' }}" data-bs-parent="#sidebar-nav">
<li>
<a class="nav-link {{ request()->routeIs('role') ? '' : 'collapsed' }}" href="{{ route('role') }}">
<i class="ri-store-2-line"></i>
<span>Role</span>
</a>
</li>
<li>
<a class="nav-link {{ request()->routeIs('datauser') ? '' : 'collapsed' }}" href="{{ route('datauser') }}">
<i class="ri-store-2-line"></i>
<span>User</span>
</a>
</li>
</ul>
</li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link {{ request()->routeIs(['tables-general', 'tables-data']) ? '' : 'collapsed' }}" data-bs-target="#foods-nav" data-bs-toggle="collapse" href="#"> <a class="nav-link {{ request()->routeIs(['tables-general', 'tables-data']) ? '' : 'collapsed' }}" data-bs-target="#foods-nav" data-bs-toggle="collapse" href="#">
<i class="ri-admin-line"></i><span>Data Makanan</span><i class="bi bi-chevron-down ms-auto"></i> <i class="bi bi-layout-text-window-reverse"></i><span>Data Makanan</span><i class="bi bi-chevron-down ms-auto"></i>
</a> </a>
<ul id="foods-nav" class="nav-content collapse {{ request()->routeIs(['tables-general', 'tables-data']) ? 'show' : '' }}" data-bs-parent="#user-nav"> <ul id="foods-nav" class="nav-content collapse {{ request()->routeIs(['tables-general', 'tables-data']) ? 'show' : '' }}" data-bs-parent="#sidebar-nav">
<li> <li>
<a class="nav-link {{ request()->routeIs('kategori') ? '' : 'collapsed' }}" href="{{ route('kategori') }}"> <a class="nav-link {{ request()->routeIs('kategori') ? '' : 'collapsed' }}" href="{{ route('kategori') }}">
<i class="ri-store-2-line"></i> <i class="ri-store-2-line"></i>

View File

@ -76,6 +76,8 @@
Route::get('/tambahkriteria', [AdminController::class, 'tambahkriteria'])->name('tambahkriteria'); Route::get('/tambahkriteria', [AdminController::class, 'tambahkriteria'])->name('tambahkriteria');
Route::post('/kriteria/storekriteria', [AdminController::class, 'storekriteria'])->name('storekriteria'); Route::post('/kriteria/storekriteria', [AdminController::class, 'storekriteria'])->name('storekriteria');
Route::get('/alternatif',[AdminController::class,'alternatif'])->name('alternatif'); Route::get('/alternatif',[AdminController::class,'alternatif'])->name('alternatif');
Route::get('/editalternatif/{alternatif}/editalternatif', [AdminController::class, 'editalternatif'])->name('editalternatif'); Route::get('/editalternatif/{alternatif}/editalternatif', [AdminController::class, 'editalternatif'])->name('editalternatif');
Route::put('/alternatif/{alternatif}', [AdminController::class, 'updatealternatif'])->name('updatealternatif'); Route::put('/alternatif/{alternatif}', [AdminController::class, 'updatealternatif'])->name('updatealternatif');