{% extends "base.html" %}

{% block title %}Главная{% endblock %}

{% block content %}

 <div class="intro-y flex flex-col sm:flex-row items-center mt-8">
                    <h2 class="text-lg font-medium mr-auto">
                        Tasks
                    </h2>
                    <!-- BEGIN: Inbox Filter
                        <div class="intro-y flex flex-col-reverse sm:flex-row items-center">
                            <div class="w-full sm:w-auto relative mr-auto mt-3 sm:mt-0">
                                <i class="w-4 h-4 absolute my-auto inset-y-0 ml-3 left-0 z-10 text-gray-700" data-feather="search"></i> 
                                <input type="text" class="input w-full sm:w-64 box px-10 text-gray-700 placeholder-theme-13" placeholder="Filter">
                                <div class="inbox-filter dropdown absolute inset-y-0 mr-3 right-0 flex items-center">
                                    <i class="dropdown-toggle w-4 h-4 cursor-pointer text-gray-700" data-feather="chevron-down"></i> 
                                    <div class="inbox-filter__dropdown-box dropdown-box mt-10 absolute top-0 left-0 z-20">
                                        <div class="dropdown-box__content box p-5">
                                            <div class="grid grid-cols-12 gap-4 row-gap-3">
                                                <div class="col-span-6">
                                                    <div class="text-xs">Requested o</div>
                                                    <select class="input w-full border mt-2 flex-1">
                                                        <option value="" selected disabled>Выберите</option>
                                                        <option>Сегодня</option>
                                                        <option>Последние 7 дней</option>
                                                        <option>За все время</option>
                                                        <option>От даты - до даты.</option>
                                                    </select>
                                                </div>
                                                <div class="col-span-6">
                                                    <div class="text-xs">Posted on</div>
                                                    <select class="input w-full border mt-2 flex-1">
                                                        <option value="" selected disabled>Выберите</option>
                                                        <option>Сегодня</option>
                                                        <option>Последние 7 дней</option>
                                                        <option>За все время</option>
                                                        <option>От даты - до даты.</option>
                                                    </select>
                                                </div>
                                                <div class="col-span-6">
                                                    <div class="text-xs">Applied on</div>
                                                    <select class="input w-full border mt-2 flex-1">
                                                        <option value="" selected disabled>Выберите</option>
                                                        <option>Сегодня</option>
                                                        <option>Последние 7 дней</option>
                                                        <option>За все время</option>
                                                        <option>От даты - до даты.</option>
                                                    </select>
                                                </div>
                                                <div class="col-span-6">
                                                    <div class="text-xs">Client</div>
                                                    <select class="input w-full border mt-2 flex-1">
                                                        <option value="" selected disabled>Выберите</option>
                                                        <option>-</option>
                                                        <option>-</option>
                                                        <option>-</option>
                                                        <option>-</option>
                                                    </select>
                                                </div>
                                                <div class="col-span-6">
                                                    <div class="text-xs">Assignee</div>
                                                     <select class="select2 w-full" multiple>
                                                        <option value="" selected disabled>Выберите</option>
                                                        <option>-</option>
                                                        <option>-</option>
                                                        <option>-</option>
                                                        <option>-</option>
                                                    </select>
                                                </div>
                                                <div class="col-span-6">
                                                    <div class="text-xs">Status</div>
                                                    <select class="select2 w-full" multiple>
                                                        
                                                        <option>Scheduled</option>
                                                        <option>Requested</option>
                                                        <option>Applying</option>
                                                        <option>Applied</option>
                                                    </select>
                                                </div>
                                                <div class="col-span-12 flex items-center mt-3">
                                                    
                                                    <button class="button w-32 justify-center block bg-theme-1 text-white ml-2">Search</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="w-full sm:w-auto flex">
                                
                                <div class="dropdown relative">
                                
                                        
                                </div>
                            </div>
                        </div>
                         END: Inbox Filter -->
                    <button class="button text-white bg-theme-1 shadow-md mr-2" onclick="window.location.href='/productuj'">Unasigned Jobs</button>
                <button class="button text-white bg-theme-1 shadow-md mr-2" onclick="window.location.href='/productmj'">My Jobs</button>

                <button class="button text-white bg-red-500 hover:bg-red-700 shadow-md mr-2" onclick="window.location.href='/product'">All Jobs</button>
                <button class="button text-white bg-theme-1 shadow-md mr-2" onclick="window.location.href='/productoj'">Outstanding Jobs</button>
                </div>
                <!-- BEGIN: Datatable -->
                <div class="intro-y datatable-wrapper box p-5 mt-5">
                    <table class="table table-report table-report--bordered display datatable w-full">
                        <thead>
                            <tr>
                                <th class="border-b-2 whitespace-no-wrap">TITLE &#10760;</th>
                                <th class="border-b-2 text-center whitespace-no-wrap">COMPANY &#10760;</th>
                                <th class="border-b-2 text-center whitespace-no-wrap">CLIENT &#10760;</th>
                                <th class="border-b-2 text-center whitespace-no-wrap">Requested on &#10760;</th>
                                <th class="border-b-2 text-center whitespace-no-wrap">Posted on &#10760;</th>
                                <th class="border-b-2 text-center whitespace-no-wrap">STATUS</th>
                                <th class="border-b-2 text-center whitespace-no-wrap">Assignee</th>


                                <th class="border-b-2 text-center whitespace-no-wrap">Applied on</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for job in jobs %}
                            <tr>
                                <td class="border-b">
                                    <a href="{{ job.job.link }}" target="_blank" class="font-medium whitespace-no-wrap">{{ job.job.job_title [:50] }}</a>
                                    <div class="text-gray-600 text-xs whitespace-no-wrap">{{ job.job.job_id  }}</div>
                                </td>
                                <td class="text-center border-b">{{job.job.job_company}}</td>
                                <td class="text-center border-b">
                                    
                                <a href="#" class="client-link text-blue-500" data-client-id="{{ job.client.id }}">{{ job.client.user_nicename }}</a>
            
                                </td>

                                <td class="text-center border-b">{{job.job.data_requested}}</td>
                                <td class="text-center border-b">{{job.job.date_posted}}</td>
                                <td class="text-center border-b">
                                    <select class="select2" onchange="updateStatus(this, '{{ job.id }}')">
                                        <option value="" {% if job.status is none %}selected{% endif %}>— Not selected —</option>
                                        <option value="Scheduled" {% if job.status == "Scheduled" %}selected{% endif %}>Scheduled</option>
                                        <option value="Requested" {% if job.status == "Requested" %}selected{% endif %}>Requested</option>
                                        <option value="In-Progress" {% if job.status == "In-Progress" %}selected{% endif %}>In-Progress</option>
                                        <option value="Applied" {% if job.status == "Applied" %}selected{% endif %}>Applied</option>
                                        <option value="Issues Applying" {% if job.status == "Issues Applying" %}selected{% endif %}>Issues Applying</option>
                                        <option value="Cancelled" {% if job.status == "Cancelled" %}selected{% endif %}>Cancelled</option>
                                    </select>
                                
                                </td>
                               <td class="text-center border-b">
                                    <select class="select2" onchange="updateAssignee(this, '{{ job.id }}')">
                                        <option value="" {% if job.assignee is none %}selected{% endif %}>— Not selected —</option>
                                        {% for user in users %}
                                            <option value="{{ user.id }}" {% if job.assignee == user.id %}selected{% endif %}>
                                                {{ user.username }}
                                            </option>
                                        {% endfor %}
                                    </select>
                                </td>
                                <td class="text-center border-b">-</td>
                            </tr>
                         {% endfor %}
                        </tbody>
                    </table>
                </div>
                <!-- END: Datatable -->
<!-- Включаем модалку -->
<!-- Модальное окно -->
{% include "modal.html" %}
<script src="/static/dist/js/prod.js"></script>

{% endblock %}