<div class="content-header">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-6">
                <h2>{{::vm.translate.get('Customers')}}</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 Customer')}}</h2>
                <h2 class="card-title ng-binding ng-scope" ng-if="vm.isEditMode">{{::vm.translate.get('Edit Customer')}}</h2>
            </div>
            <div class="card-body">
                <form name="customerForm" class="form-horizontal">
                    <div class="col-sm-offset-2 bg-danger" ng-show="vm.validationErrors">
                        <ul>
                            <li ng-repeat="error in vm.validationErrors">{{error}}</li>
                        </ul>
                    </div>
                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('FullName')}}</label>
                        <div>
                            <input name="name" ng-model="vm.customer.fullName" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Email')}}</label>
                        <div>
                            <input name="email" ng-model="vm.customer.email" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Phone Number')}}</label>
                        <div>
                            <input name="description" ng-model="vm.customer.phoneNumber" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Contact of Company')}}</label>
                        <div>
                            <select class="form-control" ng-model="vm.customer.vendorId" ng-options="vendor.id as vendor.name for vendor in vm.vendors">
                                <option value="">{{::vm.translate.get('Not Company')}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label">{{::vm.translate.get('Customer Groups')}}</label>
                        <div>
                            <div class="checkbox" ng-repeat="customergroup in vm.customerGroups">
                                <label>
                                    <input type="checkbox" ng-checked="vm.customer.customerGroupIds.indexOf(customergroup.id) > -1" ng-click="vm.toggleCustomerGroups(customergroup.id)"> {{customergroup.name}}
                                </label>
                            </div>
                        </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 onclick="history.back()" class="btn btn-default"> {{::vm.translate.get('Cancel')}}</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>