@extends('Admin.master_page')

@section('title') <h5 class="m-0 font-weight-bold text-primary" style="float: left;">Sub Category Update</h5> 

<a href="{{ route('SubCategory.index') }}" style="float: right;"><i class="fas fa-chevron-circle-left"></i></a>
@endsection

@section('content')

<div class="intro-y box"> 
        
        <form action="{{ route('SubCategory.update' , $sub->id) }}" method="POST">
            @csrf

        <input type="hidden" name="_method" value="put" />
        <label for="Name" >Name:</label>
        <div class="input-group" style="margin-top: 10px;">
           <input type="text" name="name" value="{{ $sub->name }}" class="form-control" placeholder="Title">
            @error('name')
            <span class="alert-danger">{{ $message }}</span>
            @enderror
        </div>

        <br>

        <label for="Name" >Main Category:</label>
        <div class="input-group" style="margin-top: 10px;">
           <select class="form-control" name="status_category_id" >
               <option value="">Select Main Category</option>
               @foreach($status as $st)
                <option value="{{ $st->id }}" @if($sub->status_category->id == $st->id) selected @endif>{{ $st->name }}</option>
               @endforeach
           </select>
            @error('status_category_id')
            <span class="alert-danger">{{ $message }}</span>
            @enderror
        </div>

        <br>

        <button type="submit" class="btn btn-primary">Update</button>
        </form>
    </div>



@endsection