form.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <div class = "formulaire">
  2. <div
  3. class = "section"
  4. ng-repeat = "section in formulaires.eligibilite.sections"
  5. ng-class = "{'no-padding': !formulaires.eligibilite.sections[$index+1].visible}">
  6. <div
  7. class = "section-name"
  8. ng-if = "section.visible">
  9. {{section.name}}
  10. </div>
  11. <div ng-repeat = "line in section.lines">
  12. <div
  13. class = "pres-text"
  14. ng-if = "line.text">
  15. {{line.text}}
  16. </div>
  17. <md-content
  18. layout = "row"
  19. layout-sm = "column">
  20. <md-input-container
  21. class = "{{ctrl.id}} {{ctrl.type}} {{($last && ctrl.type === 'checkbox')? 'no-padding' : ''}}"
  22. style = "width: {{ctrl.width || '100%'}};"
  23. ng-repeat = "ctrl in line.ctrls">
  24. <label>
  25. {{ctrl.name}}
  26. <span
  27. ng-if = "ctrl.require"
  28. class = "form-required">
  29. *
  30. </span>
  31. <span
  32. ng-if = "ctrl.invalid && ctrl.type !== 'select'"
  33. class = "form-required">
  34. {{ctrl.msg}}
  35. </span>
  36. </label>
  37. </label>
  38. <!-- Type text-->
  39. <input
  40. ng-if = "ctrl.type === 'text'"
  41. ng-model = "result.eligibilite[ctrl.id]"
  42. ng-change = "ready ? isFormValid() : null">
  43. <!-- Type select-->
  44. <span
  45. ng-if = "ctrl.type === 'select' && ctrl.invalid"
  46. class = "form-required">
  47. {{ctrl.msg}}
  48. </span>
  49. <md-select
  50. ng-if = "ctrl.type === 'select'"
  51. ng-change = "ready ? isFormValid() : null"
  52. ng-model = "result.eligibilite[ctrl.id]">
  53. <md-option
  54. ng-repeat = "state in ctrl.options.categories"
  55. value = "{{state.id}}">
  56. {{state.name}}
  57. </md-option>
  58. </md-select>
  59. <!-- Type radio -->
  60. <md-radio-group
  61. ng-if = "ctrl.type === 'radio'"
  62. ng-model = "result.eligibilite[ctrl.id]">
  63. <md-radio-button
  64. ng-repeat = "state in ctrl.options.categories"
  65. value = "{{state.id}}"
  66. class = "md-primary">
  67. {{state.name}}
  68. </md-radio-button>
  69. <md-radio-button
  70. value = "autre"
  71. class = "md-primary">
  72. Autre: Préciser...
  73. </md-radio-button>
  74. </md-radio-group>
  75. <!-- Type checkbox -->
  76. <md-checkbox
  77. ng-model = "result.eligibilite[ctrl.id]"
  78. ng-change = "ready ? isFormValid() : null"
  79. aria-label = "{{ctrl.name}}"
  80. ng-if = "ctrl.type === 'checkbox'">
  81. {{ctrl.libelle}}
  82. </md-checkbox>
  83. <!-- Type textarea-->
  84. <textarea
  85. ng-if = "ctrl.type === 'textarea'"
  86. ng-model = "result.eligibilite[ctrl.id]"
  87. ng-change = "ready ? isFormValid() : null"
  88. columns = "1">
  89. </textarea>
  90. <!-- Alerte -->
  91. <div
  92. class = "alerte"
  93. ng-if = "ctrl.options.alertes[result.eligibilite[ctrl.id]]">
  94. <i class = "fa fa-exclamation-circle"></i>
  95. {{ctrl.options.alertes[result.eligibilite[ctrl.id]]}}
  96. </div>
  97. </md-input-container>
  98. </md-content>
  99. </div>
  100. </div>