صفحه دوم (نتیجه سند)

نمای مینی اپ به صورت زیر خواهد بود

image-1699433114520.png

image-1699433468931.png

 

image-1699433507021.png

کد

<page id="result-page" title="تصدیق اصالت سند" layout="linear_vertical"
      background="#FFFFFF" scrollable="true" padding="16" onshown="script/main:init()">

    <include layout="pages/result/result.js.appsan" />

    <frame layout="linear_vertical" margin_left="16" margin_right="12"
           borderCornerRadius="4" background="transparent">

        <frame layout="linear_vertical" margin="0" padding="0">
            <img src="images/vekalat.png" height="150" width="328" scaleType="fit_center"/>

            <text id="DocType" text="" textsize="12" textalignment="right" margin_top="16"
                  textcolor="#424750" textstyle="bold" />

            <frame layout="linear_horizontal" reverse="true" gravity="right" childgravity="center_vertical"
                   layoutgravity="center_vertical" margin="0" padding="0">

                <text text="شناسه سند" textsize="11" textcolor="#424750" width="wrap_content"/>

                <image src="images/dot.png" width="5" height="match_parent" scaleType="fit_center"
                     gravity="center_vertical" layoutgravity="center_vertical" margin="8"
                     selfgravity="center_vertical" childgravity="center_vertical"/>

                <text id="NationalRegisterNo" text="۱۳۹۵۹۳۲۵۱۱۰۰۰۰۳۹" textsize="11" textcolor="#424750" width="wrap_content"/>
            </frame>

        </frame>


        <frame layout="linear_horizontal" reverse="true" height="wrap_content"
               width="wrap_content" margin_top="16"
               margin="0" padding="0" childgravity="bottom" gravity="bottom">

            <frame layout="linear_vertical" margin="0" padding="0" padding_bottom="0">

                <text gravity="center" textalignment="center" height="wrap_content"
                      textsize="12" id="menu-btn-1" textcolor="#0164BC"
                      elevation="0" text="مشخصات سند" onclick="script/main:changeColor('menu-btn-1')"
                      textstyle="normal" />

                <img id="menu-img-1" src="images/indicator.png" margin="0" padding="0"/>

            </frame>

            <frame layout="linear_vertical" margin="0" padding="0"
                   padding_bottom="0" width="wrap_content">

                <text gravity="center" textalignment="center" height="wrap_content"
                      width="wrap_content"
                      textsize="12" id="menu-btn-2" textcolor="#43474E"
                      elevation="0" text="افراد" onclick="script/main:changeColor('menu-btn-2')"
                      textstyle="normal" />

                <img id="menu-img-2" src="images/indicator.png" margin="0" padding="0"
                     visibility="invisible" width="wrap_content"/>

            </frame>

            <frame layout="linear_vertical" margin="0" padding="0" padding_bottom="0">

                <text gravity="center" textalignment="center" height="wrap_content"
                      textsize="12" id="menu-btn-3" textcolor="#43474E"
                      elevation="0" text="جزییات سند" onclick="script/main:changeColor('menu-btn-3')"
                      textstyle="normal" />

                <img id="menu-img-3" src="images/indicator.png" margin="0"
                     padding="0" visibility="invisible"/>

            </frame>
        </frame>
        <divider size="1" color="#E6E0E9" margin="0" padding="0"/>

        <frame id="menu-frame-1" layout="linear_vertical" visibility="visibile"
               width="match_parent" height="wrap_content"
               margin="0" padding="0" margin_top="24" gravity="right">

            <frame layout="linear_horizontal" reverse="true" margin="0"
                   padding="0" margin_bottom="16" weightsum="1"
                   childgravity="right" gravity="center_right">

                <text text="دفترخانه تنظیم‌کننده" textsize="10" textalignment="right"
                      selfgravity="center_right" layoutgravity="center_right"
                      textstyle="normal" textcolor="#424750" padding="0"
                      margin_left="4" gravity="center_right"
                      width="wrap_content" margin="0"
                />

                <text id="ScriptoriumName" text=""
                      width="wrap_content" textalignment="right" weight="1"
                      textcolor="#424750" textstyle="bold" margin_right="4"
                      padding="0" gravity="right" margin="0"
                      textsize="10" />
            </frame>

            <divider color="#F0F0F1" margin="0" size="1" />



            <frame layout="linear_horizontal" reverse="true" margin="0"
                   padding="0" margin_top="16" margin_bottom="16" weightsum="1"
                   childgravity="right" gravity="center_right">

                <text text="شناسه یکتا" textsize="10" textalignment="right"
                      selfgravity="center_right" layoutgravity="center_right"
                      textstyle="normal" textcolor="#424750" padding="0" margin_left="4" gravity="center_right"
                      width="wrap_content" margin="0"
                />

                <text id="NationalRegisterNo2" text="" width="wrap_content" textalignment="right"
                      textcolor="#424750" textstyle="bold" margin_right="4" weight="1"
                      padding="0" gravity="right" margin="0"
                      textsize="10" />
            </frame>

            <divider color="#F0F0F1" margin="0" size="1" />


            <frame layout="linear_horizontal" reverse="true" margin="0"
                   padding="0" margin_top="16" margin_bottom="16" weightsum="1"
                   childgravity="right" gravity="center_right">

                <text text="شماره ثبت دفتر" textsize="10" textalignment="right"
                      selfgravity="center_right" layoutgravity="center_right"
                      textstyle="normal" textcolor="#424750" padding="0" margin_left="4"
                      gravity="center_right"
                      width="wrap_content" margin="0"
                />

                <text id="CaseClasifyNo" text="" width="wrap_content" textalignment="right"
                      textcolor="#424750" textstyle="bold" margin_right="4" weight="1"
                      padding="0" gravity="right" margin="0"
                      textsize="10" />
            </frame>

            <divider color="#F0F0F1" margin="0" size="1" />


            <frame layout="linear_horizontal" reverse="true" margin="0"
                   padding="0" margin_top="16" margin_bottom="16" weightsum="1"
                   childgravity="right" gravity="center_right">

                <text text="تاریخ سند" textsize="10" textalignment="right"
                      selfgravity="center_right" layoutgravity="center_right"
                      textstyle="normal" textcolor="#424750" padding="0" margin_left="4" gravity="center_right"
                      width="wrap_content" margin="0"
                />

                <text id="DocDate" text="" width="wrap_content" textalignment="right"
                      textcolor="#424750" textstyle="bold" margin_right="4"
                      padding="0" gravity="right" margin="0" weight="1"
                      textsize="10" />
            </frame>
        </frame>



        <frame id="menu-frame-2" layout="linear_vertical" visibility="gone"
               width="match_parent" height="wrap_content"
               margin="0" padding="0" margin_top="24" gravity="right">


        </frame>



        <!-- frame 3-->
        <frame layout="linear_vertical" id="menu-frame-3" visibility="gone" margin="0"
               padding="0">

            <frame layout="linear_vertical" margin="0" padding="0" gravity="right" margin_bottom="16">

                <text text="متن سند" textcolor="#424750" textsize="12" textstyle="bold" margin="0"
                      padding="0" margin_top="16" />

                <text id="ImpotrtantAnnexText" textcolor="#424750" textsize="11" textstyle="normal"
                      margin="0" padding="0" margin_top="16"
                    text="" />

                <frame id="more-btn" layout="linear_horizontal" reverse="true"
                       weightsum="1" margin="0" padding="0"
                       margin_top="16" onclick="script/main:showMore()"
                       width="wrap_content" gravity="right" selfgravity="right" >

                    <text text="مشاهده بیشتر" textcolor="#0164BC" textsize="12"
                          weight="1" margin="0" margin_left="8" />
                    <image src="images/chevron.png" height="24" width="24"
                           scaleType="fit_center" margin="0" />

                </frame>
            </frame>


            <!-- commented  -->

            <divider size="1" color="#E6E0E9" margin="0" padding="0" visibility="gone"/>


            <frame id="doc_errors" layout="linear_vertical" margin="0" padding="0" visibility="gone">
                <frame layout="linear_horizontal" reverse="true" weightsum="1" margin="0"
                       padding="0" margin_top="16">
                    <image src="images/detail.png" height="24" width="24" scaleType="fit_center"
                           margin="0" padding="0" margin_left="10"/>

                    <text weight="1" textsize="11" margin_right="0" padding="0"
                          textcolor="#424750" text="این وکالت نامه بلاعزل نیست" />
                </frame>

                <frame layout="linear_horizontal" reverse="true" weightsum="1" margin="0"
                       padding="0" margin_top="16">
                    <image src="images/detail.png" height="24" width="24" scaleType="fit_center"
                           margin="0" padding="0" margin_left="10"/>

                    <text weight="1" textsize="11" margin_right="0" padding="0"
                          textcolor="#424750" text="این وکالت نامه بلاعزل نیست" />
                </frame>

                <frame layout="linear_horizontal" reverse="true" weightsum="1" margin="0"
                       padding="0" margin_top="16">
                    <image src="images/detail.png" height="24" width="24" scaleType="fit_center"
                           margin="0" padding="0" margin_left="10"/>

                    <text weight="1" textsize="11" margin_right="0" padding="0"
                          textcolor="#424750" text="این وکالت نامه بلاعزل نیست" />
                </frame>
            </frame>
        </frame>
    </frame>
