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

    <!-- Taxe numere PF -->
    <screen type="Void" id="LoadInfo">
        <actions>
            <action type="Next">
                <set key="#file" value="file://smith6.html" />
                <goto target="InfoPage"/>
            </action>
        </actions>
    </screen>
    <screen id="InfoPage" type="info" title="Informare">
        <field key="#file" />
        <actions>
            <action type="Next">
                <goto target="StepZero"/>
            </action>
            <action type="Prev">
                <goto target="previous"/>
            </action>
            <action type="Exit">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>

    <screen id="get_service_type" type="selector/bigbutton" title="Serviciu">
        <fields>
            <selector-field id="pType" message="Tip serviciu" title="Tip serviciu">
                <items type="static">
                    <item value="0" title="Numere preferentiale"/>
                    <item value="1" title="Numere la rand"/>
                    <item value="2" title="Numere provizorii"/>
                    <item value="3" title="Placa duplicat"/>
                </items>
            </selector-field>
        </fields>
        <actions>
            <action type="Next" title="Next">
                <switch value="pType">
                    <case value="0">
                        <set key="id5" value="Numere preferentiale" />
                        <goto target="StepZero_pref"/>
                    </case>
                    <case value="1">
                        <set key="id5" value="Numere la rand" />
                        <goto target="StepZero_rand"/>
                    </case>
                    <case value="2">
                        <set key="id5" value="Numere provizorii" />
                        <goto target="StepZero_prov"/>
                    </case>
                    <case value="3">
                        <set key="id5" value="Placa duplicat" />
                        <goto target="StepZero_dupl"/>
                    </case>
                    <default/>
                </switch>
            </action>
            <action type="Prev" title="Prev">
                <goto target="InfoPage"/>
            </action>
            <action type="Exit" title="Exit">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>
    <screen id="StepZero" type="table" title="Locatie institutie">
        <fields>
            <table-field id="tf" title="Tabel" read-only="false">
                <columns>
                    <column key="location" title="Selectati judetul" width="0.9"/>
                </columns>
                <items>
                    <item><cell key="location" key-title="Locatie institutie" value="DRPCIV Bucuresti" value-title="DRPCIV Bucuresti"/></item>
                    <item><cell key="location" key-title="Locatie institutie" value="DRPCIV Ilfov" value-title="DRPCIV Ilfov"/></item>
                </items>
            </table-field>
        </fields>
        <actions>
            <action type="Next" title="Inainte">
                <switch value="location">
                    <case value="DRPCIV Bucuresti"><set key="iban" value="RO76TREZ705502601X009835" /></case>
                    <case value="DRPCIV Ilfov"><set key="iban" value="RO34TREZ421502601X010317" /></case>
                </switch>
                <goto target="get_service_type"/>
            </action>
            <action type="Prev" title="Inapoi">
                <goto target="InfoPage"/>
            </action>
            <action type="Exit" title="Pagina principala">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>
    <screen id="StepZero_pref" type="table" title="Categoria">
        <fields>
            <table-field id="tf" title="Tabel" read-only="false">
                <columns>
                    <column key="categorie" title="Categorie vehicul" width="0.5"/>
                    <column key="geometrie" title="Geometrie placa" width="0.3"/>
                    <column key="id6" title="Pret (RON)" width="0.2"/>
                </columns>
                <items>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autoturisme, autorulote si autoutilitare" value-title="Autoturisme, autorulote si autoutilitare"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="85" value-title="85"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autobuze si microbuze" value-title="Autobuze si microbuze"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="85" value-title="85"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autotractoare" value-title="Autotractoare"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="85" value-title="85"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Motociclete, tricicluri si cvadricicluri" value-title="Motociclete, tricicluri si cvadricicluri"/>
                        <cell key="geometrie" key-title="geometrie" value="C" value-title="C"/>
                        <cell key="id6" key-title="Pret" value="62" value-title="62"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Rulote si remorci" value-title="Rulote si remorci"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="65" value-title="65"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Rulote si remorci" value-title="Rulote si remorci"/>
                        <cell key="geometrie" key-title="geometrie" value="B" value-title="B"/>
                        <cell key="id6" key-title="Pret" value="68" value-title="68"/>
                    </item>
                 </items>
            </table-field>
        </fields>
        <actions>
            <action type="Next" title="Inainte">
                <goto target="StepOne"/>
            </action>
            <action type="Prev" title="Inapoi">
                <goto target="StepZero"/>
            </action>
            <action type="Exit" title="Pagina principala">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>
    <screen id="StepZero_rand" type="table" title="Categoria">
        <fields>
            <table-field id="tf" title="Tabel" read-only="false">
                <columns>
                    <column key="categorie" title="Categorie vehicul" width="0.5"/>
                    <column key="geometrie" title="Geometrie placa" width="0.3"/>
                    <column key="id6" title="Pret (RON)" width="0.2"/>
                </columns>
                <items>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autoturisme, autorulote si autoutilitare" value-title="Autoturisme, autorulote si autoutilitare"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="40" value-title="40"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autobuze si microbuze" value-title="Autobuze si microbuze"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="40" value-title="40"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autotractoare" value-title="Autotractoare"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="40" value-title="40"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Motociclete, tricicluri si cvadricicluri" value-title="Motociclete, tricicluri si cvadricicluri"/>
                        <cell key="geometrie" key-title="geometrie" value="C" value-title="C"/>
                        <cell key="id6" key-title="Pret" value="17" value-title="17"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Rulote si remorci" value-title="Rulote si remorci"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="20" value-title="20"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Rulote si remorci" value-title="Rulote si remorci"/>
                        <cell key="geometrie" key-title="geometrie" value="B" value-title="B"/>
                        <cell key="id6" key-title="Pret" value="23" value-title="23"/>
                    </item>
                </items>
            </table-field>
        </fields>
        <actions>
            <action type="Next" title="Inainte">
                <goto target="StepOne"/>
            </action>
            <action type="Prev" title="Inapoi">
                <goto target="StepZero"/>
            </action>
            <action type="Exit" title="Pagina principala">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>
    <screen id="StepZero_prov" type="table" title="Categoria">
        <fields>
            <table-field id="tf" title="Tabel" read-only="false">
                <columns>
                    <column key="categorie" title="Categorie vehicul" width="0.5"/>
                    <column key="geometrie" title="Geometrie placa" width="0.3"/>
                    <column key="id6" title="Pret (RON)" width="0.2"/>
                </columns>
                <items>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autoturisme, autorulote si autoutilitare" value-title="Autoturisme, autorulote si autoutilitare"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="40" value-title="40"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autobuze si microbuze" value-title="Autobuze si microbuze"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="40" value-title="40"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autotractoare" value-title="Autotractoare"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="40" value-title="40"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Motociclete, tricicluri si cvadricicluri" value-title="Motociclete, tricicluri si cvadricicluri"/>
                        <cell key="geometrie" key-title="geometrie" value="C" value-title="C"/>
                        <cell key="id6" key-title="Pret" value="17" value-title="17"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Rulote si remorci" value-title="Rulote si remorci"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="20" value-title="20"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Rulote si remorci" value-title="Rulote si remorci"/>
                        <cell key="geometrie" key-title="geometrie" value="B" value-title="B"/>
                        <cell key="id6" key-title="Pret" value="23" value-title="23"/>
                    </item>
                </items>
            </table-field>
        </fields>
        <actions>
            <action type="Next" title="Inainte">
                <goto target="StepOne"/>
            </action>
            <action type="Prev" title="Inapoi">
                <goto target="StepZero"/>
            </action>
            <action type="Exit" title="Pagina principala">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>
    <screen id="StepZero_dupl" type="table" title="Categoria">
        <fields>
            <table-field id="tf" title="Tabel" read-only="false">
                <columns>
                    <column key="categorie" title="Categorie vehicul" width="0.5"/>
                    <column key="geometrie" title="Geometrie placa" width="0.3"/>
                    <column key="id6" title="Pret (RON)" width="0.2"/>
                </columns>
                <items>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autoturisme, autorulote si autoutilitare" value-title="Autoturisme, autorulote si autoutilitare"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="40" value-title="40"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autobuze si microbuze" value-title="Autobuze si microbuze"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="40" value-title="40"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Autotractoare" value-title="Autotractoare"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="40" value-title="40"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Motociclete, tricicluri si cvadricicluri" value-title="Motociclete, tricicluri si cvadricicluri"/>
                        <cell key="geometrie" key-title="geometrie" value="C" value-title="C"/>
                        <cell key="id6" key-title="Pret" value="17" value-title="17"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Rulote si remorci" value-title="Rulote si remorci"/>
                        <cell key="geometrie" key-title="geometrie" value="A" value-title="A"/>
                        <cell key="id6" key-title="Pret" value="20" value-title="20"/>
                    </item>
                    <item>
                        <cell key="categorie" key-title="Categorie vehicul" value="Rulote si remorci" value-title="Rulote si remorci"/>
                        <cell key="geometrie" key-title="geometrie" value="B" value-title="B"/>
                        <cell key="id6" key-title="Pret" value="23" value-title="23"/>
                    </item>
                </items>
            </table-field>
        </fields>
        <actions>
            <action type="Next" title="Inainte">
                <goto target="StepOne"/>
            </action>
            <action type="Prev" title="Inapoi">
                <goto target="StepZero"/>
            </action>
            <action type="Exit" title="Pagina principala">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>

    <screen id="StepOne" type="group" title="Introduceti datele titularului">
        <fields>
            <text-field id="id3" keyboard="any:[en]:upper:false" max-len="35" title="Nume si prenume">
                <validator type="regex">
                    <rules>
                        <rule regex="^[a-zA-Z \s]*$"/>
                    </rules>
                </validator>
                <help>
                    <![CDATA[<html>Introduceti numele si prenumele beneficiarului]]>
                </help>
            </text-field>
            <text-field id="id1" keyboard="Digital" max-len="13" title="CNP beneficiar">
                <validator type="regex">
                    <rules>
                        <rule regex="^(\d{13})$"/>
                    </rules>
                </validator>
                <help>
                    <![CDATA[<html>Introduceti CNP-ul persoanei pentru care se face plata]]>
                </help>
            </text-field>
            <text-field id="id4" keyboard="Digital" max-len="13" title="CNP platitor">
                <validator type="regex">
                    <rules>
                        <rule regex="^(\d{13})$"/>
                    </rules>
                </validator>
                <help>
                    <![CDATA[<html>Introduceti CNP-ul persoanei care face plata]]>
                </help>
            </text-field>
