<div class="modal fade" id="modalTagConfig" tabindex="-1" role="dialog" aria-labelledby="modaltagConfig" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header" style="display: flex;">
                <h5 class="modal-title" id="exampleModalLabel">@{{ titleModal }}</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: auto;">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label class="">Type</label>
                        <select name="sort" ng-model="tagConfig.type">
                            <option value="-1" selected>Select type</option>
                            <option value="CATEGORY">Category</option>
                            <option value="TAG">Tag</option>
                        </select>
                    </div>
                    <div class="form-group" ng-if="tagConfig.type != -1">
                        <label class="col-form-label">Page:</label>
                        <select name="sort"
                            class="form-control"
                            chosen
                            ng-model="tagConfig.refer" 
                            ng-options="item.name for item in allCategories track by item.id"
                            ng-if="tagConfig.type == 'CATEGORY'"
                        >
                        </select>
                        <select name="sort"
                            class="form-control"
                            chosen
                            ng-model="tagConfig.refer" 
                            ng-options="item.title for item in tags track by item.id"
                            ng-if="tagConfig.type == 'TAG'"
                        >
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="">Related Type</label>
                        <select name="sort" ng-model="tagConfig.related_type" ng-change="changeRelatedType()">
                            <option value="-1" selected>Select type</option>
                            <option value="CATEGORY">Category</option>
                            <option value="TAG">Tag</option>
                        </select>
                    </div>
                    <div class="form-group" ng-if="tagConfig.related_type != -1">
                        <label class="col-form-label">Related:</label>
                        <select name="sort"
                            class="form-control"
                            chosen
                            ng-model="tagConfig.related" 
                            ng-options="item.name for item in allCategories track by item.id"
                            ng-change="changeRelated()"
                            ng-if="tagConfig.related_type == 'CATEGORY'"
                        >
                        </select>
                        <select name="sort"
                            class="form-control"
                            chosen
                            ng-model="tagConfig.related" 
                            ng-options="item.title for item in tags track by item.id"
                            ng-change="changeRelated()"
                            ng-if="tagConfig.related_type == 'TAG'"
                        >
                        </select>
                    </div>
                    <div class="form-group" ng-if="tagConfig.related_type != -1">
                        <label class="col-form-label">Related name:</label>
                        <input type="text" class="form-control" ng-model="tagConfig.related_name">
                    </div>
                    <div class="form-group" ng-if="tagConfig.related_type != -1">
                        <label class="col-form-label">Related url:</label>
                        <input type="text" class="form-control" ng-model="tagConfig.related_url">
                    </div>
                    <div class="form-group">
                        <div class="form-group">
                            <label>Image illustration</label><br>
                            <img ng-if="tagConfig.image_url" class="comment-image" height="58px" ng-src="@{{ tagConfig.image_url }}">
                            <br>
                            <a class="btn-upload-image" ng-if="uploading">Uploading . . .</a>
                            <a ng-if="!uploading" ngf-select="uploadImages($files, variantColor)"
                                class="btn-upload-image">
                                <i class="fa fa-cloud-upload" aria-hidden="true"></i> Choose files
                            </a>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" ng-click="save()" ng-disabled="isShowLoading">Save</button>
            </div>
        </div>
    </div>
</div>