<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="fr">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="msapplication-tap-highlight" content="no">
<meta name="author" lang="fr" content="Cedric BERARD & Curtis MARTY JACKSON & Levon BAGHDASARYAN & Axel SOFONEA & Delfine SIKORA & Hamza BOURHAIL BENHADI">
{% block meta %}{% endblock %}
<title>{% block title %}Visio{% endblock %}</title>
<link rel="icon" href="{{ asset('images/logo_pm_sm.png') }}">
<link href="{{ asset('main.87c0748b313a1dda75f5.css') }}" rel="stylesheet">
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.7.0/css/buttons.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<!-- Fichier JS helpers -->
<script type="text/javascript" src="{{ asset('assets/scripts/helpers.js') }}"></script>
<link href="{{ asset('css/loading.css') }}" rel="stylesheet">
<link href="{{ asset('css/main.css') }}" rel="stylesheet">
<link href="{{ asset('css/custom-style.css') }}" rel="stylesheet">
<style>
.card-header{
height:35px;
}
</style>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block complete_body %}
<div class="app-container app-theme-white body-tabs-shadow fixed-header fixed-sidebar fixed-footer">
<div class="app-header header-shadow">
<div class="app-header__logo">
<a href="{{ path('index') }}"><div class="logo-src"></div></a>
<div class="header__pane ml-auto">
<div>
<button type="button" class="hamburger close-sidebar-btn hamburger--elastic is-active" data-class="closed-sidebar">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</button>
</div>
</div>
</div>
<div class="app-header__mobile-menu">
<div>
<button type="button" class="hamburger hamburger--elastic mobile-toggle-nav">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</button>
</div>
</div>
<div class="app-header__menu">
<span>
<button type="button" class="btn-icon btn-icon-only btn btn-primary btn-sm mobile-toggle-header-nav">
<span class="btn-icon-wrapper">
<i class="fa fa-ellipsis-v fa-w-6"></i>
</span>
</button>
</span>
</div>
<div class="app-header__content">
<div class="app-header-left">
<div class="search-wrapper">
<div class="input-holder">
<input id="search-input-id"
type="text"
class="search-input"
placeholder="{{ 'menu.search'|trans }}"
>
<button id="search-icon-id"
class="search-icon"
data-container="body"
data-toggle="popover"
data-placement="bottom"
data-content=" "
data-original-title= ""
title= "">
<span></span>
</button>
</div>
<button id="search-icon-close-id" class="close"></button>
</div>
</div>
</div>
<div class="app-header__content">
<div class="app-header-left">
</div>
<div class="app-header-right">
{% if app.session.get('accesMemo') %}
<div class="mr-3">
<form method="post" action="https://memo.planet-monetic.fr/login.php" target="_blank" id="acces_memo_form">
{# Par la suite il faudra activer validation CSRF dans le fichier security#}
{# csrf_protection: true#}
{# <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">#}
<input type="hidden" value="{{ app.user.mail }}" name="username">
{% set key = app.user.mail ~ ':' ~ "now"|date("DMY") ~ 'PM' %}
{% set key = key|md5 %}
{% set key = key|base64_encode %}
<input type="hidden" value="{{ key }}" name="key">
<button type="submit" name="acces_memo_btn" class="btn btn-info">{{ "administration.acces_memo"|trans }}</button>
</form>
</div>
{% endif %}
<div class="header-dots">
<!-- News icon -->
{{ render(controller('App\\Controller\\GlobalController::newsMenuRenderControllerTwig', {})) }}
<div class="dropdown">
<button type="button" data-toggle="dropdown" class="p-0 mr-2 btn btn-link">
<span class="icon-wrapper icon-wrapper-alt rounded-circle">
<span class="icon-wrapper-bg bg-focus"></span>
{% if app.request.locale == 'en' %}
<span class="language-icon opacity-8 flag large GB"></span>
{% else %}
<span class="language-icon opacity-8 flag large {{ app.request.locale|upper }}"></span>
{% endif %}
</span>
</button>
<div tabindex="-1" role="menu" aria-hidden="true" class="rm-pointers dropdown-menu dropdown-menu-right">
<a href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': 'fr'})) }}">
<button type="button" tabindex="0" class="dropdown-item">
<span class="mr-3 opacity-8 flag large FR"></span>
Français
</button></a>
<a href="{{ path(app.request.get('_route'), app.request.attributes.get('_route_params')|merge({'_locale': 'en'})) }}">
<button type="button" tabindex="0" class="dropdown-item">
<span class="mr-3 opacity-8 flag large GB"></span>
English
</button>
</a>
</div>
</div>
<div class="header-btn-lg pr-0">
<div class="widget-content p-0">
<div class="widget-content-wrapper">
<div class="widget-content-left">
<div class="btn-group">
<a data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="p-0 btn">
<img width="32" class="rounded-circle" src="{{ asset('assets/images/avatars/user.png') }}" alt="">
<i class="fa fa-angle-down ml-2 opacity-8"></i>
</a>
<div tabindex="-1" role="menu" aria-hidden="true" class="rm-pointers dropdown-menu-lg dropdown-menu dropdown-menu-right">
<div class="dropdown-menu-header">
<div class="dropdown-menu-header-inner profil_banner">
<div class="menu-header-image opacity-2"></div>
<div class="menu-header-content text-left">
<div class="widget-content p-0">
<div class="widget-content-wrapper">
<div class="widget-content-left mr-3">
<img width="32" class="rounded-circle" src="{{ asset('assets/images/avatars/user.png') }}" alt="">
</div>
<div class="widget-content-left">
<div class="widget-heading">
{{ app.user }}
</div>
<div class="widget-subheading opacity-8">
{{ app.session.get('profil').libelle|lower }}
</div>
</div>
<div class="widget-content-right mr-2">
<a href="{{ path('app_logout') }}" class="btn-pill btn-shadow btn-shine btn btn-danger ">{{ "menu.deconnexion"|trans }}
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="scroll-area-xs" style="height: 150px;">
<div class="scrollbar-container ps">
<ul class="nav flex-column">
<li class="nav-item-header nav-item">{{ "menu.compte"|trans }}
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="widget-content-left ml-3 header-user-info">
<div class="widget-heading">
{{ app.user }}
</div>
<div class="widget-subheading">
{{ app.user.fonction }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="app-main">
<div class="loader">
<div class="big-loader-PM">
<span>{{ 'loading_progress' | trans }}</span>
<div class="dot-loader" id="loader-2">
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
<div class="app-sidebar sidebar-shadow">
<div class="scrollbar-sidebar">
<div class="app-sidebar__inner">
<ul class="vertical-nav-menu">
{% block sidebar %}
<li class="app-sidebar__heading">MENU</li>
<li><a href="{{ path('index') }}"><i
class="metismenu-icon pe-7s-home"></i>{{ "menuvertical.accueil"|trans }}
</a></li>
{% for key_menu, menu in app.session.get('menu') %}
{% if menu.menu.seul == true %}
{% set activeLi = 'mm-active'%}
{% if menu.menu.url in app.request.pathinfo %}
<li class="{{ activeLi }}">
{% else %}
<li>
{% endif %}
<a href="{{ '/' ~ app.request.locale ~ '/' ~ menu.menu.url }}"><i
class="metismenu-icon {{ menu.menu.icone }}"></i>{{ menu.menu.libelle|trans }}
</a>
{% else %}
{% set activeLi = 'mm-active' %}
{% set activeLink = false %}
{% set activeUl = 'mm-collapse' %}
<li>
<a href="#" aria-expanded="{{ activeLink }}"><i
class="metismenu-icon {{ menu.menu.icone }}"></i>{{ menu.menu.libelle|trans }}
<i class="metismenu-state-icon pe-7s-angle-down caret-left"></i></a>
<ul class="{{ activeUl }}">
{% for key_sous_menu, sous_menu in menu.sous_menu %}
{% if sous_menu.libelle is not empty %}
<li>
<i class="metismenu-icon"></i><a
href="#">{{ sous_menu.libelle|trans }}<i
class="metismenu-state-icon pe-7s-angle-down caret-left"></i></a>
<ul>
{% endif %}
{% for key_page, page in sous_menu.page %}
{% if page.url in app.request.pathinfo %}
{% if page.url|length > 18 %}
<li class="{{ activeLi }} scrollable-line">
{% else %}
<li class="{{ activeLi }}">
{% endif %}
{% else %}
{% if page.url|length > 18 %}
<li class="scrollable-line">
{% else %}
<li>
{% endif %}
{% endif %}
{% set pathinfoSplit = app.request.pathinfo|split('/') %}
{% set nbElement = pathinfoSplit|length-1 %}
{% if page.url == pathinfoSplit[nbElement] %}
<a href="{{ '/' ~ app.request.locale ~ '/' ~ menu.menu.url ~ '/' ~ page.url }}"
class="mm-active" aria-expanded="{{ activeLink }}">
{% else %}
<a href="{{ '/' ~ app.request.locale ~ '/' ~ menu.menu.url ~ '/' ~ page.url }}">
{% endif %}
<i class="metismenu-icon"></i>
<span>{{ page.page |trans }}</span>
</a>
</li>
{% endfor %}
{% if sous_menu.libelle is not empty %}
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
{% endblock %}
</ul>
</div>
</div>
</div>
<div class="app-main__outer">
<div class="app-main__inner">
{% block title_page %}{% endblock %}
{% block message_body %}
{% for label, messages in app.flashes %}
{% for message in messages %}
<div class="alert alert-{{ label }}">
{{ message | raw }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
{% endfor %}
{% endfor %}
{% endblock %}
{% block body %}<h1>Bienvenue {{ app.user }}</h1>{% endblock %}
{% block after_body %}{% endblock %}
</div>
{% block footer %}
<div class="app-wrapper-footer">
<div class="app-footer">
<div class="app-footer__inner">
<div class="app-footer" >
<p style="text-align: center;">
Visio© 2009-{{ "now"|date("Y") }}
<br> <a href="https://www.planet-monetic.fr/politique-de-confidentialite/" target="_blank">{{'titre_info_politique_conficdentialite'|trans}}</a> - {{ 'menu.footer'|trans }} <a href="http://www.mozilla.org/firefox/" target="_blank">FIREFOX©</a> & <a href="http://www.google.com/chrome/" target="_blank">CHROME©</a>
</p>
</div>
</div>
</div>
</div>
{% endblock %}
</div>
</div>
</div>
{% endblock %}
{#<script src="scripts-init/"></script>#}
<!-- Scripts DataTables & JQuery Classique -->
<script type="text/javascript" charset="utf8" src=https://code.jquery.com/jquery-3.5.1.js></script>
<script src=https://code.jquery.com/ui/1.12.1/jquery-ui.js integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.2/moment.js"></script>
<script type="text/javascript" charset="utf8" src=https://cdn.datatables.net/1.12.1/js/jquery.dataTables.js></script>
<script src="https://cdn.datatables.net/buttons/2.0.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/2.0.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.0.1/js/buttons.print.min.js"></script>
<script src="https://cdn.datatables.net/scroller/2.0.5/js/dataTables.scroller.min.js"></script>
<script src="https://cdn.datatables.net/datetime/1.1.2/js/dataTables.dateTime.min.js"></script>
<!-- Inclure Popper.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.9.2/umd/popper.min.js" integrity="sha512-2rNj2KJ+D8s1ceNasTIex6z4HWyOnEYLVC3FigGOmyQCZc2eBXKgOxQmo3oKLHyfcj53uz4QMsRCWNbLd32Q1g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Scripts Date Range Picker -->
{#<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>#}
{#<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>#}
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<!-- Scripts -->
<script type="text/javascript" charset="utf8" src=https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js></script>
<script src=https://cdn.ckeditor.com/ckeditor5/23.1.0/classic/ckeditor.js></script>
<script src=https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js></script>
<!-- Scripts Template -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script type="text/javascript" src="{{ asset('assets/scripts/main.87c0748b313a1dda75f5.js') }}"></script>
<script type="text/javascript" src="{{ asset('assets/scripts/jquery.maphilight.min.js') }}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-modal-js/dist/bootstrap-modal-js.min.js"></script>
{#<script type="text/javascript" src="{{ asset('assets/scripts/helpers.js') }}"></script>#}
<!-- Scripts Perso -->
<script type="text/javascript">
// alert('Branché sur PROD, ne pas faire un test.');
$(".loader").show();
$(window).on('load', function() { $(".loader").fadeOut("2000"); });
var clickedButtons = {};
var dotLoaderDiv = document.getElementById("loader-2");
function showDotLoader(buttonClass, isMini = true) {
let buttonElement = document.querySelector(buttonClass);
let parentElement = buttonElement.parentNode;
let loader = dotLoaderDiv.cloneNode(true);
loader.style.width = buttonElement.offsetWidth + 'px';
loader.style.height = buttonElement.offsetHeight + 'px';
let buttonComputedStyle = window.getComputedStyle(buttonElement);
let buttonMarginLeft = parseInt(buttonComputedStyle.marginLeft);
let buttonMarginRight = parseInt(buttonComputedStyle.marginRight);
let buttonMarginTop = parseInt(buttonComputedStyle.marginTop);
let buttonMarginBottom = parseInt(buttonComputedStyle.marginBottom);
loader.style.margin = buttonMarginTop + 'px ' + buttonMarginRight + 'px ' + buttonMarginBottom + 'px ' + buttonMarginLeft + 'px';
if (isMini) {
loader.classList.add("mini-loader");
parentElement.replaceChild(loader, buttonElement);
clickedButtons[buttonClass] = { buttonElement: buttonElement, loader: loader };
} else {
let microLoader = dotLoaderDiv.cloneNode(true);
microLoader.classList.add("micro-loader");
buttonElement.parentNode.appendChild(microLoader);
buttonElement.classList.add("d-none");
}
}
function hideDotLoader(buttonClass, isMini = true) {
if (isMini) {
let buttonInfo = clickedButtons[buttonClass];
let parentElement = buttonInfo.loader.parentNode;
parentElement.replaceChild(buttonInfo.buttonElement, buttonInfo.loader);
delete clickedButtons[buttonClass];
} else {
let buttonElement = document.querySelector(buttonClass);
let loader = document.querySelector(".micro-loader");
loader.classList.add("d-none");
buttonElement.classList.remove("d-none");
}
}
function ValidAjax(url,data,function_return){
if (typeof function_return == 'undefined') {
function_return = false;
}
$.ajax({
url: url,
type: 'POST',
dataType:'json',
async: true,
data: { 'post': data},
success: function(response) {
var res = response.toString().split('|');
if(res[0] == "valide"){
$(function() {
toastr.success('', res[1], {positionClass: "toast-bottom-right"});
});
}
else if(res[0] == "html"){
$('#'+res[1]).html(res[3]);
if(res[2] == 'referentiel'){
datatable_referentiel();
}
else if(res[2] == 'affichage_materiel_cc'){
affichageMaterielCc();
}
else if (res[2] === 'recherche'){
retourAjaxRecherche();
}
if(typeof res[4] != 'undefined' && res[4] == "html"){
$('#'+res[5]).html(res[7]);
}
}
else if(res[0] == "html_append"){
// $('#'+res[5]).html($('#'+res[5]).html() + res[7]);
$('#'+res[1]).html($('#'+res[1]).html() + res[3]);
}
else if(res[0] == "no_toastr") {
$(".loader").hide();
}
else {
$(function() {
toastr.error('', res[1], {positionClass: "toast-bottom-right"});
});
$(".loader").hide();
}
if(function_return == true){
RetourAjax(res[2]);
}
},
error : function(xhr, textStatus, errorThrown) {
$(function() {
toastr.error (errorThrown, textStatus, {positionClass: "toast-bottom-right"});
console.log(errorThrown);
console.log(textStatus);
});
}
});
}
/* Empecher la Soumisson d'un formulaire sous rafraichissmeent de la page (que sur le click = Submit) */
function preventFormSubmitOnPageRefresh() {
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
}
</script>
{% block javascripts %}{% endblock %}
<script>
/* Partie popover et bouton recherche */
let ariaDescribedby = "";
$('#search-icon-id').click(()=>{
if($('#search-icon-id').hasClass("open")){
$(function(){removeAttributesSearchIcon();});
}else {
$('#search-icon-id').addClass("open");
$('#search-icon-id').addClass("bg-tempting-azure");
$('#search-icon-id').attr("style", "transform: rotate(-0.25turn);");
$('#search-input-id').attr("disabled" , true);
$(function(){
ariaDescribedby = $('#search-icon-id').attr("aria-describedby");
let identifierPopoverElement = ariaDescribedby + "-body";
$('.popover-body').append("<div id='loader-popover-search' class='loader' style='background-size: 95%'></div><div class='popover-body-child'><div style='width: 50px; height: 50px'></div></div>");
$('.popover-body-child').attr("id", identifierPopoverElement);
afficherContenuPopoverRecherche(identifierPopoverElement);
});
}
});
function removeAttributesSearchIcon(){
$('#search-icon-id').removeClass("open");
$('#search-icon-id').removeClass("bg-tempting-azure");
$('#search-icon-id').removeAttr("style");
}
$('#search-icon-close-id').click(function() {
$('#link-search-button-popover').removeAttr('href');
$('#search-input-id').val("");
if($('#search-icon-id').hasClass("open")){
$('#search-icon-id').trigger("click");
}
});
function afficherContenuPopoverRecherche(identifierPopoverElement){
ValidAjax(
"https://{{ app.request.server.get('HTTP_HOST') }}/{{ app.request.getLocale() }}/recherche/formulaire",
identifierPopoverElement,
false
);
}
function toggleSearchButtonPopover(element){
if(((element.val().trim()).length > 3) && ($('[name = search-radio]:checked').attr("id") ===
"search-radio-serial")){
$('#search-button-popover').removeAttr("disabled");
}else if(((element.val().trim()).length > 7) && ($('[name = search-radio]:checked').attr("id") ===
"search-radio-tracking")){
$('#search-button-popover').removeAttr("disabled");
}else if(element.val().trim() !== "" && $('[name = search-radio]:checked').attr("id") !==
"search-radio-tracking" && $('[name = search-radio]:checked').attr("id") !==
"search-radio-serial"){
$('#search-button-popover').removeAttr("disabled");
}else{
$('#search-button-popover').attr("disabled", true);
}
}
function retourAjaxRecherche(){
$("#loader-popover-search").hide();
if($('#search-input-id').val() !== ""){
toggleSearchButtonPopover($('#search-input-id'));
}
$('#search-input-id').removeAttr("disabled");
$('#search-input-id').focus();
$('#search-input-id').keyup(function() {
toggleSearchButtonPopover($(this));
});
$('#search-button-popover').click(function() {
let type = $('[name = search-radio]:checked').attr("id").split("-")[2];
let search = $('#search-input-id').val();
let url = "https://{{ app.request.server.get('HTTP_HOST') }}/{{ app.request.getLocale()}}/recherche/"
$('#search-input-id').attr("disabled" , true);
$('#link-search-button-popover').attr('href', (url + encodeURIComponent(type) + "/" + encodeURIComponent(search.trim())));
$('#link-search-button-popover').trigger("click");
$('#loader-popover-search').show();
});
$('#liste-client-radio-button').click(function() {
$('#search-radio-client-2').trigger("click");
});
$('#liste-client-radio-button').change(function() {
$('#search-input-id').val("");
$('#search-input-id').val($(this).val())
toggleSearchButtonPopover($('#search-input-id'));
});
$('[name = search-radio]').click(function() {
if($(this).attr("id") === 'search-radio-client-2'){
$('#search-input-id').attr("disabled" , true);
$('#search-input-id').off("focus");
$('#search-input-id').val("");
$('#search-input-id').val($('#liste-client-radio-button').val())
toggleSearchButtonPopover($('#search-input-id'));
}else{
$('#search-input-id').removeAttr("disabled");
$('#search-input-id').focus();
$('#liste-client-radio-button #default').prop("selected", "selected");
toggleSearchButtonPopover($('#search-input-id'));
}
let id = $(this).prop('id');
$('[name = search-radio]:not(#' + id + ')').removeAttr('checked');
$('#' + id).attr('checked', 'checked');
});
$('#search-input-id').keydown(function(e){
var key = e.which;
if(key === 9){
$(function (){$('#search-input-id').focus()});
}
if(key === 13){
if($('#search-button-popover').attr("disabled") !== true){
$('#search-button-popover').trigger("click")
}
}
})
$('#search-input-id').on('paste', function(){
let element = $(this);
setTimeout(function(){
toggleSearchButtonPopover(element)
},0);
});
}
/* Fin de la partie recherche */
function datatable_referentiel(){
if($('#liste_referentiel')){
let oTable = $('#liste_referentiel').DataTable({
"bInfo": false,
"lengthChange": false,
"targets": 'no-sort',
"bSort": false,
"pageLength": 15,
"dom": '<"bottom"tp><"clear">',
"language": {
"url": "{{ "datatable.langue"|trans }}"
},
"drawCallback": function() {
$("#liste_referentiel thead").remove();
$("#liste_referentiel").removeClass('no-footer'); // On supprime cette classe pour supprimer le border-bottom
}
});
$('#mySearch').keyup(function(){
oTable.search($(this).val()).draw() ;
});
}
}
$(document).ready(function() {
datatable_referentiel();
} );
function choixMateriel(id, typeRefCC) {
if (typeof typeRefCC == undefined) {
typeRefCC = null;
}
let idSplit = id.split('_')[1];
//Si c'est le popup CC materiel
if (typeRefCC != null && typeRefCC == true) {
let saveMatOld = $('#materiel_popup_choisi').val();
//Si c'est vide, on fait un reset
if (saveMatOld != '' && $('#materiel_popup_choisi').val() != idSplit) {
$('#mat_' + saveMatOld).val('');
$('#qty_mat_' + saveMatOld).val('');
$('#qty_block_' + saveMatOld).hide();
}
//On sauvegarde l'element selectioné
$('#materiel_popup_choisi').val(idSplit);
//On affiche le block
$('#qty_block_' + idSplit).show();
}
$('#mat_selectionne').val(id.replace('td_', ''));
$('.td_referentiel').css({'background': 'none', 'color': '#0099ff'});
$('#' + id).css({'background-color': '#007bff', 'color': '#fff'});
}
function ValidechoixMateriel(){
var dest = $('#destination_selection').val();
var mat = $('#mat_selectionne').val();
var nom_mat = $('#nom_mat_'+mat).val();
if($('#inPopup').val() != '' && $('#inPopup').val() == 'true') {
choixMaterielStd(mat);
}
else {
$('#ref_mat_'+dest).val(mat).trigger('change');
$('#em_'+dest).html(nom_mat);
$('#em_'+dest).css('color','#5bc0de');
}
}
function InfoPanneModal(val){
$('#td_panne_16_autre').hide();
$('#td_panne_43_autre').hide();
$('#td_panne_16_autre').val("");
$('#td_panne_43_autre').val("");
$('.list_choix_panne').css({'background': 'none', 'color': '#0099ff'});
$('#destination_panne_selection').val(val);
var val_panne = $('#type_panne_'+val).val();
var liste_panne = "";
var pannes = val_panne.split('|');
for(var i=0;i<pannes.length;i++){
if(pannes[i] != ""){
if(pannes[i].indexOf('*_*') > -1){
var autrePb = pannes[i].split('*_*');
liste_panne += "td_panne_" + autrePb[0] + '|';
$('#td_panne_' + autrePb[0]).css({'background-color': '#007bff', 'color': '#fff'});
if($('#td_panne_' + autrePb[0] + '_autre').length){
$('#td_panne_' + autrePb[0] + '_autre').val(autrePb[1]);
$('#td_panne_' + autrePb[0] + '_autre').show();
} else {
$('#td_panne_' + autrePb[0]).html($('#td_panne_' + autrePb[0]).html() + '<input type="text" id="td_panne_' + autrePb[0]+'_autre" value="'+autrePb[1]+'"/>');
}
} else {
liste_panne += "td_panne_" + pannes[i] + '|';
$('#td_panne_' + pannes[i]).css({'background-color': '#007bff', 'color': '#fff'});
}
}
}
$('#panne_selectionne').val(liste_panne);
}
function choixPanne(id, draggable){
if(typeof draggable == undefined) {
draggable = null;
}
// //Si le draggable est true, alors on sort du fonction pour ne pas sélectionner les éléments
// if(draggable != null) {
// return true;
// }
var panne = $('#panne_selectionne').val();
//Si on clique sur autre
if(id == 'td_panne_16' || id == 'td_panne_43') {
//Si on n'a pas encore cliqué sur autre, alors on insert le texte champ
if(!$('#' + id).attr('data-clique')) {
if(id == 'td_panne_16'){
$('#' + id).attr('data-clique', 'td_16_changee');
} else {
$('#' + id).attr('data-clique', 'td_43_changee');
}
if($('#td_panne_' + id + '_autre').length == 0){
$('#' + id).html($('#' + id).html() + '<input type="text" id="'+ id +'_autre" />');
}
}
}
//Si le draggable est true, alors on sort du fonction pour ne pas sélectionner les éléments
if(draggable != null) {
return true;
}
//Code qui va bloquer la cloque sur le champ autre problème (pour ne pas fermer)
$('#'+id + '_autre').click(function (event) {
return false;
});
if(panne.indexOf(id+'|') > -1){
$('#panne_selectionne').val(panne.replace(id+'|',''));
$('#'+id).css({'background': 'none', 'color': '#0099ff'});
$('#'+id + '_autre').hide();
}
else {
$('#panne_selectionne').val(panne+id+'|');
$('#'+id).css({'background-color': '#007bff', 'color': '#fff'});
$('#'+id + '_autre').show();
}
}
function ValideChoixPanne(){
var dest = $('#destination_panne_selection').val();
var pannes = $('#panne_selectionne').val().split('|');
var pannes_value = "";
var pannes_text = "";
var text = "";
for(var i=0;i<pannes.length;i++){
if(pannes[i] != "") {
//Si on a sélectionné un autre problème, alors on récupère depuis ce champ
if(pannes[i] == "td_panne_16" || pannes[i] == "td_panne_43") {
text = $('#' + pannes[i] + '_autre').val()
pannes_text +=text + " ";
pannes_value += pannes[i].replace('td_panne_', '') + '*_*'+text+'|';
}
else {
pannes_value += pannes[i].replace('td_panne_', '') + '|';
pannes_text += $('#' + pannes[i]).text() + " ";
}
}
}
if(pannes_text == ""){
pannes_text = "{{ 'type_panne'|trans }}";
}
if(pannes_text == ' ') {
pannes_text = "{{ 'pas_de_panne'|trans }}";
}
$('#type_panne_'+dest).val(pannes_value);
$('#em_panne_'+dest).html(pannes_text);
$('.list_choix_panne').css({'background': 'none', 'color': '#0099ff'});
$('#destination_panne_selection').val('');
$('#panne_selectionne').val('');
}
function UploadFile(name_input_file,destination,reference,name_progess,name_visu,name_del,name_link, fileDrop, mimeTypes, hiddenField, fileNameCustom){
if (typeof name_progess == 'undefined') {
name_progess = null;
}
if (typeof name_visu == 'undefined') {
name_visu = null;
}
if (typeof name_del == 'undefined') {
name_del = null;
}
if (typeof name_link == 'undefined') {
name_link = null;
}
if (typeof fileDrop == 'undefined') {
fileDrop = null;
}
if (typeof mimeTypes == 'undefined' || mimeTypes == null) {
mimeTypes = {
'image/jpeg': '.jpg, .jpeg',// Par défaut
};
}
if (typeof hiddenField == 'undefined') {
hiddenField = null;
}
if (typeof fileNameCustom == 'undefined' || fileNameCustom == '') {
fileNameCustom = null;
}
// Si fileDrop ne pas null, ça veut dire qu'on utilise le drag and drop
let files = null;
if(fileDrop !== null) {
files = fileDrop;
}else {
files = document.querySelector('#'+name_input_file).files;
}
//On fait une boucle pour parcourire les fichiers (si multiple)
let filesData = {};
$.each(files, (key, file) => {
if(Object.keys(mimeTypes).indexOf(file.type) != -1) {
//Nommage fichier
let date = new Date();
let time = date.getHours() + "_" + date.getMinutes() + "_" + date.getSeconds() +'_'+ date.getMilliseconds();
let fileName = file.name.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~ ]/g, "_");
let nomDuFichier = fileName.replace(/_([^_]*)$/, ".$1"); // Pour avoir un point avant l'extension
let nomDuFichierWithoutExt = nomDuFichier.split('.')[0] + '_' + time;
let fileExtension = nomDuFichier.split('.')[1];
nomDuFichierWithoutExt = nomDuFichierWithoutExt.toLowerCase();
nomDuFichier = nomDuFichierWithoutExt + '.' + fileExtension;
let nomDuFichier_ = nomDuFichier.replace(/\./g, '_');
//Si hiddenField existe, par la suite possibilité de faire dynamiquement
if(hiddenField != null) {
filesData[nomDuFichier] = nomDuFichier;
$('#'+ hiddenField).html($('#'+ hiddenField).html() + '<span id="item_img_'+ nomDuFichier_ +'"><a a href="/uploads/'+ destination +'/'+ nomDuFichier +'" class="mr-2" target="_blank">'+ nomDuFichier +'</a><a href="#step-5" id="pieceJointeSuppBtn" onclick="pieceJointeSuppBtn(\''+nomDuFichier_+'\')"><i class="pe-7s-trash"> </i></a></span>');
}
// upload file now
let data = new FormData();
//If we use a custom filename
if(fileNameCustom != null) {
nomDuFichierWithoutExt = fileNameCustom;
}
// file selected by the user
data.append('file', file);
data.append('dst',destination);
data.append('ref',nomDuFichierWithoutExt);
let request = new XMLHttpRequest();
request.open('POST', '/{{ app.request.locale }}/upload');
if(name_progess !== null) {
$('#'+ name_progess +'progress-box').css('display', 'block');
$('#'+ name_progess +'progress_bar_percent').attr('class', "progress-bar progress-bar-animated bg-info progress-bar-striped");
// upload progress event
request.upload.addEventListener('progress', function(e) {
let percent_complete = Math.round((e.loaded / e.total)*100);
// percentage of upload completed
$('#'+ name_progess +'progress_bar_percent').attr('aria-valuenow', percent_complete).css('width', percent_complete+'%');
if(percent_complete === 100){
$('#'+ name_progess +'progress_bar_percent').attr('class', "progress-bar progress-bar-animated bg-success progress-bar-striped");
$('#'+ name_progess +'progress-box').fadeOut( 3000, function() {
$(this).css('display', 'none');
$('#'+ name_progess +'progress_bar_percent').attr('aria-valuenow', 0).css('width', '0%');
});
}
});
}
// AJAX request finished event
request.addEventListener('load', function(e) {
// HTTP status message
const response = JSON.parse(request.response);
if(request.status === 200){
toastr.success ('',response[0], {positionClass: "toast-bottom-right"});
//Reactivate the Save button CC
$('#facturation_form_btn_update').prop('disabled', false);
if(name_visu !== null) {
$("#"+name_visu).css('display', 'block');
}
if(name_del !== null) {
$("#"+name_del).css('display', 'block');
}
if(name_link !== null) {
$("#"+name_link).attr('href', response[1]);
}
} else {
toastr.error ('',response[0], {positionClass: "toast-bottom-right"});
}
});
// send POST request to server side script
request.send(data);
}
else {
$('#param-livraison-upload-error').html('{{ "message.format_fichier_non_valide"|trans }}<br>{{ "message.format_fichier_non_valide_format_accepte"|trans }} ' + Object.values(mimeTypes).join(', '));
$("#param-livraison-upload-file h5").html('{{ "cc_param_livraison_fichier_drag_and_drop1"|trans }}<br>{{ "ou"|trans }}<br>{{ "cc_param_livraison_fichier_drag_and_drop2"|trans }}');
setTimeout(function(){
$('#param-livraison-upload-error').hide();
}, 10000);
}
});
return filesData;
}
function DeleteUploadFile(dst,ref,name_visu,name_del,name_link){
// user has not chosen any file
if(!confirm("{{ "message.confirmationsuppression"|trans }}")) {
return false;
} else {
let data = new FormData();
data.append('dst',dst);
data.append('ref',ref);
let request = new XMLHttpRequest();
request.open('POST', '/{{ app.request.locale }}/delupload');
// AJAX request finished event
request.addEventListener('load', function(e) {
// HTTP status message
const response = JSON.parse(request.response);
if(request.status === 200){
toastr.success ('',response[0], {positionClass: "toast-bottom-right"});
$("#"+name_visu).css('display', 'none');
$("#"+name_del).css('display', 'none');
$("#"+name_link).attr('href', "");
} else {
toastr.error ('',response[0], {positionClass: "toast-bottom-right"});
}
});
// send POST request to server side script
request.send(data);
return true;
}
}
/*
Code JS pour e commande client matériel
*/
function affichageMaterielCc()
{
//Revendeur
$('#table_produits_revendeur').DataTable({
"bLengthChange" : false,
"bInfo": false,
"pageLength": 10,
"ordering": false,
"drawCallback": function() {
$("#table_produits_revendeur thead").remove();
}
});
$('#table_produits_revendeur_filter input[type=search]').addClass('form-control mt-2').attr('style', 'width: 500px;');
$('#table_produits_revendeur_filter label').addClass('produit_recherche');
//Planet
$('#table_produits_planet').DataTable({
"bLengthChange" : false,
"bInfo": false,
"pageLength": 10,
"ordering": false,
"drawCallback": function() {
$("#table_produits_planet thead").remove();
}
});
$('#table_produits_planet_filter input[type=search]').addClass('form-control mt-2').attr('style', 'width: 500px;');
$('#table_produits_planet_filter label').addClass('produit_recherche');
}
function desactiveEntrer(e){
if (e.keyCode == 13) {
return false;
}
}
function getDateDifference(){
let d1 = $('#cc_update_status_form_dateDebut').val();
let splitDate1 = d1.split('-');
let day1 = splitDate1[2];
let month1 = splitDate1[1];
let year1 = splitDate1[0];
let d2 = $('#cc_update_status_form_dateFin').val();
let splitDate2 = d2.split('-');
let day2 = splitDate2[2];
let month2 = splitDate2[1];
let year2 = splitDate2[0];
let calculateDayDifference = (day2 - day1);
let calculateMonthDifference = (month2 - month1);
let calculateYearDifference = (year2 - year1);
if(calculateMonthDifference > 3 && calculateDayDifference === 0) {
alert("La période de recherche ne doit pas dépasser 3 mois");
return false;
} else if (calculateYearDifference == 1 && calculateMonthDifference > 3) {
alert("La période de recherche ne doit pas dépasser 3 mois");
return false;
} else if (calculateYearDifference > 2) {
alert("La période de recherche ne doit pas dépasser 3 mois");
return false;
} else if (calculateMonthDifference >= 3 && calculateDayDifference >= 1) {
alert("La période de recherche ne doit pas dépasser 3 mois");
return false;
} else {
$('#cc_update_status_form').submit();
}
}
/*
Code pour afficher/masquer le tableau type panne
*/
function checkboxPasDePanne()
{
$('#choix_mat_table').hide();
$("#type_panne_pas_de_panne").change(function() {
if(this.checked) {
$('#choix_mat_table').hide();
$('#panne_selectionne').val('td_panne_44');
}
else {
$('#choix_mat_table').show();
$('#panne_selectionne').val('');
}
});
}
function imprimer(event){
if($('#print_authorisation').html() == "false") {
alert("Vous n'avez pas le droit d'imprimer cette étiquette");
event.preventDefault();
} else {
var stock = $("#stock").html();
var modele = $("#modele").html();
var serial = $("#serial").html();
var etat = $("#etat").html();
let post = "type=btn_print";
post += "&stock="+stock;
post += "&modele="+modele;
post += "&serial="+serial;
post += "&etat="+etat;
ValidAjax('{{ app.request.uri }}', post, true);
event.preventDefault();
}
}
function datatableExportBtn(type, customizeOptions)
{
if (typeof type == 'undefined') {
type = 'csv';
}
let baseOptions = {
"extend": type,
"text": '<img src="/images/excel.png" alt="Logo" />',
"fieldSeparator": ';',
"className": 'btn_export_datatable',
"exportOptions": {
"format": {
"header": function (data) {
data = data.replace(/<[^>]+>/g, '');
data = data.trim().replace(/\s+/g, ' ');
return data;
},
"body": function (data) {
data = data.replace(/<[^>]+>/g, '');
data = data.trim().replace(/\s+/g, ' ');
return data;
}
}
}
};
if (typeof customizeOptions === 'function') {
var additionalOptions = customizeOptions();
$.extend(true, baseOptions, additionalOptions);
}
return [baseOptions];
}
function togglePasswordVisibility() {
if($('#authentification_form_motdepasse').attr('type') === 'password') {
$('#authentification_form_motdepasse').attr('type', 'text');
$('#toggle-visibility-span').attr('title', '{{ 'hide_password'|trans }}');
$('#login-form-password-icon').removeClass('fa-eye').addClass('fa-eye-slash');
} else {
$('#authentification_form_motdepasse').attr('type', 'password');
$('#toggle-visibility-span').attr('title', '{{ 'show_password'|trans }}');
$('#login-form-password-icon').removeClass('fa-eye-slash').addClass('fa-eye');
}
}
</script>
<style>
.scrollable-line {
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.scrollable-line:hover > a > span, .one-line:focus > a > span {
display: inline-block;
animation-name: scroll-text;
animation-duration: 7s;
animation-timing-function: linear;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: normal;
}
@keyframes scroll-text {
0% {
transform: translateX(0%);
}
90% {
transform: translateX(-50%);
}
95% {
transform: translateX(0%);
}
100% {
transform: translateX(0%);
}
}
.client-data:hover{
cursor: pointer;
}
.choix_liste_td td{
color: #0099ff;
text-align:center;
font-size:9pt;
}
.choix_liste_td td:hover{
background-color: #007bff;
color: #fff;
cursor: pointer;
}
/* Table des installations Clients */
.tableFixHead{
overflow: auto;
height: 100px;
}
.tableFixHead thead th {
position: sticky; top: 0;
z-index: 1;
background: white;
font-size: 12px;
}
#no_install{
font-weight: bolder;
color: red;
}
/* HIDE RADIO */
.contact_choix {
position: absolute;
opacity: 0;
width: 0;
height: 0;
}
/* IMAGE STYLES */
.contact_choix + img {
cursor: pointer;
}
/* CHECKED STYLES */
.selected + img {
border: 2px solid #73AD21;
border-radius: 25px;
}
.btn-etat:hover {
background: #3ac47d;
color:white;
}
/* Faire Apparaitre le commentaire du Tech sur Hover de la ligne ATT_HISTORIQUE */
.tooltip .tooltiptext {
visibility: hidden;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
/* Etat Btn Cloture ATT */
.selected-cloture-att{
background-color: #3ac47d;
color:white;
}
/* Style de la Table ATT HISTORIQUE */
.table_att_historique th, .table_att_historique td {
font-size: 12px;
}
.table_att_liste th, .table_att_liste td {
font-size: 12px;
}
.table_att_historique{
border-left: 6px solid #2d87c3;
}
.table_att_liste{
border-left: 6px solid #009800;
}
/* Style de la Table ETAT CLOTURE */
.table_etat_att th, .table_etat_att td {
font-size: 14px;
}
/* Style de la Table Retour SEARCH_CLIENT */
#table_result_search_client th, #table_result_search_client td{
font-size: 12px;
}
</style>
{% block modal %}
{% endblock %}
</body>
</html>