<scenario begin="input_phone">

    <screen type="Sum" sum="sum-comunal"/>
	
    <screen type="numeric/comunal" title="INTRODUCETI CODUL DE CLIENT ENGIE" id="input_phone" sound="input_payment_indent.mp3">
        <fields>
            <text-field id="id1" title="COD CLIENT" max-len="12" keyboard="Digital">
                <validator type="regex">
                    <rules>
                        <rule regex="^\d{12}$"/>
                    </rules>
				</validator>
                <formatter type="regex">
                    <rules default="**** **** ****"/>
                </formatter>                
                <help>file://helps/adv.png</help>
            </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/comunal" title="VERIFICARE DATE" id="confirm" sound="validate_phone.mp3" message="&lt;html&gt;&lt;b&gt;&lt;center&gt;&lt;br&gt;Va rugam verificati datele introduse.&lt;br&gt;&lt;br&gt;Apasati CONFIRMARE pentru a avansa.&lt;br&gt;Apasati INAPOI pentru a corecta datele.">
	<fields list="id1"/>
        <actions>
            <action type="Next" title="CONFIRMARE">
                <online-request type="default" function="" params="id1">
                    <actions>
                        <action type="success">
                            <modify src-key="id1" t-value-title="^(\d{4})(\d{4})(\d{4})$" v-value-title="$1 $2 $3"/>
                            <goto target="prepay"/>
                        </action>
                        <action type="error">
                            <dialog type="Info" title="Error" message="Cod client 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{4})(.*)(\d{4})(.*)(\d{4})$" v-value-title="$1$3$5"/>
                        <clear keys="#back"/>
                        <goto target="input_phone"/>
                    </then>
                    <else>
                        <set key="#back" value="1"/>
                        <modify src-key="id1" t-key-title="^(.*)$" v-key-title="CODUL DE CLIENT"/>
                        <goto target="pay"/>
                    </else>
                </if>
            </action>
        </actions>
    </screen>         
    
</scenario>
