const instagram1 = document.getElementById("instagram");
const facebook1 = document.getElementById("facebook");
const twitter1 = document.getElementById("twitter");
const tiktok1 = document.getElementById("tiktok");
const googleplay = document.getElementById("googleplay");
const apple = document.getElementById("apple");


axios.put("https://mobileapi.weeorder.co.uk/api/GetOpenCloseShop/GetShopInfo", {
    "ShopId": "1751"
})
    .then((response) => {

        const FaceBookUrl = response.data.GetShopInfo[0].FaceBookUrl;
        const InstagramUrl = response.data.GetShopInfo[0].InstagramUrl;
        const TikTokUrl = response.data.GetShopInfo[0].TikTokUrl;
        const AppStoreUrl = response.data.GetShopInfo[0].AppStoreUrl;
        const TwitterUrl = response.data.GetShopInfo[0].TwitterUrl;
        const GooglePlayUrl = response.data.GetShopInfo[0].GooglePlayUrl;
        var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
        if (isIOS) {
            $(".dlApp img").attr("src", "imgs/dl_app/app.png");
            if (AppStoreUrl !== null) {
                $(".dlApp a").attr("href", AppStoreUrl);
            } else {
                $(".dlApp a").attr("href", "https://apps.apple.com/us/app/mealzo/id1558698286");
            }
        } else {
            $(".dlApp img").attr("src", "imgs/dl_app/google.png");

            if (GooglePlayUrl !== null) {
                $(".dlApp a").attr("href", GooglePlayUrl);
            } else {

                $(".dlApp a").attr("href", "https://play.google.com/store/apps/details?id=com.mealzowee");
            }
        }
        var docWidth = window.matchMedia("(max-width: 992px)");
        $(document).ready(function () {
            if (docWidth.matches) {
                $("#myModal").modal('show');
            }
        });

        if (FaceBookUrl !== null) {
            facebook1.href = FaceBookUrl;
        } else {
            facebook1.style.display = "none";
        }
        if (InstagramUrl !== null) {
            instagram1.href = InstagramUrl;
        } else {
            instagram1.style.display = "none";
        }
        if (TwitterUrl !== null) {
            twitter1.href = TwitterUrl;
        } else {
            twitter1.style.display = "none";
        }

        if (TikTokUrl !== null) {
            tiktok1.href = TikTokUrl;
        } else {
            tiktok1.style.display = "none";
        }

        if (GooglePlayUrl !== null) {
            googleplay.href = GooglePlayUrl;
        } else {
            googleplay.href = "https://play.google.com/store/apps/details?id=com.mealzowee";
        }

        if (AppStoreUrl !== null) {
            apple.href = AppStoreUrl;
        } else {
            apple.href = "https://apps.apple.com/us/app/mealzo/id1558698286";
        }

    })
    .catch(function (response) {
        //handle error
        console.log(response);
    });