{"id":8403,"date":"2023-06-06T11:47:04","date_gmt":"2023-06-06T08:47:04","guid":{"rendered":"https:\/\/spatium.fi\/?page_id=8403"},"modified":"2025-06-17T13:23:29","modified_gmt":"2025-06-17T10:23:29","slug":"commercial-premises","status":"publish","type":"page","link":"https:\/\/spatium.fi\/en\/commercial-premises\/","title":{"rendered":"Commercial premises"},"content":{"rendered":"\n<style>\n    .alle-objects {\t\n\t\tmargin-bottom: 50px;\t\t\n    }  \t\n    .all-objects .wp-block-button__link {\n        margin-top: 30px;\n    }\n\n<\/style>\n\n\t\n<section class=\"all-objects\">\n\t<div class=\"objects-list row\">\n\t\t\t\t\t\t\t\t\t\n\t<\/div>\n\n\t<div id=\"loader-container\"><\/div>\n    <div id=\"no-more-results\">No more content to load<\/div>\n\n<\/section>\n\t\n\n<script>\n\t\n\t\/\/ Tuplalatausten esto\n\tvar isLoading = true;\n\t\n\t setKohteet();\n    function setKohteet() {\n\t\tjQuery('#no-more-results').hide();\n        canBeLoaded = true;\n\t\tjQuery('#loader-container').html('<span class=\"loader\"><\/span>');\n        jQuery.ajax({\n            type: 'POST',\n            url: 'https:\/\/spatium.fi\/wp-admin\/admin-ajax.php',\n            dataType: 'html',\n            data: {\n                action: 'objects_list',\n                page: 1,\n            },\n            success: function(res) {\n                jQuery('#loader-container').html('');\n                jQuery('.objects-list').html(jQuery.parseJSON(res).content);\n\t\t\t\tisLoading = false;\n\t\t\t\tconsole.log(\"res\");\n\t\t\t\t\tsessionStorage.setItem(\"page\", 2);\n\t\t\t}\n\t\t});\n\t}\n\n\tjQuery(window).scroll(function(){\n        getMoreKohteet();\n    });\n\n\tvar canBeLoaded = true, \/\/ this param allows to initiate the AJAX call only if necessary\n\tbottomOffset = 1800; \n\n\tfunction getMoreKohteet() {\n\t\t\n\t\tjQuery('#no-more-results').hide();\n\t\/\/\tsessionStorage.setItem(\"page\", p);\n\t\t\n         if(!isLoading) {\n\t\t\tvar page = sessionStorage.getItem(\"page\");\n\t\t\t\n\t\t\tif( jQuery(document).scrollTop() > ( jQuery(document).height() - bottomOffset )  && canBeLoaded == true ){\n\n                console.log(\"Ladataan lis\u00e4\u00e4. page = \" + page);\n\n                jQuery('#loader-container').html('<span class=\"loader\"><\/span>');\n               \n                jQuery.ajax({\n                    url : 'https:\/\/spatium.fi\/wp-admin\/admin-ajax.php',\n                    data: {\n                        action: 'objects_list',\n\t\t\t\t\t\tpage: page,\n                    },\n                    type:'POST',\n                    beforeSend: function( xhr ){\n                        \/\/ you can also add your own preloader here\n                        \/\/ you see, the AJAX call is in process, we shouldn't run it again until complete\n\t\t\t\t\tcanBeLoaded = false; \n                    },\n                    success:function(res){\n                        if( res ) {\n\t\t\t\t\t\t\tpage++;\n\t\t\t\t\t\t\tjQuery('#loader-container').html('');\n                            jQuery('.objects-list').append(jQuery.parseJSON(res).content);\n                            sessionStorage.setItem(\"page\", page);\n                            \/\/ console.log(jQuery.parseJSON(res).more);\n                            if(jQuery.parseJSON(res).more) {\n                                canBeLoaded = true;\n                            } else {\n                                jQuery('#loader-container').html('');\n                                jQuery('#no-more-results').show();\n                            }\n                        }\n                    }\n                });\n             }\n\t\t}\n\t}\n\n\n\n\n\/\/ favorite\n    function changeText(kohde) {\n        if (Cookies.get('favorite')) {\n            var el = document.getElementById(kohde);\n            if (el.classList.contains(\"active-favorite\")) {\n                el.innerHTML = \"Poista suosikeista\";\n            }\n        }\n    }\n    function changeBack(kohde) {\n        if (Cookies.get('favorite')) {\n            var el = document.getElementById(kohde);\n            if (el.classList.contains(\"active-favorite\")) {\n                el.innerHTML = \"Poista suosikeista\";\n            } else {\n                el.innerHTML = \"Lis\u00e4\u00e4 kohde suosikkeihin\";\n            }\n        }\n    }\n    function setCookies(kohde, id) {\n        var cookies = [];\n        if (Cookies.get('favorite')) {\n            var el = document.getElementById(kohde);\n            if (el.classList.contains(\"active-favorite\")) {\n                var array = JSON.parse(Cookies.get('favorite'));\n                for (i = 0; i < array.length; i++) {\n                    if (array[i][\"kohde\"] == kohde) {\n                        array.splice(i, 1);\n                    }\n                }\n                cookies = array;\n                document.getElementById(kohde).innerHTML = \"Lis\u00e4\u00e4 kohde suosikkeihin\";\n                document.getElementById(kohde).classList.remove('active-favorite');\n            } else {\n                var values = [];\n                var array = JSON.parse(Cookies.get('favorite'));\n                for (i = 0; i < array.length; i++) {\n                    cookies.push(array[i]);\n                    console.log(\"Added: \" + array[i][\"kohde\"]);\n                    values.push(array[i][\"kohde\"]);\n                }\n                console.log(\"values\");\n                if (!values.includes(\"kohde\")) {\n                    console.log(\"Not same!\");\n                    cookies.push({kohde: kohde, id: id});\n                }\n                document.getElementById(kohde).innerHTML = \"Poista suosikeista\";\n                document.getElementById(kohde).classList.add('active-favorite');\n            }\n        } else {\n            cookies.push({kohde: kohde, id: id});\n        }\n        Cookies.set('favorite', JSON.stringify( cookies ), { expires: 30 });\n    }\n    if (Cookies.get('favorite')) {\n        var array = JSON.parse( Cookies.get('favorite'));\n        console.log(array);\n        for (i = 0; i < array.length; i++) {\n            if (document.getElementById(array[i][\"kohde\"])) {\n                document.getElementById(array[i][\"kohde\"]).innerHTML = \"Poista suosikeista\";\n                document.getElementById(array[i][\"kohde\"]).classList.add('active-favorite');\n            }\n        }\n    }\n\n<\/script>","protected":false},"excerpt":{"rendered":"<p>We lease business premises to companies and organizations for various needs \u2014 from production and logistics to storage and office use.<br \/>\nThe spaces can be adapted to suit specific requirements. If suitable facilities are not available among our existing properties, we are happy to develop and construct new premises tailored to the client\u2019s needs.<\/p>\n","protected":false},"author":14,"featured_media":5438,"parent":0,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"class_list":["post-8403","page","type-page","status-publish","has-post-thumbnail","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/spatium.fi\/en\/wp-json\/wp\/v2\/pages\/8403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spatium.fi\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/spatium.fi\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/spatium.fi\/en\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/spatium.fi\/en\/wp-json\/wp\/v2\/comments?post=8403"}],"version-history":[{"count":4,"href":"https:\/\/spatium.fi\/en\/wp-json\/wp\/v2\/pages\/8403\/revisions"}],"predecessor-version":[{"id":8606,"href":"https:\/\/spatium.fi\/en\/wp-json\/wp\/v2\/pages\/8403\/revisions\/8606"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/spatium.fi\/en\/wp-json\/wp\/v2\/media\/5438"}],"wp:attachment":[{"href":"https:\/\/spatium.fi\/en\/wp-json\/wp\/v2\/media?parent=8403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}