123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- {% extends 'base.html' %}
- {% load crispy_forms_tags %}
- {% load static %}
- {% block modals%}
- <div class="modal" id="mo_get_info" tabindex="-1" role="dialog"></div>
- <div class="modal " id="mo_edit_info" data-backdrop="static" tabindex="-1" role="dialog"></div>
- <div class="modal " id="mo_edit_port" data-backdrop="static" tabindex="-1" role="dialog"></div>
- {% endblock %}
- {% block script %}
- <script type="text/javascript">
- function get_list() {
- var $list_get_list = $('#get_list');
- var get_search = document.getElementById("id_PSearch").value
-
- if (get_search.length >= 3) {
- $list_get_list.html('<h3> <i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3>');
- $.ajax({
- type : 'GET',
- url: '/parc/api/switch/get_list?get_search='+get_search,
- success: function(feeds) {
- $list_get_list.html(feeds);
- }
- });
- }
- if (get_search.length == "") {
- $list_get_list.html('<h3> <i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3>');
- $.ajax({
- type : 'GET',
- url: '/parc/api/switch/get_list',
- success: function(feeds) {
- $list_get_list.html(feeds);
- }
- });
- }
- };
- function bt_get_info(id){
- $.ajax({
- type : 'GET',
- url: '/parc/api/switch/get/'+id,
- success: function(data) {
- $('#mo_get_info').html(data).modal('toggle');
- },
- });
- };
- function bt_edit_info(id){
- var get_search = document.getElementById("id_PSearch").value
- $.ajax({
- type : 'GET',
- url: '/parc/api/switch/edit/'+id+'?get_search='+get_search,
- success: function(data) {
- $('#mo_edit_info').html(data).modal('toggle');
- },
- });
- };
- function bt_edit_port(switch_id, port_id){
- var get_search = document.getElementById("id_PSearch").value
- $.ajax({
- type : 'GET',
- url: '/parc/api/switch/edit/port/'+switch_id+'/'+port_id+'?get_search='+get_search,
- success: function(data) {
- $('#mo_edit_port').html(data).modal('toggle').modal('show');
- },
- });
- };
- function bt_update_port(switch_id){
- var get_search = document.getElementById("id_PSearch").value
- $.ajax({
- type : 'GET',
- url: '/parc/api/switch/update/'+switch_id+'?get_search='+get_search,
- success: function(data) {
- $('#mo_edit_port').html(data).modal('toggle').modal('show');
- },
- });
- };
- function bt_send_edit(){
- document.getElementById("form_edit").submit();
- };
- function onloading() {
- get_list();
- {% if page.item_id %}bt_get_info({{page.item_id}});{% endif %}
- };
- $(document).ready(function(){ onloading(); });
- </script>
- {% endblock %}
- {% block main %}
- <div class="card-body">
- {% if not page.output or page.err %}
- {{page.p_contenu|safe}}
- {% else %}
- {% if page.err %}{{page.err|safe}}{% endif %}
- {% if page.output and page.err %}<hr>{% endif %}
- {% if page.output %}{{page.output|safe|urlize}}{% endif %}
- {% endif %}
- </div>
- <div id="get_list"><h3><i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3></div>
- {% endblock %}
- {% block right_panel %}
- <div class="card-body">
- <div id="div_id_PSearch" class="form-group">
- <label for="id_PSearch" class=" requiredField">Recherche d'un switch (min 3 caractères) </label>
- <div class=""><input type="text" name="PSearch" maxlength="128" class="textinput textInput form-control" required="" id="id_PSearch" oninput="get_list()" value="{{page.search}}"></div>
- </div>
- <p>{{page.p_right|safe}}</p>
- <div class="d-grid gap-2 mb-2"><a class="btn btn-success" href="#" onclick="bt_edit_info(0)" role="button"><i class="far fa-plus-square"></i> Ajouter un Switch</a></div>
- <div class="d-grid gap-2"><a class="btn btn-primary" href="/parc" role="button"><i class="fas fa-undo-alt"></i> Retour</a></div>
- </div>
- {% endblock %}
|