84 lines
4.3 KiB
PHP
84 lines
4.3 KiB
PHP
@extends('template.admin')
|
|
|
|
@section('content')
|
|
<div class="max-w-4xl mx-auto p-6 bg-white shadow rounded">
|
|
|
|
<h1 class="text-lg font-semibold mb-4 text-gray-700">
|
|
{{ isset($nilaiAlternatif) ? 'Edit Nilai Alternatif' : 'Tambah Nilai Alternatif' }}
|
|
</h1>
|
|
|
|
<form action="{{ isset($nilaiAlternatif) ? route('nilai-alternatif.update', $nilaiAlternatif->id) : route('nilai-alternatif.store') }}" method="POST" class="space-y-3">
|
|
@csrf
|
|
@if(isset($nilaiAlternatif))
|
|
@method('PUT')
|
|
@endif
|
|
|
|
<!-- Mobil -->
|
|
<div>
|
|
<label for="mobil_id" class="block mb-1 text-gray-600 text-sm">Mobil</label>
|
|
<select id="mobil_id" name="mobil_id" required
|
|
class="w-full border border-gray-300 rounded px-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-[#1e3a8a]">
|
|
<option value="" disabled {{ old('mobil_id', $nilaiAlternatif->mobil_id ?? '') ? '' : 'selected' }}>-- Pilih Mobil --</option>
|
|
@foreach($mobils as $mobil)
|
|
<option value="{{ $mobil->id }}" {{ old('mobil_id', $nilaiAlternatif->mobil_id ?? '') == $mobil->id ? 'selected' : '' }}>
|
|
{{ $mobil->nama_mobil }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
@error('mobil_id')
|
|
<p class="text-red-600 text-xs mt-1">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Sub Kriteria -->
|
|
<div>
|
|
<label for="sub_kriteria_id" class="block mb-1 text-gray-600 text-sm">Sub Kriteria</label>
|
|
<select id="sub_kriteria_id" name="sub_kriteria_id" required
|
|
class="w-full border border-gray-300 rounded px-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-[#1e3a8a]">
|
|
<option value="" disabled {{ old('sub_kriteria_id', $nilaiAlternatif->sub_kriteria_id ?? '') ? '' : 'selected' }}>-- Pilih Sub Kriteria --</option>
|
|
@foreach($subkriterias as $sub)
|
|
<option value="{{ $sub->id }}" {{ old('sub_kriteria_id', $nilaiAlternatif->sub_kriteria_id ?? '') == $sub->id ? 'selected' : '' }}>
|
|
{{ $sub->nama_subkriteria }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
@error('sub_kriteria_id')
|
|
<p class="text-red-600 text-xs mt-1">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Nilai -->
|
|
<div>
|
|
<label for="nilai" class="block mb-1 text-gray-600 text-sm">Nilai</label>
|
|
<input type="number" step="0.01" min="0" max="100" id="nilai" name="nilai" required
|
|
value="{{ old('nilai', $nilaiAlternatif->nilai ?? '') }}"
|
|
class="w-full border border-gray-300 rounded px-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-[#1e3a8a]" />
|
|
@error('nilai')
|
|
<p class="text-red-600 text-xs mt-1">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<div class="flex justify-end gap-4 mt-4">
|
|
<a href="{{ route('nilai-alternatif.index') }}"
|
|
class="flex items-center gap-1 text-gray-500 hover:text-[#1e3a8a] transition" title="Batal" aria-label="Batal">
|
|
<!-- Icon silang -->
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 stroke-2" fill="none" viewBox="0 0 24 24"
|
|
stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
</svg>
|
|
<span class="text-sm">Batal</span>
|
|
</a>
|
|
|
|
<button type="submit" title="{{ isset($nilaiAlternatif) ? 'Update' : 'Simpan' }}" aria-label="{{ isset($nilaiAlternatif) ? 'Update' : 'Simpan' }}"
|
|
class="flex items-center gap-2 text-[#1e3a8a] hover:text-[#163570] transition font-medium">
|
|
<!-- Icon save/edit -->
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 stroke-2" fill="none" viewBox="0 0 24 24"
|
|
stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M11 5H6a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2v-5m-10-7l8 8m-3 0h3v3" />
|
|
</svg>
|
|
<span class="text-sm">{{ isset($nilaiAlternatif) ? 'Update' : 'Simpan' }}</span>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endsection |