<template>
    <div class="block p-6  shadow-lg bg-white border-2  2xl:w-96 text-xl" style="background-color: #f5f6d7;">
        <p class="text-blue-700 text-2xl font-semibold p-1">Get in Touch</p>
        <div v-if="BlogQry">
            <div class="form-group mb-1">
                <label  for="exampleInputName" class="form-label inline-block mb-2 text-gray-700">Your Name</label>
                <input v-model="bname" type="text" class="form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none">
            </div>
            <div class="form-group mb-1">
                <label  for="exampleInputEmail" class="form-label inline-block mb-2 text-gray-700">Your Email</label>
                <input v-model="bemail" type="email" class="form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none">
            </div>
            <div class="form-group mb-1">
                <label  for="exampleInputPhoneNumber" class="form-label inline-block mb-2 text-gray-700">Your Phone Number</label>
                <input v-model="bnumber" type="text"   class="form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none">
            </div>
            <div class="flex justify-end pt-2">
                <button @click="saveBlogQry" class="px-2  py-2.5 bg-blue-600 text-white font-medium text-lg leading-tight uppercase rounded-tl-xl rounded-br-xl shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out">Send</button>
            </div>
        </div>
        <div v-else>
            <h1 class="text-center p-16 py-32 text-3xl text-color-1">Thank You</h1>
        </div>
    </div>
</template>
<script client:only="vue" >
export default {
setup(){
// const siteData = reactive({
//   title: 'Blogs - Teeny Beans Preschool Curriculum',
//   description: `My beautiful website`,
  
// })


// useHead({
//     title: computed(() => siteData.title),
//     meta: [
//         {
//             name: 'title',
//             content: `Blogs - Teeny Beans Preschool Curriculum`
//         },
//         {
//             name: `description`,
//             content: `Get detailed information about the preschool industry and the challenges it faces.`
//         },
//     ],
// })
},
    data() {
        return {
            page: null,
            faqBlog: null,
            isLoading: true,
            bname: null,
            bemail: null,
            bnumber: null,
            BlogQry: true,
            metaname: "KKKK",
            metadescription: "Description",
            items:null
        }
    },
    
    mounted: function () {
        fetch('https://curriculum-app-api.beanstalkedu.com/items/blog?filter[property][_eq]=teenybeans_curriculum&filter[slug][_eq]=' + this.$route.params.id)
          .then(response => response.json())
          .then(data => {
            this.page = data.data
            this.isLoading = false
            this.metaTitle=this.page[0].title
            const descEl = document.querySelector('head meta[name="description"]');
            const titleEl = document.querySelector('head title');
            descEl.setAttribute('content', this.page[0].title);
            titleEl.textContent = this.page[0].title;
            
        })
        fetch('https://management.beanstalkedu.com/items/FAQ?filter[property][_eq]=teenybeans_curriculum&filter[slug][_eq]=' + this.$route.params.id)
        .then(resp => resp.json())
        .then(data => {
            this.faqBlog=data.data
            // console.log(this.faqBlog)
        })

    },
    
        
        
    methods: { 
        saveBlogQry(){
        let formData = new FormData();
        formData.append('Name', this.bname);
        formData.append('Email', this.bemail);
        formData.append('Phone', this.bnumber);
        formData.append('formName', 'tb-blog');
        fetch('https://api.teenybeans.in/API/contactFormProcessor/v1/', 
            {
                method: 'POST',
                body: formData,
            }
        )
        .then(response => response.json())
        .then(data => {
            // console.log(data)
        });
        // formData=""
        this.BlogQry=false
    }
   


},

}

</script>