{% extends "add-edit-main.html" %}
{%load static%}
{% block content %}

<!-- TO ENABLE THE SEARCH FUNCTIONALITY IN THE SELECT TAG -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/css/selectize.min.css" />
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/js/selectize.min.js"></script>


<div class="w-full px-5 s:px-9 mb-5">
    <div class="w-full h-full shadow-md rounded-md py-5 px-3 bg-white">
        <h1 class="text-3xl text-secondosiblue text-center font-semibold">
            Create Order for {{customer.user.first_name}} {{customer.user.last_name}}
        </h1>


        <form method="POST" action="{% url 'addorder' customer.id %}" enctype="multipart/form-data">
            {% csrf_token %}
            <div class="w-full flex flex-col gap-5">

    
                <div class="w-full">
                    <label class="text-gray-500">Business:</label>
                    <select name="business"
                        class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1">
                        <option selected disabled>Businesses</option>
                        {% for business in businesses %}
                        <option value="{{business.id}}">{{business.name}}</option>
                        {% endfor %}
                    </select>
                </div>



                <div class="w-full">
                    <label class="text-gray-500">Date:</label>
                    <input required name="date" type="date" id="date" name="date"
                        class="w-full p-3 border border-gray-300 rounded-md bg-transparent outline-none mt-1">
                </div>


                <select name="service" id="servicesSelectTag"
                    class="w-full h-[100px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-1 hidden"
                    multiple required>
                </select>


                <div class="w-full">
                    <p class="text-secondosiblue text-xl">Pick Services</p>
                    <div class="w-full grid grid-cols-1 md:grid-cols-2 l:grid-cols-3 gap-5 mt-3">

                        {% for service in services %}
                        <div class="w-full shadow-md border border-gray-200 flex flex-col justify-between rounded-t-md">
                            <div
                                class="w-full h-full p-9 flex flex-col justify-center items-center gap-5 rounded-t-md bg-white">
                                <p class="text-secondosiblue uppercase font-poppinsBold text-xl text-center">
                                    {{service.title}}
                                </p>
                            </div>
                            <div class="w-full flex flex-col justify-center items-center text-center mb-2">
                                <p class="text-secondosiblue font-poppinsLight text-[17px] font-semibold">
                                    ${{service.amount}}</p>
                            </div>
                            <div class="w-full px-3 py-2 text-white flex justify-center items-center gap-2 bg-osiblue rounded-b-md cursor-pointer addServiceButton"
                                data-service-id="{{service.id}}" data-service-title="{{service.title}}">
                                <p>Add</p>
                            </div>
                        </div>
                        {% endfor %}
                    </div>
                </div>

                <div class="w-full flex justify-center items-center mt-3">
                    <button type="submit"
                        class="w-fit py-1 px-5 bg-osiblue rounded-md outline-none text-white border border-osiblue text-xl cursor-pointer hover:bg-white hover:text-osiblue duration-300">Create</button>
                </div>
            </div>
        </form>
    </div>
</div>


<!---------------------- JS SCRIPTS -------------------->

<script type="text/javascript" src='{% static "js/billing/add-order.js" %}'></script>


{% endblock %}