<scenario begin="first_screen">

    <!--  Start screen -->
    <screen type="selector/currency" title="SELECTATI VALOAREA DE REINCARCARE" id="first_screen">
        <fields>
            <selector-field id="product" title="Nominal">
                <items type="static">
                    <item value="5" title="5 €" sum="5"/>				
                    <item value="8" title="8 €" sum="8"/>
                    <item value="10" title="10 €" sum="10"/>
                    <item value="13" title="13 €" sum="13"/>
                </items>
            </selector-field>
        </fields>
        <actions>
            <action type="Next" title="INAINTE">
                <goto target="input_phone"/>
            </action>
            <action type="Prev" title="INAPOI">
                <goto target="previos"/>
                <cancel/>
            </action>
            <action type="Exit" title="MENIU">
                <goto target="exit"/>
            </action>
			<action type="Edit" title="1;0xff6501">
                <cancel/>
            </action>
        </actions>
    </screen>
	
    <screen type="numeric/info" title="INTRODUCETI NUMARUL DE TELEFON" id="input_phone" sound="input_phone.mp3">
        <fields>
            <text-field id="id1" title="NUMARUL DE TELEFON" max-len="10" prefix="07" keyboard="Digital">
                <validator type="regex">
                    <rules>
                        <rule regex="^\d{10}$"/>
                    </rules>
                </validator>
                <help>file://helps/orange_internet.png</help>
            </text-field>            
        </fields>
        <actions>
            <action type="Next" title="INAINTE">
                <goto target="confirm"/>                
            </action>
            <action type="Prev" title="INAPOI">
                <goto target="first_screen"/>
            </action>
            <action type="Exit" title="MENIU">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>
    
    <!--  Вывод информации -->
    <screen type="confirm/simple" title="VERIFICARE NUMAR" id="confirm" sound="validate_phone.mp3" message="&lt;html&gt;&lt;b&gt;&lt;center&gt;&lt;br&gt;Va rugam verificati numarul de telefon introdus.&lt;br&gt;&lt;br&gt;Apasati CONFIRMARE pentru a avansa.&lt;br&gt;Apasati INAPOI pentru a corecta numarul.">
	<fields list="id1"/>
        <actions>
            <action type="Next" title="CONFIRMARE">
                <online-request type="default" function="find-provider" params="id1">
                    <actions>
                        <action type="success">
                            <goto target="prepay"/>
                        </action>
                        <action type="error">
                            <dialog type="Info" title="Error" message="Numarul de telefon nu a fost gasit" timeout="10" default="okay">
                                <actions>
                                    <action type="okay" title="OK">
                                        <cancel/>
                                    </action>                                            
                                </actions>
                            </dialog>                            
                        </action>
                        <action type="exception">
                            <dialog type="Info" title="Error" message="Nu exista conexiune cu serverul" timeout="10" default="okay">
                                <actions>
                                    <action type="okay" title="OK">
                                        <cancel/>
                                    </action>                                            
                                </actions>
                            </dialog>
                        </action>
                    </actions>
                </online-request>                
            </action>
            <action type="Prev" title="INAPOI">
                <goto target="input_phone"/>	                
            </action>
            <action type="Exit" title="MENIU">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>
	
	<screen type="Void"  id="prepay">
	
		<actions>
			<action type="Next" title="NEXT">
				<if condition="is-not-null #back">
					<then>
						<modify src-key="id1" t-value-title="^(\d{3})(.)(\d{3})(.)(\d{2})(.)(\d{2})$" v-value-title="$1$3$5$7"/>
						<clear keys="#back"/>
						<goto target="confirm"/>
					</then>
					<else>
						<set key="#back" value="1"/>
						<goto target="pay"/>
					</else>
				</if>
			</action>
		</actions>
	</screen>
	
    <screen type="Sum" sum="sum-trade"/>
    
</scenario>