admin_functions.js 53 KB

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