<div id="toaster"></div>
            
@php
    $society = false;
    $highrise = false;
    $size = '';
    $styles = '';
    
    if ($projecttype == App\ProjectType::society) {
        $society = true;
        $size = \App\ProjectType::society_size;
    
        $styles = '.highrise_type { display: none; } ';
    }
    
    if ($projecttype == App\ProjectType::high_rise) {
        $highrise = true;
        $size = \App\ProjectType::high_rise_size;
    
        $styles = '.society_type { display: none; } ';
    }
    
@endphp
@if ($society || $highrise)
    <style>
        {!! $styles !!}
    </style>
@endif
<div class="row">
    <input type='hidden' value='{{ $projecttype }}' id='type'>
    
    <div class="col-md-12">
        @if ($errors->any())
            <div class="white-box">
                <h2>Errors</h2>
                <ul>
                    {!! implode('', $errors->all('<li><span class="help-block"><strong>:message</strong></span></li>')) !!}
                </ul>
            </div>
        @endif
        <div class="white-box">

            <h3 class="box-title m-b-0"><i class="fa fa-dashboard"></i> Add New Inventory</h3>
            <p class="text-muted m-b-30 font-13"> Basic Information </p>
            <form class="form-horizontal" action="{{ route('inventory.insert') }}" method="post">
                {{ csrf_field() }}
                @can('isSuperAdmin')
                <input type='hidden'  id='set_multipro_id' name='multipro_id'>
            @endcan
                <div class='society_type'>
                    <div class="form-group">
                        <label for="address" class="col-sm-2 control-label">Allocated</label>
                        <div class="col-sm-4">
                            <div class="input-group">

                                <input type="radio" <?= old('type') == 0 ? 'checked' : '' ?> name="type"
                                    value="0" style="zoom: 1.6;" onchange="check_post(this)">
                                @if ($errors->has('type'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('type') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>


                        <label for="address" class="col-sm-2 control-label">Unallocated</label>
                        <div class="col-sm-4">
                            <div class="input-group">
                                <input type="radio" name="type" value="1"
                                    <?= old('type') == 1 ? 'checked' : '' ?> style="zoom: 1.6;"
                                    onchange="check_post(this)">
                                @if ($errors->has('type'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('type') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                    </div>
                </div>


                <div class='highrise_type'>
                    <input type="hidden" name="type" value="0" id='type_highrise_input'>
                </div>

                <div class="form-group">
                    <label for="address" class="col-sm-2 control-label" id="inventory_type">Unit / Serial
                        No</label>
                    <div class="col-sm-4">
                        <div class="input-group">
                            <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                            <input type="text" class="form-control" name="unit_number"
                                value="{{ rand('0000', '9999') }}" id="unit_number"
                                placeholder="Enter Unit Number">
                            @if ($errors->has('unit_number'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('unit_number') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>


                </div>


                <div class="form-group" id="pricelist">
                    <label for="floor" class="col-sm-2 control-label">Price List<span
                            style="color: red">*</span></label>
                    <div class="col-sm-4">
                        <div class="input-group">
                            <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                            <select id="price_list_id" class="form-control chosen-select" name="price_list_id">
                                <option value=""><b>None</b></option>
                                @foreach ($pricelist as $b)
                                    @if (old('price_list_id') == $b->id)
                                        <option selected="" value="{{ $b->id }}">{{ $b->l_no }}
                                        </option>
                                    @else
                                        <option value="{{ $b->id }}">{{ $b->l_no }} </option>
                                    @endif
                                @endforeach

                            </select>
                            @if ($errors->has('price_list_id'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('price_list_id') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group" id="parent_div"
                        style="display:<?= old('type') == 1 ? 'none' : '' ?>">
                        {{-- <div class='society_type'> --}}
                            <label for="floor" class="col-sm-2 control-label">Unit
                                <span id='floor_or_street'>
                                Street
                                </span><span
                                    style="color: red">*</span></label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                                    <select id="unit_floor_id" class="form-control chosen-select unit_floor_society"
                                        name="unit_floor_id">
                                        <option value=""><b>None</b></option>
                                        @foreach ($floors as $b)
                                            @if (old('unit_floor_id') == $b->id)
                                                <option selected="" value="{{ $b->id }}">
                                                    {{ $b->name }}
                                                    - {{ $b->unitBlock ? $b->unitBlock->name : '' }}</option>
                                            @else
                                                <option value="{{ $b->id }}">{{ $b->name }} -
                                                    {{ $b->unitBlock ? $b->unitBlock->name : '' }}</option>
                                            @endif
                                        @endforeach

                                    </select>
                                    @if ($errors->has('unit_floor_id'))
                                        <span class="help-block">
                                            <strong>{{ $errors->first('unit_floor_id') }}</strong>
                                        </span>
                                    @endif
                                </div>
                            </div>
                        {{-- </div> --}}
                        <!--  -->
                       
                        {{-- <div class='highrise_type'>
                            <label for="floor" class="col-sm-2 control-label">Unit Floor<span
                                    style="color: red">*</span></label>

                            <div class="col-sm-4">
                                <div class="input-group">
                                    <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                                    <select id="unit_floor_id" class="form-control  unit_floor_highrise" name="unit_floor_id">
                                        <option value=""><b>None</b></option>

                                        @foreach ($floors as $b)
                                            @if (old('unit_floor_id') == $b->id)
                                                <option selected="" value="{{ $b->id }}">
                                                    {{ $b->name }}
                                                    - {{ $b->unitBlock ? $b->unitBlock->name : '' }}</option>
                                            @else
                                                <option value="{{ $b->id }}">{{ $b->name }} -
                                                    {{ $b->unitBlock ? $b->unitBlock->name : '' }}</option>
                                            @endif
                                        @endforeach


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


                        
                    </div>
                    <!--  -->
                </div>



                <div class="form-group">
                    <label for="address" class="col-sm-2 control-label">Unit Type <span
                            style="color: red">*</span></label>
                    <div class="col-sm-4">
                        <div class="input-group">
                            <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                            <select class="form-control chosen-select" id="unit_type_id" name="unit_type_id">
                                <option value=""><b>None</b></option>
                                @foreach ($types as $t)
                                    @if (old('unit_type_id') == $t->id)
                                        <option selected="" value="{{ $t->id }}">
                                            {{ $t->name }}
                                        </option>
                                    @else
                                        <option value="{{ $t->id }}">{{ $t->name }}</option>
                                    @endif
                                @endforeach
                            </select>

                            @if ($errors->has('unit_type_id'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('unit_type_id') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group" id='category_portion'>
                        <label for="address" class="col-sm-2 control-label">Unit Category </label>
                        <div class="col-sm-4">
                            <div class="input-group">
                                <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                                <select class="form-control chosen-select" id="unit_category_id"
                                    name="unit_category_id[]" multiple="">
                                    <!--  <option value="" ><b>None</b></option> -->
                                    @foreach ($categories as $c)
                                        @if (old('unit_category_id') == $c->id)
                                            <option selected="" value="{{ $c->id }}">
                                                {{ $c->name }}
                                            </option>
                                        @else
                                            <option value="{{ $c->id }}">{{ $c->name }}</option>
                                        @endif
                                    @endforeach
                                </select>


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

                            </div>
                        </div>
                    </div>

                </div>



                <div class='society_type'>
                    <div class="form-group">
                        <label for="address" class="col-sm-2 control-label">Size<span
                                style="color: red">*</span></label>
                        <div class="col-sm-4">
                            <div class="input-group">
                                <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                                <select class="form-control chosen-select" id="unit_size_id"
                                    name="unit_size_id">
                                    <option value="">None</option>
                                    @foreach ($sizes as $s)
                                        @if (old('unit_size_id') == $s->id)
                                            <option selected="" value="{{ $s->id }}">
                                                {{ $s->name }} {{ $size }}</option>
                                        @else
                                            <option value="{{ $s->id }}">{{ $s->name }}
                                                {{ $size }}</option>
                                        @endif
                                    @endforeach
                                </select>

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

                            </div>
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1" class="col-sm-2 control-label">Dimension
                                (w*h)</label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                                    <input type="text" class="form-control" value="{{ old('area') }}"
                                        placeholder="Total Dimension" name="area">
                                    @if ($errors->has('area'))
                                        <span class="help-block">
                                            <strong>{{ $errors->first('area') }}</strong>
                                        </span>
                                    @endif
                                </div>
                            </div>
                        </div>

                    </div>
                </div>

                <div class='highrise_type'>
                    <input type='hidden' value=0 id='per_size_value' name='per_size_value'>
                    <div class="form-group">
                        <label for="address" class="col-sm-2 control-label">Unit Size<span
                                style="color: red">*</span></label>
                        <div class="col-sm-4">
                            <div class="input-group">
                                <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                                {{-- <select class="form-control chosen-select" onchange="totalSizeFunction(this)" id='unit_size_id'   name="unit_size_id"> --}}
                                <select class="form-control " id='high_unit_size_id' name="unit_size_id" >

                                    <option value="">None</option>
                                    @foreach ($sizes as $s)
                                        @if (old('unit_size_id') == $s->id)
                                            <option selected="" value="{{ $s->id }}"
                                                data-value='{{ $s->name }}'>
                                                {{ $s->name }} {{ $size }}</option>
                                        @else
                                            <option value="{{ $s->id }}"
                                                data-value='{{ $s->name }}'>{{ $s->name }}
                                                {{ $size }}</option>
                                        @endif
                                    @endforeach

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


                            </div>
                        </div>
                    </div>
                </div>


                <div class="form-group">
                    <label for="exampleInputEmail1" class="col-sm-2 control-label">Total Amount <span
                            style="color: red">*</span></label>
                    <div class="col-sm-4">
                        <div class="input-group">
                            <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                            <input type="integer" class="form-control" value="{{ old('total_price') }}"
                                id="total_price" placeholder="Total Price" name="total_price">
                            @if ($errors->has('total_price'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('total_price') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail1" class="col-sm-2 control-label">Net Amount<span
                                style="color: red">*</span> </label>
                        <div class="col-sm-4">
                            <div class="input-group">
                                <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                                <input type="integer" class="form-control" value="{{ old('net_amount') }}"
                                    name="net_amount" id="net_amount" placeholder="Net Amount">
                                @if ($errors->has('net_amount'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('net_amount') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </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-4">
                        <div class="input-group">
                            <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>
                            <select class="form-control chosen-select" name="status">
                                @if (old('status'))
                                    @if (old('status') == \App\Inventory::open)
                                        <option value="{{ \App\Inventory::open }}" selected="">Open
                                        </option>

                                        <option value="{{ \App\Inventory::hold_company }}">Company Hold
                                        </option>
                                    @elseif(old('status') == \App\Inventory::hold_company)
                                        <option value="{{ \App\Inventory::open }}">Open</option>
                                        <option selected="" value="{{ \App\Inventory::hold_company }}">
                                            Company
                                            Hold</option>
                                    @endif
                                @else
                                    <option value="{{ \App\Inventory::open }}" selected="">Open</option>
                                    <option value="{{ \App\Inventory::hold_company }}">Company Hold</option>


                                @endif
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail1" class="col-sm-2 control-label">Description </label>
                        <div class="col-sm-4">
                            <div class="input-group">
                                <div class="input-group-addon"><i class="fa fa-circle-o"></i></div>

                                <input type="text" class="form-control" name="description"
                                    value="{{ old('description') }}" id="description"
                                    placeholder="Description">
                                @if ($errors->has('description'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('description') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-4">&nbsp;</div>
                    <div class=" col-sm-4">
                        <button type="submit" class="btn btn-info waves-effect waves-light "
                            style="width: 100%">Save</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>