@extends('layouts.app')

@section('title')
    Edit unit Type
@stop

@section('breadcrumb')
    <ol class="breadcrumb pull-right">
        <li><a href="{{ route('home') }}"><i class="fa fa-dashboard"></i> Home</a></li>
        @permission('view-unit-type')
            <li><a href="{{ route('unit.type.all') }}">Unit Types </a></li>
        @endpermission
        <li class="active">Edit Unit Type</li>
    </ol>
@stop
@section('content')

    <div class="container-fluid">
        <!--.row-->
        <div class="row">

            <div class="col-md-12">
                <div class="white-box">
                    <h3 class="box-title m-b-0"><i class="icon-settings fa-fw"></i> Edit Unit Type</h3>
                    <p class="text-muted m-b-30 font-13" style="height: 5px;"> Update the information </p>
                    <hr>
                    <form class="form-horizontal" action="{{ route('unit.type.update') }}" method="post"
                        style="margin-top: 30px; margin-bottom: 30px;">
                        <input type='hidden' name='id' value='{{ $type->id }}'>
                        {{ csrf_field() }}
                        <div class="form-group">
                            <label for="exampleInputuname" class="col-sm-2 control-label"> Name <span
                                    style="color: red">*</span></label>
                            <div class="col-sm-10">
                                <div class="input-group" style="width:400px">

                                    <input type="text" class="form-control" name="name" value="{{ $type->name }}"
                                        id="exampleInputuname" placeholder="Update Name">
                                    @if ($errors->has('name'))
                                        <span class="help-block">
                                            <strong>{{ $errors->first('name') }}</strong>
                                        </span>
                                    @endif
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputPassword3" class="col-sm-2 control-label">Type<span
                                    style="color: red">*</span></label>
                            <div class="col-sm-10">
                                <div class="input-group" style="width: 400px;">
                                    <select class="form-control chosen-select" style="width:300px" name="projecttype_id">
                                     
                                        @foreach($project_type as $ptype )
                                        @if($type->projecttype_id == $ptype->id)
                                        <option value="{{$ptype->id}}" selected>{{$ptype->name}} </option>
                                        @else
                                        <option value="{{$ptype->id}}">{{$ptype->name}} </option>
                                        @endif
                                        @endforeach
                                     
                                    </select>

                                    @if ($errors->has('projecttype_id'))
                                        <span class="help-block">
                                            <strong>{{ $errors->first('projecttype_id') }}</strong>
                                        </span>
                                    @endif
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputPassword3" class="col-sm-2 control-label">Status<span
                                    style="color: red">*</span></label>
                            <div class="col-sm-10">
                                <div class="input-group" style="width: 400px;">
                                    <select class="form-control chosen-select" style="width:300px" name="status">

                                        @if ($type->status == true)
                                            <option value='1' selected="">Active</option>
                                            <option value="0">InActive</option>
                                        @else
                                            <option value='1'>Active</option>
                                            <option value="0"selected="">InActive</option>
                                        @endif


                                    </select>

                                    @if ($errors->has('status'))
                                        <span class="help-block">
                                            <strong>{{ $errors->first('status') }}</strong>
                                        </span>
                                    @endif
                                </div>
                            </div>
                        </div>

                        <div class="form-group m-b-0">
                            <div class="col-sm-offset-3 col-sm-2">
                                <button type="submit" class="btn btn-info waves-effect waves-light m-t-10"
                                    style="width: 100%;">Update</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!--./row-->
    </div>
    <!-- /.container-fluid -->

@stop
