@extends('layouts.main') 
@section('title', 'State Master')
@section('content')

    <div class="container-fluid">
        <div class="page-header">
            <div class="row align-items-end">
                <div class="col-lg-8">
                    <div class="page-header-title">
                        <i class="ik ik-edit bg-blue"></i>
                        <div class="d-inline">
                            <h5>{{ __('State Master')}}</h5>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <nav class="breadcrumb-container" aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">
                                <a href="{{route('dashboard')}}"><i class="ik ik-home"></i></a>
                            </li>
                            <li class="breadcrumb-item"><a href="#">{{ __('Forms')}}</a></li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-md-7 mx-auto">
                <div class="card">
                    <div class="card-header"><h3>{{ __('State Master Form')}}</h3></div>
                    <div class="card-body">
                        <form class="forms-sample" method='POST' @if(!empty($showdata)) action="{{ url('updatestate') }}" @else action="{{ url('statemasterinsert') }}" @endif name='statemaster'>
                            @csrf
                            @if(!empty($showdata))
                            <input type='hidden' name='id' value='{{$showdata[0]->id}}'>
                            @endif
                            <div class="form-group">
                                <label for="state_code">{{ __('State Code')}}</label>
                                <input type="text" class="form-control" id="state_code" name='state_code' <?php if(!empty($showdata)){ ?> value='{{$showdata[0]->state_code}}' <?php } ?> placeholder="Enter State Code" required>
                            </div>
                            <div class="form-group">
                                <label for="state_name">{{ __('State Name')}}</label>
                                <input type="text" class="form-control" id="state_name" name='state_name' <?php if(!empty($showdata)){ ?> value='{{$showdata[0]->state_name}}' <?php } ?> placeholder="Enter State Name" required>
                            </div>
                            <div class="form-group">
                                <label for="status">{{ __('State Status')}}</label>
                                <select name='status'  class='form-control' value='Select Option'>
                                    <option>Select Status</option>
                                    <option value="Yes" @if(!empty($showdata)){{ $showdata[0]->status == "Yes" ? 'selected' : '' }} @endif >Yes</option>
                                    <option value="No" @if(!empty($showdata)){{ $showdata[0]->status == "No" ? 'selected' : '' }} @endif >No</option>
                                </select>
                            </div>

                            <button type="submit" name='statesubmit' class="btn btn-primary mr-2">{{ __('Submit')}}</button>
                            @if(empty($showdata))
                            <a href='{{'state-master'}}' class="btn btn-light">{{ __('Cancel')}}</a>
                            @endif
                          </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- push external js -->
    @push('script')
        <script src="{{ asset('js/form-components.js') }}"></script>
    @endpush
@endsection