<div class="content-header">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-6">
                <h2>{{::vm.translate.get('Warehouses')}}</h2>
            </div>
        </div>
    </div>
</div>

<section class="content">
    <div class="container-fluid">
        <div class="card">
            <div class="card-header">
                <h2 class="card-title ng-binding ng-scope" ng-if="!vm.isEditMode">{{::vm.translate.get('Create Warehouse')}}</h2>
                <h2 class="card-title ng-binding ng-scope" ng-if="vm.isEditMode">{{::vm.translate.get('Edit Warehouse')}}</h2>
            </div>
            <div class="card-body">
                <form name="warehouseForm" class="form-horizontal">
                    <div class="col-sm-offset-2 bg-danger" ng-show="vm.validationErrors">
                        <ul>
                            <li ng-repeat="error in vm.validationErrors track by $index">{{error}}</li>
                        </ul>
                    </div>
                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Name')}}</label>
                        <div>
                            <input name="name" ng-model="vm.warehouse.name" class="form-control" required />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Contact Name')}}</label>
                        <div>
                            <input name="code" ng-model="vm.warehouse.contactName" class="form-control" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Phone')}}</label>
                        <div>
                            <input name="type" ng-model="vm.warehouse.phone" class="form-control" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Address Line 1')}}</label>
                        <div>
                            <input name="type" ng-model="vm.warehouse.addressLine1" class="form-control" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Address Line 2')}}</label>
                        <div>
                            <input name="type" ng-model="vm.warehouse.addressLine2" class="form-control" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('City')}}</label>
                        <div>
                            <input name="type" ng-model="vm.warehouse.city" class="form-control" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Country')}}</label>
                        <div>
                            <select required class="form-control" ng-model="vm.warehouse.countryId" ng-change="vm.onCountrySelected(vm.warehouse.countryId)" ng-options="country.id as country.name for country in vm.countries"></select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('State Or Province')}}</label>
                        <div>
                            <select required class="form-control" ng-model="vm.warehouse.stateOrProvinceId" ng-change="vm.onStateOrProvinceSelected(vm.warehouse.stateOrProvinceId)" ng-options="stateOrProvince.id as stateOrProvince.name for stateOrProvince in vm.statesOrProvinces"></select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('District')}}</label>
                        <div>
                            <select class="form-control" ng-model="vm.warehouse.districtId" ng-options="district.id as district.name for district in vm.districts">
                                <option value="0">None</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Postal Code')}}</label>
                        <div>
                            <input name="type" ng-model="vm.warehouse.zipCode" class="form-control" />
                        </div>
                    </div>

                    <div class="form-group">
                        <div>
                            <button class="btn btn-success float-right" ng-click="vm.save()"><span class="fa fa-save"></span> {{::vm.translate.get('Save')}}</button>
                            <button ui-sref="warehouses" class="btn btn-default">{{::vm.translate.get('Cancel')}}</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
