<?xml version="1.0" encoding="UTF-8"?>
<scenario begin="load">

	<!--Focus Sat - Un-doi-->
	<screen type="Void" id="load">
		<actions>
			<action type="Next">
				<set key="#file" value="file://html/focus_sat.html" />
				<goto target="prewindow"/>
			</action>
		</actions>
	</screen>

	<!-- Info -->
	<screen id="prewindow" type="info" title="Informare">
		<field key="#file" />
		<actions>
			<action type="Next">
				<goto target="online_request"/>
			</action>
			<action type="Prev">
				<goto target="previous"/>
			</action>
			<action type="Exit">
				<goto target="exit"/>
			</action>
		</actions>
	</screen>

	<screen type="void" decor="button" title="" id="online_request">
		<fields/>
		<actions>
			<action type="Next" title="Verifica lista produselor">
				<load from="point.address" key="trm_location"/>
				<set key="products" value="0"/>
				<set key="service_name" value="FocusSat"/>
				<set key="id3" value="-"/>
				<online-request type="default" function="get_products" params="products,service_name">
					<actions>
						<goto-action type="success" target="select_products"/>
						<action type="error">
							<dialog type="Info" title="Eroare" message="Lista produselor este inaccesibila momentan" timeout="10" default="okay">
								<actions>
									<action type="okay" title="OK">
										<cancel/>
									</action>
								</actions>
							</dialog>
						</action>
					</actions>
				</online-request>
			</action>
			<goto-action type="Inapoi" title="Inapoi" target="previous"/>
			<goto-action type="Pagina principala" title="Pagina principala" target="exit"/>
		</actions>
	</screen>

	<!-- Select product -->
	<screen id="select_products" type="table" title="Selectati produsul dorit">
		<fields>
			<table-field id="tf" title="Tabel" read-only="false">
				<columns>
					<column key="product" title="Pachet" width="0.7"/>
					<column key="price" title="Pret (RON)" width="0.3"/>
				</columns>
				<items type="data" key="#products"/>
			</table-field>
		</fields>
		<actions>
			<action type="Next" title="Inainte">
				<modify src-key="id1" t-key="^(.*)$" v-key="id3" t-key-title="^(.*)$" v-key-title="ID" />
				<modify src-key="price" t-key-title="^(.*)$" v-key-title="Pret" />
				<modify src-key="product" t-key="^(.*)$" v-key="id1" t-key-title="^(.*)$" v-key-title="Produs" />
				<goto target="confirm"/>
			</action>
			<action type="Prev" title="Inapoi">
				<goto target="previous"/>
			</action>
			<action type="Exit" title="Pagina principala">
				<goto target="exit"/>
			</action>
		</actions>
	</screen>

	<!-- Confirm -->
	<screen id="confirm" type="confirm" title="Confirmare">
		<fields list="id1,price"/>
		<actions>
			<action type="Next" title="Achita">
				<set-sum from="price" type="units"/>
				<goto target="pay"/>
			</action>
			<action type="Prev" title="Inapoi">
				<goto target="select_products"/>
			</action>
			<action type="Exit" title="Acasa">
				<goto target="exit"/>
			</action>
		</actions>
	</screen>
</scenario>
