<%@ page language="VB" masterpagefile="~/Template/Master.master" autoeventwireup="false" inherits="HelpDesk_DepartmentListing, MachSol.MachPanel.Web" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CPH_Content" Runat="Server">

    <script type="module">

        import { createApp } from 'vue'
        import DepartmentListing from '/Components/HelpDesk/DepartmentListing.js?v=3.6'
        import { getLabelText } from '/Components/Common/utils.js?v=3.6'

        createApp({
            data() {
                return {
                    readOnly: <%= Helper.ReadOnlyRole %>,
                    sortPreference: <%= Newtonsoft.Json.JsonConvert.SerializeObject(InitialSortPreference) %>,
                }
            },
            methods: {
                getLabelText
            },
            created: function () {
                let urlParams = new URLSearchParams(window.location.search);
                
                if (urlParams.has('AD_M')) {
                    if (urlParams.get('AD_M') == '1')
                        displaySuccessMsg(this.getLabelText('EGN0000011'));
                    else if (urlParams.get('AD_M') == '0')
                        displayErrorMsg(Error(this.getLabelText('EGN0000001')));
                }
                if (urlParams.has('ED_M')) {
                    if (urlParams.get('ED_M') == '1')
                        displaySuccessMsg(this.getLabelText('EGN0000011'));
                    else if (urlParams.get('ED_M') == '0')
                        displayErrorMsg(Error(this.getLabelText('EGN0000001')));
                }
                if (urlParams.has('ET_M')) {
                    if (urlParams.get('ET_M') == '1')
                        displaySuccessMsg(this.getLabelText('EGN0000011'));
                    else if (urlParams.get('ET_M') == '0')
                        displayErrorMsg(Error(this.getLabelText('EGN0000001')));
                }
                if (urlParams.has('parma') && urlParams.has('s')) {
                    if (urlParams.get('parma') == '2' && urlParams.get('s') == '1')
                        displaySuccessMsg(this.getLabelText('EGN0000011'));
                }
            },
            components: {
                DepartmentListing
            },
            template: `

                    <DepartmentListing :readOnly="readOnly" :sortPreference="sortPreference" />
`
        }).mount('#app')

    </script>

    <div id="app">
    </div>

</asp:Content>
