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

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

    <script type="module">

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

        createApp({
            data() {
                return {
                    readOnly: <%= Helper.ReadOnlyRole %>,
                    isLoggedInAsCustomer: <%= Helper.IsLoggedInAsCustomer.ToString().ToLower() %>,
                    pageTheme: '<%= IIF(String.IsNullOrEmpty(Me.Page.Theme), "Default", Me.Page.Theme) %>',
                    sortPreference: <%= Newtonsoft.Json.JsonConvert.SerializeObject(InitialSortPreference) %>,

                }
            },
            methods: {
                getLabelText,
            },
            components: {
                ViewTickets,
                
            },
            created: function() {

                let urlParams = new URLSearchParams(window.location.search);
                if (urlParams.has('ES')) {
                    if (urlParams.get('ES') == '1')
                        displaySuccessMsg(this.getLabelText('GN00001328'));
                    else if (urlParams.get('ES') == '0')
                        displayErrorMsg(Error(this.getLabelText('EGN0000001')));
                    else if (urlParams.get('ES') == '2')
                        displaySuccessMsg(this.getLabelText('GN00001329'));
                    else if (urlParams.get('ES') == '3')
                        displaySuccessMsg(this.getLabelText('GN00001330'));
                    else if (urlParams.get('ES') == '4')
                        displayErrorMsg(Error(this.getLabelText('EGN0000001') + ' ' + ' Email or IP is blocked.'));
                }
                if (urlParams.has('M')) {
                    if (urlParams.get('M') != '' && urlParams.get('M') != '0')
                        displaySuccessMsg(urlParams.get('M'));
                    else if (urlParams.get('M') == '0')
                        displayErrorMsg(Error(this.getLabelText('SPT002739')));
                }
                
            },
            template: `
<ViewTickets :sortPreference="sortPreference" :readOnly="readOnly" :isLoggedInAsCustomer="isLoggedInAsCustomer" :pageTheme="pageTheme" />


`
        }).mount('#app')

    </script>

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

</asp:Content>
