صفحه ی اول

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

image-1699540639488.png

کد

<page id="vaghaye" background="#F8F8F8" padding="16" scrollable="false" gravity="top" onshown="script/vaghayejs:init()">
    <frame layout="linear_vertical" scrollable="true">
        <frame layout="linear_horizontal" width="match_parent" height="64"
               background="#D5E3FF" reverse="true" gravity="center" margin="0"
               borderCornerRadius="2" weightsum="1">
            <img width="24" height="24" margin_right="16" gravity="right" scaleType="fit_center"
                 src="images/Details.png"/>
            <text gravity="left" textalignment="right" text="اسناد ثبت شده از سال ۱۳۹۲ به بعد در سامانه می‌باشد."
                  weight="1"
                  width="match_parent"
                  padding_left="4" textcolor="#0164BC" textsize="13"/>
        </frame>

        <frame layout="linear_horizontal" gravity="center" reverse="true" scrollable="true" margin_top="16"
               hidehorizontalscrollbar="true">
            <frame width="wrap_content" margin_left="8" margin_right="8" height="wrap_content"
                   onclick="script/main:tabClick('marriage')" padding_left="10" padding_right="10"
                   background="#0164BC" borderCornerRadius="16" id="btn_marriage">
                <text text="ازدواج" textsize="14" textcolor="#FFFFFF" id="txt_marriage"/>
            </frame>

            <frame width="wrap_content" margin_left="8" margin_right="8" height="wrap_content"
                   onclick="script/main:tabClick('divorce')" padding_left="10" padding_right="10"
                   background="#FFFFFF" borderCornerRadius="16" id="btn_divorce" borderColor="#E0E0E2">
                <text text="طلاق" textsize="14" textcolor="#424750" id="txt_divorce"></text>
            </frame>

            <frame width="wrap_content" margin_left="8" margin_right="8" height="wrap_content"
                   onclick="script/main:tabClick('share')" borderColor="#E0E0E2" padding_left="10" padding_right="10"
                   background="#FFFFFF" borderCornerRadius="16" id="btn_share">
                <text text="اشتراک گذاری" textsize="14" textcolor="#424750" id="txt_share"></text>
            </frame>

            <frame width="wrap_content" margin_left="8" margin_right="8"
                   height="wrap_content" onclick="script/main:tabClick('other')" padding_left="10" padding_right="10"
                   background="#FFFFFF" borderCornerRadius="16" id="btn_other" borderColor="#E0E0E2">
                <text text="وقایع دیگران" textsize="14" textcolor="#424750" id="txt_other"></text>
            </frame>
        </frame>

        <frame layout="linear_vertical" id="marriage" margin="0">

        </frame>

        <frame id="divorce" layout="linear_vertical" visibility="gone" margin="0">

        </frame>

        <frame id="share" layout="linear_vertical" visibility="gone" margin="0">

        </frame>

        <frame id="other" layout="linear_vertical" visibility="gone" margin="0">

        </frame>
    </frame>

    <script id="main">
        function tabClick(id) {
            const buttons = ['marriage', 'divorce', 'share', 'other']
            buttons.forEach(b => {
                if (id !== b) {
                    Appsan.setProperty('txt_' + b, 'textcolor', '#424750');
                    Appsan.setProperty('btn_' + b, 'background', '#FFFFFF');
                    Appsan.setProperty(b, 'visibility', 'gone');
                }
            })
            Appsan.setProperty('txt_' + id, 'textcolor', '#FFFFFF');
            Appsan.setProperty('btn_' + id, 'background', '#0164BC');
            Appsan.setProperty(id, 'visibility', 'visible');
        }

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

        function openDetails(id) {
            Appsan.setVariable('doc_id', id);
            Appsan.runAction('page/sanad-ezdevaj');
        }
    </script>

    <include layout="pages/ezdevaj-va-talagh-vaghaye/vaghaye.js.appsan"/>
</page>
<include layout="pages/ezdevaj-va-talagh-vaghaye/sanad-ezdevaj.xml.appsan"/>
<include layout="pages/ezdevaj-va-talagh-vaghaye/dialogs/eshterak.xml.appsan"/>
<include layout="pages/ezdevaj-va-talagh-vaghaye/dialogs/sharelaghv.xml.appsan"/>
<include layout="pages/ezdevaj-va-talagh-vaghaye/dialogs/sharelaghvConfirm.xml.appsan"/>


