{% include 'header.html' %}
<div class="container mx-auto">
  <section class="bg-white p-5 mt-5">
    <div class="flex flex-wrap items-center -m-2">
      <div class="w-full md:w-1/2 p-2">
        <ul class="flex flex-wrap items-center gap-x-3 mb-2">
          <li>
            <a class="flex font-medium text-xs text-coolGray-500 hover:text-coolGray-700" href="/">
              <p>Home</p>
            </a>
          </li>
          <li>
            <svg width="6" height="15" viewBox="0 0 6 15" fill="none" xmlns="http://www.w3.org/2000/svg">
              <path d="M5.34 0.671999L2.076 14.1H0.732L3.984 0.671999H5.34Z" fill="#BBC3CF"></path>
            </svg>
          </li>
          <li><a class="flex font-medium text-xs text-coolGray-500 hover:text-coolGray-700" href="/automation">Automation Strategies</a></li>
          <li>
            <svg width="6" height="15" viewBox="0 0 6 15" fill="none" xmlns="http://www.w3.org/2000/svg">
              <path d="M5.34 0.671999L2.076 14.1H0.732L3.984 0.671999H5.34Z" fill="#BBC3CF"></path>
            </svg>
          </li>
        </ul>
      </div>
    </div>
  </section>

  <section class="py-4">
    <div class="container px-4 mx-auto">
      <div class="relative py-11 px-16 bg-coolGray-900 rounded-md overflow-hidden">
        <img class="absolute z-10 left-4 top-4" src="/static/images/elements/dots-red.svg" alt="">
        <img class="absolute z-10 right-4 bottom-4" src="/static/images/elements/dots-red.svg" alt="">
        <img class="absolute h-64 left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 object-cover" src="/static/elements/wave.svg" alt="">
        <div class="relative z-20 flex flex-wrap items-center -m-3">
          <div class="w-full md:w-1/2 p-3">
            <h2 class="mb-6 text-4xl font-bold text-white tracking-tighter">Automation Strategies</h2>
            <p class="font-semibold text-coolGray-200"></p>
          </div>
          <div class="w-full md:w-1/2 p-3">
            <a id="refresh" href="/newautomationstrategy"><button class="block md:ml-auto px-5 py-3 font-medium text-lcg text-white bg-blue-500 hover:bg-blue-600 rounded-md focus:ring-0 focus:outline-none">Create New Strategy</button></a>
          </div>
        </div>
      </div>
    </div>
  </section>

{% include 'inc_messages.html' %}

  <section class="bg-white">
    <div class="pl-6 pr-6 pt-0 pb-0 mt-5 h-full overflow-hidden bg-white ">
      <div class="pb-6 border-coolGray-100">
        <div class="flex flex-wrap items-center justify-between -m-2">
          <div class="w-full pt-2">

            <div class="container px-0 mx-auto mt-5">
              <div class="overflow-x-auto relative border sm:rounded-lg">

                <form method="post">

                  <table class="w-full text-sm text-left text-gray-500 outline-none border-gray-300">

                    <thead class="text-xs text-gray-700 border-b uppercase bg-gray-50 outline-none border-gray-300">
                      <tr>
                        <th scope="col" class="py-3 px-6">Filter</th>
                        <th scope="col" class="py-3 px-6"></th>
                        <th scope="col"></th>
                      </tr>
                    </thead>

                    <tr class="bg-white border-t hover:bg-gray-50">
                      <td class="py-4 px-6 bold w-96">
                        Sort by:
                      </td>
                      <td class="py-4 bold w-96">
                        <select class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" name="sort_by">
                          <option value="created_at"{% if filters.sort_by=='created_at' %} selected{% endif %}>Created At</option>
                        </select>
                      </td>
                      <td class="py-4 px-6 pr-5">
                        <select class="pr-15 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" name="sort_dir">
                          <option value="asc"{% if filters.sort_dir=='asc' %} selected{% endif %}>Ascending</option>
                          <option value="desc"{% if filters.sort_dir=='desc' %} selected{% endif %}>Descending</option>
                        </select>
                      </td>
                    </tr>

                  </table>
              </div>
            </div>

            <div class="pt-10 bg-white bg-opacity-60 rounded-b-md">
              <div class="w-full md:w-0/12">
                <div class="flex flex-wrap justify-end -m-1.5">

                  <div class="w-full md:w-auto p-1.5">
                    <button type="submit" name='pageback' value="Page Back" class="outline-none flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 bg-white rounded-md shadow-button focus:ring-0 focus:outline-none">
                      <svg aria-hidden="true" class="mr-2 w-5 h-5" fill="#556987" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
                        <path fill-rule="evenodd" d="M7.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l2.293 2.293a1 1 0 010 1.414z" clip-rule="evenodd"></path>
                      </svg> <span>Page Back</span> </button>
                  </div>

                  <div class="flex items-center">
                    <div class="w-full md:w-auto p-1.5">
                      <p class="text-sm font-heading">Page: {{ filters.page_no }}</p>
                    </div>
                  </div>

                  <div class="w-full md:w-auto p-1.5">
                    <button type="submit" name='pageforwards' value="Page Forwards" class="outline-none flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 bg-white rounded-md shadow-button focus:ring-0 focus:outline-none"> <span>Page Forwards</span>
                      <svg aria-hidden="true" class="ml-2 w-5 h-5" fill="#556987" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
                        <path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path>
                      </svg>
                    </button>
                  </div>

                  <div class="w-full md:w-auto p-1.5 ml-2">
                    <button name='clearfilters' value="Clear Filters" class="outline-none flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 bg-white rounded-md shadow-button focus:ring-0 focus:outline-none">
                      <span>Clear Filters</span> </button>
                  </div>

                  <div class="w-full md:w-auto p-1.5 ml-2">
                    <button value="Submit" type="submit" class="flex flex-wrap justify-center w-full px-4 py-2.5 bg-blue-500 hover:bg-blue-600 font-medium text-sm text-white border border-blue-500 rounded-md shadow-button focus:ring-0 focus:outline-none">
                      <span>Submit</span> </button>
                  </div>

                </div>
              </div>
            </div>

            <input type="hidden" name="formid" value="{{ form_id }}">
            <input type="hidden" name="pageno" value="{{ filters.page_no }}">

            </form>

            <div class="container px-0 mx-auto mt-10">
              <div class="overflow-x-auto relative border sm:rounded-lg">

                <table class="w-full text-sm text-left text-gray-500 outline-none border-gray-300">


                  <thead class="text-xs text-gray-700 border-b uppercase bg-gray-50 outline-none border-gray-300">
                    <tr>
                      <th scope="col" class="py-3 px-6">Name</th>
                      <th scope="col" class="py-3">Type</th>
                    </tr>
                  </thead>

                  {% for s in strategies %}
                  <tr class="bg-white border-t hover:bg-gray-50">
                    <td class="py-4 px-6 bold w-96">
                      <a class="monospace bolder-t" href=/automationstrategy/{{ s[0] }}>{{ s[1] }}</a>
                    </td>
                    <td class="py-4 pr-5">{{ s[2] }}
                    </td>
                  </tr>
                  {% endfor %}

                </table>
              </div>
            </div>

          </div>
        </div>
      </div>
    </div>

  </section>
</div>
{% include 'footer.html' %}
</div>
</body>

</html>