{% extends "layouts/default.html" %}

{% block title %} Search {% endblock title %}

{% block stylesheets %}
<link href="/static/assets/css/dataTables.buttons.min.css" rel="stylesheet">
{% endblock stylesheets %}

{% block content %}

{% if current_user.is_authenticated %}
<div class="page-inner">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header">
                    <div class="card-title">Search across cases</div>
                </div>
                <div class="card-body">
                    <form method="post" action="" id="form_search">
                        {{ form.hidden_tag() }}
                        <div class="input-group">
                            {{ form.search_value(placeholder="Search term - You can use % as a wilcard.   Search is context-free." , class="form-control", type="text") }}
                            <div class="input-group-append">
                                <button type="button" class="btn btn-sm btn-outline-success" id="submit_search">Search</button>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="form-label mr-3">Set to search within</label>
                            <div class="selectgroup selectgroup-pills">
                                <label class="selectgroup-item">
                                    <input type="radio" name="search_type" value="ioc" class="selectgroup-input" checked="">
                                    <span class="selectgroup-button">IOC</span>
                                </label>
                                <label class="selectgroup-item">
                                    <input type="radio" name="search_type" value="notes" class="selectgroup-input">
                                    <span class="selectgroup-button">Notes</span>
                                </label>
                                <label class="selectgroup-item">
                                    <input type="radio" name="search_type" value="comments" class="selectgroup-input">
                                    <span class="selectgroup-button">Comments</span>
                                </label>
                            </div>
                        </div>
                    </form>
                    <div class="table-responsive" style="display: none;" id="search_table_wrapper">
                        <div class="selectgroup">
                            <span id="table_buttons"></span>
                        </div>
                      <table class="table display table table-striped table-hover" width="100%" cellspacing="0" id="file_search_table" >
                        <thead>
                          <tr>
                            <th>MD5</th>
                            <th>Filename</th>
                            <th>Path</th>
                            <th>VT Score</th>
                            <th>Case seen</th>
                            <th>Seen count</th>
                            <th>Flag</th>
                            <th>Comment</th>
                            <th>VT</th>
                          </tr>
                        </thead>
                        <tfoot>
                          <tr>
                            <th>MD5</th>
                            <th>Filename</th>
                            <th>Path</th>
                            <th>VT Score</th>
                            <th>Case seen</th>
                            <th>Seen count</th>
                            <th>Flag</th>
                            <th>Comment</th>
                            <th>VT</th>
                          </tr>
                        </tfoot>
                      </table>
                    </div>
                    <div class="table-responsive" style="display: none;" id="search_table_wrapper_1">
                        <div class="selectgroup">
                            <span id="table_buttons_1"></span>
                        </div>
                      <table class="table display table table-striped table-hover" width="100%" cellspacing="0" id="file_search_table_1" >
                        <thead>
                          <tr>
                            <th>Name</th>
                            <th>Description</th>
                            <th>Type</th>
                            <th>Case</th>
                            <th>Customer</th>
                            <th>TLP</th>
                          </tr>
                        </thead>
                        <tfoot>
                          <tr>
                            <th>Name</th>
                            <th>Description</th>
                            <th>Type</th>
                            <th>Case</th>
                            <th>Customer</th>
                            <th>TLP</th>
                          </tr>
                        </tfoot>
                      </table>
                    </div>
                    <div class="table-responsive" id="search_table_wrapper_2">
                        <ul class="list-group list-group-bordered list " id="notes_msearch_list">

                        </ul>
                    </div>
                    <div class="table-responsive" style="display: none;" id="search_table_wrapper_3">
                        <div class="selectgroup">
                            <span id="table_buttons_2"></span>
                        </div>
                      <table class="table display table table-striped table-hover" width="100%" cellspacing="0" id="comments_search_table" >
                        <thead>
                          <tr>
                            <th>#ID</th>
                            <th>Comment text</th>
                            <th>Case</th>
                            <th>Customer</th>
                          </tr>
                        </thead>
                        <tfoot>
                          <tr>
                            <th>#ID</th>
                            <th>Comment text</th>
                            <th>Case</th>
                            <th>Customer</th>
                          </tr>
                        </tfoot>
                      </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal" tabindex="-1" role="dialog" id="modal_note_detail">
    <div class="modal-dialog modal-xxl modal-xl" role="document">
        <div class="modal-content" id="info_note_modal_content">

        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
{% endif %}

{% endblock content %}

{% block javascripts %}
    <script src="/static/assets/js/plugin/datatables/dataTables.cellEdit.js"></script>
    <script src="/static/assets/js/plugin/datatables/dataTables.buttons.min.js"></script>
    <script src="/static/assets/js/plugin/datatables/buttons.html5.min.js"></script>
    <script src="/static/assets/js/plugin/datatables/buttons.print.min.js"></script>

    <script src="/static/assets/js/plugin/ace/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/assets/js/plugin/ace/src-noconflict/ext-language_tools.js" type="text/javascript"
        charset="utf-8"></script>

    <script src="/static/assets/js/plugin/showdown/showdown.min.js"></script>
    <script src="/static/assets/js/iris/case.common.js"></script>
    <script src="/static/assets/js/iris/search.js"></script>
{% endblock javascripts %}