templates/AtechNetCoreBundle/Default/page_layout.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block stylesheets %}
  3. {{ parent() }}
  4. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
  5. <link rel="stylesheet" type="text/css" href="{{ asset('bundles/atechnetcore/css/main.css')|appendAssetCache }}">
  6. <style>
  7. .breadcrumb {
  8. margin-bottom: 6px;
  9. padding: 5px 15px;
  10. }
  11. .navbar {
  12. margin-bottom: 6px;
  13. }
  14. .dropdown-submenu {
  15. position: relative;
  16. }
  17. .dropdown-submenu .dropdown-menu {
  18. top: 0;
  19. left: 100%;
  20. margin-top: -1px;
  21. }
  22. .dropdown-inline-submenu {
  23. list-style: none;
  24. width: max-content;
  25. padding-left: 1em;
  26. }
  27. #notification-icon {
  28. cursor: pointer;
  29. }
  30. #notification-icon .label {
  31. font-size: 100%;
  32. font-weight: normal;
  33. padding-top: 0.3em;
  34. }
  35. #notification-panel {
  36. position: absolute;
  37. display: none;
  38. width: 380px;
  39. background-color: #fff;
  40. top: 40px;
  41. right: 5%;
  42. border: 1px solid #bbb;
  43. border-radius: 4px;
  44. }
  45. #notification-panel .notification-list {
  46. max-height: 312px;
  47. overflow-y: scroll;
  48. padding: 0 5px;
  49. }
  50. #notification-panel .show-all-notification {
  51. text-align:center;
  52. background-color: inherit;
  53. width: 100%;
  54. border-top: 1px solid #dedede;
  55. padding: 8px 0px;
  56. border-radius: 0 0 4px 4px;
  57. z-index: 99;
  58. position: absolute;
  59. }
  60. #notification-panel a {
  61. display: block;
  62. padding: 5px 10px;
  63. color: #222;
  64. max-height: 280px;
  65. }
  66. #notification-panel a:hover {
  67. background-color: #eef;
  68. text-decoration: none;
  69. }
  70. #notification-panel a.active {
  71. font-weight: bold;
  72. color: #000;
  73. }
  74. #notification-panel a small {
  75. color: #555;
  76. }
  77. #page-refresh-block {
  78. display: none;
  79. position:relative;
  80. float:right;
  81. top:-31px;
  82. right:15px;
  83. }
  84. #breadcrumb-and-page-refresh {
  85. height:36px;
  86. }
  87. .main-navbar-prod {
  88. border-bottom: 3px solid #00bb00;
  89. }
  90. .main-navbar-dev {
  91. border-bottom: 3px solid #d267ff;
  92. }
  93. </style>
  94. {% endblock %}
  95. {% block title %}
  96. {% apply spaceless %}
  97. {{- parent() -}}
  98. {% if page_title is defined %}
  99. {{- page_title -}}
  100. {% endif %}
  101. {% endapply %}
  102. {% endblock %}
  103. {% block body %}
  104. <nav class="navbar navbar-inverse navbar-static-top main-navbar main-navbar-{{ app.environment }}">
  105. <div class="container-fluid" style="height:36px;">
  106. <div class="navbar-header">
  107. {% if "now"|date('d.m') == '04.05' %}
  108. <a href="{{ path('atech_net_core_dashboard') }}" class="navbar-brand" style="padding-top:8px;"><img src="{{ asset('bundles/atechnetcore/images/darth-vader.png')|appendAssetCache }}" title="May the 4th be with you!" /></a>
  109. {% else %}
  110. <a href="{{ path('atech_net_core_dashboard') }}" class="navbar-brand"><i class="glyphicon glyphicon-home"></i></a>
  111. {% endif %}
  112. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
  113. <span class="sr-only">Toggle navigation</span>
  114. <span class="icon-bar"></span>
  115. <span class="icon-bar"></span>
  116. <span class="icon-bar"></span>
  117. </button>
  118. </div>
  119. <div id="navbar" class="collapse navbar-collapse" aria-expanded="false">
  120. {{ render(controller('App\\AtechNet\\CoreBundle\\Controller\\BaseController::getMenuAction')) }}
  121. <ul class="nav navbar-nav navbar-right">
  122. {% if "now"|date('md') == 214 %}<li><div class="heart" title="Boldog Valentint!"></div></li>{% endif %}
  123. <li>
  124. <div id="notification-icon" class="navbar-text">
  125. <div class="label label-default"><i class="glyphicon glyphicon-envelope"></i> <span id="notification-value">?</span></div>
  126. </div>
  127. <div id="notification-panel"></div>
  128. </li>
  129. <li class="dropdown">
  130. <a href="{{ path('account_edit') }}" class="dropdown-title">
  131. <span class="name">{% trans %}Hello{% endtrans %} <strong>{{ app.user.nickName }}</strong></span>
  132. <i class="fa fa-caret-down"></i>
  133. </a>
  134. <ul class="dropdown-menu">
  135. <li><a href="{{ path('account_edit') }}" data-teszt="profileAccountEditButton">{{ 'Profile' |trans }}</a></li>
  136. <li><a href="{{ path('atech_net_core_user_absence_list') }}" data-teszt="profileUserAbsenceButton">{{ 'User absence' |trans }}</a></li>
  137. <li><a href="{{ path('atech_net_core_user_product_notifications') }}" data-teszt="profileProductNotificationsButton">{{ 'Product notifications' |trans }}</a></li>
  138. <li><a href="{{ path('atech_net_core_signature_generator') }}" data-teszt="profileSignatureGeneratorButton">{{ 'Signature generator' |trans }}</a></li>
  139. <li class="divider"></li>
  140. <li><a href="{{ path('atech_net_core_logout') }}" id="log-out" data-teszt="logoutButton">{% trans %}admin.logout{% endtrans %}</a></li>
  141. </ul>
  142. </li>
  143. </ul>
  144. </div>
  145. </div>
  146. </nav>
  147. <div id="breadcrumb-and-page-refresh" class="container-fluid">
  148. {{ wo_render_breadcrumbs() }}
  149. <div id="page-refresh-block">
  150. <i class="glyphicon glyphicon-time"></i> <a href="#"><i class="glyphicon glyphicon-pause"></i></a> {% trans %}Page refresh is{% endtrans %} <strong><span id="page-refresh-in">0</span></strong>s
  151. </div>
  152. </div>
  153. <div id="content" class="container-fluid">
  154. {% block content %}
  155. <div id="sidebar">
  156. {% block sidebar %}
  157. <div id="navigation">
  158. {{ render(controller('AtechNetCoreBundle/Default/navigation', {'current_page': current_page})) }}
  159. </div>
  160. {% endblock %}
  161. </div>
  162. <div id="section-wrapper">
  163. {% block section_wrapper %}
  164. <div id="section-nav">
  165. {% block section_nav %}
  166. {% if section_title is defined %}<span
  167. class="title">{{ section_title|trans }}</span>{% endif %}
  168. <div class="section-nav-action">{% block section_nav_action %}{% endblock %}</div>
  169. {% endblock %}
  170. </div>
  171. <div id="sections">
  172. {% for flashMessage in app.session.flashbag.get('notice') %}
  173. <div class="flash-notice">{{ flashMessage|trans }}</div>
  174. {% endfor %}
  175. {% block sections %}
  176. {% endblock %}
  177. </div>
  178. {% endblock %}{#section_wrapper#}
  179. </div>
  180. {% endblock %}{#content#}
  181. </div>
  182. <div id="modal-page-refresh" class="modal fade" tabindex="-1" role="dialog">
  183. <div class="modal-dialog" role="document">
  184. <div class="modal-content">
  185. <div class="modal-body text-center text-danger" style="padding: 0;">
  186. <div class="alert alert-info" role="alert" style="margin: 0;"><strong>{{ 'The page will refresh automatically, please wait' |trans }}...</strong></div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. {% include 'AtechNetCoreBundle/Common/progressBar.html.twig' %}
  192. {% endblock %}{#body#}
  193. {% block javascripts %}
  194. <script>
  195. var progressBarEndpoint = "{{ path('background_jobs-get-job') }}"
  196. var progressBarResetEndpoint = "{{ path('reset_wizard_job') }}"
  197. </script>
  198. <script src="{{ asset('bundles/atechnetcore/js/backgrounJob/progressBar.js')|appendAssetCache }}"></script>
  199. <script src="{{ asset('bundles/atechnetcore/js/ajax-native.js')|appendAssetCache }}"></script>
  200. <script src="{{ asset('bundles/atechnetcore/js/jquery-1.11.2.min.js')|appendAssetCache }}"></script>
  201. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
  202. {% if app.environment == 'prod' %}
  203. <script src="https://cdn.ravenjs.com/3.14.2/raven.min.js" crossorigin="anonymous"></script>
  204. <script>Raven.config('https://0a0726bbeb7149c2bfb0c39431121d51@sentry.io/167350').install();</script>
  205. {% endif %}
  206. <script>
  207. $('#navbar > .nav > li.dropdown > a > .fa-caret-down').on('click', function(e) {
  208. if ( $(this).closest('.dropdown').hasClass('clicked') ) {
  209. $(this).closest('.dropdown').removeClass('clicked');
  210. } else {
  211. $(this).closest('.dropdown').addClass('clicked');
  212. }
  213. return false;
  214. });
  215. $('#navbar .dropdown-submenu .fa-caret-down').on('click', function(e) {
  216. if ( $(this).closest('.dropdown-submenu').hasClass('clicked') ) {
  217. $(this).closest('.dropdown-submenu').removeClass('clicked');
  218. } else {
  219. $(this).closest('.dropdown-submenu').addClass('clicked');
  220. }
  221. return false;
  222. });
  223. const addBreadcrumbsWikiPage = (link) => {
  224. let breadcrumbs = document.getElementById('wo-breadcrumbs');
  225. if ( breadcrumbs != null ) {
  226. let li = document.createElement('li');
  227. li.classList.add('item-help', 'pull-right');
  228. li.innerHTML = '<a href="' + link + '" target="_BLANK"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a>';
  229. breadcrumbs.appendChild(li);
  230. }
  231. };
  232. var notificationUrl = '{{ path('atech_net_core_notification') }}';
  233. var notificationListUrl = '{{ path('atech_net_core_notification_list') }}';
  234. var notificationInactivateUrl = '{{ path('atech_net_core_notification_inactivate', {'id':0}) }}';
  235. var maxNotifications = 10;
  236. let notificationIndexLabel = '{{ "Show all" | trans }}'
  237. $(document).ready(function(){
  238. $('.dropdown-submenu a.dropdown-title').mouseenter( function(e){
  239. $(this).next('ul').show();
  240. }).parent().mouseleave(function(e) {
  241. $(this).children('ul').hide();
  242. });
  243. initNotifications();
  244. $('#notification-icon').click(function() {
  245. var top = $('#notification-icon').position().top + 40;
  246. $('#notification-panel').toggle().css("top", top + "px");
  247. return false;
  248. })
  249. });
  250. function initNotifications() {
  251. $.get(notificationListUrl).done(function(data){
  252. $('#notification-value').text(data.count > maxNotifications ? maxNotifications + '+' : data.count);
  253. if (data.count !== '' && data.count > 0) {
  254. $('#notification-icon > span.label').removeClass('label-default').addClass('label-info');
  255. }
  256. var html ='<div class="notification-list">';
  257. for(var i in data.result) {
  258. if (i >= maxNotifications) {
  259. break;
  260. }
  261. var d = data.result[i];
  262. html += '<a data-id="' + d.id + '" href="'+ d.url + '"'
  263. + (d.active == '1' ? ' class="active" onclick="inactivateNotification(this)"' : '')
  264. + '>' + d.text
  265. + '<br/><small><i class="glyphicon glyphicon-time"></i> '
  266. + d.created +'</small></a>';
  267. }
  268. html +='</div>';
  269. $('#notification-panel').html(html);
  270. $('#notification-panel').append('<a href="' + notificationUrl + '" class="show-all-notification"><b>' + notificationIndexLabel + '</b></a>');
  271. });
  272. }
  273. function inactivateNotification(element) {
  274. var e = $(element);
  275. var id = e.data('id');
  276. var url = notificationInactivateUrl.replace('0', id);
  277. $.get(url).done(function(data) {
  278. e.removeClass('active');
  279. e.removeAttr('onclick');
  280. var nv = $('#notification-value');
  281. if (nv.text() != (maxNotifications + '+')) {
  282. nv.text(nv.text() - 1);
  283. } else {
  284. initNotifications();
  285. }
  286. });
  287. }
  288. function areYouSure(){
  289. return confirm('{{ 'Are you sure?'|trans }}');
  290. }
  291. function copyUrlToClipboard(el) {
  292. var textArea = document.createElement("textarea");
  293. textArea.style.position = 'fixed';
  294. textArea.style.top = 0;
  295. textArea.style.left = 0;
  296. textArea.style.width = '2em';
  297. textArea.style.height = '2em';
  298. textArea.style.padding = 0;
  299. textArea.style.border = 'none';
  300. textArea.style.outline = 'none';
  301. textArea.style.boxShadow = 'none';
  302. textArea.style.background = 'transparent';
  303. textArea.value = el.getAttribute("href");
  304. document.body.appendChild(textArea);
  305. textArea.select();
  306. try {
  307. var successful = document.execCommand('copy');
  308. var msg = successful ? 'Copied' : 'Failed';
  309. el.innerHTML = msg;
  310. setTimeout(() => {
  311. el.innerHTML = '<i class="glyphicon glyphicon-copy"></i>';
  312. }, 5000);
  313. } catch (err) {
  314. alert('Oops, unable to copy');
  315. }
  316. document.body.removeChild(textArea);
  317. }
  318. // Set the name of the hidden property and the change event for visibility
  319. var hidden, visibilityChange;
  320. if ( typeof document.hidden !== "undefined" ) { // Opera 12.10 and Firefox 18 and later support
  321. hidden = "hidden";
  322. visibilityChange = "visibilitychange";
  323. } else if ( typeof document.msHidden !== "undefined" ) {
  324. hidden = "msHidden";
  325. visibilityChange = "msvisibilitychange";
  326. } else if ( typeof document.webkitHidden !== "undefined" ) {
  327. hidden = "webkitHidden";
  328. visibilityChange = "webkitvisibilitychange";
  329. }
  330. function handleVisibilityChange() {
  331. if ( document[hidden] ) {
  332. $('#page-refresh-block a').removeClass('online').addClass('offline');
  333. } else {
  334. $('#page-refresh-block a').removeClass('offline').addClass('online');
  335. }
  336. }
  337. var refreshInterval;
  338. var refreshTime = 0;
  339. var refreshElement = null;
  340. /**
  341. * Counts back from a given time in seconds, adds current value to a given container, than refreshes page
  342. * Timer is reset on mousemove and keypress
  343. * Usage:
  344. * $(document).ready(function(){ countAndRefresh(120); });
  345. *
  346. * @param time
  347. * @param textAreas one or mupltiple text areas, which if has value the timer does not tick
  348. */
  349. function countAndRefresh(time, textAreas) {
  350. let appEnvironment = '{{ app.environment }}';
  351. if (appEnvironment == 'dev' || window.location.href.includes(['web/document']) || window.location.href.includes(['web/billingo-document'])) {
  352. return;
  353. }
  354. //Zero the idle timer on mouse movement.
  355. $(this).mousemove(function (e) {
  356. refreshTime = time;
  357. $('#page-refresh-block a').removeClass('online').removeClass('offline');
  358. }).keypress(function (e) {
  359. refreshTime = time;
  360. $('#page-refresh-block a').removeClass('online').removeClass('offline');
  361. }).scroll(function (e) {
  362. refreshTime = time;
  363. $('#page-refresh-block a').removeClass('online').removeClass('offline');
  364. });
  365. var $refreshBlockControl = $('#page-refresh-block a');
  366. if(textAreas !== undefined){
  367. if(Array.isArray(textAreas)){
  368. textAreas.forEach(function (value, index, array) {
  369. $(value).bind('input propertychange', function() {
  370. if(this.value.trim() !== ""){
  371. $refreshBlockControl.addClass('paused');
  372. }else{
  373. $refreshBlockControl.removeClass('paused');
  374. }
  375. });
  376. })
  377. }else{
  378. $(textAreas).bind('input propertychange', function() {
  379. if(this.value.trim() !== ""){
  380. $refreshBlockControl.addClass('paused');
  381. }else{
  382. $refreshBlockControl.removeClass('paused');
  383. }
  384. });
  385. }
  386. }
  387. $('#page-refresh-block').show();
  388. refreshElement = $('#page-refresh-in');
  389. refreshTime = time;
  390. refreshIfIdle();
  391. }
  392. function refreshIfIdle() {
  393. if ( typeof document.addEventListener === "undefined" || hidden === undefined ) {
  394. console.log("This browser does not supports the Page Visibility API.");
  395. } else {
  396. // Handle page visibility change
  397. document.addEventListener(visibilityChange, handleVisibilityChange, false);
  398. }
  399. refreshElement.html(refreshTime);
  400. // if (!$('#page-refresh-block a').hasClass('paused')) {
  401. if (!$('#page-refresh-block a').hasClass('paused') && ($('#searchtext').length == 0 || $('#searchtext').val() == '')) {
  402. refreshTime--;
  403. }
  404. // }
  405. if (refreshTime > -1){
  406. setTimeout(function(){
  407. refreshIfIdle();
  408. }, 1000);
  409. } else {
  410. refreshInterval = setInterval(function() {
  411. if ( $('#page-refresh-block a').hasClass('online') ) {
  412. clearInterval(refreshInterval);
  413. setTimeout(function() {
  414. $('#modal-page-refresh').modal({
  415. backdrop: 'static',
  416. keyboard: false
  417. });
  418. window.location.href = window.location.href.replace('?print_label=1','').replace('print_billingo_invoice=1&','').replace('print_invoice=1&','').replace('?print-packeta-label=1','').replace(window.location.hash, '');
  419. }, 900);
  420. } else if ( !$('#page-refresh-block a').hasClass('offline') ) {
  421. clearInterval(refreshInterval);
  422. window.location.href = window.location.href.replace('?print_label=1','').replace('print_billingo_invoice=1&','').replace('print_invoice=1&','').replace('?print-packeta-label=1','').replace(window.location.hash, '');
  423. }
  424. }, 100);
  425. }
  426. }
  427. $('#page-refresh-block a').click(function(){
  428. if (!$(this).hasClass('paused')) {
  429. $(this).addClass('paused');
  430. $(this).find('i').removeClass('glyphicon-pause').addClass('glyphicon-play');
  431. } else {
  432. $(this).removeClass('paused');
  433. $(this).find('i').removeClass('glyphicon-play').addClass('glyphicon-pause');
  434. }
  435. return false;
  436. });
  437. {% if app.request.server.get("HTTP_HOST") == 'www.atechcomp.eu' %}
  438. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  439. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  440. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  441. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  442. ga('create', 'UA-26412246-8', {'siteSpeedSampleRate': 60});
  443. {% if app.user is not null %}
  444. ga('set', 'dimension1', '{{ app.user.nickName }}');
  445. ga('set', 'userId', '{{ app.user.id }}');
  446. {% endif %}
  447. ga('send', 'pageview');
  448. {% endif %}
  449. </script>
  450. {% endblock %}