Odoo modules related to surveys
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.

57 lines
3.4 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <template id="survey.page" name="Page">
  4. <div class="page-header">
  5. <p class="pull-right">Page <span t-raw='page_nr + 1'/> of <span t-raw="len(survey.page_ids)"/></p>
  6. <h1 t-field='page.title' />
  7. <div t-field='page.description' class="oe_no_empty"/>
  8. </div>
  9. <form role="form" method="post" class="js_surveyform" t-att-name="'%s_%s' % (survey.id, page.id)" t-att-action="'/survey/fill/%s/%s' % (slug(survey), token)" t-att-data-prefill="'/survey/prefill/%s/%s/%s' % (slug(survey), token, slug(page))" t-att-data-validate="'/survey/validate/%s' % (slug(survey))" t-att-data-submit="'/survey/submit/%s' % (slug(survey))">
  10. <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
  11. <input type="hidden" name="page_id" t-att-value="page.id" />
  12. <input type="hidden" name="token" t-att-value="token" />
  13. <t t-foreach='page.question_ids' t-as='question'>
  14. <t t-set="prefix" t-value="'%s_%s_%s' % (survey.id, page.id, question.id)" />
  15. <div class="js_question-wrapper" t-att-id="prefix">
  16. <h2>
  17. <span t-field='question.question' />
  18. <span t-if="question.constr_mandatory" class="text-danger">*</span>
  19. </h2>
  20. <div t-field='question.description' class="text-muted oe_no_empty"/>
  21. <t t-if="question.type == 'free_text'"><t t-call="survey.free_text"/></t>
  22. <t t-if="question.type == 'textbox'"><t t-call="survey.textbox"/></t>
  23. <t t-if="question.type == 'numerical_box'"><t t-call="survey.numerical_box"/></t>
  24. <t t-if="question.type == 'date'"><t t-call="survey.date"/></t>
  25. <t t-if="question.type == 'simple_choice'"><t t-call="survey.simple_choice"/></t>
  26. <t t-if="question.type == 'multiple_choice'"><t t-call="survey.multiple_choice"/></t>
  27. <t t-if="question.type == 'matrix'"><t t-call="survey.matrix"/></t>
  28. <t t-if="question.type == 'upload_file'"><t t-call="survey_attachment.upload_file"/></t>
  29. <div class="js_errzone alert alert-danger" style="display:none;"></div>
  30. </div>
  31. </t>
  32. <div class="text-center mt16 mb16">
  33. <button t-if="survey.users_can_go_back and page_nr > 0" type="submit" class="btn btn-default" name="button_submit" value="previous">Previous page</button>
  34. <button t-if="not last" type="submit" class="btn btn-primary" name="button_submit" value="next">Next page</button>
  35. <button t-if="last" type="submit" class="btn btn-primary" name="button_submit" value="finish">Submit survey</button>
  36. </div>
  37. </form>
  38. <!-- Modal used to display error message, i.c.o. ajax error -->
  39. <div class="modal fade" id="AJAXErrorModal" role="dialog" aria-labelledby="AJAXErrorModal" aria-hidden="true" >
  40. <div class="modal-dialog">
  41. <div class="modal-content">
  42. <div class="modal-header">
  43. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&amp;times;</button>
  44. <h4 class="modal-title">A problem has occured</h4>
  45. </div>
  46. <div class="modal-body"><p>Something went wrong while contacting survey server. <strong class="text-danger">Your answers have probably not been recorded.</strong> Try refreshing.</p></div>
  47. <div class="modal-footer"><button type="button" class="btn btn-primary" data-dismiss="modal">Close</button></div>
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. </odoo>