<script id="vaghayejs">
    const emptyContent = `    <frame  layoutgravity="center" layout="linear_horizontal" width="match_parent" height="100" margin_top="80" gravity="center" childgravity="center">
        <img width="90" height="90" gravity="center" src="images/file.png" scaleType="fit_center" selfgravity="center_horizontal"/>

    </frame>
    <text gravity="center" textalignment="center" text="واقعه ای برای شما ثبت نشده است"
          textcolor="#616161" textsize="14"/>
    <frame></frame>
    <frame width="wrap_content" height="48" borderColor="#0164BC" borderCornerRadius="8" borderStrokeWidth="0.5"
           onclick="app/end" margin_top="64" padding_right="16" padding_left="16" background="#FFFFFF">
        <text textsize="14" textcolor="#0164BC" text="بازگشت به صفحه اصلی " textalignment="center"/>
    </frame>`;

    function init() {
        HTTPClient.get('http://192.168.1.109:3000/api/v1/marry/myEvents',
            {
                headers: {
                    "Content-Type": "application/json",
                    "Authorization": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJtaW5pQXBwTmFtZSI6ImFwcDphZG1pbjp2YWdoYXllLWV6ZGV2YWotdmEtdGFsYWdoIiwidXNlcm5hbWUiOiIxMTExMTExMTExIiwic3ViIjoibWluaUFwcCIsImlhdCI6MTY5OTA4MTMxMywiZXhwIjoxNjk5OTQ1MzEzfQ.eR5ZDvwajy-ibloi5TiwIAFqftJLvsVzwkm7DjOggthy6zyxdNSmuxYmdON7MSEvKKCLO344iKggT88g82zauw",
                    "user-token": ""
                }
            }).subscribe(res => {
                Appsan.setVariable('response', JSON.stringify(res))
                if (res && res.length > 0)
                    processMyMarries(res);
                else {
                    setEmptyContent('marriage');
                    setEmptyContent('divorce');
                }
            }, err => {
                setEmptyContent('marriage', true);
                setEmptyContent('divorce', true);
            }
        );
        HTTPClient.get('http://192.168.1.109:3000/api/v1/marry/mySharedEvents',
            {
                headers: {
                    "Content-Type": "application/json",
                    "Authorization": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJtaW5pQXBwTmFtZSI6ImFwcDphZG1pbjp2YWdoYXllLWV6ZGV2YWotdmEtdGFsYWdoIiwidXNlcm5hbWUiOiIxMTExMTExMTExIiwic3ViIjoibWluaUFwcCIsImlhdCI6MTY5OTA4MTMxMywiZXhwIjoxNjk5OTQ1MzEzfQ.eR5ZDvwajy-ibloi5TiwIAFqftJLvsVzwkm7DjOggthy6zyxdNSmuxYmdON7MSEvKKCLO344iKggT88g82zauw",
                    "user-token": ""
                }
            }).subscribe(res => {
                Appsan.setVariable('response', JSON.stringify(res))
                if (res && res.length > 0)
                    processMyShared(res);
                else {
                    setEmptyContent('share');
                }
            }, err => {
                setEmptyContent('share', true);
            }
        );
        HTTPClient.get('http://192.168.1.109:3000/api/v1/marry/othersEvents',
            {
                headers: {
                    "Content-Type": "application/json",
                    "Authorization": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJtaW5pQXBwTmFtZSI6ImFwcDphZG1pbjp2YWdoYXllLWV6ZGV2YWotdmEtdGFsYWdoIiwidXNlcm5hbWUiOiIxMTExMTExMTExIiwic3ViIjoibWluaUFwcCIsImlhdCI6MTY5OTA4MTMxMywiZXhwIjoxNjk5OTQ1MzEzfQ.eR5ZDvwajy-ibloi5TiwIAFqftJLvsVzwkm7DjOggthy6zyxdNSmuxYmdON7MSEvKKCLO344iKggT88g82zauw",
                    "user-token": ""
                }
            }).subscribe(res => {
                Appsan.setVariable('response', JSON.stringify(res))
                if (res && res.length > 0)
                    processOthers(res);
                else {
                    setEmptyContent('other');
                }
            }, err => {
                setEmptyContent('other', true);
            }
        );
    }

    function processOthers(res) {
        let content = "";
        for (let i = 0; i < res.length; i++) {
            const row = res[i];
            content+=`<frame layout="linear_horizontal" weightsum="6" reverse="true" id="otherdoc"
                   borderStrokeWidth="0" margin="0" margin_top="6"
                   borderCornerRadius="14" background="#FFFFFF">
                <frame layout="linear_vertical" padding="6" weight="1">

                    <frame layout="linear_horizontal" id="alert-message" width="match_parent" reverse="true"
                           gravity="center"
                           weightsum="1" padding="0">
                        <text gravity="left" textalignment="right" text="ازدواج" weight="1" width="match_parent"
                              padding_left="4" textsize="13"/>
                    </frame>

                    <frame layout="linear_horizontal" weight="1" weightsum="3" reverse="true">
                        <text textsize="12" textalignment="right" weight="2" textcolor="#424750" text="شناسه یکتا"/>
                        <text textsize="12" textalignment="right" weight="1" textcolor="#424750"
                              text="${row.requestNo}"/>
                    </frame>

<!--                    <frame layout="linear_horizontal" id="alert-message" width="match_parent" reverse="true"-->
<!--                           gravity="center"-->
<!--                           weightsum="1" padding="0">-->
<!--                        <img width="16" height="16" gravity="right" scaleType="fit_center"-->
<!--                             src="images/Phone.png"/>-->
<!--                        <text gravity="left" textalignment="right" text="۰۹۱۷۴۸۷۳۶۴۳" weight="1" width="match_parent"-->
<!--                              padding_left="4" textsize="12" textcolor="#424750"/>-->
<!--                    </frame>-->
                    <frame layout="linear_horizontal" id="alert-message" width="match_parent" reverse="true"
                           gravity="center"
                           weightsum="1" padding="0">
                        <img width="16" height="16" gravity="right" scaleType="fit_center"
                             src="images/id-doc.png"/>
                        <text gravity="left" textalignment="right" text="${row.personNationalNoTo}" weight="1" width="match_parent"
                              padding_left="4" textsize="12" textcolor="#424750"/>
                    </frame>
                    <frame layout="linear_horizontal" id="alert-message" width="match_parent" reverse="true"
                           gravity="center"
                           weightsum="1" padding="0">
                        <img width="16" height="16" gravity="right" scaleType="fit_center"
                             src="images/calender.png"/>
                        <text gravity="left" textalignment="right" text="${row.expireDate}" weight="1"
                              width="match_parent"
                              padding_left="4" textsize="12" textcolor="#424750"/>
                    </frame>
                    <frame layout="linear_horizontal" weightsum="6" reverse="true">
                        <frame layout="linear_horizontal" weight="1" reverse="true" width="wrap_content"
                               borderColor="#E0E0E2" borderStrokeWidth="0.5" borderCornerRadius="16"
                               padding_right="16" padding_left="16" height="32"
                               onclick="script/main:openDetails('${row.requestNo}')">
                            <img width="18" height="18" margin_right="8" margin_left="0" gravity="right"
                                 scaleType="fit_center"
                                 src="images/More.png"/>
                            <text textsize="11" textalignment="right" textcolor="#424750" text="جزئیات سند"
                                  margin_left="10"/>
                        </frame>
                        <frame weight="5"></frame>
                    </frame>
                </frame>
                <frame weight="5">
                    <frame layout="frame">
                        <img width="40" height="40" scaleType="fit_center" src="images/cancel.png"
                             onclick="script/vaghayejs:dshare('${row.id}')"/>
                    </frame>
                </frame>
            </frame>`;
            Appsan.setProperty('other', 'innerElements', content)
        }
    }
    function processMyShared(res) {
        let content = "";
        for (let i = 0; i < res.length; i++) {
            const row = res[i];
            content += `<frame layout="linear_horizontal" weightsum="6" reverse="true"
                   borderStrokeWidth="0" margin="0" margin_top="6"
                   borderCornerRadius="14" background="#FFFFFF">
                <frame layout="linear_vertical" padding="6" weight="1">

                    <frame layout="linear_horizontal" id="alert-message" width="match_parent" reverse="true"
                           gravity="center"
                           weightsum="1" padding="0">
                        <text gravity="left" textalignment="right" text="ازدواج" weight="1" width="match_parent"
                              padding_left="4" textsize="13"/>
                    </frame>

                    <frame layout="linear_horizontal" weight="1" weightsum="3" reverse="true">
                        <text textsize="12" textalignment="right" weight="2" textcolor="#424750" text="شناسه یکتا"/>
                        <text textsize="12" textalignment="right" weight="1" textcolor="#424750"
                              text="${row.requestNo}"/>
                    </frame>

                    <frame layout="linear_horizontal" width="match_parent" reverse="true"
                           gravity="center"
                           weightsum="1" padding="0">
                        <img width="16" height="16" gravity="right" scaleType="fit_center"
                             src="images/Phone.png"/>
                        <text gravity="left" textalignment="right" text="${row.phoneNo}" weight="1" width="match_parent"
                              padding_left="4" textsize="12" textcolor="#424750"/>
                    </frame>
                    <frame layout="linear_horizontal" id="alert-message" width="match_parent" reverse="true"
                           gravity="center"
                           weightsum="1" padding="0">
                        <img width="16" height="16" gravity="right" scaleType="fit_center"
                             src="images/id-doc.png"/>
                        <text gravity="left" textalignment="right" text="${row.personNationalNoTo}" weight="1" width="match_parent"
                              padding_left="4" textsize="12" textcolor="#424750"/>
                    </frame>
                    <frame layout="linear_horizontal" id="alert-message" width="match_parent" reverse="true"
                           gravity="center"
                           weightsum="1" padding="0">
                        <img width="16" height="16" gravity="right" scaleType="fit_center"
                             src="images/calender.png"/>
                        <text gravity="left" textalignment="right" text="${row.expireDate}" weight="1"
                              width="match_parent"
                              padding_left="4" textsize="12" textcolor="#424750"/>
                    </frame>
                    <frame layout="linear_horizontal" weightsum="6" reverse="true">
                        <frame layout="linear_horizontal" weight="1" reverse="true" width="wrap_content"
                               borderColor="#E0E0E2" borderStrokeWidth="0.5" borderCornerRadius="16"
                               padding_right="16" padding_left="16" height="32"
                               onclick="script/main:openDetails('${row.requestNo}')">
<!--                               page/sanad-ezdevaj-->
                            <img width="18" height="18" margin_right="8" margin_left="0" gravity="right"
                                 scaleType="fit_center"
                                 src="images/More.png"/>
                            <text textsize="11" textalignment="right" textcolor="#424750" text="جزئیات سند"
                                  margin_left="10"/>
                        </frame>
                        <frame weight="5"></frame>
                    </frame>
                </frame>
                <frame weight="5">
                    <frame layout="frame">
                        <img width="40" height="40" scaleType="fit_center" src="images/cancel.png"
                             onclick="script/vaghayejs:dshare('${row.id}')"/>
                    </frame>
                </frame>
            </frame>`;
            Appsan.setProperty('share', 'innerElements', content)
        }
    }

    function processMyMarries(res) {
        let contentMarry = "";
        let contentDivorce = "";
        for (let i = 0; i < res.length; i++) {
            const row = res[i];
            if (row.typeCode === 1) {
                contentMarry += `<frame layout="linear_horizontal" weightsum="6"  reverse="true" borderStrokeWidth="0" margin="0" margin_top="6"
                   borderCornerRadius="14" background="#FFFFFF">
                <frame layout="linear_vertical" padding="6" weight="1">

                    <frame layout="linear_horizontal" id="alert-message" width="match_parent" reverse="true"
                           gravity="center"
                           weightsum="1" padding="0">
                        <img width="24" height="24" gravity="right" scaleType="fit_center"
                             src="images/Ring.png"/>
                        <text gravity="left" textalignment="right" text="ازدواج" weight="1" width="match_parent"
                              padding_left="4" textsize="13"/>
                    </frame>

                    <frame layout="linear_horizontal" weight="1" weightsum="3" reverse="true">
                        <text textsize="12" textalignment="right" weight="2" textcolor="#424750" text="شناسه یکتا"/>
                        <text textsize="12" textalignment="right" weight="1" textcolor="#424750"
                              text="${row.nationalRegisterNo}"/>
                    </frame>
                    <frame layout="linear_horizontal" weight="1" weightsum="3" reverse="true">
                        <text textsize="12" textalignment="right" weight="2" textcolor="#424750" text="شماره ترتیب"/>
                        <text textsize="12" textalignment="right" weight="1" textcolor="#424750" text="${row.registerNO}"/>
                    </frame>
                    <frame layout="linear_horizontal" weight="1" weightsum="3" reverse="true">
                        <text textsize="12" textalignment="right" weight="2" textcolor="#424750" text="تاریخ ثبت"/>
                        <text textsize="12" textalignment="right" weight="1" textcolor="#424750" text="${row.registerDate}"/>
                    </frame>
                    <frame layout="linear_horizontal" weightsum="6" reverse="true">
                        <frame layout="linear_horizontal" weight="1" reverse="true" width="wrap_content"
                               borderColor="#E0E0E2" borderStrokeWidth="0.5" borderCornerRadius="16"
                               padding_right="16" padding_left="16" height="32"
                               onclick="script/main:openDetails('${row.nationalRegisterNo}')">
                            <img width="18" height="18" margin_right="8" margin_left="0" gravity="right"
                                 scaleType="fit_center"
                                 src="images/More.png"/>
                            <text textsize="11" textalignment="right" textcolor="#424750" text="جزئیات سند"
                                  margin_left="10"/>
                        </frame>
                        <frame weight="5"></frame>
                    </frame>
                </frame>
                <frame weight="5">
                    <frame layout="frame" margin_left="5">
                        <img width="40" height="40" scaleType="fit_center" src="${row.isShared?'images/Share.png':'images/Share.png'}"
                            onclick="script/vaghayejs:openEshterak('${row.nationalRegisterNo}')"/>
                    </frame>
                </frame>
            </frame>`;
            } else {
                contentDivorce += `<frame layout="linear_horizontal" weightsum="6" reverse="true"
                   borderStrokeWidth="0" margin="0" margin_top="6"
                   borderCornerRadius="14" background="#FFFFFF">
                <frame layout="linear_vertical" padding="6" weight="1">

                    <frame layout="linear_horizontal" id="alert-message" width="match_parent" reverse="true"
                           gravity="center"
                           weightsum="1" padding="0">
                        <img width="24" height="24" gravity="right" scaleType="fit_center"
                             src="images/Ring.png"/>
                        <text gravity="left" textalignment="right" text="طلاق" weight="1" width="match_parent"
                              padding_left="4" textsize="13"/>
                    </frame>

                    <frame layout="linear_horizontal" weight="1" weightsum="3" reverse="true">
                        <text textsize="12" textalignment="right" weight="2" textcolor="#424750" text="شناسه یکتا"/>
                        <text textsize="12" textalignment="right" weight="1" textcolor="#424750"
                              text="${row.nationalRegisterNo}"/>
                    </frame>
                    <frame layout="linear_horizontal" weight="1" weightsum="3" reverse="true">
                        <text textsize="12" textalignment="right" weight="2" textcolor="#424750" text="شماره ترتیب"/>
                        <text textsize="12" textalignment="right" weight="1" textcolor="#424750" text="${row.registerNO}"/>
                    </frame>
                    <frame layout="linear_horizontal" weight="1" weightsum="3" reverse="true">
                        <text textsize="12" textalignment="right" weight="2" textcolor="#424750" text="تاریخ ثبت"/>
                        <text textsize="12" textalignment="right" weight="1" textcolor="#424750" text="${row.registerDate}"/>
                    </frame>
                    <frame layout="linear_horizontal" weightsum="6" reverse="true">
                        <frame layout="linear_horizontal" weight="1" reverse="true" width="wrap_content"
                               borderColor="#E0E0E2" borderStrokeWidth="0.5" borderCornerRadius="16"
                               padding_right="16" padding_left="16" padding_top="6" padding_bottom="6"
                               onclick="script/main:openDetails('${row.nationalRegisterNo}')">
                            <img width="18" height="18" margin_right="8" margin_left="0" gravity="right"
                                 scaleType="fit_center"
                                 src="images/More.png"/>
                            <text textsize="11" textalignment="right" textcolor="#424750" text="جزئیات سند"
                                  margin_left="10"/>
                        </frame>
                        <frame weight="5"></frame>
                    </frame>
                </frame>
                <frame weight="5">
                    <frame layout="frame">
                        <img width="40" height="40" scaleType="fit_center" src="${row.isShared?'images/Ring.png':'images/Share.png'}"
                             onclick="script/vaghayejs:openEshterak('${row.nationalRegisterNo}')"/>
                    </frame>
                </frame>
            </frame>`;
            }
        }
        if (contentMarry.length > 0) {
            Appsan.setProperty('marriage', 'innerElements', contentMarry)
        } else {
            setEmptyContent('marriage', false)
        }
        if (contentDivorce.length > 0) {
            Appsan.setProperty('divorce', 'innerElements', contentMarry)
        } else {
            setEmptyContent('divorce', false)
        }
    }

    function setEmptyContent(el, isError) {
        Appsan.setProperty(el, 'innerElements', emptyContent)
        if (isError)
            Appsan.runAction('snackbar/errorSnackbar');
    }
    function openEshterak(registerNo) {
        Appsan.setVariable('registerNo', registerNo);
        Appsan.runAction('dialog/dialog-eshterak')
    }

    function dshare(id) {
        Appsan.setVariable('shareId', id);
        Appsan.runAction('dialog/dialog-confirm');
    }

</script>