{"version":3,"sources":["Shared/Static/js/menu-quantalys.js"],"names":["define","require","$","_Drop","ajax","errorHandler","setMenuActive","localStorageCheck","$root","menuClickManager","JSON","parse","localStorage","getItem","menuParentId","subMenuId","liParent","find","get","addClass","clickMenuManager","elt","removeClass","length","parent","parents","menuParent","info","inArray","next","setItem","stringify","removeItem","e","document","ready","each","i","aHref","this","attr","undefined","targetId","substring","subMenuWidth","enfant","css","style","position","visibility","display","width","removeAttr","WidthDisplay","posXParent","offset","left","widthParent","positionMenuQuantalys","menuQuantalysWidth","positionMenuActu","marginLeftAjustementPositionSousMenu","offsetMenu","widthSubmenu","posXMinimum","posXMaximum","offsetLeft","containerWidth","GetOffsetSubmenu","SetOffsetSubMenu","click","hasClass","collapse","on","data","resetActiveMenu","$connexionFields","QuantaFormValidator","feedBackDisplay","isDisplayIconError","identifiant","val","password","remember","is","post","bLoginWebClient","then","response","sReturnURL","window","location","href","reload","catch","ex","displayError","preventDefault","InitFormulaireConnexion","target","classes","constrainToWindow","constrainToScrollParent","openOn","content","InitPopoverConnexion","InitPopoverAccount","typeahead","order","hint","cancelButton","dynamic","source","url","sSearch","maxItem","cache","compression","generateOnLoad","template","minLength","accent","ttl","callback","onClickAfter","node","a","item","event","ID_Produit","InitTypeAheadQuickSearch","focus","trigger","InitFocusSearch","InitQuickSearch"],"mappings":"AAAAA,OAAO,SAAUC,SAChB,IAAIC,EAAID,QAAQ,UAChBA,QAAQ,aACR,IAAIE,EAAQF,QAAQ,QAChBG,EAAOH,QAAQ,gBAEfI,GADYJ,QAAQ,aACLA,QAAQ,kBACDA,QAAQ,yBAqQlC,SAASK,IACR,GAAIC,IAAqB,CACxBC,MAAQN,EAAE,mBAEV,IAAIO,EAAmBC,KAAKC,MAAMC,aAAaC,QAAQ,qBACvD,GAAIJ,IAAqBA,EAAiBK,cAAgBL,EAAiBM,WAG1E,GAAqC,MAAjCN,EAAiBK,cAAwBL,EAAiBM,WAAa,EAAG,CAC7E,IAAIC,EAAWR,MAAMS,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D,SAAU,eACVqD,mBAAmB,EACnBC,yBAAyB,EAGzBC,OAAQ,QACRC,QAAStG,EAAE,qBAAqBgB,IAAI,KAhHrCuF,GAqHD,WACC,GAAgC,IAA5BvG,EAAE,eAAeqB,OAAc,OAExB,IAAIpB,GACdgG,OAAQjG,EAAE,gBAAgBgB,IAAI,GAC9BkF,QAAS,2BACTpD,SAAU,eACVqD,mBAAmB,EACnBC,yBAAyB,EAGzBC,OAAQ,QACRC,QAAStG,EAAE,mBAAmBgB,IAAI,KAhInCwF,GAwKD,YAKA,WAGCxG,EAAE,gBAAgByG,WACjBC,MAAO,OACPC,MAAM,EACNC,cAAc,EACdC,SAAS,EACTC,QACC5G,MACC6G,IAAK,sBACLvC,MACCwC,QAAS,YACTC,QAZmB,KAgBtBjE,SAAU,YAAa,QACvBkE,OAAO,EACPC,aAAa,EACbC,gBAAgB,EAChBC,SAAU,+GACVC,UAAW,EACXL,QAtBsB,EAuBtBM,QAAQ,EACRC,IAAK,MACLC,UACCC,aAAc,SAAUC,EAAMC,EAAGC,EAAMC,GACtCtC,OAAOC,SAAW,YAAcoC,EAAKE,gBAhCxCC,GA2CD,WACChI,EAAE,gBAAgBuE,GAAG,UAAW,WAC/BvE,EAAE,sBAAsBe,KAAK,sBAAsBkH,UAGpDjI,EAAE,gBAAgBuE,GAAG,WAAY,WAChCvE,EAAE,sBAAsBe,KAAK,sBAAsBmH,QAAQ,cAhD5DC,GAzKAC,GACAlH,EAAiBlB,EAAE","file":"menu-quantalys.js","sourcesContent":["define(function (require) {\r\n\tvar $ = require(\"jquery\");\r\n\trequire(\"bootstrap\");\r\n\tvar _Drop = require(\"drop\");\r\n\tvar ajax = require(\"ajax-promise\");\r\n\tvar typeahead = require(\"typeahead\");\r\n\tvar errorHandler = require(\"error-handler\");\r\n\tvar QuantaFormValidator = require(\"quanta-form-validator\");\r\n\r\n\t$(document).ready(function () {\r\n\r\n\t\t//On calcul la position des sous menu du header au chargement de la page\r\n\t\tSetOffsetSubMenu();\r\n\r\n\t\t//Sous menu\r\n\t\t$(\"#position-menu-quantalys a[data-toggle='collapse']\").click(function (e) {\r\n\r\n\t\t\tvar aHref = $(this).attr('data-target');\r\n\t\t\tif (aHref != undefined) {\r\n\t\t\t\t//On récupère l'ID du target pour ouvrir le sous menu\r\n\t\t\t\tvar targetId = aHref.substring(1, aHref.length);\r\n\t\t\t\tif (targetId != undefined) {\r\n\t\t\t\t\t//Si le menu est fermé, on l'ouvre et on ferme tout les autres\r\n\t\t\t\t\tif (!$(\"#\" + targetId).hasClass(\"in\")) {\r\n\t\t\t\t\t\t$(\"#position-menu-quantalys nav.navbar .collapse.in\").collapse('hide');\r\n\t\t\t\t\t\t$(\"#\" + targetId).collapse('show');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t$('.menu-quantalys').find('li a').on('click', function () {\r\n\t\t\tclickMenuManager($('.menu-quantalys'), $(this));\r\n\t\t});\r\n\r\n\t\t$('a:not(.menu-quantalys li a)').on('click', function () {\r\n\t\t\tresetActiveMenu($('.menu-quantalys'), this);\r\n\t\t});\r\n\r\n\t\t//Initialisation de la Popover du menu connexion\r\n\t\tInitFormulaireConnexion();\r\n\t\tInitPopoverConnexion();\r\n\t\tInitPopoverAccount();\r\n\t\tInitQuickSearch();\r\n\t\tclickMenuManager($('.menu-quantalys'));\r\n\t});\r\n\r\n\t//#region Position du sous menu\r\n\tfunction SetOffsetSubMenu() {\r\n\t\t$(\"#position-menu-quantalys a[data-toggle='collapse']\").each(function (i) {\r\n\t\t\tvar aHref = $(this).attr('data-target');\r\n\t\t\tif (aHref != undefined) {\r\n\t\t\t\t//On récupère l'ID du target pour ouvrir le sous menu\r\n\t\t\t\tvar targetId = aHref.substring(1, aHref.length);\r\n\t\t\t\tif (targetId != undefined) {\r\n\t\t\t\t\tvar subMenuWidth = WidthDisplay($(\"#\" + targetId + \" .submenu-li\"), $(\"#\" + targetId));\r\n\t\t\t\t\tvar posXParent = $(this).offset().left;\r\n\t\t\t\t\tvar widthParent = $(this).width();\r\n\t\t\t\t\tvar positionMenuQuantalys = $(\"#position-menu-quantalys\").position().left;\r\n\t\t\t\t\tvar menuQuantalysWidth = $(\"#\" + targetId).width();\r\n\t\t\t\t\tvar positionMenuActu = $(this).offset().left;\r\n\r\n\t\t\t\t\tvar marginLeftAjustementPositionSousMenu = positionMenuQuantalys - positionMenuActu;\r\n\r\n\r\n\r\n\t\t\t\t\t//On repositionne notre sous menu qui est en position absolue pour qu'il soit au bord gauche du header\r\n\t\t\t\t\t$(\"#\" + targetId).css(\"margin-left\", marginLeftAjustementPositionSousMenu + \"px\");\r\n\r\n\t\t\t\t\tvar offsetMenu = GetOffsetSubmenu(posXParent, widthParent, subMenuWidth, positionMenuQuantalys, positionMenuQuantalys + menuQuantalysWidth);\r\n\r\n\t\t\t\t\t/*if (menuQuantalysWidth == 750 && targetId == \"collapseOutils\") {\r\n\t\t\t\t\t\toffsetMenu -= 49;\r\n\t\t\t\t\t}*/\r\n\r\n\r\n\t\t\t\t\t$(\"#\" + targetId + \" .submenu-offset\").css(\"margin-left\", offsetMenu + \"px\");\r\n\t\t\t\t\t//$(\"#\" + targetId + \" .submenu-offset\").css(\"margin-left\", \"32%\");\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tfunction GetOffsetSubmenu(posXParent, widthParent, widthSubmenu, posXMinimum, posXMaximum) {\r\n\t\tvar offsetLeft = posXParent + widthParent / 2 - posXMinimum - widthSubmenu / 2;\r\n\t\tvar marginDiv = 10;\r\n\t\tvar containerWidth = posXMaximum - posXMinimum;\r\n\r\n\t\t//Cas extrême coté gauche\r\n\t\tif (offsetLeft < 0) {\r\n\t\t\treturn marginDiv;\r\n\t\t}\r\n\r\n\t\t//Cas extrême coté droit\r\n\t\tif (offsetLeft + widthSubmenu > containerWidth) {\r\n\t\t\treturn containerWidth - widthSubmenu - marginDiv;\r\n\t\t}\r\n\t\treturn offsetLeft;\r\n\t}\r\n\r\n\tfunction GetSubmenuAssociate(idListe) {\r\n\t\tvar aHref = $(\"#\" + idListe).attr('data-target');\r\n\t\tif (typeof aHref !== \"undefined\" && aHref !== null) {\r\n\t\t\t//On récupère l'ID du target pour ouvrir le sous menu\r\n\t\t\tvar targetId = aHref.substring(1, aHref.length);\r\n\t\t\tif (targetId != undefined) {\r\n\t\t\t\treturn targetId;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn undefined;\r\n\t}\r\n\r\n\tfunction SubMenuState(targetId) {\r\n\t\tvar container = $(\"#\" + targetId)\r\n\t\tcontainer.mousemove(function (event) {\r\n\t\t\tvar relativePositionX = (event.PageX - this.offsetLeft);\r\n\t\t\tvar relativePositionY = (event.PageY - this.offsetTop);\r\n\t\t});\r\n\t\tcontainer.mouseout(function () {\r\n\t\t\tcontainer.collapse('hide');\r\n\t\t})\r\n\t}\r\n\r\n\tfunction WidthDisplay(enfant, parent) {\r\n\t\tvar position = parent.css(\"position\");\r\n\t\tvar visibility = parent.css(\"visibility\");\r\n\t\tvar display = parent.css(\"display\");\r\n\r\n\t\tvar style = parent.attr(\"style\");\r\n\r\n\t\tparent.css({ \"position\": \"absolute\", \"visibility\": \"hidden\", \"display\": \"block\" });\r\n\t\tvar width = enfant.width();\r\n\t\tparent.removeAttr(\"style\");\r\n\t\tparent.attr(\"style\", style);\r\n\t\t//parent.css({ \"position\": position, \"visibility\": visibility, \"display\": display });\r\n\t\treturn width;\r\n\t}\r\n\t//#endregion\r\n\r\n\t//#region Connection\r\n\tfunction InitPopoverConnexion() {\r\n\t\tif ($(\"#btnConnexion\").length === 0) return;\r\n\r\n\t\tvar drop = new _Drop({\r\n\t\t\ttarget: $(\".btn-connexion\").get(0),\r\n\t\t\tclasses: 'drop-theme-arrows-bounce',\r\n\t\t\tposition: 'bottom right',\r\n\t\t\tconstrainToWindow: true,\r\n\t\t\tconstrainToScrollParent: false,\r\n\t\t\t//attachment: 'top right',\r\n\t\t\t//targetAttachment: 'bottom right',\r\n\t\t\topenOn: 'click',\r\n\t\t\tcontent: $(\"#contentConnexion\").get(0)\r\n\t\t});\r\n\r\n\t\treturn drop;\r\n\t}\r\n\tfunction InitPopoverAccount() {\r\n\t\tif ($(\"#btnAccount\").length === 0) return;\r\n\r\n\t\tvar drop = new _Drop({\r\n\t\t\ttarget: $(\".btn-account\").get(0),\r\n\t\t\tclasses: 'drop-theme-arrows-bounce',\r\n\t\t\tposition: 'bottom right',\r\n\t\t\tconstrainToWindow: true,\r\n\t\t\tconstrainToScrollParent: false,\r\n\t\t\t//attachment: 'top right',\r\n\t\t\t//targetAttachment: 'bottom right',\r\n\t\t\topenOn: 'click',\r\n\t\t\tcontent: $(\"#contentAccount\").get(0)\r\n\t\t});\r\n\r\n\t\treturn drop;\r\n\t}\r\n\tfunction InitFormulaireConnexion() {\r\n\t\tvar $connexionFields = $(\"#contentConnexion\").find(\".validation-connexion-header\");\r\n\t\t$connexionFields.QuantaFormValidator({\r\n\t\t\tfeedBackDisplay: {\r\n\t\t\t\tisDisplayIconError: false\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t$(\"#btnConnecter\").click(function (e) {\r\n\t\t\tif ($connexionFields.QuantaFormValidator(\"IsValid\")) {\r\n\t\t\t\tvar identifiant = $(\"#inputLogin\").val();\r\n\t\t\t\tvar password = $(\"#inputPassword\").val();\r\n\t\t\t\tvar remember = $(\"#inputRemember\").is(':checked');\r\n\r\n\t\t\t\tajax.post(\"/Login/CheckLogin\", {\r\n\t\t\t\t\tidentifiant: identifiant,\r\n\t\t\t\t\tpassword: password,\r\n\t\t\t\t\tremember: remember,\r\n\t\t\t\t\tbLoginWebClient: false\r\n }).then(function (response) {\r\n if (response.sReturnURL != null && response.sReturnURL != \"\")\r\n\t\t\t\t\t\twindow.location.href = response.sReturnURL;\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\twindow.location.reload(false);\r\n }).catch(function (ex) {\r\n errorHandler.displayError(ex);\r\n });\r\n }\r\n\t\t\te.preventDefault();\r\n\r\n\t\t});\r\n\t}\r\n\t//#endregion\r\n\r\n\t//#region Recherche rapide\r\n\tfunction InitQuickSearch() {\r\n\t\tInitTypeAheadQuickSearch();\r\n\t\tInitFocusSearch();\r\n\t}\r\n\r\n\tfunction InitTypeAheadQuickSearch() {\r\n\t\tvar maxItemDisplayed = 6;\r\n\r\n\t\t$(\"#inputSearch\").typeahead({\r\n\t\t\torder: \"desc\",\r\n\t\t\thint: false,\r\n\t\t\tcancelButton: false,\r\n\t\t\tdynamic: true,\r\n\t\t\tsource: {\r\n\t\t\t\tajax: {\r\n\t\t\t\t\turl: '/Recherche/Produits',\r\n\t\t\t\t\tdata: {\r\n\t\t\t\t\t\tsSearch: \"{{query}}\",\r\n\t\t\t\t\t\tmaxItem: maxItemDisplayed\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tdisplay: [\"sCodeISIN\", \"sNom\"],\r\n\t\t\tcache: false,\r\n\t\t\tcompression: true,\r\n\t\t\tgenerateOnLoad: false,\r\n\t\t\ttemplate: \"