templates/Documents/viewDoclist.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}
  3.     OceanExpert | Document
  4. {% endblock %}
  5. {% block stylesheets %}
  6.     <link rel="stylesheet" type="text/css" href="{{ asset('css/navbar-login.css') }}">
  7.     <link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap.min.css') }}">
  8.     <link rel="stylesheet" type="text/css" href="{{ asset('css/font-awesome.min.css') }}">
  9.     <link rel="stylesheet" type="text/css" href="{{ asset('css/ionicons.min.css') }}">
  10.     <link rel="stylesheet" type="text/css" href="{{ asset('css/AdminLTE.min.css') }}">
  11.     <link rel="stylesheet" type="text/css" href="{{ asset('css/style.css') }}">
  12.     <link rel="stylesheet" type="text/css" href="{{ asset('css/square/blue.css') }}">
  13.     <link rel="stylesheet" type="text/css" href="{{ asset('css/jquery-confirm.min.css') }}">
  14.     <link rel="stylesheet" type="text/css" href="{{ asset('css/doclist.css') }}">
  15. {% endblock %}
  16. {% block body %}
  17.     {% include('navbarlogin.html.twig') %}
  18.     <div class="container-fluid top-buffer70">
  19.         <div class="container content justify">
  20.             {% if data.doclist.idDoclist is defined and data.doclist.idDoclist is not null %}
  21.                 <div class="box-header">
  22.                     <div class="row">
  23.                         <div class="col-sm-12">
  24.                             <div class="col-sm-8">
  25.                                 <h3>{{ data.doclist.title }}</h3>
  26.                             </div>
  27.                             {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  28.                                 <div class="col-sm-4 text-right">
  29.                                     <a href="{{ path('edit_doclist',{idDoclist:data.doclist.idDoclist}) }}">[Edit this List/Add Documents]</a><br/>
  30.                                     <a href="javascript:void(0);" id="deleteList" data-iddoclist="{{ data.doclist.idDoclist }}">[Delete this
  31.                                         List]</a>
  32.                                 </div>
  33.                             {% endif %}
  34.                             <div class="col-sm-12">
  35.                                 <article>{{ data.doclist.description | raw }}</article>
  36.                             </div>
  37.                         </div>
  38.                     </div>
  39.                    <div class="table-responsive">
  40.                        <table class="table table-hover">
  41.                            <tbody>
  42.                                
  43.                                 {% if data.documents is defined and data.documents | length > 0 %}
  44.                                     {% set i = 1 %}
  45.                                     {% for document in data.documents %}
  46.                                         <tr>
  47.                                             <td>
  48.                                                 {% if data.doclist.orderBy in [5,6] %}
  49.                                                     {{ document.docCode }}
  50.                                                     {% if document.idDocstatus == 1 %}
  51.                                                         <div class="text-muted">Draft</div>
  52.                                                     {% elseif document.idDocstatus == 3 %}
  53.                                                         <div class="text-muted">Pending</div>
  54.                                                     {% endif %}
  55.                                                 {% else %}
  56.                                                     {{ i }}
  57.                                                     {% set i = i + 1 %}
  58.                                                 {% endif %}
  59.                                             </td>
  60.                                             <td>
  61.                                                 {% if document.docCode is defined and document.docCode != "" and data.doclist.orderBy not in [5,6] %}
  62.                                                     <a href="{{ path('view_document',{idDoc: document.idDoc}) }}">{{ document.docCode }}</a> : 
  63.                                                 {% endif %}
  64.                                                 {% if document.title is defined and document.title != "" %}
  65.                                                     <a href="{{ path('view_document',{idDoc: document.idDoc}) }}">{{ document.title }}</a>
  66.                                                 {% endif %}
  67.                                                 {% if document.publishedOn is defined and document.publishedOn != "" %}
  68.                                                      ({{ document.publishedOn | date('d/m/Y') }})
  69.                                                 {% endif %}
  70.                                                 {% if document.summary is defined and document.summary != "" %}
  71.                                                     <br />{{ document.summary | truncate(50,'...')}}
  72.                                                 {% endif %}
  73.                                             </td>
  74.                                             <td><i class="fa fa-download download-document fa-2x" data-idDoc="{{ document.idDoc }}"></i></td>
  75.                                             {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  76.                                                 <td width="150px"><a href="javascript:void(0);" class="removefromlist" data-idDoc="{{ document.idDoc }}" >[Remove from List]</a></td>
  77.                                             {% endif %}
  78.                                         </tr>
  79.                                     {% endfor %}
  80.                                 {% endif %}
  81.                                    
  82.                                
  83.                            </tbody>
  84.                        </table>
  85.                    </div>
  86.                 </div>
  87.                 {% if data.docFiles is defined and data.docFiles | length > 0 %}
  88.                     <div class="row">
  89.                     <div class="col-xs-10">
  90.                         <div class="panel panel-success">
  91.                             <div class="panel-heading"><i class="fa fa-download fa-fw fa-2x" aria-hidden="true"></i>
  92.                                 Download
  93.                             </div>
  94.                             <div class="panel-body">
  95.                                 {% for file in data.docFiles %}
  96.                                     <div class="files col-md-4">
  97.                                         <a href="{{ asset(file.url) }}" download>
  98.                                             {% if file.idFileformat == 1 %}
  99.                                                 <img src="{{ asset('images/fileicons/pdf.png') }}" alt="PDF" class="fileicon">
  100.                                             {% elseif file.idFileformat == 2 %}
  101.                                                 <img src="{{ asset('images/fileicons/doc.png') }}" alt="DOC" class="fileicon">
  102.                                             {% elseif file.idFileformat == 3 %}
  103.                                                 <img src="{{ asset('images/fileicons/txt.png') }}" alt="TXT" class="fileicon">
  104.                                             {% elseif file.idFileformat == 4 %}
  105.                                                 <img src="{{ asset('images/fileicons/rtf.png') }}" alt="RTF" class="fileicon">
  106.                                             {% elseif file.idFileformat == 5 %}
  107.                                                 <img src="{{ asset('images/fileicons/xls.png') }}" alt="XLS" class="fileicon">
  108.                                             {% elseif file.idFileformat == 6 %}
  109.                                                 <img src="{{ asset('images/fileicons/ppt.png') }}" alt="PPT" class="fileicon">
  110.                                             {% elseif file.idFileformat == 7 %}
  111.                                                 <img src="{{ asset('images/fileicons/ppt.png') }}" alt="PPT" class="fileicon">
  112.                                             {% elseif file.idFileformat == 8 %}
  113.                                                 <img src="{{ asset('images/fileicons/gif.png') }}" alt="GIF" class="fileicon">
  114.                                             {% elseif file.idFileformat == 9 %}
  115.                                                 <img src="{{ asset('images/fileicons/jpg.png') }}" alt="JPG" class="fileicon">
  116.                                             {% elseif file.idFileformat == 10 %}
  117.                                                 <img src="{{ asset('images/fileicons/jpg.png') }}" alt="JPG" class="fileicon">
  118.                                             {% elseif file.idFileformat == 11 %}
  119.                                                 <img src="{{ asset('images/fileicons/png.png') }}" alt="PNG" class="fileicon">
  120.                                             {% elseif file.idFileformat == 12 %}
  121.                                                 <img src="{{ asset('images/fileicons/bmp.png') }}" alt="BMP" class="fileicon">
  122.                                             {% elseif file.idFileformat == 13 %}
  123.                                                 <img src="{{ asset('images/fileicons/zip.png') }}" alt="ZIP" class="fileicon">
  124.                                             {% elseif file.idFileformat == 14 %}
  125.                                                 <img src="{{ asset('images/fileicons/xlsx.png') }}" alt="XLSX" class="fileicon">
  126.                                             {% elseif file.idFileformat == 15 %}
  127.                                                 <img src="{{ asset('images/fileicons/ppt.png') }}" alt="PPT" class="fileicon">
  128.                                             {% elseif file.idFileformat == 16 %}
  129.                                                 <img src="{{ asset('images/fileicons/ppt.png') }}" alt="PPT" class="fileicon">
  130.                                             {% elseif file.idFileformat == 17 %}
  131.                                                 <img src="{{ asset('images/fileicons/doc.png') }}" alt="DOC" class="fileicon">
  132.                                             {% endif %}
  133.                                         </a>
  134.                                         <a href="{{ path('download_document',{idFile:file.idFile}) }}"
  135.                                            target="_blank">  {{ file.languagename }}</a>
  136.                                         <span class="small">(v{{ file.version }}, {{ file.size|format_bytes }})</span>
  137.                                     </div>
  138.                                 {% endfor %}
  139.                             </div>
  140.                         </div>
  141.                     </div>
  142.                 {% endif %}
  143.                 </div>
  144.                 <div class="row">
  145.                     <hr/>
  146.                     <div class="col-xs-12">
  147.                         <div class="pull-right text-right stats">
  148.                             {% if data.documentGroup is defined and data.documentGroup | length >0 %}
  149.                                 <div>Group(s):
  150.                                     {% for documentGroup in  data.documentGroup %}
  151.                                         {{ documentGroup.groupname }}
  152.                                     {% endfor %}
  153.                                 </div>
  154.                             {% endif %}
  155.                             <div>
  156.                                 {% if data.createdAt is defined and data.createdAt != "" %}
  157.                                     {{ "Created at " ~ data.createdAt | date("H:i") ~ ' on ' ~ data.createdAt | date("d M Y") }}
  158.                                 {% endif %}
  159.                                 {% if data.createdBy is defined and data.createdBy != "" %}
  160.                                     {{ ' by ' ~ data.createdBy }}
  161.                                 {% endif %}
  162.                             </div>
  163.                             <div>
  164.                                 {% if data.updatedAt is defined and data.updatedAt != "" %}
  165.                                     {{ "Created at " ~ data.updatedAt | date("H:i") ~ ' on ' ~ data.updatedAt | date("d M Y") }}
  166.                                 {% endif %}
  167.                                 {% if data.updatedBy is defined and data.updatedBy != "" %}
  168.                                     {{ ' by ' ~ data.updatedBy }}
  169.                                 {% endif %}
  170.                             </div>
  171.                         </div>
  172.                     </div>
  173.                 </div>
  174.                 {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  175.                     
  176.                 {% endif %}
  177.             {% else %}
  178.                 <div class="alert alert-danger" role="alert">
  179.                     <i class="fa fa-exclamation-triangle fa-fw fa-2x"></i> The requested document list could not be found.
  180.                 </div>
  181.                 <a class="btn btn-success" href="{{ path('frontend_homepage') }}">Cick here to go to Home</a>
  182.             {% endif %}
  183.         </div>
  184.     </div>
  185.     {% include "footer.html.twig" %}
  186.     <script src="{{ asset('js/jquery-confirm.min.js') }}"></script>
  187.     <script type="text/javascript" class="init">
  188.         $(document).ready(function() {
  189.             //set the top nav menu style
  190.             $(".documents").addClass('navactive');
  191.         });
  192.     </script>
  193.     <script type="text/javascript">
  194.         var documentDownloadBlock = "{{ path('document_download_block') }}";
  195.         var removeDocumentFromList = "{{ path('remove_document_from_list') }}";
  196.         var deleteDocumentList = "{{ path('remove_document_from_list') }}";
  197.         var admindashboard = "{{ path('admin_dashboard') }}";
  198.         {% if data.doclist.idDoclist is defined %}
  199.         
  200.         $(".removefromlist").click(function () {
  201.             var $this = $(this);
  202.             var idDoc = $this.data("iddoc");
  203.             $.confirm({
  204.                 escapeKey: "cancel",
  205.                 title: 'Confirm!',
  206.                 content: 'Are you sure you want to remove this document from the list?',
  207.                 buttons: {
  208.                     confirm:{
  209.                         keys: ['enter'],
  210.                         btnClass: 'btn-primary',
  211.                         text: "OK",
  212.                         action: function(){
  213.                             $.ajax({
  214.                                url: removeDocumentFromList, 
  215.                                 data:{idDoclist: {{ data.doclist.idDoclist}}, idDoc: idDoc},
  216.                                 method: "POST"
  217.                             }).done(function (response) {
  218.                                 if(response.status==1 ){
  219.                                     window.location.reload();
  220.                                 }
  221.                             });
  222.                         }
  223.                     },
  224.                     cancel: function () {
  225.                         btnClass: 'btn-danger'
  226.                     }
  227.                 }
  228.             });
  229.         });
  230.         $("#deleteList").click(function () {
  231.             var $this = $(this);
  232.             var idDoclist = $this.data("iddoclist");
  233.             $.confirm({
  234.                 escapeKey: "cancel",
  235.                 title: 'Confirm!',
  236.                 content: 'The removal of this list is an irreversible process. Are you sure you want to delete it forever?',
  237.                 buttons: {
  238.                     confirm:{
  239.                         keys: ['enter'],
  240.                         btnClass: 'btn-primary',
  241.                         text: "OK",
  242.                         action: function(){
  243.                             $.ajax({
  244.                                 url:deleteDocumentList,
  245.                                 data:{idDoclist: idDoclist},
  246.                                 method: "POST"
  247.                             }).done(function (response) {
  248.                                 if(response.status==1 ){
  249.                                     window.location.href = admindashboard;
  250.                                 }
  251.                             });
  252.                         }
  253.                     },
  254.                     cancel: function () {
  255.                         btnClass: 'btn-danger'
  256.                     }
  257.                 }
  258.             });
  259.         });
  260.         
  261.         {% endif %}
  262.     </script>
  263.     <script src="{{ asset('js/event-view.js') }}" type="text/javascript"></script>
  264.    
  265. {% endblock %}