<scenario begin="input_phone" begin-process="first_void">
    
    <screen type="Void"  id="first_void">
        
        <actions>
            <action type="Next" title="NEXT">
                <if condition="is-not-null id1">
                    <then>
                        <goto target="pay"/>
                    </then>
                    <else>
                        <goto target="input_phone"/>
                    </else>    
                </if> 
            </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>
            </text-field>            
        </fields>
        <actions>
            <action type="Next" title="INAINTE">
                <goto target="confirm"/>                
            </action>
            <action type="Prev" title="INAPOI">
                <goto target="previos"/>
            </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">
                            <modify src-key="id1"  t-value-title="^(\d{3})(\d{3})(\d{2})(\d{2})$" v-value-title="$1.$2.$3.$4"/>
                            <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">
                                        <goto target="input_phone"/>
                                    </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="input_phone"/>
                    </then>
                    <else>
                        <set key="#back" value="1"/>
						<modify src-key="id1" t-key-title="^(.*)$" v-key-title="NUMARUL DE TELEFON"/>
                        <goto target="pay"/>
                    </else>
                </if>
            </action>
        </actions>
    </screen>         
    
</scenario>
