@extends('layouts.admin')
@section('title','Edit Tiket #'.$ticket->ticket_number)
@section('content')
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="card">
  <div class="card-header">Edit Tiket {{ $ticket->ticket_number }}</div>
  <div class="card-body">
    <form action="{{ route('admin.tickets.update',$ticket) }}" method="POST">
    @csrf @method('PUT')
    <div class="row g-3">
      <div class="col-md-6">
        <label class="form-label fw-semibold">Divisi</label>
        <select name="division" class="form-select" required>
          @foreach(['JPN','FixLab','Havva'] as $d)
          <option value="{{ $d }}" {{ $ticket->division===$d?'selected':'' }}>{{ $d }}</option>
          @endforeach
        </select>
      </div>
      <div class="col-md-6">
        <label class="form-label fw-semibold">Kategori</label>
        <select name="category" class="form-select" required>
          @foreach(['network'=>'Network','hardware'=>'Hardware','software'=>'Software','cctv'=>'CCTV','other'=>'Lainnya'] as $v=>$l)
          <option value="{{ $v }}" {{ $ticket->category===$v?'selected':'' }}>{{ $l }}</option>
          @endforeach
        </select>
      </div>
      <div class="col-12">
        <label class="form-label fw-semibold">Subjek</label>
        <input type="text" name="subject" class="form-control" value="{{ old('subject',$ticket->subject) }}" required>
      </div>
      <div class="col-12">
        <label class="form-label fw-semibold">Deskripsi</label>
        <textarea name="description" class="form-control" rows="5" required>{{ old('description',$ticket->description) }}</textarea>
      </div>
      <div class="col-md-6">
        <label class="form-label fw-semibold">Prioritas</label>
        <select name="priority" class="form-select" required>
          @foreach(['critical'=>'🔴 Critical','high'=>'🟠 High','medium'=>'🟡 Medium','low'=>'🟢 Low'] as $v=>$l)
          <option value="{{ $v }}" {{ $ticket->priority===$v?'selected':'' }}>{{ $l }}</option>
          @endforeach
        </select>
      </div>
      <div class="col-12 d-flex gap-2 justify-content-end">
        <a href="{{ route('admin.tickets.show',$ticket) }}" class="btn btn-secondary">Batal</a>
        <button type="submit" class="btn btn-primary"><i class="fas fa-save me-1"></i>Simpan</button>
      </div>
    </div>
    </form>
  </div>
</div>
</div></div>
@endsection
