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

<div class="w-full xxlg1:w-[75%]">
    <div class="w-full h-fit bg-white rounded-md shadow-md p-5">
        <h1 class="text-secondosiblue text-[25px]">{% if request.user.is_superuser %}Daily Reports{% else %} My Daily Reports{% endif%}</h1>

        <!-- FILTERING -->
        <div
            class="w-full py-4 px-3 bg-gray-200 rounded-md shadow-md mt-4 flex flex-col l:flex-row justify-between gap-3 items-center">
            <div class="w-full l:w-fit flex justify-start items-center gap-5">
                <div class="relative h-fit w-full l:w-fit flex items-center">
                    <input type="text" placeholder="Enter Staff Username"
                        class="py-2 px-3 border border-gray-300 rounded-md outline-none w-full l:w-[300px] h-[40px] relative">
                    <button
                        class="text-gray-500 text-xl outline-none border-none cursor-pointer absolute right-2 bg-white">
                        <i class="fa fa-search"></i>
                    </button>
                </div>
            </div>
            <div class="w-full l:w-fit">
                <a href="{% url 'adddailyreport' %}" class="w-full l:w-fit">
                    <button
                        class="w-full l:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300">Add
                        Daily Report</button>
                </a>
            </div>
        </div>

        <!-- DAILY REPORTS -->
        {% for report in dailyreports %}
        <div class="mt-5 w-full h-fit">
            <div class="daily-report w-full border-x border-t border-gray-300 rounded-t-md">
                <!-- TABLE HEADER -->
                <div
                    class="w-full flex justify-between items-center h-fit border-b border-gray-300 rounded-t-md px-4 py-3">
                    <div class="w-fit h-full flex justify-start items-center">
                        <p class="text-secondosiblue text-sm s:text-xl font-light"><span
                                class="font-semibold text-secondosiblue">{{report.staff.user.first_name}}
                                {{report.user.staff.last_name}}</span> {{report.date}} - {{report.time}}</p>
                    </div>
                    <div>
                        <button
                            class="showReportButton w-fit h-fit px-3 py-2 bg-green-700 text-white border border-green-700 cursor-pointer hover:bg-white hover:text-green-700 rounded-md shadow-md duration-300 text-sm s:text-base">
                            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"class="w-[18px]">
                                <path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
                                <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
                            </svg> 
                        </button>
                        <button
                            class="w-fit h-fit px-3 py-2 bg-osiblue text-white border border-osiblue cursor-pointer hover:bg-white hover:text-osiblue rounded-md shadow-md duration-300 text-sm s:text-base">
                            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-[18px]">
                                <path stroke-linecap="round" stroke-linejoin="round" d="M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0 1 10.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0 .229 2.523a1.125 1.125 0 0 1-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0 0 21 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 0 0-1.913-.247M6.34 18H5.25A2.25 2.25 0 0 1 3 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 0 1 1.913-.247m10.5 0a48.536 48.536 0 0 0-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5Zm-3 0h.008v.008H15V10.5Z" />
                            </svg>
                              
                        </button>
                    </div>
                </div>

                <!-- TABLE BODY -->
                <div class="w-full hidden reportContainer">
                    <!-- 1st row -->
                    <div class="w-full h-fit flex justify-between items-center border-b border-gray-300">
                        <div class="w-full h-full p-5 text-gray-500">
                            {{ report.text|linebreaks }}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {% endfor %}

    </div>
</div>


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

<!-- TO DISPLAY THE DAILY REPORT CONTENT -->
<script type="text/javascript" src='{% static "js/daily-reports.js" %}'></script>


{% endblock content %}