<div class="panel panel-default">
    <div class="panel-heading">
        <h2 ng-if="!vm.isEditMode">{{::vm.translate.get('Create Vendor')}}</h2>
        <h2 ng-if="vm.isEditMode">{{::vm.translate.get('Edit Vendor')}}</h2>
    </div>
    <div class="panel-body">
        <form name="vendorForm" 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="col-sm-2 control-label">{{::vm.translate.get('Name')}}</label>
                <div class="col-sm-10">
                    <input name="name" ng-model="vm.vendor.name" ng-change="vm.updateSlug()" class="form-control" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Slug')}}</label>
                <div class="col-sm-10">
                    <input name="slug" ng-model="vm.vendor.slug" class="form-control" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Email')}}</label>
                <div class="col-sm-10">
                    <input name="email" ng-model="vm.vendor.email" class="form-control" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Managers')}}</label>
                <div class="col-sm-10">
                    <p class="form-control-static">
                        <a ui-sref="user-edit({id: user.userId})" ng-repeat="user in vm.vendor.managers">{{user.email}} </a>
                        <a ui-sref="users" ng-if="vm.vendor.managers.length === 0 && vm.isEditMode">Add users as manager</a>
                        <span ng-if="!vm.isEditMode">{{::vm.translate.get('After vendor is created. Go to user list and create or set users as managers')}}</span>
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">{{::vm.translate.get('Description')}}</label>
                <div class="col-sm-10">
                    <input name="description" ng-model="vm.vendor.description" class="form-control" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" ng-model="vm.vendor.isActive"> {{::vm.translate.get('Is Active')}}
                        </label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button class="btn btn-primary" ng-click="vm.save()"><span class="glyphicon glyphicon-ok"></span> {{::vm.translate.get('Save')}}</button>
                    <button ui-sref="vendors" class="btn btn-default">{{::vm.translate.get('Cancel')}}</button>
                </div>
            </div>
        </form>
    </div>
</div>