admin_license_candidate.html.twig 3.32 KB
Newer Older
1
{# Copyright 2014-2017 Siemens AG
2 3 4 5 6 7

   Copying and distribution of this file, with or without modification,
   are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
   This file is offered as-is, without any warranty.
#}
{% extends "include/base.html.twig" %}
8 9 10 11
{% block styles %}
  {{ parent() }}
  <link rel="stylesheet" href="css/highlights.css"/>
{% endblock %}
12 13 14 15 16

{% block content %}

<table class="semibordered" id="licenseCandidateTbl" width="100%" cellpadding="0">
  <thead>
17
    <tr><th width="5%"></th><th width="10%"></th><th width="15%"></th><th width="50%"></th><th width="10%"></th><th width="10%"></th></th></tr>
18 19 20 21 22 23 24 25
  </thead>
</table>
  <br/><br/>
  
{% endblock %}

{% block foot %}
  {{ parent() }}
26
  <script src="/javascript/jquery-datatables/jquery.dataTables.min.js" type="text/javascript"></script>
27
  <script src="scripts/jquery.dataTables.select.js" type="text/javascript"></script>
28
  <script src="/javascript/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
29 30 31 32 33 34 35 36
  <script type="text/javascript">
    function createBrowseTable() {
      
    tableColumns = [
    {"sTitle": "{{ "Edit"|trans }}", "sClass": "center", "bSearchable": false},
    {"sTitle": "{{ "Shortname"|trans }}", "sClass": "center", "bSearchable": true},
    {"sTitle": "{{ "Fullname"|trans }}", "sClass": "center", "bSearchable": false},
    {"sTitle": "{{ "Text"|trans }}", "sClass": "left", "bSearchable": false},
37 38
    {"sTitle": "{{ "Group"|trans }}", "sClass": "center", "bSearchable": true},
    {"sTitle": "{{ "Delete"|trans }}", "sClass": "center", "bSearchable": false}
39 40 41 42 43 44 45 46 47 48
  ];

  tableSorting = [ [1, "asc"] ];

  dataTableConfig =
      {
        "aoColumns": tableColumns,
        "aaSorting": tableSorting,
        "iDisplayLength": 20,
        "aaData": {{ aaData }},
49
        "sPaginationType": "listbox",
50 51 52 53 54 55 56
        "bStateSave": true
      };

    var otable = $('#licenseCandidateTbl').dataTable(dataTableConfig);
    return otable;
  }
    
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
  function deleteCandidate(rfPk) {
    var mainDiv = "<div></div>";
    var confrimMessage = "Remove this license from candidate license list?";
    $(mainDiv).html(confrimMessage).dialog({
      title: "Please Confrim",
      resizable: false,
      modal: true,
      buttons: {
        "Ok": function() {
          $(this).dialog("close");
          $.ajax({
            type: 'POST',
            dataType: 'text',
            url: '?mod=admin_license_candidate&do=deletecandidate',
            data: { rf : rfPk },
            success: function(dataOnSuccess) {
              if(dataOnSuccess == "true"){
                $("#deletecandidate" + rfPk).closest("tr").hide();
              }else{
                $(mainDiv).html(dataOnSuccess).dialog({
                  title: "Cannot remove license, Because it is in use at",
                  width:'auto',
                  height:'auto',
                  modal: true,
                  buttons: {
                    "Close": function() {
                      $(this).dialog("close");
                    }
                  }
                });
              }
            },
            error: function() { alert('error'); }
          });
          },
        Cancel: function() {
          $(this).dialog("close");
        }
      }
96
    });
97 98 99 100 101
  }

  $(document).ready(function () {
    createBrowseTable();
  });
102 103
    
  </script>
104
{% endblock %}