maintenance.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <html xmlns="http://www.w3.org/1999/xhtml"
  2. xmlns:xf="http://www.w3.org/2002/xforms"
  3. xmlns:ev="http://www.w3.org/2001/xml-events"
  4. xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  5. <head>
  6. <title>Maintenance</title>
  7. <xf:model>
  8. <xf:instance xmlns="" id="document">
  9. <Data>
  10. <page>info</page>
  11. <contact>John Doe</contact>
  12. <email>john.doe@example.com</email>
  13. <phone>555-123456</phone>
  14. <task>Gremlins in the hallways</task>
  15. <resolution>Repair</resolution>
  16. <tasks/>
  17. <problem/>
  18. <problemcode/>
  19. <part>None</part>
  20. <part2>None</part2>
  21. <partlist/>
  22. <time>30</time>
  23. <bill/>
  24. <maxprice>10000</maxprice>
  25. <parts>
  26. <part name="Lock / Office door">
  27. <name>Abloy A-3453</name>
  28. <description>Lock for regular office door</description>
  29. <price>36</price>
  30. </part>
  31. <part name="Lock / Outside door">
  32. <name>Abloy B-503</name>
  33. <description>Lock for outside doors</description>
  34. <price>54</price>
  35. </part>
  36. <part name="Lock / Fire door">
  37. <name>Abloy F-54</name>
  38. <description>Lock for fire doors</description>
  39. <price>87</price>
  40. </part>
  41. <part name="Handle / Office door">
  42. <name>Hanbar 45-5</name>
  43. <description>Handle for regular office door</description>
  44. <price>12</price>
  45. </part>
  46. <part name="Handle / Outside or fire door (reinforced)">
  47. <name>Hanbar 3-56</name>
  48. <description>Handle for outside or fire doors</description>
  49. <price>23</price>
  50. </part>
  51. <part name="Office door">
  52. <name>DuraMax Office</name>
  53. <description>Replacement office door</description>
  54. <price>200</price>
  55. </part>
  56. <part name="Outside door">
  57. <name>DuraMax Weatherproof</name>
  58. <description>Replacement outside door</description>
  59. <price>500</price>
  60. </part>
  61. <part name="Fire door">
  62. <name>DuraMax Firedrake</name>
  63. <description>Replacement fire door</description>
  64. <price>800</price>
  65. </part>
  66. <part name="None">
  67. <name>No part</name>
  68. <description>No part</description>
  69. <price>0</price>
  70. </part>
  71. </parts>
  72. </Data>
  73. </xf:instance>
  74. <xf:bind nodeset="/Data/time" type="xsd:integer"/>
  75. <xf:bind nodeset="/Data/problem" relevant="/Data/resolution != 'No Fault'"/>
  76. <xf:bind nodeset="/Data/problemcode" relevant="/Data/resolution != 'No Fault'"/>
  77. <xf:bind nodeset="/Data/problemcode" type="xsd:decimal"/>
  78. <xf:bind nodeset="/Data/tasks" relevant="/Data/resolution = 'Repair'"/>
  79. <xf:bind nodeset="/Data/part" relevant="/Data/resolution = 'Replace'"/>
  80. <xf:bind nodeset="/Data/maxprice" relevant="/Data/resolution = 'Replace'" type="xsd:decimal"/>
  81. <xf:bind nodeset="/Data/time" constraint="/Data/time &gt;= 30"/>
  82. <xf:bind nodeset="/Data/bill" calculate="number(/Data/time) * 1.5 + (/Data/parts/part[@name=/Data/part]/price * number(if(/Data/resolution='Replace','1','0')))"/>
  83. <xf:bind nodeset="/Data/parts/part/name" relevant="/Data/resolution = 'Replace'"/>
  84. <xf:bind nodeset="/Data/parts/part/description" relevant="/Data/resolution = 'Replace'"/>
  85. <xf:bind nodeset="/Data/parts/part/price" relevant="/Data/resolution = 'Replace'"/>
  86. </xf:model>
  87. </head>
  88. <body>
  89. <xf:input ref="/Data/contact">
  90. <xf:label>Contact</xf:label>
  91. </xf:input>
  92. <xf:switch appearance="compact" id="pageselector">
  93. <xf:label>Page</xf:label>
  94. <!-- ================================================================= -->
  95. <xf:case id="infopage" lazy-init="true">
  96. <xf:label>Info</xf:label>
  97. <xf:output ref="/Data/contact" class="myoutput">
  98. <xf:label>Contact</xf:label>
  99. </xf:output>
  100. <xf:output ref="/Data/phone">
  101. <xf:label>Phone</xf:label>
  102. </xf:output>
  103. <xf:output ref="/Data/task">
  104. <xf:label>Task</xf:label>
  105. </xf:output>
  106. <xf:trigger>
  107. <xf:label>Go to Work</xf:label>
  108. <xf:action ev:event="DOMActivate">
  109. <xf:toggle case="workpage"/>
  110. <xf:setfocus control="pageselector" />
  111. </xf:action>
  112. </xf:trigger>
  113. </xf:case>
  114. <!-- ================================================================= -->
  115. <xf:case id="workpage" lazy-init="true">
  116. <xf:label>Work</xf:label>
  117. <xf:select1 ref="/Data/resolution" appearance="minimal">
  118. <xf:label>Resolution</xf:label>
  119. <xf:item>
  120. <xf:label>Repair</xf:label>
  121. <xf:value>Repair</xf:value>
  122. </xf:item>
  123. <xf:item>
  124. <xf:label>Replace</xf:label>
  125. <xf:value>Replace</xf:value>
  126. </xf:item>
  127. <xf:item>
  128. <xf:label>No Fault</xf:label>
  129. <xf:value>No Fault</xf:value>
  130. <xf:message ev:event="xforms-select" if="/Data/time &gt; 30">Detecting no fault should not take more than 30 minutes!</xf:message>
  131. </xf:item>
  132. <xf:hint>Please select the type of solution applied to the problem.</xf:hint>
  133. </xf:select1>
  134. <xf:select ref="/Data/tasks" appearance="minimal">
  135. <xf:label>Tasks</xf:label>
  136. <xf:item>
  137. <xf:label>Fault Analysis</xf:label>
  138. <xf:value>analysis</xf:value>
  139. </xf:item>
  140. <xf:item>
  141. <xf:label>Repair</xf:label>
  142. <xf:value>repair</xf:value>
  143. </xf:item>
  144. <xf:item>
  145. <xf:label>Extensive On-Site User Training</xf:label>
  146. <xf:value>training</xf:value>
  147. </xf:item>
  148. <xf:item>
  149. <xf:label>Cleanup</xf:label>
  150. <xf:value>cleanup</xf:value>
  151. </xf:item>
  152. <xf:hint>Please select which tasks were included in the work you performed</xf:hint>
  153. </xf:select>
  154. <xf:range ref="/Data/time" start="0" end="240" step="15">
  155. <xf:label value="concat('Work time: ',/Data/time,' min')" />
  156. <xf:alert>Minimum charge is 30 minutes!</xf:alert>
  157. </xf:range>
  158. <xf:input ref="/Data/problem">
  159. <xf:label>Problem description</xf:label>
  160. <xf:hint>Please enter problem description here</xf:hint>
  161. </xf:input>
  162. <xf:input ref="/Data/problemcode">
  163. <xf:label>Problem Code</xf:label>
  164. <xf:hint>Please enter problem code here</xf:hint>
  165. </xf:input>
  166. <xf:select1 ref="/Data/part" id="partselection" appearance="minimal">
  167. <xf:label>Replacement part</xf:label>
  168. <xf:itemset nodeset="/Data/parts/part[price &lt;= /Data/maxprice]">
  169. <xf:label ref="@name"/>
  170. <xf:value ref="@name"/>
  171. </xf:itemset>
  172. <xf:hint>Please select which replacement part was needed.</xf:hint>
  173. </xf:select1>
  174. <xf:output ref="/Data/parts/part[@name=/Data/part]/name">
  175. <xf:label>Part ID</xf:label>
  176. </xf:output>
  177. <xf:output ref="/Data/parts/part[@name=/Data/part]/description">
  178. <xf:label>Description</xf:label>
  179. </xf:output>
  180. <xf:output ref="/Data/parts/part[@name=/Data/part]/price">
  181. <xf:label>Price</xf:label>
  182. </xf:output>
  183. <xf:trigger>
  184. <xf:label>Go to Final</xf:label>
  185. <xf:action ev:event="DOMActivate">
  186. <xf:toggle case="finalpage"/>
  187. <xf:setfocus control="pageselector" />
  188. </xf:action>
  189. </xf:trigger>
  190. </xf:case>
  191. <!-- ================================================================= -->
  192. <xf:case id="finalpage" lazy-init="true">
  193. <xf:label>Final</xf:label>
  194. <xf:trigger>
  195. <xf:label>Cancel</xf:label>
  196. <xf:action ev:event="DOMActivate">
  197. <xf:message>Canceled!</xf:message>
  198. <xf:toggle case="infopage"/>
  199. <xf:setvalue ref="/Data/page" value="'info'"/>
  200. </xf:action>
  201. </xf:trigger>
  202. <xf:trigger>
  203. <xf:label>Submit</xf:label>
  204. <xf:action ev:event="DOMActivate">
  205. <xf:message>In a real application, data would now be submitted.</xf:message>
  206. </xf:action>
  207. </xf:trigger>
  208. </xf:case>
  209. </xf:switch>
  210. <!-- ================================================================= -->
  211. <xf:output ref="/Data/bill">
  212. <xf:label>Total EUR</xf:label>
  213. </xf:output>
  214. </body>
  215. </html>