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.

178 lines
9.2 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <templates id="template" xml:space="preserve">
  3. <t t-name="FieldDomain.content">
  4. <t t-if="partialUse">
  5. <div t-if="hasModel" class="o_field_domain_panel">
  6. <!--<div t-if="hasModel" class="o_field_domain_panel">
  7. <i class="fa fa-arrow-right" role="img" aria-label="Domain" title="Domain"/>
  8. <button t-if="isValid" class="btn btn-sm btn-secondary o_domain_show_selection_button" type="button">
  9. <t t-esc="nbRecords"/> record(s)
  10. </button>
  11. <span t-else="" class="text-warning" role="alert"><i class="fa fa-exclamation-triangle" role="img" aria-label="Warning" title="Warning"/> Invalid domain</span>
  12. <button t-if="inDialogEdit" class="btn btn-sm btn-primary o_field_domain_dialog_button">Edit Domain</button>
  13. </div>
  14. <div t-else="">Select a model to add a filter.</div>-->
  15. </div>
  16. </t>
  17. <t t-if="!partialUse">
  18. <div t-if="hasModel" class="o_field_domain_panel">
  19. <i class="fa fa-arrow-right" role="img" aria-label="Domain" title="Domain"/>
  20. <button t-if="isValid" class="btn btn-sm btn-secondary o_domain_show_selection_button" type="button">
  21. <t t-esc="nbRecords"/> record(s)
  22. </button>
  23. <span t-else="" class="text-warning" role="alert"><i class="fa fa-exclamation-triangle" role="img" aria-label="Warning" title="Warning"/> Invalid domain</span>
  24. <button t-if="inDialogEdit" class="btn btn-sm btn-primary o_field_domain_dialog_button">Edit Domain</button>
  25. </div>
  26. <div t-else="">Select a model to add a filter.</div>
  27. </t>
  28. </t>
  29. <div aria-atomic="true" t-name="DomainSelector" t-attf-class="o_domain_node o_domain_tree o_domain_selector #{widget.readonly ? 'o_read_mode' : 'o_edit_mode'}">
  30. <t t-if="widget.options.partialUse">
  31. <t t-if="widget.children.length === 0">
  32. <span>SMatch <strong>all records</strong></span>
  33. <button t-if="!widget.readonly" class="btn btn-sm btn-primary o_domain_add_first_node_button"><i class="fa fa-plus"/> Add filter</button>
  34. </t>
  35. <t t-else="">
  36. <div class="o_domain_tree_header">
  37. <t t-if="widget.children.length === 1">Please navigate below and select field:</t>
  38. <t t-else="">
  39. <span>SSMatch records with</span>
  40. <t t-call="DomainTree.OperatorSelector"/>
  41. <span>of the following rules:</span>
  42. </t>
  43. </div>
  44. <div class="o_domain_node_children_container"/>
  45. </t>
  46. </t>
  47. <t t-if="!widget.options.partialUse">
  48. <t t-if="widget.children.length === 0">
  49. <span>Match <strong>all records</strong></span>
  50. <button t-if="!widget.readonly" class="btn btn-sm btn-primary o_domain_add_first_node_button"><i class="fa fa-plus"/> Add filter</button>
  51. </t>
  52. <t t-else="">
  53. <div class="o_domain_tree_header">
  54. <t t-if="widget.children.length === 1">Match records with the following rule:</t>
  55. <t t-else="">
  56. <span>Match records with</span>
  57. <t t-call="DomainTree.OperatorSelector"/>
  58. <span>of the following rules:</span>
  59. </t>
  60. </div>
  61. <div class="o_domain_node_children_container"/>
  62. </t>
  63. <label t-if="widget.debug &amp;&amp; !widget.readonly" class="o_domain_debug_container">
  64. <span class="small"># Code editor</span>
  65. <input type="text" class="o_domain_debug_input"/>
  66. </label>
  67. </t>
  68. </div>
  69. <t t-name="DomainNode.ControlPanel">
  70. <t t-if="widget.options.partialUse">
  71. <div t-if="!widget.readonly &amp;&amp; !widget.noControlPanel" class="o_domain_node_control_panel" role="toolbar" aria-label="Domain node">
  72. </div>
  73. </t>
  74. <t t-if="!widget.options.partialUse">
  75. <div t-if="!widget.readonly &amp;&amp; !widget.noControlPanel" class="o_domain_node_control_panel" role="toolbar" aria-label="Domain node">
  76. <button class="btn o_domain_delete_node_button" title="Delete node" aria-label="Delete node"><i class="fa fa-times"/></button>
  77. <button class="btn o_domain_add_node_button" title="Add node" aria-label="Add node"><i class="fa fa-plus-circle"/></button>
  78. <button class="btn o_domain_add_node_button" title="Add branch" aria-label="Add branch" data-branch="1"><i class="fa fa-ellipsis-h"/></button>
  79. </div>
  80. </t>
  81. </t>
  82. <div t-name="DomainLeaf" t-attf-class="o_domain_node o_domain_leaf o_domain_selector_row #{widget.readonly ? 'o_read_mode' : 'o_edit_mode'}">
  83. <t t-call="DomainNode.ControlPanel"/>
  84. <div t-if="!widget.readonly" class="o_domain_leaf_edition">
  85. <!-- field selector will be instantiated here -->
  86. <t t-if="!widget.options.partialUse">
  87. <div> <!-- used for flex stretching -->
  88. <select class="o_domain_leaf_operator_select o_input">
  89. <option t-foreach="widget.operators" t-as="key"
  90. t-att-value="key"
  91. t-att-selected="widget.displayOperator === key ? 'selected' : None">
  92. <t t-esc="key_value"/>
  93. </option>
  94. </select>
  95. </div>
  96. <div t-attf-class="o_ds_value_cell#{_.contains(['set', 'not set'], widget.displayOperator) ? ' d-none' : ''}">
  97. <t t-if="widget.selectionChoices !== null">
  98. <select class="o_domain_leaf_value_input o_input">
  99. <option t-foreach="widget.selectionChoices" t-as="val"
  100. t-att-value="val[0]"
  101. t-att-selected="_.contains(val, widget.displayValue) ? 'selected' : None">
  102. <t t-esc="val[1]"/>
  103. </option>
  104. </select>
  105. </t>
  106. <t t-else="">
  107. <t t-if="_.contains(['in', 'not in'], widget.operator)">
  108. <div class="o_domain_leaf_value_input">
  109. <span class="badge badge-pill" t-foreach="widget.displayValue" t-as="val">
  110. <t t-esc="val"/> <i class="o_domain_leaf_value_remove_tag_button fa fa-times" t-att-data-value="val" role="img" aria-label="Remove tag" title="Remove tag"/>
  111. </span>
  112. </div>
  113. <div class="o_domain_leaf_value_tags">
  114. <input placeholder="Add new value" type="text" class="o_input"/>
  115. <button class="btn btn-sm btn-primary fa fa-plus o_domain_leaf_value_add_tag_button" aria-label="Add tag" title="Add tag"/>
  116. </div>
  117. </t>
  118. <t t-else="">
  119. <input class="o_domain_leaf_value_input o_input" type="text" t-att-value="widget.displayValue"/>
  120. </t>
  121. </t>
  122. </div>
  123. </t>
  124. </div>
  125. <div t-else="" class="o_domain_leaf_info">
  126. <!-- field selector will be instantiated here -->
  127. <t t-if="_.isString(widget.value)">
  128. <span class="o_domain_leaf_operator"><t t-esc="widget.operator_mapping[widget.operator]"/></span>
  129. <span class="o_domain_leaf_value text-primary">"<t t-esc="widget.value"/>"</span>
  130. </t>
  131. <t t-if="_.isArray(widget.value)">
  132. <span class="o_domain_leaf_operator"><t t-esc="widget.operator_mapping[widget.operator]"/></span>
  133. <t t-foreach="widget.value" t-as="v">
  134. <span class="o_domain_leaf_value text-primary">"<t t-esc="v"/>"</span>
  135. <t t-if="!v_last"> or </t>
  136. </t>
  137. </t>
  138. <t t-if="_.isNumber(widget.value)">
  139. <span class="o_domain_leaf_operator"><t t-esc="widget.operator_mapping[widget.operator]"/></span>
  140. <span class="o_domain_leaf_value text-primary"><t t-esc="widget.value"></t></span>
  141. </t>
  142. <t t-if="_.isBoolean(widget.value)">
  143. is
  144. <t t-if="widget.operator === '=' &amp;&amp; widget.value === false || widget.operator === '!=' &amp;&amp; widget.value === true">not</t>
  145. set
  146. </t>
  147. </div>
  148. </div>
  149. <div aria-atomic="true" t-name="ModelFieldSelector" t-attf-class="o_field_selector#{!widget.options.readonly ? ' o_edit_mode o_input' : ''}">
  150. <div class="o_field_selector_value" tabindex="0"/>
  151. <t t-if="!widget.options.partialUse">
  152. <div class="o_field_selector_controls" tabindex="0">
  153. <i role="alert" class="fa fa-exclamation-triangle o_field_selector_warning d-none" title="Invalid field chain" aria-label="Invalid field chain"/>
  154. </div>
  155. </t>
  156. <div t-if="!widget.options.readonly" class="o_field_selector_popover d-none" tabindex="0">
  157. <div class="o_field_selector_popover_header text-center">
  158. <i class="fa fa-arrow-left o_field_selector_popover_option o_field_selector_prev_page" title="Previous" role="img" aria-label="Previous"/>
  159. <div class="o_field_selector_title"/>
  160. <i class="fa fa-times o_field_selector_popover_option o_field_selector_close" title="Close" role="img" aria-label="Close"/>
  161. </div>
  162. <div class="o_field_selector_popover_body">
  163. <ul class="o_field_selector_page"/>
  164. </div>
  165. <div t-if="widget.options.debugMode" class="o_field_selector_popover_footer">
  166. <input type="text" class="o_input"/>
  167. </div>
  168. </div>
  169. </div>
  170. </templates>