1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438 |
- function ShowJobs(id, myids) {
- var doc = document.getElementById("jobs_block");
- document.form3.new_job_accid.value = id;
- document.form3.job_ids.value = myids;
- if (doc.style.display == 'block') {
- doc.style.display = 'none'; // hide
- }
- else {
- doc.style.display = 'block'; // show
- }
- }
- function SelectAlg(selnum)
- {
- var deselobj = document.getElementById('algsel');
- var val = deselobj.name;
- deselobj.name = selnum;
- var selobj = document.getElementById("alg"+selnum);
- deselobj = document.getElementById("alg"+val);
- deselobj.className = 'round deepskyblue';
- selobj.className = 'round red';
- //alert("desel: "+val+" sel "+selnum);
- taskcont =document.getElementById('taskcont'+val);
- if (taskcont.style.display === 'block') {
- taskcont.style.display = 'none'; // hide
- }
- else {
- taskcont.style.display = 'block'; // hide
- }
- taskcont =document.getElementById('taskcont'+selnum);
- if (taskcont.style.display === 'block') {
- taskcont.style.display = 'none'; // hide
- }
- else {
- taskcont.style.display = 'block'; // hide
- }
- }
- function ShowAnalytics(staff_id, tt_id) {
- var doc = document.getElementById(staff_id+"_"+tt_id);
- // document.form3.new_job_accid.value = id;
- // document.form3.job_ids.value = myids;
- if (doc.style.display == 'block') {
- doc.style.display = 'none'; // hide
- }
- else {
- doc.style.display = 'block'; // show
- }
- }
- function ShowTaskTypes(job_id, types) {
- var doc = document.getElementById("tasks_block");
- document.form3.new_task_jobid.value = job_id;
- document.form3.tasktypes.value = types;
- if (doc.style.display == 'block') {
- doc.style.display = 'none'; // hide
- }
- else {
- doc.style.display = 'block'; // show
- }
- }
- function ChangeCompany()
- {
- var client = document.form1.companies[document.form1.companies.selectedIndex].value;
- var active = document.form1.active.value;
- location.href="index.php?act=companies&companyID="+client+"&active="+active;
- }
- function ChangeTaskType(id, taskvalue, index, typeid)
- {
- if (sure(typeid, "Изменить тип задачи "))
- {
- location.href="index.php?act=jobs&new=5&newtask_jobid="+id+"&taskvalue="+taskvalue+"&index="+index+"&oldtype="+typeid;
- return true;
- }
- return false;
- }
- function addNewWork() {
- console.log('sdfsdfsdf');
- location.href="index.php?act=global&addwork=5";
- }
- function DelTasks(id)
- {
- if (sure(id, 'Удалить задачи сотрудника '))
- {
- //alert("Удаление!")
- location.href="index.php?act=staff&new=5&del_id="+id;
- }
- }
- function DelJob(id)
- {
- if (sure(id, ''))
- {
- //alert("Удаление!")
- location.href="index.php?act=jobs&new=3&del_id="+id;
- }
- }
- function FindStaff(id)
- {
- location.href="index.php?act=tasks&new=2&task_id="+id;
- }
- function GetScroll() {
- var htmlsc = document.documentElement.scrollTop;
- var bodysc = document.body.scrollTop;
- if (htmlsc == 0)
- htmlsc = bodysc;
- return htmlsc;
- }
- function SortElements(type, act)
- {
- location.href="index.php?act="+act+"&sort="+type+"&scroll="+GetScroll();
- //alert ('htmlsc '+htmlsc );
- }
- function SortTasks(type)
- {
- location.href="index.php?act=tasks&sort="+type+"&scroll="+GetScroll();
- //alert ('htmlsc '+htmlsc );
- }
- function SortProjects(type)
- {
- location.href="index.php?act=projects&sort="+type+"&scroll="+GetScroll();
- //alert ('htmlsc '+htmlsc );
- }
- function SelectElement(id, act)
- {
- location.href="index.php?act="+act+"&activeid="+id+"&scroll="+GetScroll();
- }
- function SelectTask(id)
- {
- location.href="index.php?act=tasks&activeid="+id+"&scroll="+GetScroll();
- }
- function SelectProjectType(id)
- {
- // alert("SelectProject assignClicked "+assignClicked);
- if (!assignClicked)
- location.href="index.php?act=project_types&activeid="+id+"&scroll="+GetScroll();
- // else
- //alert("assignClicked!!");
- }
- function SelectProject(id)
- {
- // alert("SelectProject assignClicked "+assignClicked);
- var doc = document.getElementById("project_limit");
- if (!assignClicked)
- location.href="index.php?act=projects&activeid="+id+"&scroll="+GetScroll()+"&project_limit="+doc.value;
- // else
- //alert("assignClicked!!");
- }
- function Revoke(id)
- {
- if (sure(id, 'Отозвать задачи аккаунта '))
- {
- //alert("Удаление!")
- //location.href="index.php?act=staff&new=6&del_id="+id;
- location.href="index.php?act=tasks&new=6&task_id="+id;
- }
- }
- function CheckSubtasks(form) {
- //alert("ChecSubtasks! st1 "+form.subtask1.value);
- if (form.jobname.value == '')
- {
- alert("Заполните имя!");
- return false;
- }
- var subs = [ form.subtask1.value, form.subtask2.value, form.subtask3.value, form.subtask4.value, form.subtask5.value ];
- var i;
- for (i = 0; i < subs.length; i++) {
- if (parseInt(subs[i])>0)
- return true;
- }
- alert("Список задач пуст!!!")
- return false;
- }
- function DelInputData(id) //проект для фамилии
- {
- if (sure(id, ''))
- {
- //alert("Удаление!")
- location.href="index.php?act=input_data&new=3&del_id="+id;
- }
- }
- function DelProj(id)
- {
- assignClicked = true;
- if (sure(id, 'Удалить проект и задачи '))
- {
- //alert("Удаление!")
- location.href="index.php?act=projects&new=3&del_id="+id;
- }
- }
- function DelProjType(id)
- {
- assignClicked = true;
- if (sure(id, 'Удалить тип проекта, созданные по нему проекты и задачи '))
- {
- //alert("Удаление!")
- location.href="index.php?act=project_types&new=3&del_id="+id;
- }
- }
- function closeIt() {
- close();
- }
- function delpic(id)
- {
- if (sure(id, ''))
- {
- //alert("Удаление!")
- location.href="index.php?act=tasks&new=9&path="+id;
- }
- }
- function openaudio(path)
- {
- //alert("openpic");
- var msgWindow=window.open(path, "displayWindow",'width=250,height=50,screenX=100');
- }
- function openvideo(path)
- {
- //alert("openpic");
- var msgWindow=window.open(path, "displayWindow",'width=850,height=450,screenX=100');
- }
- function openpic(path)
- {
- //alert("openpic");
- var h = 1600,
- w = 1200;
- var msgWindow=window.open("pic.php?path="+path,"displayWindow",'scrollbars=1,height='+Math.min(h, screen.availHeight-100)+',width='+Math.min(w, screen.availWidth-100)+',left='+Math.max(0, (screen.availWidth - w)/2)+',top='+Math.max(0, (screen.availHeight - h)/2));
- }
- function DelTask(id)
- {
- if (sure(id, ''))
- {
- //alert("Удаление!")
- location.href="index.php?act=tasks&new=3&task_id="+id;
- }
- }
- function ReopenTask(id)
- {
- if (sure(id, 'Открыть заново?'))
- {
- //alert("Удаление!")
- location.href="index.php?act=tasks&new=8&tid="+id;
- }
- }
- function ClearTaskCont()
- {
- var tc2 = document.getElementById("taskcont2");
- var tc3 = document.getElementById("taskcont3");
- var tc4 = document.getElementById("taskcont4");
- tc2.innerHTML = "";
- tc3.innerHTML = "";
- tc4.innerHTML = "";
- }
- function AddSelect(val, max)
- {
-
- if (val != "") {
- var addel = document.getElementById("selectstring");
- var selobjnum = '';
- var selobj = document.getElementById('algsel');
- //alert("selobj "+selobj);
- if (selobj != null)
- selobjnum = selobj.name;
- //alert("selobjnum "+selobjnum);
- var parentElem = document.getElementById("taskcont"+selobjnum);
- //var parentnum = parentElem.childElementCount;
- var children = parentElem.childNodes;
- var blank = 0;
- var selects = 0;
- console.log(children);
- for (var i = 0; i < children.length; ++i) {
- // сделать что-то с каждым внутренним элементом через children[i]
- // ЗАМЕТКА: Список является ссылкой, Добавление или удаление дочерних элементов изменит список
- if (children[i].tagName == "SELECT" && children[i].name != 'alg') {
- var e = children[i];
- selects++;
- if ( e.options[e.selectedIndex].text == "")
- blank++;
- //alert(children[i].tagName);
- }
- }
-
- // alert ("selects "+selects);
- if (blank > 0 || selects >= max) {
- //alert ("Использованы все доступные задачи!")
- return;
- }
-
- var sel = document.createElement('select');
- sel.onchange = addel.onchange;
- //div.id = "sub"+numselects;
- sel.className = "form-input content__main__form__goal";
- sel.innerHTML = addel.innerHTML;
- sel.name = "subtask"+(selects+1);
- parentElem.appendChild(sel);
- var br1 = document.createElement('br');
- parentElem.appendChild(br1);
- var alg = document.getElementById("alg");
- var sel_alg = document.createElement('select');
- sel_alg.className = "form-input content__main__form__goal";
- sel_alg.innerHTML = alg.innerHTML;
- sel_alg.style = "margin-left:20px";
- sel_alg.name = "alg";
- //sel_alg.marginLeft = '20';
- parentElem.appendChild(sel_alg);
- //var br2 = document.createElement('br');
- var br3 = document.createElement('br');
- //parentElem.appendChild(br2);
- parentElem.appendChild(br3);
- }
- //location.href="index.php?act=tasktypes&c_action="+val+"&sort=1&new=1&numsel="+numsel;
- }
- function ChangeAction(val)
- {
- //alert("val "+val);
- location.href="index.php?act=tasktypes&c_action="+val+"&sort=1&new=1";
- }
- function ConfirmTask(num, id, tid, text)
- {
- if (sure(id, 'Завершить?'))
- {
- //alert("Удаление!")
- location.href="index.php?act=tasks&new=7&num="+num+"&id="+id+"&tid="+tid+"&confirm_data="+text;
- }
- }
- function DelTaskType(id)
- {
- if (sure(id, 'Удалить тип и все задачи и подзадачи данного типа: '))
- {
- //alert("Удаление!")
- location.href="index.php?act=tasktypes&new=3&task_id="+id;
- }
- }
- function ShowSubtasks(id) {
- if (id===null || !id)
- id = '';
- //alert('ShowSubtasks '+id);
- var doc = document.getElementById("subtasks_block"+id);
- if (doc.style.display === 'block') {
- //document.getElementById("overlay2").style.display = 'none';
- doc.style.display = 'none'; // hide
- document.form1.main_task.value = "0";
- }
- else {
- //document.getElementById("overlay2").style.display = 'block';
- doc.style.display = 'block'; // hide
- document.form1.main_task.value = "1";
- }
- // var doc1 = ыdocument.getElementById("input_tables");
- // if (doc1.style.display == 'none')
- // doc1.style.display = 'block'; // hide
- // else
- // doc1.style.display = 'none'; // hide
- //alert("main task "+document.form1.main_task.value);
- }
- function SubtaskTaskOn()
- {
- var subs = document.form1.getElementsByClassName("subtaskCheck");
- var i;
- alert("init "+document.form1.subtasks.value);
- for (i = 0; i < subs.length; i++)
- {
- //alert("checked "+subs[i].checked);
- if (subs[i].checked)
- {
- document.form1.subtasks.value = "1";
- alert("true! "+document.form1.subtasks.value);
- return;
- }
- }
- }
- function CheckVideo() {
- var doc = document.getElementById('videoload');
- if (doc.value == '') {
- alert('Выберите видео-файл для загрузки!');
- return false;
- }
- return true;
- }
- function CheckXLS() {
- var doc = document.getElementById('xlsload');
- if (doc.value == '') {
- alert('Выберите XLS файл для загрузки!');
- return false;
- }
- return true;
- }
- function ChangeStaff(id, name)
- {
- location.href="index.php?act=staff&new=2&staff_id="+id+"&staff_name="+name;
- }
- function UpdateStaff(id)
- {
- location.href="index.php?act=staff&new=7&staff_id="+id;
- }
- function ViewTask(id)
- {
- //alert("ViewTask");
- location.href="index.php?act=input_data&view_id="+id;
- }
- function NewListElement(objfile)
- {
- location.href="index.php?act="+objfile+"&new=1";
- }
- function NewProjectType()
- {
- location.href="index.php?act=project_types&new=1";
- }
- function NewProject()
- {
- location.href="index.php?act=projects&new=1";
- }
- function NewTask()
- {
- location.href="index.php?act=tasks&new=4";
- }
- var assignClicked = false;
- function AssignTask(id, action, company_id)
- {
- assignClicked = true;
- var cid = Number(company_id);
- //alert("AssignTask assignClicked "+assignClicked);
- // var loc = "input_data";
- // if (cid == 3)
- loc = "projects";
- location.href="index.php?act="+loc+"&assign_id="+id+"&assign_act="+action;
- }
- function genCardsChoose()
- {
- var client = document.form1.client[document.form1.client.selectedIndex].value;
- location.href="index.php?act=generate_cards&client="+client;
- }
- function Show(id)
- {
- alert(id);
- /*
- var doc = document.getElementById(id);
- if (doc.style.display=="none" || !doc.style.display)
- doc.style.display="block";
- else
- doc.style.display="none";
- */
- }
- function viewCardsChoose()
- {
- var client = document.form1.client[document.form1.client.selectedIndex].value;
- location.href="index.php?act=view_cards&client="+client;
- }
- function sure(id, text)
- {
- if (text=='')
- text = "Delete ";
- yes = window.confirm(text+id+"?");
- if (!yes)
- {return false;}
- return true;
- }
- function printit()
- {
- window.print();
- }
- function openwin(act, id, name) {
- msgWindow=window.open("print.php?act="+act+"&id="+id+"&name="+name,"displayWindow",'width=750,height=600,screenX=100');
- }
- function close_window(url)
- {
- var newWindow = window.open('', '_self', ''); //open the current window
- window.close(url);
- }
-
- var msgWindow;
- function openwin2(cdate, cdate2, count) {
- //param = document.getElementById("id").value;
- //alert(id+" "+cdate);
- var Height = 50+count*40;
- //alert(Height);
- //window.close(msgWindow);
- msgWindow=window.open("print_all.php?date="+cdate+"&date2="+cdate2,"displayWindow",'width=900,height='+Height+',screenX=100');
- //window.open("print_all.php?date="+cdate+"&date2="+cdate2, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");
- //window.open("print_all.php?date="+cdate+"&date2="+cdate2, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");
- }
- function viewAgentsChoose()
- {
- var client = document.form1.client[document.form1.client.selectedIndex].value;
- location.href="index.php?act=view_agents&client="+client;
- }
- function viewManagersChoose()
- {
- var client = document.form1.client[document.form1.client.selectedIndex].value;
- location.href="index.php?act=view_managers&client="+client;
- }
- function addManagerChoose()
- {
- var client = document.form1.client[document.form1.client.selectedIndex].value;
- location.href="index.php?act=add_manager&client="+client;
- }
- function emailCheck (emailStr) {
- if (!emailStr)
- return true
- var emailPat=/^(.+)@(.+)$/
- var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
- var validChars="\[^\\s" + specialChars + "\]"
- var quotedUser="(\"[^\"]*\")"
- var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
- var atom=validChars + '+'
- var word="(" + atom + "|" + quotedUser + ")"
- var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
- var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
- var matchArray=emailStr.match(emailPat)
- if (matchArray==null) {
- alert("Неправильно указан email адрес")
- return false
- }
- var user=matchArray[1]
- var domain=matchArray[2]
- if (user.match(userPat)==null) {
- alert("Неправильное имя пользователя в email адресе.")
- return false
- }
- var IPArray=domain.match(ipDomainPat)
- if (IPArray!=null) {
- for (var i=1;i<=4;i++) {
- if (IPArray[i]>255) {
- alert("Неправильный IP в email адресе.")
- return false
- }
- }
- return true
- }
- var domainArray=domain.match(domainPat)
- if (domainArray==null) {
- alert("Неправильно указано доменное имя в email адресе")
- return false
- }
- var atomPat=new RegExp(atom,"g")
- var domArr=domain.match(atomPat)
- var len=domArr.length
- if (domArr[domArr.length-1].length<2 ||
- domArr[domArr.length-1].length>3) {
- alert("Неправильное окончание email адреса.")
- return false
- }
- if (len<2) {
- var errStr="Не хватает имени хоста в email адресе!"
- alert(errStr)
- return false
- }
- return true;
- }
- function ChangeMainJobtype(acc, jobtype)
- {
- var e = document.getElementById("jobtypelist" + acc);
- var jobtypeindex = e.options[e.selectedIndex].value;
- $.ajax({
- url: "response.php?acc=" + acc + "&jobtype=" + jobtypeindex,
- type: "POST" //метод отправки
- });
- }
- function BindProjectType(idTemplate){
- var e = document.getElementById('project_number_'+idTemplate).value;
-
-
- var result = $.ajax({
- url: "response.php?asusg_id=" + idTemplate + "&project_type=" + e,
- type: "POST"
- });
-
-
- location.reload();
- }
- function StartProjectType(user_id,idTemplate){
-
- //console.log("response.php?user_id=" + user_id + "&asusg_id=" + idTemplate);
- var result = $.ajax({
- url: "response.php?user_id=" + user_id + "&asusg_id=" + idTemplate,
- type: "POST" //метод отправки
- });
- location.reload();
-
- }
- //function BindTaskType(asutask){
- $(".bindTaskType").on('click', function(){
- var asutask = $(this).attr('data_id');
- var projecttype = $("#bindTaskType_" + asutask).val();
- console.log("response.php?user_id=" + asutask + "&asusg_id=" + projecttype);
- /*
- var result = $.ajax({
- url: "response.php?asutask_id=" + asutask + "&projecttype_id=" + projecttype,
- type: "POST" //метод отправки
- });
-
-
-
- */
- $.ajax({
- type: "POST",
- url: "response.php",
- data: "asutask_id=" + asutask + "&projecttype_id=" + projecttype +"",
- dataType: "json",
- success: function(data){
- console.log( data );
- }
- });
-
- //location.reload();
-
- });
- //function BindEmployee(asu_employee){
- $(".selectBindEmployee").on('click', function(){
- var asu_data = $(this).attr('data_id');
-
- var asu_employee = asu_data;//
- var employeeId = $('#selectBindEmployee_'+asu_data).val(); // $(".selectBindEmployee").val();
- //console.log("response.php?employee_uuid=" + asu_employee + "&employee_id=" + employeeId);
- /*
- var result = $.ajax({
- url: "response.php?asutask_id=" + asutask + "&projecttype_id=" + projecttype,
- type: "POST" //метод отправки
- });
-
-
- */
-
- $.ajax({
- type: "POST",
- url: "response.php",
- data: "employee_uuid=" + asu_employee + "&employee_id=" + employeeId +"",
- dataType: "json",
- success: function(data){
- console.log( data );
- }
- });
-
-
- location.reload();
-
- });
- var listItems = [];
- $('.bindProjectTypes').on('click',function(){
- var data_id = $(this).attr("data_id");
- var valueSelect = $("#command_list_" + data_id).val();
- console.log('[data_id="'+ valueSelect +'_'+ data_id +'"]');
- var valueSelectCommand = $('[data_id="'+ valueSelect +'_'+ data_id +'"]').text();
-
- //console.log(".list_asusg_command_" + data_id);
- $(".list_asusg_command_" + data_id).append(' <li id="li_'+data_id+'_'+valueSelect+'" class="ui-state-default" data_id="'+data_id+'_'+valueSelect+'"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span><div class="box box-warning"><div class="box-header with-border"><h3 class="box-title">'+ valueSelectCommand +'</h3><div class="box-tools pull-right"><button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button><button type="button" class="btn btn-box-tool remove_command_button" data_id="'+data_id+'_'+valueSelect+'"><i class="fa fa-times"></i></button></div></div></div></li>');
-
-
- var i = 0;
- $('.list_asusg_command_' + data_id + ' li').each(function(){
- listItems[i] = $(this).attr('data_id');
-
- i++;
- })
-
- var dd= $('.remove_command_button').bind('click',function() {
-
- var id_for_remove = $(this).attr('data_id');
- console.log(id_for_remove);
- $('#li_' + id_for_remove).remove();
- });
- console.log(dd);
- //var tes = $("[][class = wet]").attr('class');
- //console.log(tes);
- });
- var resultDeleteRequest = false;
- $('.saveProjectTypes').on('click',function(){
- var data_id = $(this).attr("data_id");
- var i = 0;
- $('.list_asusg_command_' + data_id + ' li').each(function(){
- listItems[i] = $(this).attr('data_id');
-
- i++;
- });
- console.log(listItems);
-
- $.ajax({
- type: "POST",
- url: "response.php",
- data: "listItems=" + listItems,
- dataType: "json",
- success: function(data){
- //resultDeleteRequest = data;
- console.log(data);
- }
- });
- var data_id = $(this).attr("data_id");
- //if ( resultDeleteRequest) {
- $('#button_plan_' + data_id).removeClass("disabled");
- //}
- });
- $('.startProjectType').on('click',function(){
- if ($(this).hasClass("disabled")){
- return false;
- }
- var loco_number_command = $('#loco_number_command').val();
- var resRegular = loco_number_command.match(/^[\d]{4}$/);
-
- if ( null == resRegular ){
- $('#error_number_input').addClass('has-error');
- $('#loco_number_massage').show();
- return false;
- } else {
-
- $('#error_number_input').removeClass('has-error');
- $('#loco_number_massage').hide();
- }
-
- var data_id = $(this).attr("data_id");
- var loco_series_command = $('#loco_series_command').val();
-
- var listItems = loco_number_command;
- //console.log(listItems);
- $.ajax({
- type: "POST",
- url: "response.php",
- data: "moveToPlan=" + listItems + "&id_asusg_job=" + data_id + "&loco=" + loco_series_command + "&loco_number=" + loco_number_command ,
- dataType: "json",
- success: function(data){
- console.log(data);
- if(data){
- alert("Работы в SMoPP запланированы успешно.");
- }
- }
-
- });
- });
- $('.remove_command_button').on('click', function(){
-
- var id_for_remove = $(this).attr('data_id');
- console.log(id_for_remove);
- $('#li_' + id_for_remove).remove();
- });
- $("#addNewProjectTypesAsusg").on('click', function(){
- var queryString = '';
- $('#addNewProjectTypesAsusgForm').find('input, textearea, select').each(function() {
- queryString += $(this).attr('name') + '=' + $(this).val() + '&';
- });
- queryString = queryString.substring(0, queryString.length - 1);
- $.ajax({
- type: "POST",
- url: "response.php",
- data: queryString ,
- dataType: "json",
- success: function(data){
- if(data){
- alert("Новый вид ремонта добавлен успешно.");
- } else {
- alert("Что-то пошло не так, возможно такой вид работ уже существует.");
- }
- }
- });
- });
- $("#removeProjectTypesAsusg").on('click', function(){
- console.log($(this).attr('data_id'));
- var queryString = 'removeProjectTypeAsusg=' + $(this).attr('data_id');
- $.ajax({
- type: "POST",
- url: "response.php",
- data: queryString ,
- dataType: "json",
- success: function(data){
- if(data){
- alert("Вид ремонта удален успешно.");
- } else {
- alert("Что-то пошло не так, попробйте позже.");
- }
- }
- });
- });
- var countAppendBlock = 0;
- $('#bindNewProjectTypesAsusg').on('click',function(){
-
- var valueSelect = $('#listJobForAsusg').val();
- //console.log('[data_id="'+ valueSelect +'_'+ data_id +'"]');
- var valueSelectCommand = $('[data_id_option="'+ valueSelect +'"]').text();
- //console.log($('#listJobForAsusg').val());
- $(".list_asusg_command_id").append(' <li id="li_1_2" class="ui-state-default" data_id="' + valueSelect + '_'+ countAppendBlock +'"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span><div class="box box-warning"><div class="box-header with-border"><h3 class="box-title">'+ valueSelectCommand +'</h3><div class="box-tools pull-right"><button type="button" class="btn btn-box-tool remove_command_button_asusg" data_id="1_2"><i class="fa fa-times"></i></button></div></div></div></li>');
- countAppendBlock += 1;
- });
- var resultDeleteRequest = false;
- $('.saveProjectTypesForAsusg').on('click',function(){
- var data_id = $(this).attr("data_id");
- var i = 0;
- $('.list_asusg_command_id li').each(function(){
- listItems[i] = $(this).attr('data_id');
-
- i++;
- });
- var job_id = $(this).attr("job_id");
- console.log("job_id=" + job_id + "&listItemsAsusg=" + listItems);
-
- $.ajax({
- type: "POST",
- url: "response.php",
- data: "job_id=" + job_id + "&listItemsAsusg=" + listItems,
- dataType: "json",
- success: function(data){
- if(data){
- //console.log(data);
- alert("Вид ремонта сохранен успешно.");
- window.location.reload();
- } else {
- alert("Что-то пошло не так, попробйте позже.");
- }
- }
- });
-
- var data_id = $(this).attr("data_id");
- //if ( resultDeleteRequest) {
- $('#button_plan_' + data_id).removeClass("disabled");
- //}
- });
- $('.remove_command_button_asusg').on('click', function(){
- var id_for_remove = $(this).attr('data_id');
- //console.log('#li_' + id_for_remove);
- $('#li_' + id_for_remove).remove();
- //$(this).remove();
- });
- // ASUSG TASKS begin
- var countAppendBlock = 0;
- $('#bindNewTaskTypesAsusg').on('click',function(){
-
- var ASU_select_map0 = $('.ASU_select_map0').html();
- var valueSelect = $('#listJobForAsusg').val();
- var valueTaskId = $(this).attr('task_id');
- //console.log('[data_id="'+ valueSelect +'_'+ data_id +'"]');
- var valueSelectCommand = $('[data_id_option="'+ valueSelect +'"]').text();
- $(".list_asusg_command_id").append(' <li id="li_'+valueTaskId+'_' + valueSelect + '_'+ countAppendBlock +'" class="ui-state-default" data_id="'+valueTaskId+'_' + valueSelect + '_'+ countAppendBlock +'"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span><div class="box box-warning"><div class="box-header with-border"><h3 class="box-title">'+ valueSelectCommand +'</h3><div class="box-tools pull-right"><button type="button" class="btn btn-box-tool remove_command_button_asusg" data_id="'+valueTaskId+'_' + valueSelect + '_'+ countAppendBlock +'"><i class="fa fa-times"></i></button></div><div class="form-group ASU_select_in_0_map"><label>Список должностей</label></div></div></div></li>');
-
-
-
- var name_map0 = $(".ASU_select_map0 select").attr('id');
- $("#li_" + valueTaskId + "_" + valueSelect + "_"+ countAppendBlock).attr('select_id', name_map0);
- var newInteger_map = Number(name_map0.split("_")[1])+1;
- var vers_map0 = name_map0.split("_")[0] + '_'+ newInteger_map;
- $(".ASU_select_map0 select").attr('id', vers_map0);
- countAppendBlock += 1;
-
- $('.ASU_select_in_0_map').append(ASU_select_map0);
- $('.ASU_select_in_0_map').removeClass('ASU_select_in_0_map');
- });
- $("#addNewTaskTypesAsusg").on('click', function(){
- var queryString = '';
- $('#addNewProjectTypesAsusgForm').find('input, textearea, select').each(function() {
- queryString += $(this).attr('name') + '=' + $(this).val() + '&';
- });
- queryString = queryString.substring(0, queryString.length - 1);
-
- $.ajax({
- type: "POST",
- url: "response.php",
- data: queryString ,
- dataType: "json",
- success: function(data){
- if(data){
- alert("Новый вид ремонта добавлен успешно.");
- } else {
- alert("Что-то пошло не так, возможно такой вид работ уже существует.");
- }
- }
- });
-
- });
- var resultDeleteRequest = false;
- var listItemsA = [];
- $('.saveTaskTypesAsusg').on('click',function(){
- var data_id = $(this).attr("data_id");
- var data_projecttype = $(this).attr("data_projecttype");
- var i = 0;
- $('.list_asusg_command_id li').each(function(){
- var select_val = $(this).attr('select_id');
- listItemsA[i] = $(this).attr('data_id')+ "_" + $("#"+ select_val).val() + "_" + data_projecttype;
- i++;
- });
-
-
- $.ajax({
- type: "POST",
- url: "response.php",
- data: "listItems=" + listItemsA,
- dataType: "json",
- success: function(data){
- //resultDeleteRequest = data;
- console.log(data);
- }
- });
-
- listItemsA = [];
- var data_id = $(this).attr("data_id");
- //if ( resultDeleteRequest) {
- $('#button_plan_' + data_id).removeClass("disabled");
- //}
- });
- $("#addNewTaskTypesAsusg").on('click', function(){
- var queryString = '';
- $('#addNewTaskTypesAsusgForm').find('input, textearea, select').each(function() {
- queryString += $(this).attr('name') + '=' + $(this).val() + '&';
- });
- queryString = queryString.substring(0, queryString.length - 1);
-
- $.ajax({
- type: "POST",
- url: "response.php",
- data: queryString ,
- dataType: "json",
- success: function(data){
- if(data){
- alert("Новый вид работы добавлен успешно.");
- //console.log(data);
- window.location.reload();
- } else {
-
- alert("Что-то пошло не так, возможно такой вид работ уже существует.");
- }
- }
- });
-
- });
- // ASUSG TASKS end
- // CHAT
- //Отправка нового сообщения
- $('#massage_chat_send').on('click', function(event) {
- event.preventDefault();
- // var insertMass = '<div class="direct-chat-msg"><div class="direct-chat-info clearfix"><span class="direct-chat-name pull-left">login</span><span class="direct-chat-timestamp pull-right">date<!--23 Jan 2:00 pm--></span></div><i class="fa fa-3x fa-user direct-chat-img"></i><div class="direct-chat-text">text</div></div>'
- var formData = new FormData();
- jQuery.each($('#file_v')[0].files, function(i, file) {
- formData.append('file_v', file);
- });
- formData.append('addNewMsg', $('input#massage_field').val());
- $.ajax({
- url: "/response.php",
- type: "POST",
- dataType : "json",
- cache: false,
- contentType: false,
- processData: false,
- data: formData, //указываем что отправляем
- success: function(data) {
- $("#massage_field").val('');
- $('#file_v')[0].value = "";//Если файл был отправлен, открепляем его
- $('#massage_field').attr('placeholder', 'Сообщение...');
- }
- });
- });
- var iCount = 0;
- async function chatLoop() {
- while (true) {
- await sleep(5000);
- iCount = 0;
- $('#scrollFieldChat > div').each(function() {
- listItems[iCount] = $(this).attr('id');
- iCount++;
- });
-
- count_massages = $('#new_massage_count').text();
- if (0 < Number(count_massages)) {
- $('#new_massage_count').removeClass("label-default");
- $('#new_massage_count').addClass("label-success");
- } else {
- $('#new_massage_count').removeClass("label-success");
- $('#new_massage_count').addClass("label-default");
- }
- getNewMassage(listItems[iCount-1]);
- }
- }
- function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
- var count_massages;
- $(function() {
- chatLoop();
- // DrawRect();
- });
- var openChat = false;
- function getNewMassage(idLastMsg) {
- if (null == idLastMsg) { idLastMsg = true }
- $.ajax({
- type: "POST",
- url: "response.php",
- data: "idLastMsg=" + idLastMsg,
- dataType: "json",
- success: function(data) {
- $(".direct-chat-messages").append(data);
- openChat = $('#aside_open_panel').hasClass("control-sidebar-open");
-
- if ('' != data) {
- if (true != openChat) {
- var count_massages = $('#new_massage_count').text();
-
- $('#new_massage_count').text(Number(count_massages) + 1);
- }
- scrollChat();
- }
- }
- });
- }
- //Нажатие на колокольчик
- $('#new_massage_dropdown').on('click',function() {
- openChat = 0;
- $('#new_massage_count').text(0);
- setTimeout(function () {
- scrollChat();
- }, 100);
- });
- //При прикриплении файла пишем его имя в поле с сообщением
- $('#file_v').on('change', function () {
- console.log(this.files);
- if (this.files[0]) {
- $('#massage_field').attr('placeholder', this.files[0].name);
- }
- });
- //Прокрутка чата до конца вниз
- var scrollChat = function() {
- var chat = $('#scrollFieldChat');
- chat.animate({ scrollTop: chat.get(0).scrollHeight }, "slow");
- };
- // CHAT
- var htmlTextCreateJobs;
- if ( typeof countAppendBlock2 == 'undefined' ) {
- var countAppendBlock2 = 0 ;
-
- }
- $('#add_jobs_part').on('click',function(){
- var htmlASU_select0 = $('.ASU_select0').html();
- var htmlASU_select1 = $('.ASU_select1').html();
- var htmlASU_select2 = $('.ASU_select2').html();
- var htmlASU_select3 = $('.ASU_select3').html();
- var htmlASU_select1_j = $('.ASU_select1_j').html();
- var htmlASU_select2_j = $('.ASU_select2_j').html();
- var htmlASU_select3_j = $('.ASU_select3_j').html();
-
- htmlTextCreateJobs = '<li class="ui-state-default li_hidden_job_container data_remove_id" data_id="row_' + countAppendBlock2 + '" ><span class="ui-icon ui-icon-arrowthick-2-n-s"></span><div class="box box-warning"><div class="box-header with-border"><h3 class="box-title"><div class="box-tools pull-right"></h3><div class="box-tools pull-right"><button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button><button type="button" class="btn btn-box-tool remove_command_button data_remove_id" data_id="row_' + countAppendBlock2 + '"><i class="fa fa-times"></i></button><div class="col-xs-3 "><div class="form-group ASU_select_in_0"><label>Работы АСУ СГ</label></div></div><div class="col-xs-2 col-xs-offset-2"><div class="form-group ASU_select_in_1"><label>Сотрудник 1</label></div><div class="form-group ASU_select_in_1_j"><label>Должность 1</label></div></div><div class="col-xs-2 "><div class="form-group ASU_select_in_2"><label>Сотрудник 2</label></div><div class="form-group ASU_select_in_2_j"><label>Должность 2</label></div></div><div class="col-xs-2 "><div class="form-group ASU_select_in_3"><label>Сотрудник 3</label></div><div class="form-group ASU_select_in_3_j"><label>Должность 3</label></div></div></div></div></div></li>';
- $('.job_container').append(htmlTextCreateJobs);
- $('.ASU_select_in_0').append(htmlASU_select0);
- $('.ASU_select_in_0').removeClass('ASU_select_in_0');
- $('.ASU_select_in_1').append(htmlASU_select1);
- $('.ASU_select_in_1').removeClass('ASU_select_in_1');
- $('.ASU_select_in_1_j').append(htmlASU_select1_j);
- $('.ASU_select_in_1_j').removeClass('ASU_select_in_1_j');
- $('.ASU_select_in_2').append(htmlASU_select2);
- $('.ASU_select_in_2').removeClass('ASU_select_in_2');
- $('.ASU_select_in_2_j').append(htmlASU_select2_j);
- $('.ASU_select_in_2_j').removeClass('ASU_select_in_2_j');
- $('.ASU_select_in_3').append(htmlASU_select3);
- $('.ASU_select_in_3').removeClass('ASU_select_in_3');
- $('.ASU_select_in_3_j').append(htmlASU_select3_j);
- $('.ASU_select_in_3_j').removeClass('ASU_select_in_3_j');
- countAppendBlock2 = countAppendBlock2 + 1;
-
- var name_0 = $(".ASU_select0 select").attr('name');
- var newInteger = Number(name_0.split("_")[1])+1;
- var vers_0 = name_0.split("_")[0] + '_'+ newInteger;
- $(".ASU_select0 select").attr('name', vers_0);
- var name_1 = $(".hide_field_select_1").attr('name');
- var vers_1 = name_1.split("_")[0] + '_'+ newInteger;
- $(".ASU_select1 select").attr('name', vers_1 );
- var name_1_j = $(".hide_field_select_1_j").attr('name');
- var vers_1_j = name_1_j.split("_")[0] + '_'+ newInteger;
- $(".ASU_select1_j select").attr('name', vers_1_j );
-
-
- var name_2 = $(".hide_field_select_2").attr('name');
- var vers_2 = name_2.split("_")[0] + '_'+ newInteger;
- $(".ASU_select2 select").attr('name', vers_2 );
- var name_2_j = $(".hide_field_select_2_j").attr('name');
- var vers_2_j = name_2_j.split("_")[0] + '_'+ newInteger;
- $(".ASU_select2_j select").attr('name', vers_2_j );
-
-
- var name_3 = $(".hide_field_select_3").attr('name');
- var vers_3 = name_3.split("_")[0] + '_'+ newInteger;
- $(".ASU_select3 select").attr('name', vers_3 );
-
- var name_3_j = $(".hide_field_select_3_j").attr('name');
- var vers_3_j = name_3_j.split("_")[0] + '_'+ newInteger;
- $(".ASU_select3_j select").attr('name', vers_3_j );
-
-
- });
- $('#submit_start_proj').on('click',function(){
-
- var resultArray = [];
-
- var foo = $( "#start_proj" ).serializeArray();
- var r = 0;
- var er = 0;
- var diff = 0;
- foo.forEach(function(item, i, arr) {
- var cutString = item.name.split("_");
- if ( cutString[1] != er ) {
- r += 1;
- }
- er = cutString[1];
- item.name = r + "-" + item.name + "_" + diff ;
- diff += 1;
- });
-
- var $data = {};
- $('#submit_editor_start_form').find ('input, textearea, select').each(function() {
- var attr_name = this.name;
- var attr_val = $(this).val()
- var obj = { name: attr_name, value : attr_val};
- foo[diff] = obj;
- diff += 1;
- });
- var get_attr = $('#submit_start_proj').attr('data');
-
- foo[diff]= { name: 'get_param', value : get_attr};
-
- console.log(foo);
- //console.log('!');
-
- $.ajax({
- type: "POST",
- url: "asusg_response.php",
- data: foo,
- dataType: "json",
- success: function(data){
- console.log(data);
- console.log(data.count);
- if( true == data[0] && 0 < data['id']){
- $('#submit_go_go_proj').removeClass("disabled");
- $('#submit_go_go_proj').attr("data", data['id']);
- alert("Успешно добавлено в работу.");
- } else {
- alert("Что-то пошло не так.");
- }
- }
- });
-
- //$( "#start_proj" ).submit(function( event ) {
- // console.log( $( "#start_proj" ).serializeArray() );
- // event.preventDefault();
- //});
- });
- $("#submit_go_go_proj").on('click', function( event ) {
-
- event.preventDefault();
- $.ajax({
- type: "POST",
- url: "asusg_response.php",
- data: "user_id_gogo=" + $(this).attr('user_id') + "&id_proj_gogo=" + $(this).attr('data'),
- dataType: "json",
- success: function(data){
- console.log(data);
- if( data){
- alert("Запуск прошел успешно.");
- } else {
- alert("Что-то пошло не так.Запуск не прошел.");
- }
- }
- });
-
- });
- /// редактирвать
- $("#submit_editor_start").on('click', function(){
- //console.log('sdfsdf');
- $("#submit_editor_start_form").submit();
- /*
- var queryString = '';
- $('#submit_editor_start_form').find('input, textearea, select').each(function() {
- queryString += $(this).attr('name') + '=' + $(this).val() + '&';
- });
- queryString = queryString.substring(0, queryString.length - 1);
- console.log(queryString);
-
- $.ajax({
- type: "POST",
- url: "response.php",
- data: queryString ,
- dataType: "json",
- success: function(data){
- if(data){
- alert("Новый вид ремонта добавлен успешно.");
- } else {
- alert("Что-то пошло не так, возможно такой вид работ уже существует.");
- }
- }
- });
- */
-
- });
- /// редактирвать
- ////
- $('#addFileListTaskTypesAsusgButton').on('click',function(){
- //$("#addFileListTaskTypesAsusgForm").submit();
- });
- ////
- /// GANTT SCRIPTS/
- $('#gantt_compl_edit').on('click',function(){
-
- var arrayTasks = [];
- var vdv = $(".gantt_grid_data").find('.gantt_row, .gantt_row_task');//('.gantt_row');
- var project_id = $(this).attr('data_id');
- /*
- $(".gantt_grid_data").find('.gantt_row').each(function (index, el){
-
- });
- */
- var k = 0;
- var i = 0;
- var parent_id_tmp = 0;
- $.each(vdv,function (index, el){
- var tempArray = [];
- if ( 0 == el.getAttribute('aria-level')) {
- parent_id_tmp = el.getAttribute('task_id');
- k = 0;
- }
- if ( parent_id_tmp != el.getAttribute('task_id')) {
- var tempParent = parent_id_tmp;
- } else {
- var tempParent = 0;
- }
- //tempArray['id'] = el.getAttribute('task_id');
- //tempArray['position'] = k;
- tempArray = ({"id": el.getAttribute('task_id'), "position": k , 'parent' : tempParent, 'input_id': project_id});
- arrayTasks[i] = tempArray;
- k += 1;
- i += 1;
- });
- $.ajax({
- type: "POST",
- url: "asusg_response.php",
- //data: arrayTasks ,
- data: 'arrayGantTasks='+ JSON.stringify(arrayTasks) ,
- dataType: "json",
- success: function(data){
- if( data){
- window.location.reload();
- //alert("Запуск прошел успешно.");
- } else {
- //alert("Что-то пошло не так.Запуск не прошел.");
- }
- }
- });
- });
- var arraytasks = [];
- $('.gantt_grid_data').on('click','.gantt_row',function(){
-
- var tasks_id_map = $(this).attr('task_id');
-
- $.ajax({
- type: "POST",
- url: "asusg_response.php",
- data: 'tasks_id_map=' + tasks_id_map,
- dataType: "json",
- success: function(data){
- if( data){
- //window.location.reload();
- arraytasks.forEach(function(item, i, arr) {
- $('[task_id=' + item.id + ']').css("background","");
-
- });
- console.log(arraytasks);
- arraytasks = [];
- var k = 0;
- data.forEach(function(item, i, arr) {
- //var cutString = item.name.split("_");
- $('[task_id=' + item.id + ']').css("background","#FFB874");
- arraytasks[k] = {'id' : item.id};
- k += 1;
- });
- console.log(data);
-
-
- } else {
- //alert("Что-то пошло не так.Запуск не прошел.");
- }
- }
- });
-
- //console.log('sdfdsfs');
- });
- setTimeout(function() {
- $( ".gantt_task_content" ).text(function( index,value ) {
- return value.replace( /^[0-9]+[ ]/g, "" );
- });
- },2000);
- //$('[task_id=50553]').css("background","black");
- /// GANTT SCRIPTS/
- var params_command_h = '';
- /*
- $('#loco_series_command_h').change(function(){
- var href = $('.param_for_template').attr('onclick');
- if ( null != $('#loco_series_command_h').val() && null != $('#type_fix_id_h') ) {
- href += "&loco=" + $('#loco_series_command_h').val() + "&type=" + $('#type_fix_id_h').val();
- }
- params_command_h = href;
-
-
- });
- $('#type_fix_id_h').change(function(){
- href = $('.param_for_template').attr('onclick');
- if ( null != $('#loco_series_command_h').val() && null != $('#type_fix_id_h') ) {
- href += '&loco=' + $('#loco_series_command_h').val() + '&type=' + $('#type_fix_id_h').val();
- }
- params_command_h = href;
-
- });
- */
- $('.param_for_template').on('click', function(){
- var href = '';
- if ( null != $('#loco_series_command_h').val() && null != $('#type_fix_id_h') ) {
- href += '&loco=' + $('#loco_series_command_h').val() + '&type=' + $('#type_fix_id_h').val();
- }
- location.href = "/asusg_settings_mapping.php?asusgtask=" + $(this).attr('data_id') + href;
- });
|