{% extends 'order_base.html' %}
{% load staticfiles %}
{% block extrastyle %}<link rel="stylesheet" href="{% static 'base/css/jquery-confirm.min.css' %}"/>{% endblock extrastyle %}
{% block content %}
	<article>
        <form method="post" action="{% url 'kindergarten:search' %}">
            {% csrf_token %}
            <input id="id_search_word" class="sreachKin" name="search_word" type="text" placeholder="이름으로 검색">
            <div>
                <button class="kinSearchBtn" type="submit">검색</button>
            </div>
        </form>
		<a href="{% url 'kindergarten:create' %}"><div class="addKinGroup blackBtn">유치원 생성하기</div></a>
		<table>
			<colgroup>
				<col width="5%">
				<col width="10%">
				<col width="17%">
				<col width="43%">
				<col width="15%">
				<col width="10%">
			</colgroup>
			<thead>
				<tr>
					<th>No.</th>
					<th>상권</th>
					<th>유치원명</th>
					<th>주소</th>
					<th>전화번호</th>
					<th>추가</th>
				</tr>
			</thead>
			<tbody>
                {% if object_list %}
                {% for object in object_list %}
                    <tr>
                        <td>{{ object.id }}</td>
                        <td>{{ object.area }}</td>
                        <td>{{ object.name }}</td>
                        <td>{{ object.address }}</td>
                        <td>{{ object.tel }}</td>
                        <td><a class="kindergartenRegistration" href="{% url 'kindergarten:through_smart_create' object.id %}"><button>추가</button></a></td>
                    </tr>
                {% endfor %}
                {% else %}
                    <tr>
                        <td></td>
                        <td></td>
                        <td>결과가 없습니다. 검색어를 입력해주세요.</td>
                        <td></td>
                        <td></td>
                    </tr>
                {% endif %}
			</tbody>
		</table>
	</article>
    {% include 'pagination/pagination.html' %}
{% endblock content %}
{% block extrascript %}
    <script type="text/javascript" src="{% static 'base/js/jquery-confirm.min.js' %}"></script>
    <script type="text/javascript">

        $("a.kindergartenRegistration").confirm({
            title: 'Confirm!',
            content: '내 영업관리에 등록하시겠습니까?',
            useBootstrap: false,
            buttons: {
                confirm: function () {
                    location.href = this.$target.attr('href');
                },
                cancel: function () {
                }
            }
        });

    </script>
{% endblock extrascript %}