{% block addTag %}
    {% if feature %}
        <style>
            .table td {
                text-align: center;
            }
        </style>
        <!-- 房源特色出层 -->
        <div class="modal fade" id="houseFeature" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document" style="position: absolute;top: 0;bottom: 0;left: 0;right: 0;	margin: auto;height: 200px;overflow-y: auto;overflow-x: hidden;">
                <div class="modal-content">
                    <div class="row" id="featureTable">
                        <div class="col-md-12">
                            <table class="table" id="tagList">
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    {% endif %}
    <script>
        function init_modal_addTag(type, callback) {
            var tagList = $('#tagList');
            $("#houseFeature").on("show.bs.modal", function () {
                tagList.html('');
                $.ajax({
                    type: "POST",
                    url: "/tospur/wp-admin/admin-ajax.php",
                    data: "action=searchTagOrFeature&type=" + type,
                    success: function (data) {
                        var tr;
                        $.each(data, function (index, item) {
                            if (index % 4 == 0) {
                                tr = $('<tr>');
                            }
                            tr.append('<td id="' + item.id + '">' + item.value + '</td>');
                            tagList.append(tr);
                        });

                        tagList.find("tr > td").on("click", function () {
                            callback($(this).attr('id'), $(this).text());
                        });
                    }
                });
            });
        }
    </script>
{% endblock %}