</page>



<include layout="pages/main/dialogs/waiting.xml.appsan" />

 

 

<script id="main">
    const data = JSON.parse(Appsan.getVariable('response').value);
    function init() {

        Appsan.setProperty('DocType', 'text', numberToPersian(data.DocType));
        Appsan.setProperty('NationalRegisterNo', 'text', numberToPersian(data.NationalRegisterNo));
        Appsan.setProperty('ScriptoriumName', 'text', numberToPersian(data.ScriptoriumName));
        Appsan.setProperty('NationalRegisterNo2', 'text', numberToPersian(data.NationalRegisterNo));
        Appsan.setProperty('CaseClasifyNo', 'text', numberToPersian(data.CaseClasifyNo));
        Appsan.setProperty('DocDate', 'text', numberToPersian(data.DocDate));
        Appsan.setProperty('ImpotrtantAnnexText', 'text', numberToPersian(data.ImpotrtantAnnexText.substring(0, 300)));

        let personsFrame = ``;
        for (let role of data.lstUserRoles){
            let group = `<frame layout="linear_vertical" margin="0" padding="0">`
            for (const person of data.lstFindPersonInQuery[role]) {
                let frame = `
                <frame layout="linear_horizontal" reverse="true" weightsum="1"
                   margin="0" padding="0"
                   margin_bottom="22">

                <frame layout="linear_vertical" width="wrap_content" height="match_parent"
                       margin="0" padding="0" gravity="top">

                    <image src="images/user-image.png" height="32"
                           width="32" margin="0" padding="0"
                           scaleType="fit_center"
                    />
                </frame>

                <frame layout="linear_vertical" weight="1" margin_right="16" margin="0"
                       margin_top="4" height="wrap_content" layoutgravity="right" gravity="right">

                    <frame layout="linear_horizontal" reverse="true" margin="0" padding="0"
                           margin_bottom="16" height="wrap_content"
                           childgravity="right" gravity="center_right">

                        <text text="نام و نام خانوادگی ${person.RoleType}" textsize="10"
                              textalignment="right" height="wrap_content"
                              selfgravity="center_right" layoutgravity="center_right"
                              textstyle="normal" textcolor="#424750" padding="0"
                              margin_left="4" gravity="center_right"
                              width="wrap_content" margin="0"
                        />

                        <text text="${person.Name} ${person.Family}" width="wrap_content" textalignment="right"
                              textcolor="#424750" textstyle="bold" margin_right="4"
                              padding="0" gravity="right" margin="0"
                              textsize="10" />
                    </frame>

                    <frame layout="linear_horizontal" reverse="true" margin="0" padding="0"
                           margin_bottom="16" weight="1" layoutgravity="right"
                           childgravity="right" gravity="center_right">

                        <text text="کد ملی ${person.RoleType}" textsize="10" textalignment="right"
                              selfgravity="center_right" layoutgravity="center_right"
                              textstyle="normal" textcolor="#424750" padding="0" margin_left="4"
                              gravity="center_right"
                              width="wrap_content" margin="0"
                        />

                        <text text="${numberToPersian(person.NationalNo)}" width="wrap_content" textalignment="right"
                              textcolor="#424750" textstyle="bold" margin_right="4"
                              padding="0" gravity="right" margin="0"
                              textsize="10" />
                    </frame>
                </frame>

            </frame>
                `

                group += frame;
            }
            group += `</frame>`
            personsFrame += group;
            personsFrame += `<divider color="#F0F0F1" margin="0" size="1" />`
        }

        Appsan.setProperty('menu-frame-2', 'innerElements', personsFrame);
    }

    function numberToPersian(number) {
        let persianDigits = "۰۱۲۳۴۵۶۷۸۹";
        let persianMap = persianDigits.split("");
        let persianNumbers = number.replace(/\d/g, function (m) {
            return persianMap[parseInt(m)];
        });
        return persianNumbers;
    }


    function showMore() {
        Appsan.setProperty('ImpotrtantAnnexText', 'text', numberToPersian(data.ImpotrtantAnnexText));
        Appsan.setProperty('more-btn', 'visibility', 'gone');
    }
    function changeColor(id) {
        const buttons = ['menu-btn-1', 'menu-btn-2', 'menu-btn-3'];
        const images = ['menu-img-1', 'menu-img-2', 'menu-img-3'];
        const frames = ['menu-frame-1', 'menu-frame-2', 'menu-frame-3'];


        for (let i=0; i < buttons.length; i++) {
            let btn_id = buttons[i];
            let img_id = images[i];
            let frame_id = frames[i];

            if (btn_id === id) {
                Appsan.setProperty(btn_id, 'textcolor', '#0164BC');
                Appsan.setProperty(btn_id, 'textstyle', 'bold');
                Appsan.setProperty(img_id, 'visibility', 'visible');
                Appsan.setProperty(frame_id, 'visibility', 'visible');

            } else {
                Appsan.setProperty(btn_id, 'textcolor', '#43474E');
                Appsan.setProperty(btn_id, 'textstyle', 'normal');
                Appsan.setProperty(img_id, 'visibility', 'invisible')
                Appsan.setProperty(frame_id, 'visibility', 'gone');
            }
        }
    }

    function closeElem(id){
        Appsan.setProperty(id, 'visibility', 'gone');
    }

</script>