PageRenderTime 54ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/application/views/admin/actividades_prospecto_view.bakRaul.php

https://bitbucket.org/darazoft/grupo-cadi
PHP | 426 lines | 393 code | 32 blank | 1 comment | 22 complexity | de20367bb047239e95ab4b69e59eb483 MD5 | raw file
  1. <script type="text/javascript">
  2. jQuery(document).ready(
  3. function($){
  4. var open = false;
  5. speed = 500;
  6. $(".hideForm").hide();
  7. $(".shContent").click(
  8. function(){
  9. if(!open){
  10. $(".hideForm").show(speed);
  11. open = true;
  12. } else{
  13. $(".hideForm").hide(speed);
  14. open = false;
  15. }
  16. }
  17. );
  18. //Jquery validations
  19. $( ".datepicker" ).datepicker();
  20. jQuery("#newUser").validationEngine(
  21. 'attach',
  22. {
  23. onValidationComplete: function(form, status){
  24. if (status == true) {
  25. return true;
  26. }
  27. }
  28. }
  29. );
  30. $(".deleteRow").live(
  31. 'click',
  32. function(e){
  33. e.preventDefault();
  34. var thisID = $(this).attr('href');
  35. noty({
  36. text: 'Realmente desea eliminar este registro? Se eliminará todo lo relacionado con el mismo.',
  37. type: 'alert',
  38. dismissQueue: true,
  39. layout: 'center',
  40. theme: 'default',
  41. buttons: [
  42. {addClass: 'btn btn-primary', text: 'Ok', onClick: function($noty) {
  43. $noty.close();
  44. $.ajax({
  45. url : '<?=base_url()?>admin/prospecto/eliminar_actividad',
  46. type : 'POST',
  47. dataType : 'json',
  48. data : 'idHojaActividad=' + thisID + '&tipo=deleted',
  49. success: function(data){
  50. if(data.response == 'true'){
  51. $("#" + thisID).stop().hide('slow');
  52. }
  53. else {
  54. noty({
  55. text : 'OCURRIÓ UN ERROR AL ELIMINAR EL REGISTRO. INTÉNTE NUEVAMENTE.',
  56. type : 'error',
  57. dismissQueue: true,
  58. layout: 'top',
  59. theme: 'default',
  60. timeout: 4000
  61. });
  62. }
  63. }
  64. })
  65. }
  66. },
  67. {addClass: 'btn btn-danger', text: 'Cancel', onClick: function($noty) {
  68. $noty.close();
  69. return false
  70. }
  71. }
  72. ]
  73. });
  74. }
  75. );
  76. $(".updateEstado").live(
  77. 'click',
  78. function(e){
  79. e.preventDefault();
  80. var thisID = $(this).attr('href');
  81. noty({
  82. text: 'Realmente desea terminar esta actividad?',
  83. type: 'alert',
  84. dismissQueue: true,
  85. layout: 'center',
  86. theme: 'default',
  87. buttons: [
  88. {addClass: 'btn btn-primary', text: 'Ok', onClick: function($noty) {
  89. $noty.close();
  90. $.ajax({
  91. url : '<?=base_url()?>admin/prospecto/editar_estado_actividad',
  92. type : 'POST',
  93. dataType : 'json',
  94. data : 'idHojaActividad=' + thisID,
  95. success: function(data){
  96. if(data.response == 'true'){
  97. $("#" + thisID).stop().hide('slow');
  98. }
  99. else {
  100. noty({
  101. text : 'OCURRIÓ UN ERROR AL ELIMINAR EL REGISTRO. INTÉNTE NUEVAMENTE.',
  102. type : 'error',
  103. dismissQueue: true,
  104. layout: 'top',
  105. theme: 'default',
  106. timeout: 4000
  107. });
  108. }
  109. }
  110. })
  111. }
  112. },
  113. {addClass: 'btn btn-danger', text: 'Cancel', onClick: function($noty) {
  114. $noty.close();
  115. return false
  116. }
  117. }
  118. ]
  119. });
  120. }
  121. );
  122. $("tr.hideMessages").slideUp(1);
  123. $("tr.showMessages").click(
  124. function(){
  125. var speed = 250;
  126. var thisID = $(this).attr('id');
  127. $("tr.hideMessages").slideUp();
  128. $("#" + thisID + "_messages").slideDown();
  129. $("tr.addMessagetr").hide(1);
  130. }
  131. );
  132. $("tr.addMessagetr").slideUp(1);
  133. $("a.addMessage").click(
  134. function(e){
  135. e.preventDefault();
  136. $("tr.addMessagetr").hide(1);
  137. var thisID = $(this).attr('href');
  138. $("#" + thisID + "_addMessage").fadeIn(250);
  139. }
  140. );
  141. $(".addMessageForm").submit(
  142. function(e){
  143. e.preventDefault();
  144. var formID = $(this).attr('id');
  145. var commentID = $(this).attr('data-rel');
  146. console.log(formID);
  147. console.log(commentID);
  148. $("#" + commentID + "_messages").before('<tr class="strong hideMessages"><td></td><td colspan="2">La neta está bien chido DE AJAX</td><td colspan="2">Pedro 2012-09-09 23:00:03</td></tr>');
  149. }
  150. );
  151. }
  152. );
  153. </script>
  154. <div id="contentUsers">
  155. <form class="niceform">
  156. <input type="button" value="Nueva Actividad" class="shContent" />
  157. <input type="button" value="Calendario" class="floatRight" style="margin: 0 10px 0 0; cursor: pointer;" />
  158. </form>
  159. <br />
  160. <div id="newUserContainer" class="hideForm">
  161. <form id="newUser" name="newUser" method="post" class="niceform" action="<?=base_url()?>admin/prospecto/nueva_actividad_do" enctype="multipart/form-data">
  162. <input type="hidden" name="idHojaVida" value="<?=$this_prospecto->idHojaVida?>" />
  163. <?=form_fieldset('Nueva Actividad'); ?>
  164. <table>
  165. <tr>
  166. <td align="right">
  167. <label for="nombreActividad">Actividad:</label>
  168. </td>
  169. <td>
  170. <div class="divhojadd">
  171. <select name="nombreActividad" id="nombreActividad" class="validate[required]">
  172. <option value="" > - - - - </option>
  173. <option value="1" >Llamada</option>
  174. <option value="2" >Cita</option>
  175. <option value="3" >Email</option>
  176. <option value="4" >Firma de contrato</option>
  177. <option value="5" >Pago de apartado</option>
  178. <option value="6" >Cancelaci&oacute;n</option>
  179. <option value="7" >Seguimiento post-venta</option>
  180. <option value="8" >Atenci&oacute;n a queja</option>
  181. <option value="9" >Seguimiento a cobranza</option>
  182. <option value="10">Entrega de casa</option>
  183. <option value="11">Firma de escritura</option>
  184. <option value="12">Otra</option>
  185. </select>
  186. </div>
  187. </td>
  188. <td align="right">
  189. <label for="fechaInico">Fecha:</label>
  190. </td>
  191. <td>
  192. <div class="divhojadd">
  193. <input type="text" name="fechaInicio" id="fechaInicio" readonly="readonly" class="validate[required] text-input datepicker" />
  194. </div>
  195. </td>
  196. </tr>
  197. <tr>
  198. <td align="right">
  199. <label for="horaInicio">Hora:</label>
  200. </td>
  201. <td>
  202. <select name="horaInicio" id="horaInicio">
  203. <?php for($i = 0; $i<=24; $i++):
  204. $showHour = $i;
  205. if($i < 10):
  206. $showHour = '0'.$i;
  207. endif; ?>
  208. <option value="<?=$showHour?>"><?=$showHour?></option>
  209. <?php endfor; ?>
  210. </select>
  211. </td>
  212. <td align="right">
  213. <label for="minutoInicio">Minuto inicio:</label>
  214. </td>
  215. <td>
  216. <select name="minutoInicio" id="minutoInicio">
  217. <?php for($i = 0; $i<=59; $i++):
  218. $showHour = $i;
  219. if($i < 10):
  220. $showHour = '0'.$i;
  221. endif; ?>
  222. <option value="<?=$showHour?>"><?=$showHour?></option>
  223. <?php endfor; ?>
  224. </select>
  225. </td>
  226. </tr>
  227. <tr>
  228. <td align="right">
  229. <label for="archivo">Archivo:</label>
  230. </td>
  231. <td>
  232. <input type="file" name="archivo" id="archivo" />
  233. </td>
  234. <td align="right">
  235. <label for="descripcion">Descripcion:</label>
  236. </td>
  237. <td>
  238. <div class="divhojadd">
  239. <textarea name="descripcion" id="descripcion" class="validate[required] text-input"></textarea>
  240. </div>
  241. </td>
  242. </tr>
  243. <tr>
  244. <td align="right" colspan="3"><label>&nbsp;</label></td>
  245. <td><input type="submit" value="Agregar Actividad" id="agregar" /></td>
  246. </tr>
  247. </table>
  248. <?=form_fieldset_close(); ?>
  249. </form>
  250. </div>
  251. <table id="usersTable" class="resultTable">
  252. <thead>
  253. <tr>
  254. <th>Actividad</th> <th>Fecha Inicio</th> <th>Descripci&oacute;n</th> <th>Documento</th> <th>Acciones</th>
  255. </tr>
  256. </thead>
  257. <tbody id="newUserBody">
  258. <?php
  259. $strong = true;
  260. $class = 'strong';
  261. if($actividades != null):
  262. foreach ($actividades as $key):
  263. $stringActividad = '';
  264. switch($key->nombreActividad):
  265. case '1':
  266. $stringActividad = 'Llamada';
  267. break;
  268. case '2':
  269. $stringActividad = 'Cita';
  270. break;
  271. case '3':
  272. $stringActividad = 'Email';
  273. break;
  274. case '4':
  275. $stringActividad = 'Firma de contrato';
  276. break;
  277. case '5':
  278. $stringActividad = 'Pago de apartado';
  279. break;
  280. case '6':
  281. $stringActividad = 'Cancelaci&oacute;n';
  282. break;
  283. case '7':
  284. $stringActividad = 'Seguimiento post-venta';
  285. break;
  286. case '8':
  287. $stringActividad = 'Atenci&oacute;n a queja';
  288. break;
  289. case '9':
  290. $stringActividad = 'Seguimiento cobranza';
  291. break;
  292. case '10':
  293. $stringActividad = 'Entrega de casa';
  294. break;
  295. case '11':
  296. $stringActividad = 'Firma de escritura';
  297. break;
  298. case '12':
  299. $stringActividad = 'Otro';
  300. break;
  301. default:
  302. $stringActividad = 'Otro';
  303. break;
  304. endswitch;
  305. if($strong):
  306. $class = 'strong';
  307. $strong = false;
  308. elseif(!$strong):
  309. $class = 'light';
  310. $strong = true;
  311. endif; ?>
  312. <tr id="<?=$key->idHojaActividad?>" class="<?=$class?> showMessages" style="cursor: pointer;">
  313. <td> <?=$stringActividad?> </td>
  314. <td> <?=$key->fechaInicio?> </td>
  315. <td> <?=$key->descripcion?> </td>
  316. <td align="center" style="text-align: center !important;">
  317. <?php if($key->adjunto != null): ?>
  318. <a href="<?=base_url()?>docs/actividades/<?=$key->adjunto?>" target="_new" title="Ver Adjunto">
  319. <img src="<?=base_url()?>img/attachment.png" alr="Un dato adjunto" />
  320. </a>
  321. <?php endif; ?>
  322. </td>
  323. <td>
  324. <?php
  325. if($key->statusActividad == 3) :
  326. ?>
  327. <span> <img src="<?=base_url()?>img/green.png" alt="Estado" title="Realizada" /> </span>
  328. &nbsp;
  329. <?php
  330. elseif($key->estado == 'yellow') :
  331. ?>
  332. <a href="<?=base_url()?>admin/prospecto/editar_estado_actividad/<?=$key->idHojaActividad?>/<?=$this_prospecto->idHojaVida?>" title="Pendiente">
  333. <img src="<?=base_url()?>img/yellow.png" alt="Estado" /> </span>
  334. </a>
  335. &nbsp;
  336. <?php
  337. elseif($key->estado == 'red') :
  338. ?>
  339. <a href="<?=base_url()?>admin/prospecto/editar_estado_actividad/<?=$key->idHojaActividad?>/<?=$this_prospecto->idHojaVida?>" title="Vencida">
  340. <img src="<?=base_url()?>img/red.png" alt="Estado" />
  341. </a>
  342. &nbsp;
  343. <?php
  344. endif;
  345. ?>
  346. <!-- <a href="<?=$key->idHojaActividad?>">
  347. <img src="<?=base_url()?>img/comments.png" alt="Comentarios" />
  348. </a>
  349. &nbsp; -->
  350. <a href="<?=base_url()?>admin/prospecto/editar_actividad/<?=$key->idHojaActividad?>">
  351. <img src="<?=base_url()?>img/edit_row.png" alt="Editar" />
  352. </a>
  353. &nbsp;
  354. <a id="deleteRow<?=$key->idHojaActividad?>" href="<?=$key->idHojaActividad?>" class="deleteRow">
  355. <img src="<?=base_url()?>img/delete_row.png" alt="Eliminar" />
  356. </a>
  357. </td>
  358. </tr>
  359. <tr id="<?=$key->idHojaActividad?>_messages" class="<?=$class?> hideMessages">
  360. <td style="text-align: right !important">
  361. <a href="<?=$key->idHojaActividad?>" class="addMessage" title="Agregar Comentario">
  362. <img src="<?=base_url()?>img/add_message.png" />
  363. </a>
  364. </td>
  365. <td colspan="2">
  366. La neta está bien chido
  367. </td>
  368. <td colspan="2">
  369. Pedro 2012-09-09 23:00:03
  370. </td>
  371. </tr>
  372. <tr id="<?=$key->idHojaActividad?>_addMessage" class="<?=$class?> addMessagetr">
  373. <td colspan="5" style="vertical-align: middle !important;">
  374. <form id="formMessage<?=$key->idHojaActividad?>" action="<?=base_url()?>admin/prospecto/nuevo_mensaje_do/<?=$key->idHojaVida?>" data-rel="<?=$key->idHojaActividad?>" class="niceform addMessageForm">
  375. Comentario: <textarea name="nuevoComment" id="nuevoComment" style="width: 735px !important; height: 50px !important"></textarea>
  376. <br />
  377. <br />
  378. <input type="submit" value="Agregar comentario" />
  379. <br />
  380. &nbsp;
  381. </form>
  382. </td>
  383. </tr>
  384. <?php
  385. endforeach;
  386. else: ?>
  387. <tr class="<?=$class?>">
  388. <td colspan="5"> A&Uacute;N NO SE HAN AGENDADO ACTIVIDADES PARA ESTE PROSPECTO </td>
  389. </tr>
  390. <?endif;
  391. ?>
  392. </tbody>
  393. </table>
  394. </div>