@extends('component.app')
@section('title', 'Mesin')
@section('active13', 'active')
@section('menu1', 'open')
@section('content')
    <div class="content-wrapper">
        <div class="container-xxl flex-grow-1 container-p-y">
            <!-- Invoice List Table -->
            <div class="card">
                <div class="header-menu d-flex justify-content-between align-items-center">
                    <h4 class="card-header">Edit Data Mesin</h4>
                    <form action="{{ route('mesin.update', $data->id) }}" method="POST" enctype="multipart/form-data">
                        @csrf
                        <button type="submit" class="btn btn-primary me-2" data-bs-toggle="modal"
                            data-bs-target="#staticBackdrop"><i class="bx bx-save bx-sm"></i> Simpan</button>
                </div>

                <div class="card-body">
                    <div class="row">
                        <!-- Kolom Kiri -->
                        <div class="col-md-6">
                            @if (Auth::user()->role == 'admin' || Auth::user()->role == 'superadmin')
                                <div class="mb-3">
                                    <label for="users_id" class="form-label">Pilih Laundry</label>
                                    <select id="pelanggan" name="laundry_id" class="form-select form-control-sm" required>
                                        <option value="{{ $data->laundry_id }}"> {{ $data->laundry_id }} -
                                            {{ $data->laundry->nama_laundry }}</option>
                                        @foreach ($laundry as $Laundry)
                                            <option value="{{ $Laundry->id }}">{{ $Laundry->id }} -
                                                {{ $Laundry->nama_laundry }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            @else
                                <div class="mb-3">
                                    <label for="users_id" class="form-label">Pilih laundry</label>
                                    <input type="text" class="form-control"
                                        value="{{ $laundry->laundry_id }} - {{ $laundry->laundry->nama_laundry }}" readonly>
                                    <input type="text" class="form-control" id="users_id" name="laundry_id"
                                        value="{{ $laundry->laundry_id }}" hidden>
                                </div>
                            @endif
                            <div class="mb-3">
                                <label for="nama_parfum" class="form-label">Kode/Nomor Mesin</label>
                                <input type="text" class="form-control" id="no_mesin" name="no_mesin"
                                    placeholder="Masukkan Keterangan Wangi" value="{{ $data->no_mesin }}" required>
                            </div>
                            <div class="mb-3">
                                <label for="nama_parfum" class="form-label">Nama Mesin</label>
                                <input type="text" class="form-control" id="nama_mesin" name="nama_mesin"
                                    placeholder="Masukkan Nama Mesin" value="{{ $data->nama_mesin }}" required>
                            </div>
                        </div>
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

@endsection