<!--            <text-field id="id2" keyboard="any:[en,symb]:lower:true" max-len="99" message="Introduceti adresa de email" title="Email" default="">-->
<!--                <validator type="regex">-->
<!--                    <rules>-->
<!--                        <rule regex="^[-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}$"/>-->
<!--                    </rules>-->
<!--                </validator>-->
<!--                <help>-->
<!--                    <![CDATA[<html><center>Introduceti adresa de email a persoanei pentru care se face plata]]>-->
<!--                </help>-->
<!--            </text-field>-->
        </fields>
        <actions>
            <action type="Next">
                <set key="id2" value="-" />
                <switch value="pType">
                    <case value="0">
                        <goto target="StepTwo_pref"/>
                    </case>
                    <case value="1">
                        <goto target="StepTwo"/>
                    </case>
                    <case value="2">
                        <goto target="StepTwo"/>
                    </case>
                    <case value="3">
                        <goto target="StepTwo_pref"/>
                    </case>
                    <default/>
                </switch>
            </action>
            <action type="Prev">
                <goto target="get_service_type"/>
            </action>
            <action type="Exit">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>

    <screen id="StepTwo" type="group" title="Introduceti datele titularului">
        <fields>
            <text-field id="id7" keyboard="Digital" max-len="1" title="Numar seturi de placi">
                <validator type="regex">
                    <rules>
                        <rule regex="^(\d{1})$"/>
                    </rules>
                </validator>
                <help>
                    <![CDATA[<html>Introduceti numarul seturilor de placi]]>
                </help>
            </text-field>
            <text-field id="telefon" keyboard="Digital" max-len="10" title="Numar telefon">
                <validator type="regex">
                    <rules>
                        <rule regex="^(\d{10})$"/>
                    </rules>
                </validator>
                <help>
                    <![CDATA[<html>Introduceti numarul de telefon]]>
                </help>
            </text-field>
        </fields>
        <actions>
            <action type="Next">
                <set key="service_name" value="DRPCIVnumere"/>
                <online-request type="default" function="check_request" params="id1,id2,id3,id4,id5,id6,id7,location,service_name">
                    <actions>
                        <action type="success">
                            <if condition="code == 0">
                                <then>
                                    <goto target="ConfirmPage"/>
                                </then>
                                <else>
                                    <dialog type="Info" title="Eroare" message="Eroare: {0}" timeout="10" default="okay" mess-params="exception">
                                        <actions>
                                            <action type="okay" title="OK">
                                                <cancel/>
                                            </action>
                                        </actions>
                                    </dialog>
                                </else>
                            </if>
                        </action>
                        <action type="error">
                            <dialog type="Info" title="Eroare" message="A intervenit o eroare, va rugam sa incercati din nou" timeout="10" default="okay">
                                <actions>
                                    <action type="okay" title="OK">
                                        <cancel/>
                                    </action>
                                </actions>
                            </dialog>
                        </action>
                    </actions>
                </online-request>
            </action>
            <action type="Prev">
                <goto target="StepOne"/>
            </action>
            <action type="Exit">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>
    <screen id="StepTwo_pref" type="group" title="Introduceti datele titularului">
        <fields>
            <text-field id="id7" keyboard="Digital" prefix="1" max-len="1" title="Numar seturi de placi">
                <validator type="regex">
                    <rules>
                        <rule regex="^(\d{1})$"/>
                    </rules>
                </validator>
                <help>
                    <![CDATA[<html>Maxim seturi permise: 1]]>
                </help>
            </text-field>
            <text-field id="telefon" keyboard="Digital" max-len="10" title="Numar telefon">
                <validator type="regex">
                    <rules>
                        <rule regex="^(\d{10})$"/>
                    </rules>
                </validator>
                <help>
                    <![CDATA[<html>Introduceti numarul de telefon]]>
                </help>
            </text-field>
        </fields>
        <actions>
            <action type="Next">
                <set key="service_name" value="DRPCIVnumere"/>
                <online-request type="default" function="check_request" params="id1,id2,id3,id4,id5,id6,id7,location,service_name">
                    <actions>
                        <action type="success">
                            <if condition="code == 0">
                                <then>
                                    <goto target="ConfirmPage"/>
                                </then>
                                <else>
                                    <dialog type="Info" title="Eroare" message="Eroare: {0}" timeout="10" default="okay" mess-params="exception">
                                        <actions>
                                            <action type="okay" title="OK">
                                                <cancel/>
                                            </action>
                                        </actions>
                                    </dialog>
                                </else>
                            </if>
                        </action>
                        <action type="error">
                            <dialog type="Info" title="Eroare" message="A intervenit o eroare, va rugam sa incercati din nou" timeout="10" default="okay">
                                <actions>
                                    <action type="okay" title="OK">
                                        <cancel/>
                                    </action>
                                </actions>
                            </dialog>
                        </action>
                    </actions>
                </online-request>
            </action>
            <action type="Prev">
                <goto target="StepOne"/>
            </action>
            <action type="Exit">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>

    <!-- Confirm -->
    <screen id="ConfirmPage" type="confirm" title="Verificati corectitudinea datelor introduse">
        <fields list="id1,id3,id4,categorie,id7,price,location"/>
        <actions>
            <action type="Next" title="Achita">
                <clear keys="#file"/>
                <set-sum from="price" type="units"/>
                <dialog type="Info" title="Info" message="Sunteti de acord cu prelucrarea datelor cu caracter personal in scopuri de marketing?" timeout="10" default="cancel" mess-params="name">
                    <actions>
                        <action type="okay" title="Da">
                            <set key="gdpr" value="1"/>
                            <goto target="pay"/>
                        </action>
                        <action type="cancel" title="Nu">
                            <set key="gdpr" value="0"/>
                            <goto target="pay"/>
                        </action>
                    </actions>
                </dialog>
            </action>
            <action type="Prev" title="Inapoi">
                <goto target="StepOne"/>
            </action>
            <action type="Exit" title="Acasa">
                <goto target="exit"/>
            </action>
        </actions>
    </screen>
</scenario>
