PageRenderTime 45ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/web/OrganicPM/templates/default/templates/admin/jsReady.tpl

http://praticarh.googlecode.com/
Smarty Template | 346 lines | 281 code | 65 blank | 0 comment | 33 complexity | b7157654af9988bcabfd9a0662439cfb MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. {literal}
  2. //Background
  3. var bgHeight = $('#background img').css('height').substr(0, 3);
  4. var height = bgHeight - 130;
  5. $('#background img').css({'height' : height+'px'});
  6. //Reajuste de largura
  7. var width = $(window).width() - 460;
  8. $('#content #content-wrapper #right').css({'width' : width+'px'});
  9. $('.item .item_title').click(function(){
  10. if ($(this).parent().children('ul').css('display') == "none")
  11. $(this).parent().children('ul').fadeIn("slow");
  12. else
  13. $(this).parent().children('ul').fadeOut("slow");
  14. return false;
  15. });
  16. //Tabs
  17. $("#tabs").tabs();
  18. $('#descricao').limit('300','#li_1 .left');
  19. $("#data_inicio, #inscricoes_ate, #data_fim, #fase_data_inicio, #fase_data_fim").datepicker({ dateFormat: 'dd/mm/yy' });
  20. ////////////////////////////////////////
  21. // #tabs-1
  22. ////////////////////////////////////////
  23. $('#tabs-1 .next').click(function() {
  24. var procsel_erro = false;
  25. var descricao = $('#descricao').val();
  26. var data_inicio = $('#data_inicio').val();
  27. var data_fim = $('#data_fim').val();
  28. var insc_ate = $('#inscricoes_ate').val();
  29. var vagas = $('#vagas').val();
  30. var cargo = $('#cargo option:selected').val();
  31. if (!descricao)
  32. {
  33. $('#tabs-1 #li_1 .error').html("Preenchimento obrigatório");
  34. $('#tabs-1 #li_1 .error').show();
  35. procsel_erro = true;
  36. }
  37. else
  38. $('#tabs-1 #li_1 .error').hide();
  39. if (!insc_ate)
  40. {
  41. $('#tabs-1 #li_6 .error').html("Preenchimento obrigatório");
  42. $('#tabs-1 #li_6 .error').show();
  43. procsel_erro = true;
  44. }
  45. else
  46. $('#tabs-1 #li_6 .error').hide();
  47. if (!data_inicio)
  48. {
  49. $('#tabs-1 #li_2 .error').html("Preenchimento obrigatório");
  50. $('#tabs-1 #li_2 .error').show();
  51. procsel_erro = true;
  52. }
  53. else
  54. $('#tabs-1 #li_2 .error').hide();
  55. if (!data_fim)
  56. {
  57. $('#tabs-1 #li_3 .error').html("Preenchimento obrigatório");
  58. $('#tabs-1 #li_3 .error').show();
  59. procsel_erro = true;
  60. }
  61. else
  62. $('#tabs-1 #li_3 .error').hide();
  63. if (!vagas)
  64. {
  65. $('#tabs-1 #li_4 .error').html("Preenchimento obrigatório");
  66. $('#tabs-1 #li_4 .error').show();
  67. procsel_erro = true;
  68. }
  69. else
  70. $('#tabs-1 #li_4 .error').hide();
  71. if (!cargo)
  72. {
  73. $('#tabs-1 #li_5 .error').html("Preenchimento obrigatório");
  74. $('#tabs-1 #li_5 .error').show();
  75. procsel_erro = true;
  76. }
  77. else
  78. $('#tabs-1 #li_5 .error').hide();
  79. if (procsel_erro == false)
  80. {
  81. var $tabs = $('#tabs').tabs();
  82. $tabs.tabs('select', 1);
  83. }
  84. });
  85. ////////////////////////////////////////
  86. // #tabs-2
  87. ////////////////////////////////////////
  88. var edit = false;
  89. var clearFase = function() {
  90. $('#fase_tipo').val("");
  91. $('#fase_data_inicio').val("");
  92. $('#fase_data_fim').val("");
  93. $('#teste').val("");
  94. $('#nota').val("");
  95. $('#tabs-2 #li_4').hide();
  96. $('#tabs-2 #li_5').hide();
  97. }
  98. $('#fase_tipo').change(function(){
  99. var fase_tipo = $('#fase_tipo option:selected').html();
  100. if (fase_tipo.search("Teste") != -1)
  101. {
  102. $('#teste').load("list_testes.php");
  103. $('#nota').load("list_notas.php");
  104. $('#tabs-2 #li_5,#tabs-2 #li_4').fadeIn("slow");
  105. }
  106. else
  107. {
  108. $('#tabs-2 #li_5,#tabs-2 #li_4').fadeOut("slow");
  109. }
  110. });
  111. $('.delete').click(function(){
  112. $(this).parent().remove();
  113. });
  114. $('.edit').click(function(){
  115. edit = $(this).parent();
  116. var id = '#'+$(this).parent().attr("id")+' ';
  117. var fase_nome = $(id+'.fase_nome').html();
  118. var fase_tipo = $(id+'.fase_0').val();
  119. var fase_data_inicio = $(id+'.fase_1').val();
  120. var fase_data_fim = $(id+'.fase_2').val();
  121. if (fase_nome.search("Teste") != -1)
  122. {
  123. //Na fase teste todos os dados ficam armazenados no mesmo input
  124. var str = fase_tipo.split("-");
  125. fase_tipo = str[0];
  126. var teste = str[1];
  127. var nota = str[2];
  128. $('#teste').val(teste);
  129. $('#nota').val(nota);
  130. }
  131. $('#fase_tipo').val(fase_tipo);
  132. $('#fase_data_inicio').val(fase_data_inicio);
  133. $('#fase_data_fim').val(fase_data_fim);
  134. $('#fase-form').fadeIn("slow");
  135. if (fase_nome.search("Teste") != -1)
  136. {
  137. $('#tabs-2 #li_5,#tabs-2 #li_4').fadeIn("slow");
  138. }
  139. });
  140. $('#tabs-2 .save').click(function() {
  141. var fase_erro = false;
  142. var fase_tipo = $('#fase_tipo option:selected').val();
  143. var fase_data_inicio = $('#fase_data_inicio').val();
  144. var fase_data_fim = $('#fase_data_fim').val();
  145. var teste = $('#teste option:selected').val();
  146. var nota = $('#nota option:selected').val();
  147. var fase = $('#fase_tipo option:selected').html();
  148. if (!fase_tipo)
  149. {
  150. $('#tabs-2 #li_1 .error').html("Preenchimento obrigatório");
  151. $('#tabs-2 #li_1 .error').show();
  152. fase_erro = true;
  153. }
  154. else
  155. $('#tabs-2 #li_1 .error').hide();
  156. if (!fase_data_inicio)
  157. {
  158. $('#tabs-2 #li_2 .error').html("Preenchimento obrigatório");
  159. $('#tabs-2 #li_2 .error').show();
  160. fase_erro = true;
  161. }
  162. else
  163. $('#tabs-2 #li_2 .error').hide();
  164. if (!fase_data_fim)
  165. {
  166. $('#tabs-2 #li_3 .error').html("Preenchimento obrigatório");
  167. $('#tabs-2 #li_3 .error').show();
  168. fase_erro = true;
  169. }
  170. else
  171. $('#tabs-2 #li_3 .error').hide();
  172. if (fase.search("Teste") != -1)
  173. {
  174. if (!teste)
  175. {
  176. $('#tabs-2 #li_4 .error').html("Preenchimento obrigatório");
  177. $('#tabs-2 #li_4 .error').show();
  178. fase_erro = true;
  179. }
  180. else
  181. $('#tabs-2 #li_4 .error').hide();
  182. if (!nota)
  183. {
  184. $('#tabs-2 #li_5 .error').html("Preenchimento obrigatório");
  185. $('#tabs-2 #li_5 .error').show();
  186. fase_erro = true;
  187. }
  188. else
  189. $('#tabs-2 #li_5 .error').hide();
  190. }
  191. else
  192. {
  193. $('#tabs-2 #li_5 .error,#tabs-2 #li_4 .error').hide();
  194. }
  195. if (fase_erro == false)
  196. {
  197. var num = $('#fases-list li').size() + 1;
  198. if (fase.search("Teste") != -1)
  199. fase_tipo = fase_tipo + '-' + teste + '-' + nota;
  200. var html = '<li id="listItem_'+num+'">'
  201. +'<img src="{/literal}{#templateDir#}{literal}resources/images/arrow.png" alt="Mover" width="16" height="16" class="handle" />'
  202. +'<a href="#" title="Editar" class="edit"><img src="{/literal}{#templateDir#}{literal}resources/images/edit.png" alt="Editar" width="16" height="16" /></a>'
  203. +'<a href="#" title="Deletar" class="delete"><img src="{/literal}{#templateDir#}{literal}resources/images/delete.png" alt="Deletar" width="16" height="16" /></a>'
  204. +'<strong class="fase_nome">'+fase+'</strong> ('+fase_data_inicio+' - '+fase_data_fim+')'
  205. +'<input class="fase_0" name="fase_tipo[]" type="hidden" value="'+fase_tipo+'"/>'
  206. +'<input class="fase_1" name="fase_data_inicio[]" type="hidden" value="'+fase_data_inicio+'"/>'
  207. +'<input class="fase_2" name="fase_data_fim[]" type="hidden" value="'+fase_data_fim+'"/>'
  208. +'</li>';
  209. if (edit != false)
  210. {
  211. var html =
  212. '<img src="{/literal}{#templateDir#}{literal}resources/images/arrow.png" alt="Mover" width="16" height="16" class="handle" />'
  213. +'<a href="#" title="Editar" class="edit"><img src="{/literal}{#templateDir#}{literal}resources/images/edit.png" alt="Editar" width="16" height="16" /></a>'
  214. +'<a href="#" title="Deletar" class="delete"><img src="{/literal}{#templateDir#}{literal}resources/images/delete.png" alt="Deletar" width="16" height="16" /></a>'
  215. +'<strong class="fase_nome">'+fase+'</strong> ('+fase_data_inicio+' - '+fase_data_fim+')'
  216. +'<input class="fase_0" name="fase_tipo[]" type="hidden" value="'+fase_tipo+'"/>'
  217. +'<input class="fase_1" name="fase_data_inicio[]" type="hidden" value="'+fase_data_inicio+'"/>'
  218. +'<input class="fase_2" name="fase_data_fim[]" type="hidden" value="'+fase_data_fim+'"/>';
  219. edit.html(html);
  220. edit = false;
  221. }
  222. else
  223. $('#fases-list').append(html);
  224. clearFase();
  225. $('#fase-form').fadeOut("slow");
  226. clearFase();
  227. $('.delete').click(function(){
  228. $(this).parent().remove();
  229. });
  230. $('.edit').click(function(){
  231. edit = $(this).parent();
  232. var id = '#'+$(this).parent().attr("id")+' ';
  233. var fase_nome = $(id+'.fase_nome').html();
  234. var fase_tipo = $(id+'.fase_0').val();
  235. var fase_data_inicio = $(id+'.fase_1').val();
  236. var fase_data_fim = $(id+'.fase_2').val();
  237. if (fase_nome.search("Teste") != -1)
  238. {
  239. //Na fase teste todos os dados ficam armazenados no mesmo input
  240. var str = fase_tipo.split("-");
  241. fase_tipo = str[0];
  242. var teste = str[1];
  243. var nota = str[2];
  244. $('#teste').val(teste);
  245. $('#nota').val(nota);
  246. }
  247. $('#fase_tipo').val(fase_tipo);
  248. $('#fase_data_inicio').val(fase_data_inicio);
  249. $('#fase_data_fim').val(fase_data_fim);
  250. $('#fase-form').fadeIn("slow");
  251. if (fase_nome.search("Teste") != -1)
  252. {
  253. $('#tabs-2 #li_5,#tabs-2 #li_4').fadeIn("slow");
  254. }
  255. });
  256. }
  257. });
  258. $('#tabs-2 .add').click(function() {
  259. $('#fase-form').fadeIn("slow");
  260. });
  261. $('#tabs-2 .clear').click(function() {
  262. clearFase();
  263. });
  264. $('#tabs-2 .cancel').click(function() {
  265. $('#fase-form').fadeOut("slow");
  266. clearFase();
  267. $('.error').each(function() {
  268. $(this).hide();
  269. });
  270. });
  271. $("#fases-list").sortable({
  272. handle : '.handle',
  273. update : function () {
  274. var order = $('#fases-list').sortable('serialize');
  275. //$("#ordem_fases").val(order);
  276. }
  277. });
  278. $('.addKeyword').click(function(){
  279. $('#keywords').append('<div><input class="keyword" name="keyword[]" class="element text small" type="text" maxlength="80" value=""/><p class="error"></p></div>');
  280. });
  281. {/literal}