Licitator 1.0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
5.7 KiB

5 years ago
  1. {# sin dependencias #}
  2. {% set tareaanterior=null %}
  3. {% set tareacurrent=tarea[0] %}
  4. {% set tareas=tarea[0].getProcesosId.getTarea|sort((a, b) => a.position <=> b.position) %}
  5. {% for tareadep in tareas %}
  6. {% if not tareadep.invisible %}
  7. {% for tusuario in tareadep.getTareaUsuario %}
  8. {% if tusuario.greenEntrepreneur.id==app.user.id or (ge is defined and tusuario.greenEntrepreneur.id==ge.id) %}
  9. {% if tusuario.completada==true %}
  10. {% if tareadep.position < tareacurrent.position %}
  11. {% set tareaanterior=tareadep %}
  12. {% endif %}
  13. {% endif %}
  14. {% endif %}
  15. {% endfor %}
  16. {% else %}
  17. {% if tarea[0].alias starts with 'exercise14'%}
  18. {% if tareadep.position < tareacurrent.position %}
  19. {% set tareaanterior=tareadep %}
  20. {% endif %}
  21. {% endif %}
  22. {% endif %}
  23. {% endfor %}
  24. <div class="exercise-btn-moves-group">
  25. <a class="btn btn-up" href="#"><i class="fa fa-arrow-up"></i></a>
  26. {% if tareaanterior is defined and tareaanterior is not null %}
  27. {% if tareaanterior.position < tarea[0].position %}
  28. {% if getvars.modal is defined and getvars.modal==1 %}
  29. {% if app.user.getType == 'green_entrepreneur' and getvars.modal is not defined %}
  30. <a class="btn btn-prev" href="{{ path('admin.procesos.realizartarea',{'id':tareaanterior.id}) }}">{{'Previous'|trans({})}}</a>
  31. {% endif %}
  32. {% else %}<span></span>
  33. {%endif%}
  34. {% if getvars.modal is defined and getvars.modal==1 %}
  35. <input type="hidden" id='modal{{tarea[0]}}' name='modal' value='1'></>
  36. {% endif%}
  37. <script>
  38. $('.btn.btn-prev').on('click', function(e){
  39. e.preventDefault();
  40. Swal.fire({
  41. title: 'Are you sure to go previous step without save?',
  42. text: "You won't be able to revert this!",
  43. icon: 'warning',
  44. showCancelButton: true,
  45. confirmButtonColor: '#3085d6',
  46. cancelButtonColor: '#d33',
  47. confirmButtonText: 'Yes, I´m not interested in save!'
  48. }).then((result) => {
  49. if (result.value) {
  50. {% if tarea[0].alias starts with 'exercise14' %}
  51. {% if app.user.getType == 'trainer' %}
  52. window.location.href = "{{ path('admin.procesos.comentar',{'id':tareaanterior.id, 'user': ge.id}) }}{% if getvars.modal is defined and getvars.modal==1 %}?modal=1{%endif%}";
  53. {% else %}
  54. window.location.href = "{{ path('admin.procesos.realizartarea',{'id':tareaanterior.id}) }}";
  55. {% endif %}
  56. {% else %}
  57. {% if app.user.getType == 'trainer' %}
  58. window.location.href = "{{ path('admin.procesos.comentar',{'id':tareaanterior.id, 'user': ge.id}) }}{% if getvars.modal is defined and getvars.modal==1 %}?modal=1{%endif%}";
  59. {% else %}
  60. window.location.href = "{{ path('admin.procesos.realizartarea',{'id':tareaanterior.id}) }}";
  61. {% endif %}
  62. {% endif %}
  63. }
  64. });
  65. })</script>
  66. {% else %}
  67. <a class="btn btn-prev ocultar" href=""></a>
  68. {% endif %}
  69. {% else %}
  70. <a class="btn btn-prev ocultar" href=""></a>
  71. {% endif %}
  72. <span class="mensaje"></span>
  73. {% if app.user.getType == 'trainer' %}
  74. <a id="save" class="btn btn-save" href="#" onclick="$('#wizard').parsley().validate();if($('#wizard').parsley().isValid())$.ajax({ type: 'POST', url: '{{ path('api_app_api_guardartareaapi_savetask', {'id': tarea[0].id})}}', data: $('form').serialize(), cache: false,}).done(function() {$('.exercise-btn-moves-group .mensaje').text('Saving...');window.setTimeout(function(){$('.exercise-btn-moves-group .mensaje').text('Changes saved');}, 1000);}).fail(function() {$('.exercise-btn-moves-group .mensaje').text('Saving...');window.setTimeout(function(){$('.exercise-btn-moves-group .mensaje').text('Error saving changes');}, 1000);});">{{'Save'|trans({})}}</a>
  75. {% else %}
  76. <a id="save" class="btn btn-save" href="#" onclick="$('#wizard').parsley().validate();if($('#wizard').parsley().isValid())$.ajax({ type: 'POST', url: '{{ path('api_app_api_guardartareaapi_savetask', {'id': tarea[0].id})}}', data: $('form').serialize(), cache: false,}).done(function() {$('.exercise-btn-moves-group .mensaje').text('Saving...');window.setTimeout(function(){$('.exercise-btn-moves-group .mensaje').text('Changes saved');}, 1000);}).fail(function() {$('.exercise-btn-moves-group .mensaje').text('Saving...');window.setTimeout(function(){$('.exercise-btn-moves-group .mensaje').text('Error saving changes');}, 1000);});">{{'Save'|trans({})}}</a>
  77. {% if tarea[0].alias=='exercise12n' and getvars.modal is not defined %}
  78. <a class="btn btn-next" href="#" onclick=" $('.tab-content>div').each(function() {
  79. $(this).find('.ex12n_customers textarea').text($(this)[0].closest('section.body').id);
  80. });$('#wizard').submit()">{{'Next'|trans({})}}</a>
  81. {% elseif getvars.modal is not defined %}
  82. <a class="btn btn-next" href="#" onclick="$('#wizard').submit()">{{'Next'|trans({})}}</a>
  83. {% endif %}
  84. {% endif %}
  85. </div>