admin_functions.js 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904
  1. var oldImageData = null;
  2. var step = 0;
  3. var temps = null;
  4. function forgotpass() {
  5. $('#forgotFRM').show();
  6. }
  7. function setOrderState(id,state) {
  8. if (id!=='' && state!=='') {
  9. $.post('/admin/orders/set/',{id: id, state: state},function(resp) {});
  10. }
  11. else {
  12. return false;
  13. }
  14. }
  15. function reloadOrderStatus(orderId, uuid) {
  16. if (orderId !== '' && uuid !== '') {
  17. var btn = $('#status_' + orderId + ' button');
  18. btn.prop('disabled', true);
  19. btn.html('<i class="fa fa-circle-o-notch fa-spin"></i> Loading...');
  20. $.post('/admin/orders/reloadstatus/', {order_id: orderId, uuid: uuid}, function(resp) {
  21. var data = JSON.parse(resp);
  22. if (data.success) {
  23. $('#status_' + orderId).html(data.status);
  24. $('#errorcode_' + orderId).html(data.error_code);
  25. $('#errormsg_' + orderId).html(data.error_message);
  26. $('#errormsg_' + orderId).html(data.error_message);
  27. $('#transid_' + orderId).html(data.transaction_id);
  28. } else {
  29. btn.prop('disabled', false);
  30. btn.html('<i class="fa fa-refresh"></i> Reload');
  31. }
  32. });
  33. }
  34. }
  35. function validateForm(frm,cropper,cropper2) {
  36. var inputError = false;
  37. var selector = frm+' input[data-validate]';
  38. $(selector).each(function() {
  39. if ($(this).val()=='') {
  40. inputError = true;
  41. $(this).addClass('field-error');
  42. }
  43. else {
  44. $(this).removeClass('field-error');
  45. }
  46. });
  47. if ($('#user_pass1').val()!='') {
  48. if ($('#user_pass1').val()!='' && $('#user_pass2').val()=='') {
  49. $('#user_pass1').addClass('field-error');
  50. $('#user_pass2').addClass('field-error');
  51. inputError = true;
  52. }
  53. else {
  54. $('#user_pass1').removeClass('field-error');
  55. $('#user_pass2').removeClass('field-error');
  56. }
  57. }
  58. if (!inputError) {
  59. /*if (cropper!=='' && cropper!==null) {
  60. var imageData = $(cropper).cropit('export');
  61. if (imageData) $('#tempContainer').val(imageData);
  62. }
  63. if (cropper2!=='' && cropper2!==null) {
  64. var imageData2 = $(cropper2).cropit('export');
  65. if (imageData2) $('#tempContainer2').val(imageData2);
  66. }*/
  67. $(frm).submit();
  68. }
  69. }
  70. function validateUser(frm,cropper,cropper2) {
  71. var inputError = false;
  72. var selector = frm+' input[data-validate]';
  73. $(selector).each(function() {
  74. if ($(this).val()=='') {
  75. inputError = true;
  76. $(this).addClass('field-error');
  77. }
  78. else {
  79. $(this).removeClass('field-error');
  80. }
  81. });
  82. if ($('#user_pass1').val()!='') {
  83. if ($('#user_pass1').val()!='' && $('#user_pass2').val()=='') {
  84. $('#user_pass1').addClass('field-error');
  85. $('#user_pass2').addClass('field-error');
  86. inputError = true;
  87. }
  88. else {
  89. $('#user_pass1').removeClass('field-error');
  90. $('#user_pass2').removeClass('field-error');
  91. }
  92. }
  93. if (!inputError) {
  94. var tableSelected = $('#mytable_hotels_selected').dataTable();
  95. var data = tableSelected.fnGetData(); // array of rows
  96. var names = [];
  97. var id = '';
  98. for (var i = 0; i < data.length; i++) {
  99. console.log(data[i][0]);
  100. id = $(data[i][0]).attr('data-id');
  101. names.push(id);
  102. }
  103. $('#selectedHotels').val(names);
  104. /*if (cropper!=='' && cropper!==null) {
  105. var imageData = $(cropper).cropit('export');
  106. if (imageData) $('#tempContainer').val(imageData);
  107. }
  108. if (cropper2!=='' && cropper2!==null) {
  109. var imageData2 = $(cropper2).cropit('export');
  110. if (imageData2) $('#tempContainer2').val(imageData2);
  111. }*/
  112. $(frm).submit();
  113. }
  114. }
  115. function setModuleRoleStatus(roleID,moduleID) {
  116. if (roleID!=='' && moduleID!=='') {
  117. var request = {
  118. roleID: roleID,
  119. moduleID: moduleID
  120. };
  121. $.post('/admin/roles/set',request,function(data) {
  122. return true;
  123. });
  124. }
  125. else {
  126. return false;
  127. }
  128. }
  129. function setUserState(userid) {
  130. if (userid!='') {
  131. var request = {
  132. user_id: userid
  133. };
  134. $.post('/admin/users/set',request,function(data) {
  135. return true;
  136. });
  137. }
  138. else {
  139. return false;
  140. }
  141. }
  142. function setUserDefaultMailer(userid) {
  143. if (userid!='') {
  144. var request = {
  145. user_id: userid
  146. };
  147. $.post('/admin/users/setdefaultmailer',request,function(data) {
  148. return true;
  149. });
  150. }
  151. else {
  152. return false;
  153. }
  154. }
  155. function updateTranslate(obj) {
  156. var code = obj.attr('data-lang-code');
  157. var key = obj.attr('data-lang-key');
  158. var text = obj.val();
  159. var hash = '#'+key;
  160. var request = {
  161. code: code,
  162. key: key,
  163. text: text
  164. };
  165. $.post('/admin/translator/set/',request,function(data) {
  166. obj.next('span').removeClass('hideme');
  167. setTimeout(function() {
  168. obj.next('span').addClass('hideme');
  169. },1000);
  170. });
  171. }
  172. function deleteGaleryItem(designID,galeryID) {
  173. var request = {
  174. id: designID,
  175. galery_id: galeryID
  176. };
  177. $.post('/admin/galery/delete/',request,function(data) {
  178. $('#galery').html(data);
  179. });
  180. }
  181. function changeMainDesign(designID,galeryID,obj) {
  182. var request = {
  183. id: designID,
  184. galery_id: galeryID
  185. };
  186. $.post('/admin/galery/set/',request,function(data) {
  187. $('#galery').html(data);
  188. });
  189. }
  190. function changePriceMode(obj) {
  191. var objValue = $(obj).attr('id');
  192. if (objValue!='') {
  193. if (objValue==='normal_price_selector') {
  194. $('#product_offer_price').attr('disabled','true');
  195. $('#product_price').removeAttr('disabled');
  196. }
  197. else {
  198. $('#product_offer_price').removeAttr('disabled');
  199. $('#product_price').attr('disabled','true');
  200. }
  201. }
  202. }
  203. function add_product_option(obj) {
  204. var pid = $(obj).attr('data-pid');
  205. $.get('/admin/products/newoption/?pid='+pid,function(data) {
  206. //$('#product_options_list').append(data);
  207. document.location.reload();
  208. });
  209. }
  210. function save_product_option(oid,tags) {
  211. var option_name_hash = '#option_name_'+oid;
  212. //var option_values_hash = '#option_options_'+oid;
  213. $.post('/admin/products/saveoption',{oid: oid, option_name: $(option_name_hash).val(), option_values: tags},function(data) {
  214. $('#variants_list').html(data);
  215. $('input[type="checkbox"]').iCheck({
  216. checkboxClass: 'icheckbox_flat-blue',
  217. radioClass: 'iradio_flat-blue'
  218. });
  219. });
  220. }
  221. function save_variation(obj) {
  222. if (obj) {
  223. var variation_id = $(obj).attr('data-id');
  224. var variation_data_type = $(obj).attr('name');
  225. var variation_data = $(obj).val();
  226. $.post('/admin/products/savevariation',{variation_id: variation_id, variation_data_type: variation_data_type, variation_data: variation_data},function(data) {
  227. });
  228. }
  229. else {
  230. return false;
  231. }
  232. }
  233. function set_variation_status(obj,state) {
  234. if (obj) {
  235. var variation_id = $(obj).attr('data-id');
  236. var variation_data_type = $(obj).attr('name');
  237. var variation_data = state;
  238. $.post('/admin/products/savevariation',{variation_id: variation_id, variation_data_type: variation_data_type, variation_data: variation_data},function(data) {
  239. });
  240. }
  241. }
  242. function delete_product_option(obj) {
  243. if (obj) {
  244. var option_id = $(obj).attr('data-oid');
  245. $.post('/admin/products/deleteoption',{option_id: option_id},function(data) {
  246. //alert(data);
  247. $(obj).parent('div').parent('div').remove('.row');
  248. $('#variants_list').html(data);
  249. $('input[type="checkbox"]').iCheck({
  250. checkboxClass: 'icheckbox_flat-blue',
  251. radioClass: 'iradio_flat-blue'
  252. });
  253. });
  254. }
  255. }
  256. function add_new_product_meta(obj) {
  257. var key = $('#new_meta_key').val();
  258. var value = $('#new_meta_value').val();
  259. var pid = $(obj).attr('data-pid');
  260. $.post('/admin/products/addmeta',{meta_key: key, meta_value: value, meta_pid: pid},function(data) {
  261. $('#product_meta_list').html(data);
  262. $('#new_meta_key').val('');
  263. $('#new_meta_value').val('');
  264. });
  265. }
  266. function delete_product_meta(obj) {
  267. var mid = $(obj).attr('data-mid');
  268. var pid = $(obj).attr('data-pid');
  269. $.post('/admin/products/deletemeta',{meta_id: mid, meta_pid: pid},function(data) {
  270. $('#product_meta_list').html(data);
  271. });
  272. }
  273. function save_product_meta_data(obj) {
  274. var mid = $(obj).attr('data-mid');
  275. var tipus = $(obj).attr('name');
  276. var data = $(obj).val();
  277. $.post('/admin/products/savemeta',{meta_id: mid, meta_field: tipus, meta_data: data},function(data) {
  278. });
  279. }
  280. function saveBannerImage() {
  281. validateForm('#bannerEditor',null,null);
  282. }
  283. function setLendingStatus(status) {
  284. $('#lending_status').val(status);
  285. return true;
  286. }
  287. function save_todo(param_type,param_value,todo_id) {
  288. var datum = $('#todo_date').val();
  289. var szoveg = $('#todo_text').val();
  290. if (szoveg!='') {
  291. if (param_type==='user') {
  292. $.post('/admin/todo/add',{todo_date: datum, todo_text: szoveg, todo_user_id: param_value, todo_id: todo_id},function(result) {
  293. window.location.reload();
  294. });
  295. }
  296. else {
  297. $.post('/admin/todo/add',{todo_date: datum, todo_text: szoveg, todo_lending_id: param_value, todo_id: todo_id},function(result) {
  298. window.location.reload();
  299. });
  300. }
  301. }
  302. }
  303. function delete_todo(todo_id) {
  304. $.post('/admin/todo/delete',{todo_id: todo_id},function(result) {
  305. window.location.reload();
  306. });
  307. }
  308. function update_input(obj,destination) {
  309. var objVal = $(obj).val();
  310. var objFilter = $(obj).attr('data-filter');
  311. if (objFilter!='') {
  312. objVal = Math.round(eval(objFilter));
  313. }
  314. $(destination).val(objVal);
  315. return true;
  316. }
  317. function finish_todo(obj) {
  318. var objID = $(obj).attr('data-id');
  319. var objState = $(obj).is(':checked');
  320. $.post('/admin/todo/finish',{todo_id: objID, state: objState},function(result) {});
  321. }
  322. function next_block() {
  323. var probe = step+1;
  324. var last = step;
  325. var next_hash = '#step_'+probe;
  326. var last_hash = '#step_'+last;
  327. var obj = $(next_hash);
  328. if (obj.length) {
  329. step++;
  330. $(obj).removeClass('inactive-list').addClass('active-list');
  331. $(last_hash).removeClass('active-list').addClass('inactive-list');
  332. $('.nextBtn').removeAttr('disabled');
  333. $('.prevBtn').removeAttr('disabled');
  334. check_for_prev_next();
  335. }
  336. else {
  337. $('.nextBtn').attr('disabled','true');
  338. }
  339. }
  340. function prev_block() {
  341. var probe = step-1;
  342. var last = step;
  343. var next_hash = '#step_'+probe;
  344. var last_hash = '#step_'+last;
  345. var obj = $(next_hash);
  346. if (obj.length) {
  347. step--;
  348. $(obj).removeClass('inactive-list').addClass('active-list');
  349. $(last_hash).removeClass('active-list').addClass('inactive-list');
  350. $('.nextBtn').removeAttr('disabled');
  351. $('.prevBtn').removeAttr('disabled');
  352. check_for_prev_next();
  353. }
  354. else {
  355. $('.prevBtn').attr('disabled','true');
  356. }
  357. }
  358. function check_for_prev_next() {
  359. var probe = step+1;
  360. var last = step;
  361. var next_hash = '#step_'+probe;
  362. var last_hash = '#step_'+last;
  363. var obj = $(next_hash);
  364. if (obj.length) {
  365. $('.nextBtn').removeAttr('disabled');
  366. }
  367. else {
  368. $('.nextBtn').attr('disabled','true');
  369. }
  370. probe = step-1;
  371. last = step;
  372. next_hash = '#step_'+probe;
  373. last_hash = '#step_'+last;
  374. obj = $(next_hash);
  375. if (obj.length) {
  376. $('.prevBtn').removeAttr('disabled');
  377. }
  378. else {
  379. $('.prevBtn').attr('disabled','true');
  380. }
  381. }
  382. function show_works_add() {
  383. $('#workEditor').slideDown('fast');
  384. }
  385. function update_field(obj,table,field,id,key,currency) {
  386. var new_value = $(obj).val();
  387. $.post('/admin/updater/save',{
  388. table: table,
  389. field: field,
  390. id: id,
  391. value: new_value,
  392. key: key,
  393. currency: currency
  394. },function(result){
  395. $(obj).parent('td').removeClass('in-edit');
  396. $(obj).parent('td').html(result);
  397. });
  398. }
  399. function simple_update_field(obj,table,field,id,key,category) {
  400. var new_value = $(obj).val();
  401. $.post('/admin/factors/save',{
  402. table: table,
  403. field: field,
  404. id: id,
  405. value: new_value,
  406. key: key,
  407. category: category
  408. },function(result){});
  409. }
  410. function update_multiple_field(obj,table,field,id,key,currency) {
  411. var new_value = $(obj).val();
  412. $.post('/admin/multiupdater/save',{
  413. table: table,
  414. field: field,
  415. id: id,
  416. value: new_value,
  417. key: key,
  418. currency: currency
  419. },function(result){
  420. $(obj).parent('td').removeClass('in-edit');
  421. $(obj).parent('td').html(result);
  422. });
  423. }
  424. function update_field_by_object(obj,recolor,reload) {
  425. var new_value = $(obj).val();
  426. var id = $(obj).attr('data-id');
  427. var key = $(obj).attr('data-key');
  428. var table = $(obj).attr('data-table');
  429. var field = $(obj).attr('name');
  430. var is_radio = $(obj).attr('type');
  431. if ($(obj).parent('button').hasClass('radiobtn')) {
  432. if ($(obj).parent('button').children('i').hasClass('fa-dot-circle-o')) {
  433. new_value = '1';
  434. if (recolor==='true') {
  435. $(obj).parent('button').parent('td').parent('tr').removeClass('uj-elem');
  436. }
  437. }
  438. else {
  439. new_value = '2';
  440. if (recolor==='true') {
  441. $(obj).parent('button').parent('td').parent('tr').addClass('uj-elem');
  442. }
  443. }
  444. }
  445. $.post('/admin/updater/save/',{
  446. table: table,
  447. field: field,
  448. id: id,
  449. value: new_value,
  450. key: key
  451. },function(result) {
  452. if (reload==='true') {
  453. window.location.reload();
  454. }
  455. });
  456. }
  457. function update_bill_image(id,obj) {
  458. var filename = $('.uploadedFile').val();
  459. $.post('/admin/bills/updatefile/',{
  460. id: id,
  461. filename: filename
  462. },function(response){
  463. window.location.reload();
  464. });
  465. }
  466. function update_bill(id,obj) {
  467. var filename = $('.uploadedFile').val();
  468. $.post('/admin/costlist/updatebill/',{
  469. id: id,
  470. filename: filename
  471. },function(response){
  472. window.location.reload();
  473. });
  474. }
  475. function update_rajz_image(id,obj) {
  476. var filename = $('.uploadedFile').val();
  477. if (filename!=='') {
  478. $.post('/admin/rajzok/updatefile/',{
  479. id: id,
  480. filename: filename
  481. },function(response){
  482. window.location.reload();
  483. });
  484. }
  485. }
  486. function update_document(id,obj) {
  487. var filename = $('.uploadedFile').val();
  488. $.post('/admin/beszerzes/updatedoc/',{
  489. id: id,
  490. filename: filename
  491. },function(response){
  492. window.location.reload();
  493. });
  494. }
  495. function show_partner_add() {
  496. $('#partnerEditor').toggle('fast');
  497. }
  498. function show_client_add() {
  499. $('#clientEditor').toggle('fast');
  500. }
  501. function show_bill_add() {
  502. $('#editor_form').slideDown('fast');
  503. }
  504. function show_rajz_add() {
  505. $('#editor_form').toggle('fast');
  506. }
  507. function show_beszerzes_add() {
  508. $('#editor_form').toggle();
  509. $('#beszerzesEditor').slideDown('fast');
  510. $('#beszer_uploader').slideDown('fast');
  511. }
  512. function show_group_add(group) {
  513. if (group!=='') {
  514. $('#'+group).toggle('fast');
  515. }
  516. else {
  517. return false;
  518. }
  519. }
  520. function export_xlsx() {
  521. $.post('/admin/costlist/export',function(response) {
  522. window.location=response;
  523. });
  524. }
  525. function export_gyartas_xlsx() {
  526. $.post('/admin/gyartas/export',function(response) {
  527. window.location=response;
  528. });
  529. }
  530. function remove_filter() {
  531. window.location='/admin/costlist/clear';
  532. }
  533. function assign_partner(obj) {
  534. var base_id = $(obj).attr('data-base-id');
  535. var dest_id = $(obj).val();
  536. if (window.confirm('Figyelem! Valóban egyesíteni kívánja a két partnert?')) {
  537. $.post('/admin/partners/assign/',{
  538. base_id: base_id,
  539. dest_id: dest_id
  540. },function(response) {
  541. window.location.reload();
  542. });
  543. }
  544. }
  545. function assign_client(obj) {
  546. var base_id = $(obj).attr('data-base-id');
  547. var dest_id = $(obj).val();
  548. if (window.confirm('Figyelem! Valóban egyesíteni kívánja a két ügyfelet?')) {
  549. $.post('/admin/clients/assign/',{
  550. base_id: base_id,
  551. dest_id: dest_id
  552. },function(response) {
  553. window.location.reload();
  554. });
  555. }
  556. }
  557. function change_currency(obj) {
  558. var actual_currency = $(obj).val();
  559. $.post('/admin/costlist/setcurrency/',{
  560. currency: actual_currency
  561. },function(response){
  562. $('.currency').html(actual_currency);
  563. if (actual_currency!=='HUF') {
  564. $('#arfolyam').show();
  565. $('#egyseg_arfolyam').show();
  566. }
  567. else {
  568. $('#arfolyam').hide();
  569. $('#egyseg_arfolyam').hide();
  570. }
  571. });
  572. }
  573. function set_currency_field(obj) {
  574. var new_value = $(obj).val();
  575. var id = $(obj).attr('data-id');
  576. var key = $(obj).attr('data-key');
  577. var table = $(obj).attr('data-table');
  578. var field = $(obj).attr('name');
  579. $.post('/admin/updater/save',{
  580. table: table,
  581. field: field,
  582. id: id,
  583. value: new_value,
  584. key: key
  585. },function(result){});
  586. }
  587. function radiobtn_set_state(obj) {
  588. var state = $(obj).val();
  589. var on_state = $(obj).attr('data-on-value');
  590. var off_state = $(obj).attr('data-off-value');
  591. var default_state = $(obj).attr('data-default-value');
  592. var on_icon = $(obj).attr('data-on-icon');
  593. var off_icon = $(obj).attr('data-off-icon');
  594. var default_icon = $(obj).attr('data-default-icon');
  595. if (state===default_state) {
  596. $(obj).val(default_state);
  597. $(obj).children('span').html(default_state);
  598. $(obj).children('i').attr('class','fa');
  599. $(obj).children('i').addClass(default_icon);
  600. $(obj).children('input[type=hidden]').val(default_state);
  601. }
  602. else if (state===on_state) {
  603. $(obj).val(on_state);
  604. $(obj).children('span').html(on_state);
  605. $(obj).children('i').attr('class','fa');
  606. $(obj).children('i').addClass(on_icon);
  607. $(obj).children('input[type=hidden]').val(on_state);
  608. }
  609. else if (state===off_state) {
  610. $(obj).val(off_state);
  611. $(obj).children('span').html(off_state);
  612. $(obj).children('i').attr('class','fa');
  613. $(obj).children('i').addClass(off_icon);
  614. $(obj).children('input[type=hidden]').val(off_state);
  615. }
  616. }
  617. function checkbtn_set_state(obj) {
  618. var state = $(obj).val();
  619. var on_state = $(obj).attr('data-on-value');
  620. var off_state = $(obj).attr('data-off-value');
  621. var default_state = $(obj).attr('data-default-value');
  622. var on_icon = $(obj).attr('data-on-icon');
  623. var off_icon = $(obj).attr('data-off-icon');
  624. var default_icon = $(obj).attr('data-default-icon');
  625. if (state===default_state) {
  626. $(obj).val(default_state);
  627. $(obj).children('span').html(default_state);
  628. $(obj).children('i').attr('class','fa');
  629. $(obj).children('i').addClass(default_icon);
  630. }
  631. else if (state===on_state) {
  632. $(obj).val(on_state);
  633. $(obj).children('span').html(on_state);
  634. $(obj).children('i').attr('class','fa');
  635. $(obj).children('i').addClass(on_icon);
  636. }
  637. else if (state===off_state) {
  638. $(obj).val(off_state);
  639. $(obj).children('span').html(off_state);
  640. $(obj).children('i').attr('class','fa');
  641. $(obj).children('i').addClass(off_icon);
  642. }
  643. else {
  644. $(obj).val(default_state);
  645. $(obj).children('span').html(default_state);
  646. $(obj).children('i').attr('class','fa');
  647. $(obj).children('i').addClass(default_icon);
  648. }
  649. }
  650. function checkbtn_change_state(obj) {
  651. var active_state = $(obj).attr('value');
  652. var on_state = $(obj).attr('data-on-value');
  653. var off_state = $(obj).attr('data-off-value');
  654. var default_state = $(obj).attr('data-default-value');
  655. var on_icon = $(obj).attr('data-on-icon');
  656. var off_icon = $(obj).attr('data-off-icon');
  657. var default_icon = $(obj).attr('data-default-icon');
  658. if (active_state===default_state || active_state==='') {
  659. $(obj).val(on_state);
  660. $(obj).children('span').html(on_state);
  661. $(obj).children('i').attr('class','fa');
  662. $(obj).children('i').addClass(on_icon);
  663. $(obj).children('input[type=hidden]').val(on_state);
  664. }
  665. else if (active_state===on_state) {
  666. $(obj).val(off_state);
  667. $(obj).children('span').html(off_state);
  668. $(obj).children('i').attr('class','fa');
  669. $(obj).children('i').addClass(off_icon);
  670. $(obj).children('input[type=hidden]').val(off_state);
  671. }
  672. else if (active_state===off_state) {
  673. $(obj).val(default_state);
  674. $(obj).children('span').html(default_state);
  675. $(obj).children('i').attr('class','fa');
  676. $(obj).children('i').addClass(default_icon);
  677. $(obj).children('input[type=hidden]').val(default_state);
  678. }
  679. }
  680. function radiobtn_change_state(obj,event_trigger,reloader) {
  681. var active_state = $(obj).val();
  682. var on_state = $(obj).attr('data-on-value');
  683. var off_state = $(obj).attr('data-off-value');
  684. var default_state = $(obj).attr('data-default-value');
  685. var on_icon = $(obj).attr('data-on-icon');
  686. var off_icon = $(obj).attr('data-off-icon');
  687. var default_icon = $(obj).attr('data-default-icon');
  688. if (active_state===on_state) {
  689. $(obj).val(off_state);
  690. $(obj).children('span').html(off_state);
  691. $(obj).children('i').attr('class','fa');
  692. $(obj).children('i').addClass(off_icon);
  693. $(obj).children('input[type=hidden]').val(off_state);
  694. $(obj).removeClass('btn-success');
  695. $(obj).addClass('btn-info');
  696. }
  697. else if (active_state===off_state) {
  698. $(obj).val(on_state);
  699. $(obj).children('span').html(on_state);
  700. $(obj).children('i').attr('class','fa');
  701. $(obj).children('i').addClass(on_icon);
  702. $(obj).children('input[type=hidden]').val(on_state);
  703. $(obj).removeClass('btn-info');
  704. $(obj).addClass('btn-success');
  705. }
  706. if (event_trigger===true) {
  707. $(obj).children('input[type=hidden]').trigger('change');
  708. }
  709. }
  710. function set_currency_field(obj) {
  711. }
  712. function show_partner_details(partner_details,obj) {
  713. if ($(partner_details).css('display')==='block') {
  714. $('.partner-details').hide();
  715. }
  716. else {
  717. $('.partner-details').hide();
  718. $(partner_details).show();
  719. }
  720. }
  721. function show_client_details(client_details,obj) {
  722. if ($(client_details).css('display')==='block') {
  723. $('.client-details').hide();
  724. }
  725. else {
  726. $('.client-details').hide();
  727. $(client_details).show();
  728. }
  729. }
  730. function editable(obj,update_parts) {
  731. if (!$(obj).hasClass('in-edit')) {
  732. $(obj).addClass('in-edit');
  733. var actual_value = $(obj).html();
  734. console.log(actual_value);
  735. var currency = $(obj).attr('data-currency');
  736. if (currency==='true') {
  737. actual_value = actual_value.replace(",- Ft","");
  738. actual_value = actual_value.replace(" ","");
  739. }
  740. var field_name = $(obj).attr('data-field');
  741. var table_name = $(obj).attr('data-table');
  742. var row_id = $(obj).attr('data-id');
  743. var key = $(obj).attr('data-key');
  744. if (update_parts==true) {
  745. $(obj).html('<input style="width: 100%;" type="text" name="'+field_name+'" id="'+field_name+'" value="'+actual_value+'" class="form-control edit" onblur="javascript: update_field($(this),\''+table_name+'\',\''+field_name+'\',\''+row_id+'\',\''+key+'\',\''+currency+'\'); window.location=\'/admin/rendelesek/\';">');
  746. }
  747. else {
  748. $(obj).html('<input style="width: 100%;" type="text" name="'+field_name+'" id="'+field_name+'" value="'+actual_value+'" class="form-control edit" onblur="javascript: update_field($(this),\''+table_name+'\',\''+field_name+'\',\''+row_id+'\',\''+key+'\',\''+currency+'\');">');
  749. }
  750. $('#'+field_name).focus();
  751. }
  752. }
  753. function multiple_editable(obj) {
  754. if (!$(obj).hasClass('in-edit')) {
  755. $(obj).addClass('in-edit');
  756. var actual_value = $(obj).html();
  757. console.log(actual_value);
  758. var currency = $(obj).attr('data-currency');
  759. if (currency==='true') {
  760. actual_value = actual_value.replace(",- Ft","");
  761. actual_value = actual_value.replace(" ","");
  762. }
  763. var field_name = $(obj).attr('data-field');
  764. var table_name = $(obj).attr('data-table');
  765. var row_id = $(obj).attr('data-id');
  766. var key = $(obj).attr('data-key');
  767. $(obj).html('<input type="text" name="'+field_name+'" id="'+field_name+'" value="'+actual_value+'" class="form-control edit" onblur="update_multiple_field($(this),\''+table_name+'\',\''+field_name+'\',\''+row_id+'\',\''+key+'\',\''+currency+'\')">');
  768. $('#'+field_name).focus();
  769. }
  770. }
  771. function open_upload(obj) {
  772. $(obj).parent('div').children('.myuploader').click();
  773. }
  774. function start_upload(obj) {
  775. var input = obj;
  776. var files = input.files;
  777. var data = new FormData();
  778. var id = $(obj).attr('data-id');
  779. $.each(files, function(key, value) {
  780. data.append(key, value);
  781. });
  782. data.append('id',id);
  783. var old = $(obj).parent('div').children('.uploder').html();
  784. $(obj).parent('div').children('.uploder').html('<i class="fa fa-circle-o-notch fa-spin"></i>');
  785. $.ajax({
  786. url: '/admin/bills/updatefile/',
  787. type: 'POST',
  788. data: data,
  789. cache: false,
  790. processData: false,
  791. contentType: false,
  792. success: function(resp) {
  793. $(obj).parent('div').children('.uploder').html('<i class="fa fa-check"></i>');
  794. $(obj).parent('div').children('.bill-image').attr('href',resp);
  795. $(obj).parent('div').children('.bill-image').children('button').children('i').attr('class','fa fa-eye');
  796. var clearIcon = setInterval(function() {
  797. $(obj).parent('div').children('.uploder').html(old);
  798. clearInterval(clearIcon);
  799. },3000);
  800. }
  801. });
  802. }
  803. function start_upload_rajz(obj) {
  804. var input = obj;
  805. var files = input.files;
  806. var data = new FormData();
  807. var id = $(obj).attr('data-id');
  808. $.each(files, function(key, value) {
  809. data.append(key, value);
  810. });
  811. data.append('id',id);
  812. var old = $(obj).parent('div').children('.uploder').html();
  813. $(obj).parent('div').children('.uploder').html('<i class="fa fa-circle-o-notch fa-spin"></i>');
  814. $.ajax({
  815. url: '/admin/rajzok/updatefile/',
  816. type: 'POST',
  817. data: data,
  818. cache: false,
  819. processData: false,
  820. contentType: false,
  821. success: function(resp) {
  822. $(obj).parent('div').children('.uploder').html('<i class="fa fa-check"></i>');
  823. $(obj).parent('div').children('.bill-image').attr('href',resp);
  824. var clearIcon = setInterval(function() {
  825. $(obj).parent('div').children('.uploder').html(old);
  826. clearInterval(clearIcon);
  827. },3000);
  828. }
  829. });
  830. }
  831. function start_upload_document(obj) {
  832. var input = obj;
  833. var files = input.files;
  834. var data = new FormData();
  835. var id = $(obj).attr('data-id');
  836. $.each(files, function(key, value) {
  837. data.append(key, value);
  838. });
  839. data.append('id',id);
  840. data.append('MAX_FILE_SIZE','90000000');
  841. var old = $(obj).parent('div').children('.uploder').html();
  842. $(obj).parent('div').children('.uploder').html('<i class="fa fa-circle-o-notch fa-spin"></i>');
  843. $.ajax({
  844. url: '/admin/sales/updatefile/',
  845. type: 'POST',
  846. data: data,
  847. cache: false,
  848. processData: false,
  849. contentType: false,
  850. success: function(resp) {
  851. $(obj).parent('div').children('.uploder').html('<i class="fa fa-check"></i>');
  852. $(obj).parent('div').children('.bill-image').attr('href',resp);
  853. var clearIcon = setInterval(function() {
  854. $(obj).parent('div').children('.uploder').html(old);
  855. clearInterval(clearIcon);
  856. },3000);
  857. }
  858. });
  859. }
  860. function start_upload_techno(obj) {
  861. var input = obj;
  862. var files = input.files;
  863. var data = new FormData();
  864. var id = $(obj).attr('data-id');
  865. $.each(files, function(key, value) {
  866. data.append(key, value);
  867. });
  868. data.append('id',id);
  869. var old = $(obj).parent('div').children('.uploder').html();
  870. $(obj).parent('div').children('.uploder').html('<i class="fa fa-circle-o-notch fa-spin"></i>');
  871. $.ajax({
  872. url: '/admin/techno/updatefile/',
  873. type: 'POST',
  874. data: data,
  875. cache: false,
  876. processData: false,
  877. contentType: false,
  878. success: function(resp) {
  879. $(obj).parent('div').children('.uploder').html('<i class="fa fa-check"></i>');
  880. $(obj).parent('div').children('.bill-image').attr('href',resp);
  881. var clearIcon = setInterval(function() {
  882. $(obj).parent('div').children('.uploder').html(old);
  883. clearInterval(clearIcon);
  884. },3000);
  885. }
  886. });
  887. }
  888. function start_upload_beszer(obj) {
  889. var input = obj;
  890. var files = input.files;
  891. var data = new FormData();
  892. var id = $(obj).attr('data-id');
  893. $.each(files, function(key, value) {
  894. data.append(key, value);
  895. });
  896. data.append('id',id);
  897. var old = $(obj).parent('div').children('.uploder').html();
  898. $(obj).parent('div').children('.uploder').html('<i class="fa fa-circle-o-notch fa-spin"></i>');
  899. $.ajax({
  900. url: '/admin/beszerzes/updatedoc/',
  901. type: 'POST',
  902. data: data,
  903. cache: false,
  904. processData: false,
  905. contentType: false,
  906. success: function(resp) {
  907. $(obj).parent('div').children('.uploder').html('<i class="fa fa-check"></i>');
  908. $(obj).parent('div').children('.bill-image').attr('href',resp);
  909. var clearIcon = setInterval(function() {
  910. $(obj).parent('div').children('.uploder').html(old);
  911. clearInterval(clearIcon);
  912. },3000);
  913. }
  914. });
  915. }
  916. function show_bill(e,obj) {
  917. e.preventDefault();
  918. $(obj).orangeBox('create');
  919. }
  920. function scroll_left(obj) {
  921. $('#scroller').scrollLeft($('#scroller').scrollLeft()-100);
  922. }
  923. function scroll_right() {
  924. $('#scroller').scrollLeft($('#scroller').scrollLeft()+100);
  925. }
  926. function set_kategoria_state() {
  927. var act = $('#cost_type_id').val();
  928. if (act==='9' || act==='11') {
  929. $('#cost_category_id').val('');
  930. $('#cost_category_id').attr('disabled','true');
  931. }
  932. else {
  933. $('#cost_category_id').removeAttr('disabled');
  934. }
  935. }
  936. function set_filters_partner(obj) {
  937. var values = $(obj).val();
  938. if (values!==null) {
  939. $('#clients_filter').hide();
  940. temps = $('#filter_forras').children('optgroup[label="bevétel"]');
  941. $('#filter_forras').children('optgroup[label="bevétel"]').remove();
  942. $(".mypayment").select2({placeholder: 'Válasszon fizetési módot!'});
  943. }
  944. else {
  945. $('#clients_filter').show();
  946. $('#filter_forras').prepend(temps);
  947. $(".mypayment").select2({placeholder: 'Válasszon fizetési módot!'});
  948. }
  949. }
  950. function set_filters_client(obj) {
  951. var values = $(obj).val();
  952. if (values!==null) {
  953. $('#partners_filter').hide();
  954. temps = $('#filter_forras').children('optgroup[label="kiadás"]');
  955. $('#filter_forras').children('optgroup[label="kiadás"]').remove();
  956. $(".mypayment").select2({placeholder: 'Válasszon fizetési módot!'});
  957. }
  958. else {
  959. $('#partners_filter').show();
  960. $('#filter_forras').append(temps);
  961. $(".mypayment").select2({placeholder: 'Válasszon fizetési módot!'});
  962. }
  963. }
  964. function client_text(obj) {
  965. var value = $(obj).val();
  966. if (value!=='' && value!=='undefined' && value!==null) {
  967. $('#cost_partner').attr('disabled','true');
  968. $('#cost_type_id').children('option[value=7]').hide();
  969. $('#cost_type_id').children('option[value="12"]').hide();
  970. $('#cost_type_id').children('option[value="44"]').hide();
  971. $('#cost_category_id').attr('disabled','true');
  972. }
  973. else {
  974. $('#cost_partner').removeAttr('disabled');
  975. $('#cost_type_id').children('option[value=7]').show();
  976. $('#cost_type_id').children('option[value="12"]').show();
  977. $('#cost_type_id').children('option[value="44"]').show();
  978. $('#cost_category_id').removeAttr('disabled');
  979. }
  980. }
  981. function partner_text(obj) {
  982. var value = $(obj).val();
  983. if (value!=='' && value!=='undefined' && value!==null) {
  984. $('#cost_client').attr('disabled','true');
  985. $('#cost_type_id').children('option[value="9"]').hide();
  986. $('#cost_type_id').children('option[value="11"]').hide();
  987. }
  988. else {
  989. $('#cost_client').removeAttr('disabled');
  990. $('#cost_type_id').children('option[value="9"]').show();
  991. $('#cost_type_id').children('option[value="11"]').show();
  992. }
  993. }
  994. function set_egyseg_forall() {
  995. var egyseg = $('#rajz_egyseg :selected').html();
  996. $('#rajz_min_rendeles').next('span').html(egyseg);
  997. $('#rajz_alert').next('span').html(egyseg);
  998. }
  999. function add_alkatresz(obj,reszegyseg,altipus) {
  1000. $.post('/admin/gyartas/addalkatresz/',{
  1001. reszegyseg: reszegyseg,
  1002. altipus: altipus
  1003. },function(resp) {
  1004. window.location.reload();
  1005. });
  1006. }
  1007. function add_altipus(obj,reszegyseg) {
  1008. $.post('/admin/gyartas/addaltipus/',{
  1009. reszegyseg: reszegyseg
  1010. },function(resp) {
  1011. window.location.reload();
  1012. });
  1013. }
  1014. function add_reszegyseg(obj) {
  1015. $.post('/admin/gyartas/addreszegyseg/',{},function(resp) {
  1016. window.location.reload();
  1017. });
  1018. }
  1019. function allocate_parts(id) {
  1020. window.location='/admin/rendelesek/allocate/?id='+id;
  1021. // $.post('/admin/rendelesek/allocate/',{
  1022. // id: id
  1023. // },function(response) {
  1024. // window.location.reload();
  1025. // });
  1026. }
  1027. function get_gep_data(gep) {
  1028. $.post('/admin/gyartas/gepinfo/',{gep: gep},function(response) {
  1029. $('#dialog').html(response);
  1030. $('.wrapper').addClass('blur');
  1031. $('#dialog').modal({
  1032. escapeClose: true,
  1033. clickClose: true,
  1034. showClose: true
  1035. });
  1036. });
  1037. }
  1038. function get_cikknev_data(obj,target) {
  1039. $.post('/admin/autocomplete/getcikknev/',{value: $(obj).val()},function(resp) {
  1040. if (resp=='') {
  1041. $(target).removeAttr('disabled');
  1042. }
  1043. else {
  1044. $(target).val(resp);
  1045. $(target).attr('disabled','true');
  1046. }
  1047. });
  1048. }
  1049. function get_cikkszam_data(obj,target) {
  1050. $.post('/admin/autocomplete/getcikkszam/',{value: $(obj).val()},function(resp) {
  1051. if (resp=='') {
  1052. $(target).removeAttr('disabled');
  1053. }
  1054. else {
  1055. $(target).val(resp);
  1056. $(target).attr('disabled','true');
  1057. }
  1058. });
  1059. }
  1060. function set_admin_email_notifications(obj,id) {
  1061. $.post('/admin/admins/notifications/',{id: id},function(resp) {});
  1062. }
  1063. function set_admin_creator(admin_id, creator_id) {
  1064. $.post('/admin/admins/setcreator/',{admin_id: admin_id, admin_creator: creator_id},function(resp) {});
  1065. }
  1066. function add_new_referens() {
  1067. $.get('/admin/ertekeles/referenskereses',function(resp) {
  1068. $('#dialog').html(resp);
  1069. $('.wrapper').addClass('blur');
  1070. $('#dialog').modal({
  1071. escapeClose: true,
  1072. clickClose: true,
  1073. showClose: true
  1074. });
  1075. $(".select2").select2({
  1076. dropdownParent: $('#dialog')
  1077. });
  1078. });
  1079. }
  1080. function add_new_iroda() {
  1081. $.get('/admin/irodak/irodakereses',function(resp) {
  1082. $('#dialog').html(resp);
  1083. $('.wrapper').addClass('blur');
  1084. $('#dialog').modal({
  1085. escapeClose: true,
  1086. clickClose: true,
  1087. showClose: true
  1088. });
  1089. $(".select2").select2({
  1090. dropdownParent: $('#dialog')
  1091. });
  1092. });
  1093. }
  1094. function setIrodaState(id) {
  1095. $.get('/admin/irodak/setstate/?id='+id,function(resp) {
  1096. });
  1097. }
  1098. function add_agent_to_db(id) {
  1099. $.get('/admin/ertekeles/addreferens/?id='+id,function(resp) {
  1100. window.location='/admin/ertekeles/edit/?id='+resp;
  1101. });
  1102. }
  1103. function add_iroda_to_db(id) {
  1104. $.get('/admin/irodak/addiroda/?id='+id,function(resp) {
  1105. window.location='/admin/irodak/edit/?id='+resp;
  1106. });
  1107. }
  1108. function isNumber(evt) {
  1109. evt = (evt) ? evt : window.event;
  1110. var charCode = (evt.which) ? evt.which : evt.keyCode;
  1111. if (charCode==46) {
  1112. return true;
  1113. }
  1114. else {
  1115. if (charCode > 31 && (charCode < 48 || charCode > 57)) {
  1116. return false;
  1117. }
  1118. return true;
  1119. }
  1120. }
  1121. function loadEvents(groupID) {
  1122. if (groupID!=='') {
  1123. $.get('/api/loadevents/?groupid=' + groupID,function(resp) {
  1124. $('#parent_event').html(resp);
  1125. });
  1126. }
  1127. }
  1128. function loadMenu(eventID) {
  1129. if (eventID!=='') {
  1130. $.get('/api/loadmenus/?eventid=' + eventID,function(resp) {
  1131. $('#parent_menu').html(resp);
  1132. });
  1133. }
  1134. }
  1135. function loadProds(groupID) {
  1136. if (groupID!=='') {
  1137. $.get('/api/loadprods/?groupid=' + groupID,function(resp) {
  1138. $('#parent_prods').html(resp);
  1139. });
  1140. }
  1141. }
  1142. function loadMenuDetails(obj) {
  1143. var label = $(obj).find(':selected').data('label');
  1144. var description = $(obj).find(':selected').data('description');
  1145. var price = $(obj).find(':selected').data('price');
  1146. console.log(label, description, price);
  1147. $('#box_title').val(label);
  1148. $('#box_subtitle').val(description);
  1149. $('#box_price').val(price);
  1150. }
  1151. $(document).ready(function() {
  1152. $('.checkbtn').each(function() {
  1153. //checkbtn_set_state($(this));
  1154. });
  1155. if (active_page.indexOf('beszerzes')==-1) {
  1156. $('.radiobtn').each(function() {
  1157. radiobtn_set_state($(this));
  1158. });
  1159. }
  1160. $('#page_content').trumbowyg({
  1161. btnsDef: {
  1162. image: {
  1163. dropdown: ['insertImage', 'upload'],
  1164. ico: 'insertImage'
  1165. }
  1166. },
  1167. btns: [
  1168. ['viewHTML'],
  1169. ['formatting'],
  1170. ['foreColor', 'backColor'],
  1171. ['strong', 'em', 'del'],
  1172. ['superscript', 'subscript'],
  1173. ['link'],
  1174. ['image'],
  1175. ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
  1176. ['unorderedList', 'orderedList'],
  1177. ['horizontalRule'],
  1178. ['removeformat'],
  1179. ['fullscreen']
  1180. ],
  1181. plugins: {
  1182. upload: {
  1183. serverPath: '/upload.php',
  1184. fileFieldName: 'image',
  1185. urlPropertyName: 'data.link'
  1186. }
  1187. }
  1188. });
  1189. $('#page_content_en').trumbowyg({
  1190. btnsDef: {
  1191. image: {
  1192. dropdown: ['insertImage', 'upload'],
  1193. ico: 'insertImage'
  1194. }
  1195. },
  1196. btns: [
  1197. ['viewHTML'],
  1198. ['formatting'],
  1199. ['foreColor', 'backColor'],
  1200. ['strong', 'em', 'del'],
  1201. ['superscript', 'subscript'],
  1202. ['link'],
  1203. ['image'],
  1204. ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
  1205. ['unorderedList', 'orderedList'],
  1206. ['horizontalRule'],
  1207. ['removeformat'],
  1208. ['fullscreen']
  1209. ],
  1210. plugins: {
  1211. upload: {
  1212. serverPath: '/upload.php',
  1213. fileFieldName: 'image',
  1214. urlPropertyName: 'data.link'
  1215. }
  1216. }
  1217. });
  1218. $('#battle_start').datetimepicker();
  1219. $('#battle_end').datetimepicker();
  1220. check_for_prev_next();
  1221. $('#dialog').on($.modal.BEFORE_CLOSE,function(event,modal) {
  1222. $('.wrapper').removeClass('blur');
  1223. });
  1224. $('.roles').on('click',function(event) {
  1225. var roleID = $(this).attr('data-role-id');
  1226. var moduleID = $(this).attr('data-module-id');
  1227. setModuleRoleStatus(roleID,moduleID);
  1228. });
  1229. $('.states').on('ifChecked',function(event) {
  1230. var userID = $(this).val();
  1231. setUserState(userID);
  1232. });
  1233. $('.states').on('ifUnchecked',function(event) {
  1234. var userID = $(this).val();
  1235. setUserState(userID);
  1236. });
  1237. $('.galery-image-item').on('mouseover',function() {
  1238. $(this).children('.minimal').show();
  1239. $(this).children('.deleter').show();
  1240. });
  1241. $('.galery-image-item').on('mouseout',function() {
  1242. $(this).children('.minimal').hide();
  1243. $(this).children('.deleter').hide();
  1244. });
  1245. $('.variation_status').on('ifChecked',function(event) {
  1246. set_variation_status($(this),true);
  1247. });
  1248. $('.variation_status').on('ifUnchecked',function(event) {
  1249. set_variation_status($(this),false);
  1250. });
  1251. $('.szuro').on('click',function() {
  1252. var filter = '.'+$(this).val();
  1253. $('.all').hide();
  1254. $(filter).show();
  1255. });
  1256. $('.editable').on("click",function() {
  1257. if (!$(this).hasClass('in-edit')) {
  1258. $(this).addClass('in-edit');
  1259. var actual_value = $(this).html();
  1260. var currency = $(this).attr('data-currency');
  1261. if (currency==='true') {
  1262. actual_value = actual_value.replace(",- Ft","");
  1263. actual_value = actual_value.replace(" ","");
  1264. }
  1265. var field_name = $(this).attr('data-field');
  1266. var table_name = $(this).attr('data-table');
  1267. var row_id = $(this).attr('data-id');
  1268. var key = $(this).attr('data-key');
  1269. $(this).html('<input type="text" name="'+field_name+'" id="'+field_name+'" value="'+actual_value+'" class="form-control edit" onblur="update_field($(this),\''+table_name+'\',\''+field_name+'\',\''+row_id+'\',\''+key+'\',\''+currency+'\')">');
  1270. $('#'+field_name).focus();
  1271. }
  1272. });
  1273. $(".select2").select2();
  1274. $(".mypartner").select2({placeholder: 'Válasszon partnert!'});
  1275. $(".fmachines").select2({placeholder: 'Válasszon gépet!'});
  1276. $(".fparts").select2({placeholder: 'Válasszon részegységet!'});
  1277. $(".myclient").select2({placeholder: 'Válasszon ügyfelet!'});
  1278. $(".mypayment").select2({placeholder: 'Válasszon fizetési módot!'});
  1279. $(".mycategory").select2({placeholder: 'Válasszon kategóriát!'});
  1280. $('.datepicker').datepicker({
  1281. autoclose: true
  1282. });
  1283. $('#cost_partner').autocomplete({
  1284. source: function(request,response) {
  1285. $.ajax({
  1286. url: '/admin/autocomplete/search/',
  1287. dataType: "jsonp",
  1288. data: {
  1289. term: request.term
  1290. },
  1291. success: function(data) {
  1292. response(data);
  1293. }
  1294. });
  1295. },
  1296. minLength: 1
  1297. });
  1298. $('#cost_client').autocomplete({
  1299. source: function(request,response) {
  1300. $.ajax({
  1301. url: '/admin/autocomplete/search_client/',
  1302. dataType: "jsonp",
  1303. data: {
  1304. term: request.term
  1305. },
  1306. success: function(data) {
  1307. response(data);
  1308. }
  1309. });
  1310. },
  1311. minLength: 1
  1312. });
  1313. $('.rendeles_ugyfel').autocomplete({
  1314. source: function(request,response) {
  1315. $.ajax({
  1316. url: '/admin/autocomplete/search_client/',
  1317. dataType: "jsonp",
  1318. data: {
  1319. term: request.term
  1320. },
  1321. success: function(data) {
  1322. response(data);
  1323. }
  1324. });
  1325. },
  1326. minLength: 1
  1327. });
  1328. $('#filter_bill_number').autocomplete({
  1329. source: function(request,response) {
  1330. $.ajax({
  1331. url: '/admin/autobill/search/',
  1332. dataType: "jsonp",
  1333. data: {
  1334. term: request.term
  1335. },
  1336. success: function(data) {
  1337. response(data);
  1338. }
  1339. });
  1340. },
  1341. minLength: 1
  1342. });
  1343. $('#cost_bill_number').autocomplete({
  1344. source: function(request,response) {
  1345. $.ajax({
  1346. url: '/admin/autobill/search/',
  1347. dataType: "jsonp",
  1348. data: {
  1349. term: request.term
  1350. },
  1351. success: function(data) {
  1352. response(data);
  1353. }
  1354. });
  1355. },
  1356. minLength: 1
  1357. });
  1358. $('#beszer_beepites_cikkszam').autocomplete({
  1359. source: function(request,response) {
  1360. $.ajax({
  1361. url: '/admin/autocikkszam/search/',
  1362. dataType: "jsonp",
  1363. data: {
  1364. term: request.term
  1365. },
  1366. success: function(data) {
  1367. response(data);
  1368. }
  1369. });
  1370. },
  1371. minLength: 1
  1372. });
  1373. $('#filter_comment').autocomplete({
  1374. source: function(request,response) {
  1375. $.ajax({
  1376. url: '/admin/autocomment/search/',
  1377. dataType: "jsonp",
  1378. data: {
  1379. term: request.term
  1380. },
  1381. success: function(data) {
  1382. response(data);
  1383. }
  1384. });
  1385. },
  1386. minLength: 1
  1387. });
  1388. $('#cost_egyseg_cikkszam').autocomplete({
  1389. source: function(request,response) {
  1390. $.ajax({
  1391. url: '/admin/autocomplete/cikkszam/',
  1392. dataType: "jsonp",
  1393. data: {
  1394. term: request.term
  1395. },
  1396. success: function(data) {
  1397. response(data);
  1398. }
  1399. });
  1400. },
  1401. minLength: 1
  1402. });
  1403. $('#cost_egyseg_nev').autocomplete({
  1404. source: function(request,response) {
  1405. $.ajax({
  1406. url: '/admin/autocomplete/cikknev/',
  1407. dataType: "jsonp",
  1408. data: {
  1409. term: request.term
  1410. },
  1411. success: function(data) {
  1412. response(data);
  1413. }
  1414. });
  1415. },
  1416. minLength: 1
  1417. });
  1418. $('#beszer_termek').autocomplete({
  1419. source: function(request,response) {
  1420. $.ajax({
  1421. url: '/admin/autotermek/search/',
  1422. dataType: "jsonp",
  1423. data: {
  1424. term: request.term
  1425. },
  1426. success: function(data) {
  1427. response(data);
  1428. }
  1429. });
  1430. },
  1431. minLength: 1
  1432. });
  1433. $('#beszer_anyagminoseg').autocomplete({
  1434. source: function(request,response) {
  1435. $.ajax({
  1436. url: '/admin/autominoseg/search/',
  1437. dataType: "jsonp",
  1438. data: {
  1439. term: request.term
  1440. },
  1441. success: function(data) {
  1442. response(data);
  1443. }
  1444. });
  1445. },
  1446. minLength: 1
  1447. });
  1448. $('#beszer_egyseg').autocomplete({
  1449. source: function(request,response) {
  1450. $.ajax({
  1451. url: '/admin/autoegyseg/search/',
  1452. dataType: "jsonp",
  1453. data: {
  1454. term: request.term
  1455. },
  1456. success: function(data) {
  1457. response(data);
  1458. }
  1459. });
  1460. },
  1461. minLength: 1
  1462. });
  1463. $('#beszer_kategoria').autocomplete({
  1464. source: function(request,response) {
  1465. $.ajax({
  1466. url: '/admin/autokategoria/search/',
  1467. dataType: "jsonp",
  1468. data: {
  1469. term: request.term
  1470. },
  1471. success: function(data) {
  1472. response(data);
  1473. }
  1474. });
  1475. },
  1476. minLength: 1
  1477. });
  1478. $('.uploadMe').on('click',function() {
  1479. //$.post('/admin/bills/updatefile',{id: },function(response) {});
  1480. });
  1481. var msg_timer = setTimeout(function() {
  1482. $('.callout-success').hide();
  1483. },3000);
  1484. $('#mytable').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1485. $('#mytable2').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1486. $('#mytable3').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1487. $('#mytable_tech').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1488. $('#mytable_rendelesek').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1489. //$('#mytable4').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1490. //$('#mytable5').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1491. $('#mytable6').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1492. $('#mytable7').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1493. $('#mytablex').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1494. $('#mytablex').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1495. $('#mytable_s1').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1496. $('#mytable_s2').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1497. $('#mytable_s3').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1498. $('#mytable_s4').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1499. //$('#mytable_hotels_forselect').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1500. //$('#mytable_hotels_selected').wrap('<div style="overflow-x: scroll;" id="scroller"></div>');
  1501. $('.main-header').swipe({
  1502. swipe: function(event, direction, distance, duration, fingerCount, fingerData) {
  1503. if ($('.skin-black').hasClass('sidebar-collapse')) {
  1504. $('.skin-black').removeClass('sidebar-collapse');
  1505. $('#fogantyu').css('left','0px');
  1506. }
  1507. else {
  1508. $('.skin-black').addClass('sidebar-collapse');
  1509. $('#fogantyu').css('left','230px');
  1510. }
  1511. if ($('.skin-black').hasClass('sidebar-open')) {
  1512. $('.skin-black').removeClass('sidebar-open');
  1513. }
  1514. else {
  1515. $('.skin-black').addClass('sidebar-open');
  1516. }
  1517. }
  1518. });
  1519. $('.main-sidebar').swipe({
  1520. swipe: function(event, direction, distance, duration, fingerCount, fingerData) {
  1521. if ($('.skin-black').hasClass('sidebar-collapse')) {
  1522. $('.skin-black').removeClass('sidebar-collapse');
  1523. $('#fogantyu').css('left','0px');
  1524. }
  1525. else {
  1526. $('.skin-black').addClass('sidebar-collapse');
  1527. $('#fogantyu').css('left','230px');
  1528. }
  1529. if ($('.skin-black').hasClass('sidebar-open')) {
  1530. $('.skin-black').removeClass('sidebar-open');
  1531. }
  1532. else {
  1533. $('.skin-black').addClass('sidebar-open');
  1534. }
  1535. }
  1536. });
  1537. $('#fogantyu').swipe({
  1538. swipe: function(event, direction, distance, duration, fingerCount, fingerData) {
  1539. if ($('.skin-black').hasClass('sidebar-collapse')) {
  1540. $('.skin-black').removeClass('sidebar-collapse');
  1541. $('#fogantyu').css('left','0px');
  1542. }
  1543. else {
  1544. $('.skin-black').addClass('sidebar-collapse');
  1545. $('#fogantyu').css('left','230px');
  1546. }
  1547. if ($('.skin-black').hasClass('sidebar-open')) {
  1548. $('.skin-black').removeClass('sidebar-open');
  1549. }
  1550. else {
  1551. $('.skin-black').addClass('sidebar-open');
  1552. }
  1553. }
  1554. });
  1555. if (screen.width<767) {
  1556. $('#coll-hack').addClass('collapsed-box');
  1557. $('#coll-sign').removeClass('fa-minus');
  1558. $('#coll-sign').addClass('fa-plus');
  1559. }
  1560. });
  1561. $(window).resize(function() {
  1562. if (screen.width<767) {
  1563. $('#coll-hack').addClass('collapsed-box');
  1564. $('#coll-sign').removeClass('fa-minus');
  1565. $('#coll-sign').addClass('fa-plus');
  1566. }
  1567. else {
  1568. $('#coll-hack').removeClass('collapsed-box');
  1569. $('#coll-sign').removeClass('fa-plus');
  1570. $('#coll-sign').addClass('fa-minus');
  1571. }
  1572. });