{% extends "layouts/default_ext.html" %} {% block title %} Case Assets {% endblock title %} {% block stylesheets %}
{% include 'includes/header_case.html' %}
<link rel="stylesheet" href="/static/assets/css/bootstrap-select.min.css">
{% endblock stylesheets %}
{% block content %}
{% include 'includes/navigation_ext.html' %}

{% include 'includes/sidenav.html' %}
<div class="main-panel">

    <div class="content">
        {% if current_user.is_authenticated %}
        {{ form.hidden_tag() }}
        <nav class="navbar navbar-header navbar-expand-lg pt-2 pb-2 bg-case-gradient nav-sticky">
                <div class="container-fluid">
                    <div class="collapse" id="search-nav">
                        <div id="tables_button"></div>
                     </div>
					<ul class="navbar-nav topbar-nav ml-md-auto align-items-center page-navigation page-navigation-style-2 page-navigation-secondary">
                        <li class="nav-item ml-2">
                            <span class="text-white text-sm mr-2" id="last_resfresh">Loading</span>
                            <span class="text-warning text-sm mr-2" id="page_warning"></span>
                        </li>
                        <li class="nav-item">
                            <button class="btn btn-primary btn-sm" onclick="reload_assets();">
                                <span class="menu-title">Refresh</span>
                            </button>
                        </li>
                        <li class="nav-item">
                            <button class="btn btn-dark btn-sm" onclick="add_assets();">
                                <span class="menu-title">Add assets</span>
                            </button>
                        </li>
                        <li class="nav-item">
                            <div class="dropdown">
                              <button class="btn btn-sm btn-border btn-black" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                  <span class="menu-title"><i class="fas fa-ellipsis-v"></i></span>
                              </button>
                                <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                                <a class="dropdown-item" href="#" onclick="fire_upload_assets();">Upload CSV of assets</a>

                              </div>
                            </div>
                        </li>
					</ul>
            </div>


        </nav>

        <div class="page-inner ">
            <div class="row ">
                <div class="loader1 text-center ml-mr-auto" id="loading_msg">Loading...</div>
                <div class="col-md-12">
                    <div class="card" id="card_main_load" style="display:none;">
                        <div class="card-body">
                            <div class="col" id="assets_table_wrapper">
                              <table class="table display table-striped table-hover responsive" width="100%" cellspacing="0" id="assets_table" >
                                <thead>
                                  <tr>
                                      <th>Name</th>
                                      <th>Type</th>
                                      <th>Description</th>
                                      <th>IP</th>
                                      <th>Compromised</th>
                                      <th>IOC</th>
                                      <th>Tags</th>
                                      <th>Analysis</th>
                                  </tr>
                                </thead>
                                <tfoot>
                                  <tr>
                                      <th>Name</th>
                                      <th>Type</th>
                                      <th>Description</th>
                                      <th>IP</th>
                                      <th>Compromised</th>
                                      <th>IOC</th>
                                      <th>Tags</th>
                                      <th>Analysis</th>
                                  </tr>
                                </tfoot>
                              </table>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <div class="modal modal-case-focus" tabindex="-1" role="dialog" id="modal_add_asset" data-backdrop="true">
            <div class="modal-xl modal-dialog" role="document">
                <div class="modal-content" id="modal_add_asset_content">

                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        {% endif %}
    </div>
    <div class="modal " tabindex="-1" role="dialog" id="modal_upload_assets" data-backdrop="true">
      <div class="modal-lg modal-dialog" role="document">
        <form method="post" action="" id="form_upload_assets">

          <div class="modal-content">
            <div class="modal-header">
              <h5>Upload assets list (CSV format)</h5>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                  aria-hidden="true">&times;</span></button>
            </div>

            <div class="modal-body">
                <div class="form-group">
                    <label for="ioc_format" class="placeholder">Expected CSV File format</label>
                    <textarea class="form-control col-md-12 col-sm-12 sizable-textarea" rows="2" disabled>asset_name,asset_type_name,asset_description,asset_ip,asset_domain,asset_tags (separated with &quot;|&quot;)</textarea>
                </div>
                <div class="form-group">
                    <label class="placeholder">CSV File format example</label>
                    <textarea class="form-control col-md-12 col-sm-12 sizable-textarea" rows="3" disabled>asset_name,asset_type_name,asset_description,asset_ip,asset_domain,asset_tags
    "My computer","Mac - Computer","Computer of Mme Michu","192.168.15.5","iris.local","Compta|Mac"
    "XCAS","Windows - Server","Xcas server","192.168.15.48","iris.local",""</textarea>
                </div>
                  <div class="form-group">
                      <label class="placeholder">Choose CSV file to import : </label>
                      <input id="input_upload_assets" type="file" accept="text/csv">
                  </div>
            </div>
            <div class='invalid-feedback' id='ioc-invalid-msg'></div>
            <div class="modal-footer">
                    <button type="button" class="btn btn-outline-dark mr-auto" onclick="generate_sample_csv();">Download sample CSV</button>
                    <button type="button" class="btn btn-outline-success" onclick="upload_assets();">Upload</button>
            </div>
          </div><!-- /.modal-content -->
        </form>
      </div><!-- /.modal-dialog -->
    </div>
    {% include 'includes/footer.html' %}

</div>
{% endblock content %}
{% block javascripts %}
{% include 'includes/footer_case.html' %}
<script src="/static/assets/js/plugin/sortable/sortable.js "></script>
<script src="/static/assets/js/iris/case.asset.js"></script>


{% endblock javascripts %}