@extends('layouts.app')

@section('content')
    <div class="row justify-content-center">
        <div class="col-lg-6">
            <div class="card shadow-sm">
                <div class="card-header fw-bold">Edit department</div>
                <div class="card-body">
                    <form method="POST" action="{{ route('departments.master.update', $department) }}" class="row g-2">
                        @csrf
                        @method('PUT')
                        <div class="col-12">
                            <label class="form-label">Name</label>
                            <input name="name" class="form-control" required maxlength="120" value="{{ old('name', $department->name) }}">
                        </div>
                        <div class="col-12">
                            <label class="form-label">Slug</label>
                            <input name="slug" class="form-control" maxlength="120" value="{{ old('slug', $department->slug) }}">
                        </div>
                        <div class="col-12">
                            <label class="form-label">Description</label>
                            <input name="description" class="form-control" maxlength="255" value="{{ old('description', $department->description) }}">
                        </div>
                        <div class="col-12 form-check">
                            <input type="hidden" name="is_active" value="0">
                            <input class="form-check-input" type="checkbox" name="is_active" value="1" id="act" {{ old('is_active', $department->is_active) ? 'checked' : '' }}>
                            <label class="form-check-label" for="act">Active</label>
                        </div>
                        <div class="col-12 d-flex gap-2">
                            <button class="btn btn-primary">Update</button>
                            <a href="{{ route('departments.master.index') }}" class="btn btn-outline-secondary">Back</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
@endsection
