<br><br>
<div id="viewContainer">
</div>

<div class="pagination">
    <button id="prevBtnLogsPropertyDetailsPage" class="btn btn-primary"
        onclick="LoadDataPageFunc.Logs.changePage(-1)">Next</button>
    <span id="pageInfo"></span>
    <button id="nextBtnLogsPropertyDetailsPage" class="btn btn-primary"
        onclick="LoadDataPageFunc.Logs.changePage(1)">Previous</button>
</div>
<script>  $$ = {};
    $$.UI = {};
    $$.UI.Table = {};
    $$.UI.Table.CreateTable = function (id, theadinnerhtml, bodyinnerhtml) { return CreateTable(id, theadinnerhtml, bodyinnerhtml); };
    $$.UI.Table.GenerateTheadFromArraySimple = function (array) { return GenerateTheadFromArraySimple(array); };
    $$.UI.Table.GenerateTableRowFromArraySimple = function (array) { return GenerateTableRowFromArraySimple(array); };
    $$.UI.ResetBrowserAndCache = function () { return ResetBrowserAndCache(); };
    $$.UI.formatCurrency = function (number, withdecimal = true) { return formatCurrency(number, withdecimal); };
    $$.UI.getDateInGMT8 = function () { return getDateInGMT8(); };
    $$.UI.RunFunctiononMutation = function (targetidToMonitor, callbackfunction) { return RunFunctiononMutation(targetidToMonitor, callbackfunction); };
    $$.UI.Element = {};
    $$.UI.Element.appendtobody = function (string) { return appendtobody(string); };
    $$.UI.Element.Exists = function (ElementIDtext) { ElementExists(ElementIDtext); };
    $$.UI.Element.RemovebyID = function (idstring) { return removeelementbyID(idstring); };
    $$.UI.Element.DeleteById = function (id) { return DeleteElementById(id); }
    $$.UI.Element.getHTML = function (idetext) { return getElementhtml(idtext); };
    $$.UI.Element.setHTML = function (idetext, html) { return setElementhtml(idtext, html); };
    $$.UI.Element.getValue = function (idetext) { return getElementvalue(idtext); };
    $$.UI.Element.setValue = function (idetext,) { return setElementvalue(idtext, value); };
    $$.UI.Validate = {};
    $$.UI.Validate.isValidEmail = function (email) { return isValidEmail(email); };
    $$.UI.Validate.hasValidMobileFormat = function (usernumber) { return hasValidMobileFormat(usernumber); };
    $$.UI.Modal = {};
    $$.UI.Modal.Create = function (modalid, modaltitle, modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return createmodal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
    $$.UI.Modal.Show = function (idtxt) { return modalshow(idtxt); };
    $$.UI.Modal.Hide = function (idtxt) { return modalhide(); };
    $$.UI.Modal.CreateAndShow = function (modalid, modaltitle, modalbody, modalfooter = '', modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header') { return CreateAndShowModal(modalid, modaltitle, modalbody, modalfooter, modalfooterclose, topclosebutton, modalbodyclass, modalheaderclass); };
    $$.UI.Modal.ModalQuickDismiss = function (modaltitle, modalbody, modalid = '', modaltohide = '', functiontodo = '', conditiontrue = true) { return ModalQuickDismiss(modaltitle, modalbody, modalid, modaltohide, functiontodo, conditiontrue) };
    $$.UI.Modal.ModalContinueCancel = function (modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext = 'Cancel', continuebuttontext = 'Continue', continuebuttoncss = 'btn btn-danger', cancelbuttoncss = 'btn btn-warning') { return ModalContinueCancel(modalid, modaltitle, modalbody, continuebuttononclick, cancelbuttontext, continuebuttontext, continuebuttoncss, cancelbuttoncss); };
    $$.UI.Modal.hide = function (modalid) { return hidemodal(modalid); };
    $$.UI.Modal.show = function (modalid) { return showmodal(modalid); };
    $$.UI.col = function (content = '', additionalclass = '') { return col(content, additionalclass); };
    $$.UI.row = function (content = '', additionalclass = '', hidden = false, style = '') { return row(content, additionalclass, hidden, style); };
    $$.UI.dualcolrow = function (colcontent1, colcontent2, rowclass = '', hidden = false, style = '') { return dualcolrow(colcontent1, colcontent2, rowclass, hidden, style); };
    $$.UI.Button = {};
    $$.UI.Button.Default = function (content, value = '', onclick = '', idtext = '', setclass = '', addtionaldata = '') { return button(content, value, onclick, idtext, setclass, addtionaldata); };
    $$.UI.Button.Warning = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonwarning(content, value, onclick, block, idtext, addclass, addtionaldata); };
    $$.UI.Button.Danger = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttondanger(content, value, onclick, block, idtext, addclass, addtionaldata); };
    $$.UI.Button.Primary = function (content, value = '', onclick = '', block = '', idtext = '', addclass = '', addtionaldata = '') { return buttonprimary(content, value, onclick, block, idtext, addclass, addtionaldata); };
    $$.UI.Button.HomeMenuButtons = function (buttonicon, buttonText, buttonGo, buttonVariabletoPass = '', iconwidth = '', iconheight = '', buttonstyle = '', buttononclick = '', divclass = '', divid = '', buttonid = '', textclass = '') { return HomeMenuButtons(buttonicon, buttonText, buttonGo, buttonVariabletoPass, iconwidth, iconheight, buttonstyle, buttononclick, divclass, divid, buttonid, textclass); };
    $$.UI.Input = {};
    $$.UI.Input.textInput = function (idtext = '', setclass = '', required = '', placeholder = '', value = '') { return textinput(idtext, setclass, required, placeholder, value); };
    $$.UI.Input.textFormControl = function (idtext = '', addclass = '', required = '', placeholder = '', value = '') { return textformcontrol(idtext, addclass, required, placeholder, value); };
    $$.UI.Card = {};
    $$.UI.Card.Create = function (cardtitle = '', cardid = '', cardtools = '', cardbodyid = '', cardbodytext = '', cardbodyclassadd = '', maincardstyle = '', titlecardhide = false) { return createCard(cardtitle, cardid, cardtools, cardbodyid, cardbodytext, cardbodyclassadd, maincardstyle, titlecardhide); };
    $$.UI.Card.Simple = function (title = '', text = '', id = '') { return CreateCardSimple(title, text, id); };
    $$.UIalt = {};
    $$.UIalt.hrefonclickButtonGO = function (pagename, pagedatastring = '') { return hrefonclickButtonGO(pagename, pagedatastring); };
    $$.UIalt.generateHTMLfromarray = function (prepend, append, array, func) { return generateHTMLfromarray(prepend, append, array, func); };
    $$.UIalt.imgiconuserdefault = function (imgsrc, imgwidth = '', imgheight = '', id = '') { return imgiconuserdefault(imgsrc, imgwidth, imgheight, id); };
    $$.UIalt.UICardStats = {};
    $$.UIalt.UICardStats.UICardStatsDetails = function (Title = '', number = 0, Unit = '', leftORright = 'left', numberid = '') { return UICardStatsDetails(Title, number, Unit, leftORright, numberid); };
    $$.UIalt.UICardStats.UIStatsDetailsArray = function (statsarray) { return UIStatsDetailsArray(statsarray); };
    $$.UIalt.BalanceCard = {};
    $$.UIalt.BalanceCard.UIBalance_WrapperfromArray = function (statsarray) { return UIBalance_WrapperfromArray(statsarray); };
    $$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item = function (maintitle = '', onclickstring = '', imgsrc = '', href = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '', imgwidth = '', imgheight = '') { return UIBalance_Wrapper_WalletFooter_Item(maintitle, onclickstring, imgsrc, href, subtitleline1, subtitleline2, subtitleline3, subtitleline4, imgwidth, imgheight); };
    $$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_Item_ButtonGO = function (maintitle, pagename, pagestring = '', iconclass = '', subtitleline1 = '', subtitleline2 = '', subtitleline3 = '', subtitleline4 = '') { return UIBalance_Wrapper_WalletFooter_Item_ButtonGO(maintitle, pagename, pagestring, iconclass, subtitleline1, subtitleline2, subtitleline3, subtitleline4); };
    $$.UIalt.BalanceCard.UIBalance_Wrapper_WalletFooter_ARRAY = function (balancewrapper_item_array) { return UIBalance_Wrapper_WalletFooter_ARRAY(balancewrapper_item_array); };
    $$.UIalt.BalanceCard.UIcreateBalanceBoxfromArray = function (statsarray, balancewrapper_item_array, style = 'border: solid 3px #000d88;') { return UIcreateBalanceBoxfromArray(statsarray, balancewrapper_item_array, style); };
    $$.UIalt.Services = {};
    $$.UIalt.Services.Button = function (imgiconsrc, title = '', onclick = '', href = '', bgcolor8 = false) { return UIServices_Button(imgiconsrc, title, onclick, href, bgcolor8); };
    $$.UIalt.Services.Button_GOTOPAGE = function (imgiconsrc, title, pagename, pagedatastring = '') { return UIServices_Button_GOTOPAGE(imgiconsrc, title, pagename, pagedatastring); };
    $$.UIalt.Services.FullDIV_GOTOPAGE_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_GOTOPAGE_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
    $$.UIalt.Services.FullDIV_ONCLICK_Array = function (title, viewallhref = '', viewallonclick = '', viewalltext = '', services_button_array) { return UIServices_FullDIV_ONCLICK_Array(title, viewallhref, viewallonclick, viewalltext, services_button_array); };
    $$.UIalt.Sidetext = {};
    $$.UIalt.Sidetext.UISideText_DualColumnButton = function (text, pagename, pagedatastring = '', imgsrc = '', imgwidth = '', imgheight = '') { return UISideText_DualColumnButton(text, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
    $$.UIalt.Sidetext.UISideText_DualColumnButton_Array = function (sidetext_button_dualcolumn_array) { return UISideText_DualColumnButton_Array(sidetext_button_dualcolumn_array); };
    $$.UIalt.UICardSimple = function (title, text = '', id = '') { return UICardSimple(title, text, id); };
    $$.UIalt.RecentSearchBar = {};
    $$.UIalt.RecentSearchBar.SearchBar = function (searchplaceholdertext, classtosearch, id, imgsrclefticon = '', imgsrcrighticon = '', imgwidth = '', imgheight = '') { return UIRecentSearchBar(searchplaceholdertext, classtosearch, id, imgsrclefticon, imgsrcrighticon, imgwidth, imgheight); };
    $$.UIalt.RecentSearchBar.Searchable_Button_GO = function (title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIRecentSearchable_Button_GO(title, subtitle, rightsidetext, classforsearch, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
    $$.UIalt.RecentSearchBar.Searchable_Button_GO_ARRAY = function (title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata = '', viewalltext = '') { return UIRecentSearchable_Button_GO_ARRAY(title, recentssearchablebuttonarray, viewallpagetarget, viewallpagedata, viewalltext); };
    $$.UIalt.UIListArrowButton_GO = function (title, subtitle, pagename, pagedatastring = '', imgsrc, imgwidth = '', imgheight = '') { return UIListArrowButton_GO(title, subtitle, pagename, pagedatastring, imgsrc, imgwidth, imgheight); };
    $$.UIalt.RecentSearchBar.SearchBox_with_BUTTONS_FULL = function (title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY = '', viewallpagetarget, viewallpagedata = '', viewalltext = '', classtosearch = '', searchid = '', searchplaceholdertext = '', searchlefticon = '', searchrighticon = '', imgwidth = '', imgheight = '') { return UISearchBox_with_BUTTONS_FULL(title, recentssearchablebuttonarray, UIListArrowButtonGOARRAY, viewallpagetarget, viewallpagedata, viewalltext, classtosearch, searchid, searchplaceholdertext, searchlefticon, searchrighticon, imgwidth, imgheight); };
    $$.UIalt.Input = {};
    $$.UIalt.Input.InputGroupCore = function (innerhtml = '', label = '', inputgroupid = '') { return UIinputgroupcore(innerhtml, label, inputgroupid); };
    $$.UIalt.Input.InputGroup = function (placeholder, type, id, label = '', classinput = '', spanclass = '', imginsteadofspan = '', required = false, textvalue = '') { return UIInputGroup(placeholder, type, id, label, classinput, spanclass, imginsteadofspan, required, textvalue); };
    $$.UIalt.Input.InputGroupSelect = function (id = '', label = '', optionsarray = '', spanclass = '', imginsteadofspan = '', selectedvalue = '') { return UIInputGroupSelect(id, label, optionsarray, spanclass, imginsteadofspan, selectedvalue); };
    $$.UIalt.Input.InputGroupDatePicker = function () { return UIInputGroupDatePicker(); };
    $$.UIalt.Input.ArraytoOptionforSelect = function (array, selectedvalue = '') { return UIArraytoOptionforSelect(array, selectedvalue); };
    $$.UIalt.Input.ReplaceCurrentOptionsSelect = function (selectid, optionsarray, selectedvalue = '') { return UIReplaceCurrentOptionsSelect(selectid, optionsarray, selectedvalue); };
    $$.UIalt.Input.InputGroupButton = function (buttontext, buttonclass = '', buttonid = '', onclick = '', buttonstyle = '') { return UIInputGroupButton(buttontext, buttonclass, buttonid, onclick, buttonstyle); };
    $$.UIalt.UISetDarkMode = function () { return UISetDarkMode(); };
    $$.UIalt.UIUpdateBodyHTML = function (html = '') { return UIUpdateBodyHTML(html); };
    $$.UIalt.changeTopbarTitle = function (title) { return changeTopbarTitle(title); };
    $$.StatusIntToString = function (Status) { return InttoStrDetailsFuncs.Status(Status); };
    $$.StatusPropertiesIntToString = function (Status) { return InttoStrDetailsFuncs.PropertyStatus(Status); };
</script>
<script>
    Target_Uploaded_Files = [];
    LoadDataPageFunc = {};
    LoadDataPageFunc.Settings = {};
    LoadDataPageFunc.PageTitle = 'Property Details';
    LoadDataPageFunc.currentTargetPage = 'ViewPropertyDetails';

    LoadDataPageFunc.URLs = {};
    LoadDataPageFunc.URLs.MainData = '/View/Property/Details';
    LoadDataPageFunc.URLs.AddLog = '/View/Property/Details/Logs/Add';
    LoadDataPageFunc.URLs.SubmitEdit = '/View/Property/Details/Edit/Submit';
    LoadDataPageFunc.URLs.ChangeStatus = '/View/Property/Details/ChangeStatus'

    LoadDataPageFunc.ids = {};
    LoadDataPageFunc.ids.ViewPropertyContainer = "viewContainer";
    LoadDataPageFunc.ids.ViewDetailsLogsContainer = 'ViewDetailsLogsContainer';
    LoadDataPageFunc.ids.ViewPropertyCard = 'ViewPropertyCard';
    LoadDataPageFunc.ids.ViewPropertyDetailsCardBody = 'ViewPropertyDetailsCardBody';
    LoadDataPageFunc.ids.PreviousLogsPage = 'prevBtnLogsPropertyDetailsPage';
    LoadDataPageFunc.ids.NextLogsPage = 'nextBtnLogsPropertyDetailsPage';
    LoadDataPageFunc.ids.ChangeStatus_Select = 'ViewPropertyDetails_ChangeStatus_Select';

    LoadDataPageFunc.onclicks = {};
    LoadDataPageFunc.onclicks.EditDetailsModalOnclick = 'LoadDataPageFunc.EditDetails.EditDetailsModal();';


    LoadDataPageFunc.Logs = {};
    LoadDataPageFunc.Logs.Pagination = {};


    LoadDataPageFunc.Logs.Pagination.cardsPerPage = 5;
    LoadDataPageFunc.Logs.Pagination.currentPage = 1;

    LoadDataPageFunc.Logs.LogRowCard = function (Date = '', content = '') {
        content = replaceLineBreaks(content);
        return (UICardSimple('', formatDateTimetoReadable(Date) + '<br><br><h4>' + content + '</h4>'));
    };

    LoadDataPageFunc.Logs.Pagination.PageArray = function () {
        return divideArrayIntoSets(LoadDataPageFunc.Logs.LogsCardRowHTMLArray, LoadDataPageFunc.Logs.Pagination.cardsPerPage);
    };

    LoadDataPageFunc.Logs.Pagination.Firstpage = 1;
    LoadDataPageFunc.Logs.Pagination.Lastpage = function () {
        return LoadDataPageFunc.Logs.Pagination.PageArray().length;
    };

    LoadDataPageFunc.Logs.LogsCardRowHTMLArray = [];


    LoadDataPageFunc.Logs.Pagination.FirstPageFound = function () {
        $('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', false);
        $('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', true);
    };
    LoadDataPageFunc.Logs.Pagination.LastPageFound = function () {
        $('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', true);
        $('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', false);
    };

    LoadDataPageFunc.Logs.Pagination.MiddlePageFound = function () {
        $('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', false);
        $('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', false);
    };

    LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound = function () {
        $('#' + LoadDataPageFunc.ids.NextLogsPage).prop('disabled', true);
        $('#' + LoadDataPageFunc.ids.PreviousLogsPage).prop('disabled', true);
    };

    LoadDataPageFunc.Logs.LogRowHtmlPage = function (page = 1) {
        if (page) { LoadDataPageFunc.Logs.Pagination.currentPage = page; }

        let arrayset = LoadDataPageFunc.Logs.Pagination.PageArray();
        let newpageindex = LoadDataPageFunc.Logs.Pagination.currentPage - 1;


        if (!isIndexAccessibleArray(arrayset, newpageindex)) {
            return false;
        }

        LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton(page);

        let targetarr = arrayset[newpageindex];
        const htmlstr = targetarr.join('<br>');

        $('#' + LoadDataPageFunc.ids.ViewDetailsLogsContainer).html(htmlstr);
    };

    LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton = function (newpage) {
        if (newpage <= LoadDataPageFunc.Logs.Pagination.Firstpage) { LoadDataPageFunc.Logs.Pagination.FirstPageFound(); }
        else if (newpage >= LoadDataPageFunc.Logs.Pagination.LastPageFound()) {
            LoadDataPageFunc.Logs.Pagination.FirstPageFound();
        } else if (LoadDataPageFunc.Logs.Pagination.Lastpage() == 1) {
            LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound();
        } else if (newpage > LoadDataPageFunc.Logs.Pagination.Firstpage && newpage < LoadDataPageFunc.Logs.Pagination.Lastpage()) {
            LoadDataPageFunc.Logs.Pagination.MiddlePageFound();
        }

        if (LoadDataPageFunc.Logs.Pagination.Lastpage() === 1) {
            LoadDataPageFunc.Logs.Pagination.OnlyOnePageFound();
        }
    };

    LoadDataPageFunc.Logs.changePage = function (forwardORBackward) {
        if (!forwardORBackward) { return false; }

        let newpage = LoadDataPageFunc.Logs.Pagination.currentPage;
        if (forwardORBackward === -1) { newpage = newpage - 1; }
        else if (forwardORBackward === 1) { newpage = newpage + 1; }
        if (newpage < LoadDataPageFunc.Logs.Pagination.Firstpage || newpage > LoadDataPageFunc.Logs.Pagination.Lastpage()) {
            newpage = LoadDataPageFunc.Logs.Pagination.currentPage;
            return false;
        }

        LoadDataPageFunc.Logs.Pagination.DetectAndTogglePageButton(newpage);
        LoadDataPageFunc.Logs.Pagination.currentPage = newpage;

        // Load the new page
        LoadDataPageFunc.Logs.LogRowHtmlPage(newpage);
    };


    LoadDataPageFunc.Logs.LogFullCard = function (obj) {
        if (!obj.logs) { return ''; }
        LoadDataPageFunc.LogsCardRowHTMLArray = [];
        let newlogfullarr = [];
        if (typeof obj.logs === 'string') {
            obj.logs = JSON.parse(obj.logs);
        }
        if (obj.logs && Array.isArray(obj.logs)) {
            newlogfullarr.push('<br><br><div id="' + LoadDataPageFunc.ids.ViewDetailsLogsContainer + '">');
            let logrow = '';

            const reversedLogs = [...obj.logs].reverse();

            for (let log of reversedLogs) {
                logrow = LoadDataPageFunc.Logs.LogRowCard(log[0], log[1]);
                LoadDataPageFunc.Logs.LogsCardRowHTMLArray.push(logrow);
                //    newlogfullarr.push(logrow);
            }
        }
        newlogfullarr.push('</div>');

        return newlogfullarr.join('');

    };

    LoadDataPageFunc.RefetchDataAndReload = function (istrue = true) {
        if (!istrue) { return false; }
        Preloaders.ViewPropertyDetailsData(currenttarget, false,
            function (response) {
                ReloadPage();
            }
        );
    };

    LoadDataPageFunc.buttonLImaker = function (text, onclick, icon) {
        return `<li><a href="javascript:void(0);" onclick="${onclick}"><div class="icon-box "><img src="/assets/${icon}"></div>${text}</a></li>`;
    };
    LoadDataPageFunc.buttonContainer = function (BUTTONSstr) {
        return `<div class="mt-5"><div class="tf-container">` + '<ul class="box-service mt-3">' + BUTTONSstr + '</ul</div></div>';
    };


    LoadDataPageFunc.DetailsCardControls = function () {
        let buttonLImaker = LoadDataPageFunc.buttonLImaker;
        let htmlarr = [`<div class="mt-5"><div class="tf-container">`];
        htmlarr.push('<ul class="box-service mt-3">');
        htmlarr.push(buttonLImaker('Change Status', 'LoadDataPageFunc.ChangeStatus.NewStatusModal();', 'changestatus.png'));
        htmlarr.push(buttonLImaker('Add Logs', 'LoadDataPageFunc.Logs.AddLogsModal();', 'logs.png'));
        htmlarr.push(buttonLImaker('Edit Details', LoadDataPageFunc.onclicks.EditDetailsModalOnclick, 'edit.png'));
        htmlarr.push(buttonLImaker('Leads', "ButtonGo('LeadsByProperty','" + currenttarget + "');", 'ListLeads.png'));
        htmlarr.push(buttonLImaker('Referral URL', 'LoadDataPageFunc.MyReferralURL.ReferralURLModal();', 'betshistory.png'));
        htmlarr.push('</ul</div></div>');
        return htmlarr.join('');
    };

    LoadDataPageFunc.Logs.SubmitNewLog = function () {
        let ShowEmptyTextModal = function () { ModalQuickDismiss('No Input', 'Please input text as log.') };
        let ShowUnabletoAddLog = function () { ModalQuickDismiss('Error', 'Unable to Add Log.') };
        let ShowSuccess = function () { ModalQuickDismiss('Success', 'New Log Added.') };
        let ShowError = function (errorstring) { ModalQuickDismiss('Error', 'Error Occured. <br><br>' + errorstring) };
        let newlogtext = $('#newlogtextarea').val();
        if (!newlogtext) {
            ShowEmptyTextModal();
            return false;
        }
        request
            .url(LoadDataPageFunc.URLs.AddLog)
            .type(LoadDataPageFunc.Settings.RequestType)
            .fromVarCache(false)
            .data({ target: currenttarget, newlog: newlogtext })
            .success((response) => {
                console.log(response);
                if (response === true) {

                    LoadDataPageFunc.RefetchDataAndReload(true);
                    ShowSuccess();
                    modalhide('ViewDetailsNewLogModal');

                    return true;
                } else {
                    ShowUnabletoAddLog();
                    return false;
                }
            })
            .error((err) => {
                ShowError(err);
                return false;
            })
            .caching(false)
            .go();


    };


    LoadDataPageFunc.Logs.AddLogsModal = function () {
        let modalbody = `<label for="newlogtextarea">Log:</label>
                        <textarea id="newlogtextarea" rows="10" cols="50" placeholder="Enter the log here..."></textarea>`;
        CreateAndShowModal('ViewDetailsNewLogModal', 'New Log', modalbody, buttonprimary('Add New Log', value = '', onclick = 'LoadDataPageFunc.Logs.SubmitNewLog();', block = '', idtext = 'ViewPropertyDetailsAddLogButton'));
    };

    LoadDataPageFunc.Details = {};
    LoadDataPageFunc.Details.Status = '';
    LoadDataPageFunc.ids.PhotosShowCard = 'PhotosCard';

    LoadDataPageFunc.PropertyDetailsCard = function (obj) {
        if (!obj) { return false; }

        let rowcoldetail = [];
        const imgwidth = '200px'; const imgheight = "200px";
        if (!obj) { rowcoldetail = 'No Data'; return createCard('Unknown', cardid = 'PropertyRowCard-' + rownum, '', cardbodyid = '', rowcoldetail, cardbodyclassadd = 'ListPropertyRow'); }

        let created = obj.created || false;
        let modified = obj.modified || false;
        let name = obj.name || false;
        let description = obj.description || false;
        let status = obj.status || false;
        let remarks = obj.remarks || false;
        let referralid = obj.referralid || false;
        let createdby = obj.createdby || false;
        let category = obj.category || '';
        let subcategory = obj.subcategory || '';
        let photourl = obj.photourl || false;
        let sqm = obj.sqm || false;
        let bedrooms = obj.bedrooms || false;
        let rooms = obj.rooms || false;
        let toilet = obj.toilet || false;
        let kitchen = obj.kitchen || false;
        let floors = obj.floors || false;
        let price = obj.price || false;
        let specs = obj.specs || false;
        let location = obj.location || false

        status = InttoStrDetailsFuncs.PropertyStatus(status);
        modified = formatDateTimetoReadable(modified);
        created = formatDateTimetoReadable(created);

        try { photourl = JSON.parse(photourl); } catch (e) { photourl = photourl; }

        //LoadDataPageFunc.Details.Status = Status;

        const AddDualColifValue = function (varstr, label) {
            if (varstr !== false && varstr !== null) {
                rowcoldetail.push(dualcolrow(label, varstr));
            }
        };

        rowcoldetail.push(createCard('', LoadDataPageFunc.ids.PhotosShowCard, '', LoadDataPageFunc.ids.ViewPropertyDetailsCardBody, '', '', '', true));
        rowcoldetail.push('<br><br>');
        AddDualColifValue(modified, 'Last Activity');
        AddDualColifValue(subcategory, category);
        AddDualColifValue(status, 'Status');
        AddDualColifValue(createdby, 'Filled By');
        AddDualColifValue(location, 'Location');
        AddDualColifValue(sqm, 'Size');
        AddDualColifValue(bedrooms, 'Bedrooms');
        AddDualColifValue(rooms, 'Rooms');
        AddDualColifValue(toilet, 'Toilet');
        AddDualColifValue(kitchen, 'Kitchen');
        AddDualColifValue(floors, 'Floors');
        AddDualColifValue(price, 'Price');
        rowcoldetail.push('<br><br>');

        rowcoldetail.push(LoadDataPageFunc.DetailsCardControls());
        let LogsCard = LoadDataPageFunc.Logs.LogFullCard(obj);

        rowcoldetail.push(LogsCard);

        const finalRowColDetail = rowcoldetail.join('');

        let ViewPropertyCardDetails = createCard(name, LoadDataPageFunc.ids.ViewPropertyCard, created, LoadDataPageFunc.ids.ViewPropertyDetailsCardBody, cardbody = finalRowColDetail);
        return ViewPropertyCardDetails;
    };


    LoadDataPageFunc.LoadPhotosCard = async function () {
        let photosdiv = $('#' + LoadDataPageFunc.ids.PhotosShowCard);
        if (photosdiv.length === 0) { return false; }
        if (!LoadDataPageFunc.Details.photourl) { photosdiv.html('No Photos.<br>'); return false; }
        let photolist = JSON.parse(LoadDataPageFunc.Details.photourl);
        if (!photolist || photolist.length === 0) { photosdiv.html('No Photos.<br>'); return false; }
        let htmlbody = $(`<div class="splide" role="group" aria-label="photosSplide">
            <div class="splide__track">
		<ul class="splide__list">
		</ul> </div></div>`);
        const NewSplideLIImage = function (imgsrc) {
            return `<li class="splide__slide" onclick="ButtonGo('ViewAllPhotos','${currenttarget}');"><img src="${imgsrc}" style="max-width: 300px; 
            max-height: 300px; 
            width: auto; 
            height: auto;"></li>`;
        };
        let splidebody = htmlbody.find('ul');
        LoadDataPageFunc.PhotoBlobs = [];
        photolist.forEach(function (photo) {
            LoadAndCreateURLfromFileHash(photo).then(bloburl => {
                splidebody.append(NewSplideLIImage(bloburl));
                LoadDataPageFunc.PhotoBlobs.push(bloburl);
            });
        });

        photosdiv.html(htmlbody);

        new Splide('.splide').mount();
    };



    LoadDataPageFunc.ChangeStatus = {};
    LoadDataPageFunc.ids.ChangeStatusModal = 'ViewDetails_ChangeStatusModal';


    LoadDataPageFunc.ChangeStatus.NewStatusModal = function () {
        const StatusSelect = $$.UIalt.Input.InputGroupSelect(LoadDataPageFunc.ids.ChangeStatus_Select, '', [
            [-2, $$.StatusPropertiesIntToString(-2)],
            [-1, $$.StatusPropertiesIntToString(-1)],
            [0, $$.StatusPropertiesIntToString(0)],
            [1, $$.StatusPropertiesIntToString(1)],
            [2, $$.StatusPropertiesIntToString(2)],
            [3, $$.StatusPropertiesIntToString(3)]], '', '', LoadDataPageFunc.Details.status);


        const htmltext = 'Update the Status of the Property';
        let modalbody = StatusSelect + htmltext;
        CreateAndShowModal(LoadDataPageFunc.ids.ChangeStatusModal, 'Update Status', modalbody, buttonprimary('Update', value = '', onclick = 'LoadDataPageFunc.ChangeStatus.Submit();', block = '', idtext = ''));


    };


    LoadDataPageFunc.ChangeStatus.Submit = function () {
        const sel = $('#' + LoadDataPageFunc.ids.ChangeStatus_Select).val();
        const selectedstatus = (sel !== null) ? sel : null;

        if (selectedstatus === null) { $$.UI.Modal.ModalQuickDismiss('', 'Select a Status'); return false; }
        if (selectedstatus == LoadDataPageFunc.Details.Status) { $$.UI.Modal.ModalQuickDismiss('', 'Nothing to Change!'); return false; }


        let request = new RequestData(false);
        request
            .url(LoadDataPageFunc.URLs.ChangeStatus)
            .type(LoadDataPageFunc.Settings.RequestType)
            .fromVarCache(false)
            .data({ target: currenttarget, newstatus: selectedstatus })
            .success((response) => {

                if (response === true) {
                    LoadDataPageFunc.RefetchDataAndReload(true);
                    $$.UI.Modal.ModalQuickDismiss('', 'Success!');
                    hidemodal(LoadDataPageFunc.ids.ChangeStatusModal);

                    return true;
                }

            })
            .error((err) => {
                ModalQuickDismiss('Error', 'Unable To Change Status<br><br>' + err);
            })
            .go();

    };



    LoadDataPageFunc.vars = {};
    LoadDataPageFunc.vars.idprefix = 'ViewProperty';
    LoadDataPageFunc.ids.EditDetailsModal = LoadDataPageFunc.vars.idprefix + '_EditDetailsModal';
    LoadDataPageFunc.EditDetails = {};

    LoadDataPageFunc.ids.EditDetailsMidfix = '-EditDetails';
    LoadDataPageFunc.ids.EditDetails_name = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'PropertyName';
    LoadDataPageFunc.ids.EditDetails_Description = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'PropertyDescription';
    LoadDataPageFunc.ids.EditDetails_Remarks = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Remarks';
    LoadDataPageFunc.ids.EditDetails_Location = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Location';
    LoadDataPageFunc.ids.EditDetails_Category = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Category';
    LoadDataPageFunc.ids.EditDetails_SubCategory = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'SubCategory';
    LoadDataPageFunc.ids.EditDetails_sqm = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'sqm';
    LoadDataPageFunc.ids.EditDetails_Bedrooms = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Bedrooms';
    LoadDataPageFunc.ids.EditDetails_Rooms = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Rooms';
    LoadDataPageFunc.ids.EditDetails_Toilet = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Toilet';
    LoadDataPageFunc.ids.EditDetails_Kitchen = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Kitchen';
    LoadDataPageFunc.ids.EditDetails_Floors = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Floors';
    LoadDataPageFunc.ids.EditDetails_Price = LoadDataPageFunc.vars.idprefix + LoadDataPageFunc.ids.EditDetailsMidfix + 'Price';

    LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone = 'newpropertydropzonephoto';
    LoadDataPageFunc.ids.EditDetailsReplacePhotosButton = 'EditDetailsreplacePhotos';

    LoadDataPageFunc.EditDetails.InitializePhotoDropZone = function () {
        Target_Uploaded_Files = [];
        myDropzone = null;
        currentDropzone = DropZoneFunc.InitializeDropZone('/File/Upload/Property', (response) => {
            if (response.length === 72) {
                Target_Uploaded_Files.push(response);
                LoadDataPageFunc.ShowPhotoClearButton();
            } else {
                currentDropzone.removeFile(currentDropzone.files[currentDropzone.files.length - 2]);
            }
        }, LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone, DropZoneFunc.AcceptedFilesString.images, 'file', maxfilesize = 100);
    };


    LoadDataPageFunc.ids.ClearPhotosButton = 'newpropertydropzoneclearbutton';

    LoadDataPageFunc.ShowPhotoClearButton = function () {
        $('#' + LoadDataPageFunc.ids.ClearPhotosButton).show();
    };
    LoadDataPageFunc.ClearPhotos = function () {
        DropZoneFunc.ClearDropzoneUpload();
        LoadDataPageFunc.HidePhotoClearButton();
    };

    LoadDataPageFunc.HidePhotoClearButton = function () {
        $('#' + LoadDataPageFunc.ids.ClearPhotosButton).hide();
    };

    LoadDataPageFunc.EditDetails.EditDetailsModal = function () {
        Target_Uploaded_Files = [];
        $('#' + LoadDataPageFunc.ids.EditDetailsModal).remove();

        const SubmitOnclick = '';
        const targetdiv = 'modal-body-' + LoadDataPageFunc.ids.EditDetailsModal;
        let FormHTML = ReusableUIElements.NewPropertyGenerateUI(targetdiv, idprefix = LoadDataPageFunc.vars.idprefix + '-EditDetails', replace = false,
            LoadDataPageFunc.Details.name, LoadDataPageFunc.Details.description,
            LoadDataPageFunc.Details.status, LoadDataPageFunc.Details.remarks,
            LoadDataPageFunc.Details.location, LoadDataPageFunc.Details.category, LoadDataPageFunc.Details.subcategory, LoadDataPageFunc.Details.sqm,
            LoadDataPageFunc.Details.bedrooms, LoadDataPageFunc.Details.rooms, LoadDataPageFunc.Details.toilet,
            LoadDataPageFunc.Details.kitchen, LoadDataPageFunc.Details.floors,
            false, true, LoadDataPageFunc.Details.price);
        const footer = buttonprimary('Update', '', onclick = 'LoadDataPageFunc.EditDetails.Submit();');
        const modalhtml = $$.UI.Modal.Create(LoadDataPageFunc.ids.EditDetailsModal, 'Update Details', FormHTML, footer);
        $$.UI.Element.appendtobody(modalhtml);
        const replacePhotosButton = buttonprimary('Replace Photos', value = '', onclick = 'LoadDataPageFunc.EditDetails.ShowPhotoUploadButton();', block = '', LoadDataPageFunc.ids.EditDetailsReplacePhotosButton);
        $('#ViewProperty-EditDetailsNewPropertyPhotosInputGroup').append(replacePhotosButton);
        $('#' + LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone).hide();
        $('#ViewProperty-EditDetailsStatus-select-div-mb3').remove();
        $('label[for="ViewProperty-EditDetailsStatus-select-div-mb3"]').remove();


        Preloaders.Datalist.NewPropertyCategory(function () { ReqCachetoDatalist('/Datalist/NewPropertyCategory', 'ViewProperty-EditDetailsSubCategory', replace = true); });
        Preloaders.Datalist.NewPropertySubCategory(function () { ReqCachetoDatalist('/Datalist/NewPropertySubCategory', 'ViewProperty-EditDetailsSubCategory', replace = true); });


        $('#' + LoadDataPageFunc.ids.ClearPhotosButton).hide();

        $('#newpropertydropzoneclearbutton').click(function () {
            LoadDataPageFunc.ClearPhotos();
        });

        LoadDataPageFunc.EditDetails.ShowPhotoUploadButton = function () {
            $('#' + LoadDataPageFunc.ids.EditDetailsUploadPhotoDropzone).show();
            $('#' + LoadDataPageFunc.ids.EditDetailsReplacePhotosButton).hide();
        };

        LoadDataPageFunc.EditDetails.InitializePhotoDropZone();

        showmodal(LoadDataPageFunc.ids.EditDetailsModal);



    };



    LoadDataPageFunc.EditDetails.GetChanges = function () {
        let objectdata = {};
        objectdata.target = currenttarget;
        const new_name = $('#' + LoadDataPageFunc.ids.EditDetails_name).val();
        const new_description = $('#' + LoadDataPageFunc.ids.EditDetails_Description).val();
        const new_remarks = $('#' + LoadDataPageFunc.ids.EditDetails_Remarks).val();
        const new_location = $('#' + LoadDataPageFunc.ids.EditDetails_Location).val();
        const new_category = $('#' + LoadDataPageFunc.ids.EditDetails_Category).val();
        const new_subcategory = $('#' + LoadDataPageFunc.ids.EditDetails_SubCategory).val();
        let new_sqm = Number($('#' + LoadDataPageFunc.ids.EditDetails_sqm).val());
        let new_bedroom = Number($('#' + LoadDataPageFunc.ids.EditDetails_Bedrooms).val());
        let new_rooms = Number($('#' + LoadDataPageFunc.ids.EditDetails_Rooms).val());
        let new_toilet = Number($('#' + LoadDataPageFunc.ids.EditDetails_Toilet).val());
        let new_kitchen = Number($('#' + LoadDataPageFunc.ids.EditDetails_Kitchen).val());
        let new_floors = Number($('#' + LoadDataPageFunc.ids.EditDetails_Floors).val());
        let new_price = Number($('#' + LoadDataPageFunc.ids.EditDetails_Price).val());

        let changes = 0;

        if (LoadDataPageFunc.Details.name !== new_name) { objectdata.name = new_name; changes++; }
        if (LoadDataPageFunc.Details.description !== new_description) { objectdata.description = new_description; changes++; }
        if (LoadDataPageFunc.Details.remarks !== new_remarks) { objectdata.remarks = new_remarks; changes++; }
        if (LoadDataPageFunc.Details.location !== new_location) { objectdata.location = new_location; changes++; }
        if (LoadDataPageFunc.Details.category !== new_category) { objectdata.category = new_category; changes++; }
        if (LoadDataPageFunc.Details.subcategory !== new_subcategory) { objectdata.subcategory = new_subcategory; changes++; }
        if (LoadDataPageFunc.Details.sqm !== new_sqm) { objectdata.sqm = new_sqm; changes++; }
        if (LoadDataPageFunc.Details.bedrooms !== new_bedroom) { objectdata.bedrooms = new_bedroom; changes++; }
        if (LoadDataPageFunc.Details.rooms !== new_rooms) { objectdata.rooms = new_rooms; changes++; }
        if (LoadDataPageFunc.Details.toilet !== new_toilet) { objectdata.toilet = new_toilet; changes++; }
        if (LoadDataPageFunc.Details.kitchen !== new_kitchen) { objectdata.kitchen = new_kitchen; changes++; }
        if (LoadDataPageFunc.Details.floors !== new_floors) { objectdata.floors = new_floors; changes++; }
        if (LoadDataPageFunc.Details.price !== new_price) { objectdata.price = new_price; changes++; }
        if (Target_Uploaded_Files.length > 0) { objectdata.photourl = JSON.stringify(Target_Uploaded_Files); changes++; }
        if (!changes) { return null; }
        if (!new_name || !new_description || !new_location || !new_sqm) {
            return false;
        }

        return objectdata;
    };


    LoadDataPageFunc.EditDetails.Submit = function () {

        let ChangesObject = LoadDataPageFunc.EditDetails.GetChanges();
        if (ChangesObject === null) { $$.UI.Modal.ModalQuickDismiss('No Changes', 'No Changes to Update!'); return false; }
        if (ChangesObject === false) { $$.UI.Modal.ModalQuickDismiss('', 'Incomplete Details!<br>The following are required!<br><br>Property Name<br>Description<br>Location<br>Size in sqm'); return false; }
        if (Target_Uploaded_Files.length == 0) { $$.UI.Modal.ModalQuickDismiss('', 'No New Photos Uploaded!<br>Previous Photos Would be used!',); }
        let SendUpdatedDetails = new RequestData(false);
        request
            .url(LoadDataPageFunc.URLs.SubmitEdit)
            .type(LoadDataPageFunc.Settings.RequestType)
            .fromVarCache(false)
            .data(ChangesObject)
            .success((response) => {
                if (!response) { return false; }
                const error = response.error || false;
                if (response !== true) {
                    if (error) { $$.UI.Modal.ModalQuickDismiss('Error', error); }
                    return false;
                } else if (response === true) {
                    LoadDataPageFunc.RefetchDataAndReload(true);
                    ReloadPage();
                    hidemodal(LoadDataPageFunc.ids.EditDetailsModal);
                    $$.UI.Modal.ModalQuickDismiss('Success', 'Details Updated');
                }
            })
            .error((err) => {
                ModalQuickDismiss('Error', 'Unable to Load<br>' + err);
            })
            .go();

    };

    LoadDataPageFunc.MyReferralURL = {};
    LoadDataPageFunc.MyReferralURL.ToURL = function (ReferralCode) {
        let PropertyHash = LoadDataPageFunc.Details.hashkey;
        if (!ReferralCode || !PropertyHash) { return false; }
        return window.location.origin + '/p/ReferProperty/s/' + PropertyHash + '/dr/' + ReferralCode;
    };
    LoadDataPageFunc.MyReferralURL.ReferralURLModal = function () {

        let RefferralREQ = new RequestData(false);
        let modalbody = '';
        let FinalURL = '';
        RefferralREQ.url('/ReferralCode/List/data').type('POST')
            .fromVarCache(false)
            .success(function (response) {

                let newURLRow = function (ReferralCode) {
                    const MainURL = LoadDataPageFunc.MyReferralURL.ToURL(ReferralCode)
                    const textarea = '<textarea>' + MainURL + '</textarea>';
                    const CopybuttonOnclick = 'navigator.clipboard.writeText(`' + MainURL + '`);this.textContent=`Copied!`;';
                   
                    const SharebuttonOnclick = `if (navigator.share) {
                    navigator.share({
                        title: '${LoadDataPageFunc.Details.name} Property',
                        text: 'Interested In this Property ${LoadDataPageFunc.Details.name}',
                        url: '${MainURL}'
                        });}`;

                
                    return `<div class="tf-container"><ul class="box-service mt-3">
                        <li>${textarea}</li>
                    ${LoadDataPageFunc.buttonLImaker('Copy',CopybuttonOnclick,'edit.png')}
                    ${LoadDataPageFunc.buttonLImaker('Share',SharebuttonOnclick,'share.png')}
                        </ul>
                        </div><br><br>`;
                }

                /*
                for (let index = 0; index < response.length; index++) {
                    const element = response[index];
                    const referralCode = element['referral_code'];
                    modalbody += newURLRow(referralCode);
                }
                */

                iterateArray(response, (element) => {
                    modalbody += newURLRow(element['referral_code']);
                });


                if (!response) { modalbody = '<center>NO URL</center>   '; }
                modalbody += '<br>' + LoadDataPageFunc.buttonContainer(LoadDataPageFunc.buttonLImaker('Generate URL', 'LoadDataPageFunc.MyReferralURL.Generate();', 'sync.png'));
                $$.UI.Modal.ModalQuickDismiss('My Property Referral URL', modalbody, 'PropertyReferralCodes');
            }).go();

    };

    LoadDataPageFunc.MyReferralURL.Generate = function () {

        let ONsuccess = function () {
            hidemodal('PropertyReferralCodes');
           
            LoadDataPageFunc.MyReferralURL.ReferralURLModal();
        };


        let REQQ = new RequestData(false);
        REQQ.url('/ReferralCode/Request/New').type('POST').fromVarCache(false).
            success((response) => {
                if (response) {
                    ONsuccess();
                    return true;
                } else {
                    $$.UI.Modal.ModalQuickDismiss('', 'Error! Try Again Later');
                }
            }).go();


    };


    LoadDataPageFunc.Settings = {};


    LoadDataPageFunc.Settings.RequestType = 'POST';
    LoadDataPageFunc.Settings.fromVarCache = true;
    LoadDataPageFunc.DefaultDatatoSend = function () {
        return { target: currenttarget };
    };
    LoadDataPageFunc.LoadMainDetails = {};
    LoadDataPageFunc.LoadMainDetails.OnSuccess = function (response) {
        if (!response) { ModalQuickDismiss('Error', 'No Data Loaded<br>'); return ''; }
        LoadDataPageFunc.PropertyCurrentDetails = response.Details;
        LoadDataPageFunc.Details = response.Details;
        $('#' + LoadDataPageFunc.ids.ViewPropertyContainer).html(LoadDataPageFunc.PropertyDetailsCard(response.Details));
        LoadDataPageFunc.Logs.LogRowHtmlPage();
        LoadDataPageFunc.LoadPhotosCard();
    };

    LoadDataPageFunc.LoadMainDetails.OnError = function (err) { ModalQuickDismiss('Error', 'Unable to Load<br>' + err); };



    LoadDataPageFunc.LoadMainDetails.LoadNow = function () {

        let request = new RequestData(false);
        request
            .url(LoadDataPageFunc.URLs.MainData)
            .type(LoadDataPageFunc.Settings.RequestType)
            .fromVarCache(LoadDataPageFunc.Settings.fromVarCache)
            .data(LoadDataPageFunc.DefaultDatatoSend())
            .success((response) => {
                if (typeof LoadDataPageFunc === 'undefined' || LoadDataPageFunc.currentTargetPage === 'undefined') {
                    return false;
                }
                if (currentPage !== LoadDataPageFunc.currentTargetPage) { return false; }
                LoadDataPageFunc.LoadMainDetails.OnSuccess(response);
            })
            .error((err) => {
                ModalQuickDismiss('Error', 'Unable to Load<br>' + err);
            })
            .go();
    };



    LoadDataPageFunc.main = function () {
        LoadDataPageFunc.LoadMainDetails.LoadNow();

        changeTopbarTitle(LoadDataPageFunc.PageTitle);
    };




    $(document).ready(function () {
        LoadDataPageFunc.main();

    });



</script>