admin_functions.js 50 KB

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