123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>Система учёта рабочего времени (CPS) НИЯУ МИФИ: Приветствие</title>
- <meta name="robots" content="noindex,nofollow">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="Content-Language" content="ru">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="keywords" content="cps,нияу мифи,мифи,система учёта рабочего времени,сурв">
- <link rel="shortcut icon" type="image/png" href="/img/favicon.ico">
- <script type='application/ld+json'>{"@context":"http://schema.org","@type":"CollegeOrUniversity","address":"115409, Moscow, Kashirskoe shosse, 31","email":"rector@mephi.ru","name":"National research nuclear university \"MEPhI\"","sameAs":"https://en.wikipedia.org/wiki/National_Research_Nuclear_University_MEPhI","telephone":"+7 (495) 788-5699"}</script>
- <style>
- body input[type="submit"], body .button, body button {
- background: transparent;
- }
- body .select2-container--default.select2-container--focus .select2-selection--multiple {
- border: none;
- }
- body select {
- min-width: 545px;
- }
- html body .select2-container--default .select2-selection--multiple .select2-selection__rendered input {
- min-width: 530px;
- padding: 23px;
- }
- body select, body input[type="text"], body .select2-container--default .select2-selection--multiple .select2-selection__rendered input {
- font-size: 24px;
- padding: 13px;
- border-radius: 20px;
- width: 500px;
- }
- .parameter {
- white-space: nowrap;
- }
- html body .button {
- box-shadow: rgb(84, 163, 247) 0px 1px 0px 0px inset;
- background: linear-gradient(rgb(0, 125, 193) 5%, rgb(0, 97, 167) 100%) rgb(0, 125, 193);
- border-radius: 20px;
- border: 1px solid rgb(18, 77, 119);
- display: inline-block;
- cursor: pointer;
- color: rgb(255, 255, 255);
- font-size: 24px;
- padding: 20px 24px;
- text-decoration: none;
- text-shadow: rgb(21, 70, 130) 0px 1px 0px;
- }
- html body .button:hover {
- background: linear-gradient(rgb(100, 225, 255) 5%, rgb(0, 97, 167) 100%) rgb(0, 125, 193);
- }
- body .select2-container--default .select2-selection--multiple {
- background-color: transparent;
- border: none;
- }
- #employee-search, body .select2-container--default .select2-selection--multiple .select2-selection__rendered input {
- text-transform: capitalize;
- }
- #search-page, body select, body input[type="text"], body .select2-container--default .select2-selection--multiple .select2-selection__rendered input {
- background: #006397;
- }
- #search-page, #title a, body input[type="text"], body .select2-container--default .select2-selection--multiple .select2-selection__rendered input {
- color: #e0eeff;
- text-shadow: 0 0 10px rgba(255,255,255,0.35);
- }
- body select, body input[type="text"], body .select2-container--default .select2-selection--multiple .select2-selection__rendered input {
- border-color: rgba(82,168,236,0.8);
- box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(82,168,236,0.6);
- }
- body select, body input[type="text"]:focus, body .select2-container--default .select2-selection--multiple .select2-selection__rendered input:focus {
- border-color: #fff;
- box-shadow: 0 0 6px #fff;
- }
- body select, body input[type="text"]:focus:required:invalid, body .select2-container--default .select2-selection--multiple .select2-selection__rendered input:focus:required:invalid {
- border-color: #e9322d;
- box-shadow: 0 0 6px #e9322d;
- }
- body h1, body h2, body h3, body h4, #title a {
- font-weight: bold;
- }
- #title a:hover {
- color: #fff !important;
- text-shadow: 0 0 10px rgba(255,255,255,0.8);
- }
- #logoa {
- padding: 10px;
- box-shadow: 0 0 20px rgba(255,255,255,1);
- background: rgba(255,255,255,1);
- border-radius: 100px;
- }
- #logoa img {
- padding: 0px;
- }
- #search-page {
- position: absolute;
- width: 100%;
- padding: 20px;
- }
- #data {
- position: absolute;
- z-index: -3;
- width: 100%;
- height: 100%;
- }
- #parameters, #calculate-button {
- z-index: 256;
- }
- #parameters {
- color: #006397;
- width: 148px;
- display: block;
- position: fixed;
- bottom: 50px;
- right: 0;
- padding: 20px;
- border: 1px #0078e7 solid;
- background: #fff;
- }
- #parameters-faces, #parameters-units {
- max-height: 300px;
- overflow-y: auto;
- overflow-x: hidden;
- }
- #calculate-button:hover, #parameters-button:hover {
- background-color: #309cff;
- }
- #calculate-button, #parameters-button {
- display: block;
- position: fixed;
- bottom: 0;
- height: 50px;
- width: 190px;
- text-transform: uppercase;
- background-color: #0078e7;
- color: #fff;
- text-align: center;
- line-height: 53px;
- font-size: 24px;
- cursor: pointer;
- -webkit-transition: background-color 0.1s ease-in-out 0s;
- -moz-transition: background-color 0.1s ease-in-out 0s;
- -o-transition: background-color 0.1s ease-in-out 0s;
- transition: background-color 0.1s ease-in-out 0s;
- }
- #calculate-button {
- right: 0;
- }
- #parameters-button {
- right: left;
- }
- @media all and (max-width: 1550px) {
- #title {
- display: none !important;
- }
- }
- @media all and (max-width: 880px) {
- header {
- display: none !important;
- }
- }
- @media all and (max-width: 920px) {
- body #parameters {
- display: none;
- }
- html body input[type="text"] {
- font-size 20px;
- max-width: 250px;
- }
- html body .select2-container--default .select2-selection--multiple .select2-selection__rendered input {
- min-width: 280px;
- }
- body #units-tree {
- margin: 20px 30px 30px 0;
- }
- }
- #units-tree {
- color: #000;
- width: 100%;
- position: absolute;
- background: #fff;
- z-index: 64;
- margin: 20px 0px 0px 0;
- padding: 0 0 0 20px;
- left: 0px;
- box-shadow: 0 0 20px rgba(255,255,255,1);
- }
- .clear-input:before {
- content: "✖";
- }
- .clear-input {
- opacity: 0.5;
- width: 20px;
- font-size: 24px;
- margin: 0 20px 0 -40px;
- cursor: pointer;
- }
- body input[type="submit"]:hover {
- background-color: #2885c1;
- }
- .jstree-anchor {
- /*enable wrapping*/
- white-space : normal !important;
- /*ensure lower nodes move down*/
- height : auto !important;
- /*offset icon width*/
- padding-right : 24px;
- }
- body .select2-container--default .select2-selection--multiple .select2-selection__choice {
- position: absolute;
- top: 70px;
- color: #000;
- display: none;
- }
- #paillette {
- background-color: #0ff;
- border-radius: 20px;
- position: fixed;
- display: none;
- width: 15px;
- height: 15px;
- opacity: 0.7;
- box-shadow: 0 0 6px #0ff;
- z-index: 512;
- }
- .smooth-motion {
- -webkit-transition: top 0.5s ease-in-out 0s, left 0.5s ease-out 0s, right 0.5s ease-out 0s, margin 0.5s ease-out 0s;
- -moz-transition: top 0.5s ease-in-out 0s, left 0.5s ease-out 0s, right 0.5s ease-out 0s, margin 0.5s ease-out 0s;
- -o-transition: top 0.5s ease-in-out 0s, left 0.5s ease-out 0s, right 0.5s ease-out 0s, margin 0.5s ease-out 0s;
- transition: top 0.5s ease-in-out 0s, left 0.5s ease-out 0s, right 0.5s ease-out 0s, margin 0.5s ease-out 0s;
- }
- #search-page-bg {
- position:fixed;
- background-color:#fff;
- left:0;
- top:0;
- width:100%;
- height:100%;
- z-index:-2;
- }
- body iframe {
- border: 0;
- position: fixed;
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
- }
- .jstree-leaf, .jstree-node {
- font-size: 18px;
- }
- </style>
- </head>
- <body>
- <header style='right:0;left:initial'>
- <span id="title" style="padding-top: 0px; padding-right: 20px; opacity: 1;">
- <h2 style="font-size: 30px; line-height: 40px;"><a href="/">Система учёта рабочего времени</a></h2>
- <h3 style="margin-top: -13px; font-size: 24px; line-height: 40px; float: right"><a href="https://voip.mephi.ru/units/0153600">Управления информатизации</a></h3>
- </span>
- <a id='logoa' href="/" style='display:inline-block'>
- <img id="logo" src="https://voip.mephi.ru/public/img/nrnu_mephi.png" width="100px" height="100px" style="width: 100px; height: 100px;">
- </a>
- </header>
- <div style='position: relative'>
- <div id="right-waitbar"> </div>
- <section id='search-page'>
- <div id='search-page-bg'></div>
- <h1>Поиск по физ. лицам:</h1>
- <form action='#' method='GET' onsubmit="employeeSearchSubmit(); return false">
- <input id='employee-search' class="cyrillic-only" name="employeesQuery" type="text" placeholder="">
- <span id="employee-search-clear" class="clear-input" onclick='$("#employee-search").val("")'></span>
- <span id='employees-reset' class='button' onclick="employeesReset()" >Сбросить</span>
- <!--input type='submit' value="" name="search" style='margin-left:10px;width:132px;height:132px;background-image:url(/img/search.png);background-size:100%;border-radius:100px'-->
- <div id='paillette'></div>
- </form>
- <h1>Фильтр по подразделениям:</h1>
- <input id='units-filter' class="cyrillic-only" type='text' onkeyup="considerUnitsFilter()">
- <span id="units-filter-clear" class="clear-input" onclick='$("#units-filter").val(""); considerUnitsFilter()'></span>
-
- <span id='units-select' class='button' onclick="unitsSelect()">Выбрать</span>
- <span id='units-reset' class='button' onclick="unitsReset()" >Сбросить</span><br><input id="ppsOnlyCheckBox" type="checkbox" name="ppsOnly"> <label style='display:inline-block' for="ppsOnlyCheckBox">только ППС?</label>
- <ul id='units-tree'>
- </ul>
- <div id='parameters'>
- Физ. лица:
- <ul id='parameters-faces'>
- </ul>
- Подразделения:
- <ul id='parameters-units'>
- </ul>
- </div>
- <div id="calculate-button" onclick="calculate()">посчитать</div>
- </section>
- <section id='data'>
- <iframe src='empty.html'>Ваш браузер не поддерживает плавающие фреймы!</iframe>
- <div id="parameters-button" onclick="showSearchPage()">параметры</div>
- </section>
- </div>
- </body>
- </html>
- <script src="https://voip.mephi.ru/public/js/3rdparty/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="https://voip.mephi.ru/public/3rdparty/jquery-ui-1.11.4.custom/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="https://voip.mephi.ru/public/js/3rdparty/cursor.js" type="text/javascript" charset="utf-8"></script>
- <script src="https://voip.mephi.ru/public/js/3rdparty/jstree.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="https://voip.mephi.ru/public/js/3rdparty/select2.full.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="https://voip.mephi.ru/public/js/misc.js" type="text/javascript" charset="utf-8"></script>
- <script src="/js/common.js?v=2.18" type="text/javascript" charset="utf-8"></script>
- <!--script src="https://voip.mephi.ru/public/js/3rdparty/clamp.min.js" type="text/javascript" charset="utf-8"></script-->
- <link rel="stylesheet" type="text/css" href="https://voip.mephi.ru/public/css/voip.css">
- <link rel="stylesheet" type="text/css" href="https://voip.mephi.ru/public/css/voip-portable.css">
- <link rel="stylesheet" type="text/css" href="https://voip.mephi.ru/public/css/revel.css-minified.css">
- <link rel="stylesheet" type="text/css" href="https://voip.mephi.ru/public/css/3rdparty/jstree/style.min.css">
- <link rel="stylesheet" type="text/css" href="https://voip.mephi.ru/public/3rdparty/jquery-ui-1.11.4.custom/jquery-ui.min.css">
- <link rel="stylesheet" type="text/css" href="https://voip.mephi.ru/public/3rdparty/perfect-scrollbar-0.6.7/perfect-scrollbar.min.css">
- <link rel="stylesheet" type="text/css" href="https://voip.mephi.ru/public/css/3rdparty/select2.min.css">
- <script>
- var startDate = (new Date(new Date() - 30*24*3600*1000).getFullYear())+'-01-01';
- var endDate = (parseInt(startDate.split('-')[0])+1)+'-01-01';
- function convert_lat2cyr(ev) {
- var found = 0;
- var el = ev.target;
- if (typeof(el.value) == 'undefined') {
- return;
- }
- el.value.replace(/[A-Za-z\[\];',.`~]/g, function (m) { // TODO: replace this "replace" with a search function
- found = 1;
- });
- if (found) {
- caretPos = getSelectionStart(el);
- el.value = el.value.replace(/[A-Za-z\[\];',.`~]/g, function (m) {
- return {
- 'q': 'й',
- 'w': 'ц',
- 'e': 'у',
- 'r': 'к',
- 't': 'е',
- 'y': 'н',
- 'u': 'г',
- 'i': 'ш',
- 'o': 'щ',
- 'p': 'з',
- '[': 'х',
- ']': 'ъ',
- 'a': 'ф',
- 's': 'ы',
- 'd': 'в',
- 'f': 'а',
- 'g': 'п',
- 'h': 'р',
- 'j': 'о',
- 'k': 'л',
- 'l': 'д',
- ';': 'ж',
- '\'': 'э',
- 'z': 'я',
- 'x': 'ч',
- 'c': 'с',
- 'v': 'м',
- 'b': 'и',
- 'n': 'т',
- 'm': 'ь',
- ',': 'б',
- '.': 'ю',
- 'Q': 'Й',
- 'W': 'Ц',
- 'E': 'У',
- 'R': 'К',
- 'T': 'Е',
- 'Y': 'Н',
- 'U': 'Г',
- 'I': 'Ш',
- 'O': 'Щ',
- 'P': 'З',
- '{': 'Х',
- '}': 'Ъ',
- 'A': 'Ф',
- 'S': 'Ы',
- 'D': 'В',
- 'F': 'А',
- 'G': 'П',
- 'H': 'Р',
- 'J': 'О',
- 'K': 'Л',
- 'L': 'Д',
- ':': 'Ж',
- '"': 'Э',
- 'Z': 'Я',
- 'X': 'Ч',
- 'C': 'С',
- 'V': 'М',
- 'B': 'И',
- 'N': 'Т',
- 'M': 'Ь',
- '<': 'Б',
- '>': 'Ю',
- '`': 'ё',
- '~': 'Ё',
- }[m];
- });
- el.setSelectionRange(caretPos, caretPos);
- }
- };
- function setup_cyrilliconly() {
- $('.cyrillic-only').unbind('keyup', convert_lat2cyr).keyup(convert_lat2cyr);
- }
- function generateUnitsTags(nodes) {
- nodes.sort(function(a, b) {
- return a.SortNumber - b.SortNumber;
- });
- var ul = document.createElement('ul');
- for (var key in nodes) {
- var node = nodes[key];
- var li=document.createElement('li');
- li.innerText = node.Code+" "+node.Name+" ["+node.BriefName+"]";
- li.dataset.unitId = node.Id;
- li.dataset.unitCode = node.Code;
- li.dataset.unitBriefName = node.BriefName;
- $(li).append(generateUnitsTags(node.Children));
- ul.appendChild(li);
- }
- return ul;
- }
- function showSearchPage() {
- var els = $('#search-page, #units-tree, #calculate-button, #parameters');
- els.removeClass('smooth-motion').addClass('smooth-motion').css('right', '0')
- $('#search-page').css('left', '0');
- $('#data').css('z-index', -3);
- $('header').css('display','');
- }
- function hideSearchPage() {
- var els = $('#search-page, #units-tree, #calculate-button, #parameters');
- els.removeClass('smooth-motion').addClass('smooth-motion').css('right', '120%');
- $('#search-page').css('left', '-120%');
- $('#data').css('z-index', -1);
- $('header').css('display','none');
- }
- function calculate() {
- if ($('#parameters input').length == 0) {
- alert('Необходимо выбрать хотя бы одного сотрудника или подразделение');
- return;
- }
- var personIds = [];
- var unitIds = [];
- $('input[name="faces[]"]').each(function(i,e){
- personIds.push(e.value);
- })
- $('input[name="units[]"]').each(function(i,e){
- unitIds.push(e.value);
- })
- var ppsOnly = $('input[name="ppsOnly"]').prop('checked');
- var newLocation = '/calculate.html?ppsOnly='+ppsOnly+'&unitIds='+unitIds.join(",")+'&personIds='+personIds.join(",");
- /*var oldtitle = document.title;
- var olddata = $('html').html();
- try{window.history.pushState({'html': olddata, 'pageTitle': oldtitle}, "", newLocation)}catch(e){window.history.pushState({'html': '', 'pageTitle': oldtitle}, "", newLocation)};*/
- $('iframe').attr('src', newLocation);
- hideSearchPage();
- }
- /*function showFoundEmployees(source, people) {
- var results = []
- for (var i = 0; i < people.length; i++) {
- var person = people[i];
- results[results.length] = {
- id: person.Id,
- text: person.Fullname,
- }
- }
- console.log(results);
- }*/
- function subscribersToPeople(subscribers) {
- return subscribersToAsuFaces(subscribers); // from misc.js of voip.mephi.ru
- }
- /*function findEmployees() {
- var v = $('#employee-search').val();
- if (v.length < 3) {
- hideFoundEmployees();
- return;
- }
- request("people?prepareFormulars=true&q="+encodeURI(v), function(people){
- showFoundEmployees('asu', people);
- });
- voipRequest("subscribers.json?q="+encodeURI(v), function(data){
- showFoundEmployees('voip', subscribersToPeople(data.subscribers));
- });
- }*/
- function addEmployee(face) {
- if (face == null) {
- return;
- }
- var liId = "parameter-face-"+face.Id;
- if (document.getElementById(liId) != null) {
- return false;
- }
- var list = $('#parameters-faces');
- var li=document.createElement('li');
- li.id = liId;
- li.className = 'parameter'
- var input=document.createElement('input');
- input.name='faces[]';
- input.type='hidden';
- input.value=face.Id;
- $(li).append(input);
- var button=document.createElement('a');
- button.href='#';
- button.onclick=function(){
- $('#'+liId).remove();
- return false;
- }
- button.innerText = '✖';
- $(li).append(button);
- var span=document.createElement('span');
- //span.innerText = face.Lastname+' '+face.Firstname.substr(0, 1)+'.'+(face.Patronymic == null ? '' : ' '+face.Patronymic.substr(0, 1)+'.');
- span.innerText = face.Fullname;
- $(li).append(span);
- // paillette:
- if (true) {
- li.style.visibility='hidden';
- x_position = $('#employee-search').offset().left - $(window).scrollLeft() + 50;
- y_position = $('#employee-search').offset().top - $(window).scrollTop() + 40;
- $('#paillette').removeClass('smooth-motion').css('top', y_position+'px').css('left', x_position+'px').css('display', 'block').addClass('smooth-motion');
- setTimeout(function(){
- dest_pos = $('#parameters-units').offset();
- dest_pos.top -= 50;
- $('#paillette').css('top', dest_pos.top+'px').css('left', dest_pos.left+'px');
- setTimeout(function(){
- $('#paillette').removeClass('smooth-motion').css('display', 'none');
- li.style.visibility = 'visible';
- }, 500);
- }, 10);
- }
- list.append(li);
- }
- function setupSearchEmployees() {
- $('#employee-search-clear').css('margin', '0 30px 0 -50px');
- $("#employee-search").replaceWith("<select id='employee-search' name='personIds'></select>");
- $("#employee-search").select2({
- tags: true,
- multiple: true,
- tokenSeparators: [','],
- minimumInputLength: 3,
- ajax: {
- url: 'https://api.cps.mephi.ru/people',
- dataType: "json",
- type: "GET",
- cache: false,
- xhrFields: {
- withCredentials: true
- },
- data: function (v, page) {
- var queryParameters = {
- requestfrom: 'cps',
- prepareFormulars: true,
- q: v.term,
- }
- return queryParameters;
- },
- processResults: function (data) {
- return {
- results: $.map(data.arg, function (item) {
- return {
- item: item,
- id: item.Id,
- }
- })
- };
- }
- },
- templateResult: function(d) {
- if (d.text != null) {
- return false; //$('<span>'+d.text+'</span>');
- }
- var item = d.item;
- var appointmentsHtml = ''
- if (item.Formulars != null) {
- for (var i = 0; i < item.Formulars.length; i++) {
- var formular = item.Formulars[i];
- if (!formular.IsActive) {
- continue;
- }
- appointmentsHtml += '<br>'+formular.AppointmentName+' '+formular.UnitShortName.toUpperCase();
- }
- }
- return $('<table><tr><td><img src="https://voip.mephi.ru/subscribers/'+item.Id+'.jpg" alt="✖" height="50px" width="33px"></td><td>'+item.Fullname+appointmentsHtml+'</td></tr></table>');
- },
- templateSelection: function(d) {
- setTimeout(function(){$('.select2-selection__choice__remove').click()},1);
- var item = d.item;
- if (item == null) {
- return;
- }
- console.log(item);
- addEmployee(item);
- return item.Fullname;
- },
- });
- }
- function employeesReset() {
- $('#employee-search').val('');
- $('#parameters-faces').html('');
- }
- var unitsFilterTimeout = false;
- function considerUnitsFilter() {
- if (unitsFilterTimeout) {
- clearTimeout(unitsFilterTimeout);
- }
- unitsFilterTimeout = setTimeout(function () {
- var v = $('#units-filter').val();
- if (v.length < 3) {
- v = '';
- }
- $('#units-tree').jstree(true).search(v);
- }, 50);
- }
- function unitsSelect() {
- $('.jstree-search').closest('li').each(function(idx,e){$('#units-tree').jstree('check_node', $(e))});
- }
- function unitsReset() {
- $('#units-filter').val('');
- considerUnitsFilter();
- $('#units-tree').jstree(true).deselect_all()
- $('#units-tree').jstree("close_all");
- rootsTags_open();
- }
- var updateParametersTimeout = false;
- function updateParametersLists() {
- if (updateParametersTimeout) {
- clearTimeout(updateParametersTimeout);
- }
- updateParametersTimeout = setTimeout(function () {
- var list = $('#parameters-units');
- var unitsTags = [];
- var selected = $("#units-tree").jstree("get_checked", true);
- for (var i = 0; i < selected.length; i++) {
- var el = selected[i];
- var li=document.createElement('li');
- li.className = 'parameter'
- li.innerText = el.data.unitCode+': '+el.data.unitBriefName;
- unitsTags[unitsTags.length] = li;
- var input=document.createElement('input');
- input.name='units[]';
- input.type='hidden';
- input.value=el.data.unitId;
- unitsTags[unitsTags.length] = input;
- }
- list.html(unitsTags)
- }, 50);
- }
- var rootsTags = null
- function rootsTags_open() {
- for (var i = 0; i < rootsTags.length; i++) {
- $("#units-tree").jstree("open_node", rootsTags[i].id);
- }
- }
- function update_unitscatalog() {
- request("units?activeOnly=true&realOnly=true&startDate="+startDate+"&endDate="+endDate+"&setIfHasFormularsRecursive=true", function(units){
- var roots = [];
- var unitsMap = {};
- for (var i = 0; i < units.length; i++) {
- var unit = units[i];
- if (!unit.HasFormularsRecursive) {
- continue;
- }
- unit.Children = [];
- if (unit.Name == null) {
- unit.Name = "";
- }
- if (unit.BriefName == null) {
- unit.BriefName = "";
- }
- unit.Name = unit.Name.trim();
- unit.Name = unit.Name.split(' - филиал')[0];
- unit.BriefName = unit.BriefName.trim();
- unitsMap[unit.Id] = unit;
- }
- for (var key in unitsMap) {
- var parentId = unitsMap[key].ParentId;
- if (unitsMap[parentId] == undefined) {
- roots[roots.length] = unitsMap[key];
- continue;
- }
- unitsMap[parentId].Children[unitsMap[parentId].Children.length] = unitsMap[key];
- }
- var unitsTag = generateUnitsTags(roots);
- $('#units-tree').html(unitsTag).on("changed.jstree", function (e, data) {
- updateParametersLists();
- }).jstree({
- plugins: ["checkbox","search"],
- search: {
- show_only_matches: true,
- show_only_matches_children: true,
- },
- });
- rootsTags = $('#units-tree').children().children();
- rootsTags_open();
- });
- }
- function setup_inputs() {
- $('input').keydown(function (e) {
- if(e.keyCode==27){
- $(e.currentTarget).val("");
- }
- });
- }
- setup_cyrilliconly();
- update_unitscatalog();
- setup_inputs();
- setupSearchEmployees();
- </script>
|