<scenario begin="input_code">
	
	
	<screen type="group/comunal" title="INTRODUCETI COD CLIENT" id="input_code" sound="input_payment_indent.mp3">
    <fields>
      <text-field id="id1" title="Cod client" max-len="10" keyboard="Digital">
        <validator type="regex">
          <rules>
              <rule regex="^\d{8,10}$"/>
          </rules>
        </validator>
      </text-field>
    </fields>
    <actions>
      <action type="Next" title="INAINTE">
        <goto target="input_number"/>                
      </action>
      <action type="Prev" title="INAPOI">
        <goto target="previos"/>
      </action>
      <action type="Exit" title="MENIU">
        <goto target="exit"/>
      </action>
    </actions>
  </screen>


	<screen type="group/comunal" title="INTRODUCETI NUMAR FACTURA" id="input_number" sound="input_payment_num.mp3">
    <fields>
      <text-field id="id2" title="Numar factura" max-len="10" keyboard="Digital">
        <validator type="regex">
          <rules>
            <rule regex="^\d{8,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/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 numarul.">
	<fields list="id1,id2"/>
    <actions>
      <action type="Next" title="CONFIRMARE">
        <set key="sum" value="1"/>
        <online-request type="default" function="adv-preliminary" params="id1">
          <actions>
            <action type="success">
              <online-request type="default" function="checkPaymentRequisites" params="id1,id2">
                <actions>
                  <action type="success">
                    <clear keys="sum"/>
                    <goto target="pay"/>
                  </action>
                  <action type="error">
                    <dialog type="Info" title="Error" message="Datele introduse sunt gresite" timeout="10" default="okay">
                      <actions>
                        <action type="okay" title="OK">
                          <clear keys="sum"/>
                          <goto target="input_code"/>
                        </action>                                            
                      </actions>
                    </dialog>                            
                  </action>
                  <action type="exception">
                    <dialog type="Info" title="Error" message="Operatorul nu poate raspunde cererii" timeout="10" default="okay">
                      <actions>
                        <action type="okay" title="OK">
                          <clear keys="sum"/>
                          <cancel/>
                        </action>                                            
                      </actions>
                    </dialog>
                  </action>
                </actions>
              </online-request>          
            </action>
            <action type="error">
              <dialog type="Info" title="Error" message="Acest aparat nu dispune de fondurile necesare pentru a finaliza tranzactia." timeout="10" default="okay">
                <actions>
                  <action type="okay" title="OK">
                    <clear keys="sum"/>
                    <goto target="input_code"/>
                  </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">
                    <clear keys="sum"/>
                    <cancel/>
                  </action>                                            
                </actions>
              </dialog>
            </action>
          </actions>
        </online-request>         
      </action>
      <action type="Prev" title="INAPOI">
        <goto target="input_number"/>	                
      </action>
      <action type="Exit" title="MENIU">
        <goto target="exit"/>
      </action>
    </actions>
  </screen>

</scenario>