form.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. ng-bind-html = "$sce.trustAsHtml(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-start = "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. ng-if = "ctrl.other"
  71. value = "autre"
  72. class = "md-primary">
  73. Autre:
  74. </md-radio-button>
  75. <div
  76. class = "note"
  77. ng-if = "ctrl.note">
  78. <br><br>
  79. {{ctrl.note}}
  80. </div>
  81. </md-radio-group>
  82. <!-- Type checkbox -->
  83. <md-checkbox
  84. ng-model = "result.eligibilite[ctrl.id]"
  85. ng-change = "ready ? isFormValid() : null"
  86. aria-label = "{{ctrl.name}}"
  87. ng-if = "ctrl.type === 'checkbox'">
  88. {{ctrl.libelle}}
  89. </md-checkbox>
  90. <!-- Type textarea-->
  91. <textarea
  92. ng-if = "ctrl.type === 'textarea'"
  93. ng-model = "result.eligibilite[ctrl.id]"
  94. ng-change = "ready ? isFormValid() : null"
  95. columns = "1">
  96. </textarea>
  97. <!-- Alerte -->
  98. <div
  99. class = "alerte"
  100. ng-if = "ctrl.options.alertes[result.eligibilite[ctrl.id]]">
  101. <i class = "fa fa-exclamation-circle"></i>
  102. {{ctrl.options.alertes[result.eligibilite[ctrl.id]]}}
  103. </div>
  104. </md-input-container>
  105. <div
  106. ng-repeat-end
  107. style = "position: absolute; left: 92px; top: {{ ctrl.id === 'ce_logement_est' ? '77px' : '101px'}};"
  108. ng-if = "ctrl.type === 'radio' && result.eligibilite[ctrl.id] === 'autre'">
  109. <input
  110. class = "other-radio"
  111. placeholder = "Précisez ici..."
  112. ng-model = "result.autres[ctrl.id]"
  113. ng-change = "ready ? isFormValid() : null"/>
  114. </div>
  115. </md-content>
  116. </div>
  117. </div>