|
- import{j as P,k as o,C as E,z as S,s as B,r as R,c as b,a as e,b as M,w as D,m as v,v as y,x as N,i as x,t as w,F as q,u as z,d as A,e as $,o as k,D as Q}from"./index-5dca7a6a.js";import{p,Q as O}from"./apiFrom-e81977dd.js";/* empty css */import{c as W,b as J,p as K}from"./api-2fe5baa7.js";const X={class:"page-wrapper",id:"app","data-layout":"horizontal","data-navbarbg":"skin6","data-sidebartype":"full","data-sidebar-position":"fixed","data-header-position":"fixed"},Y=A('<header class="app-header"><nav class="navbar navbar-expand-lg navbar-light container-fluid px-0"><ul class="navbar-nav"><li class="nav-item d-block d-lg-none"><a class="nav-link sidebartoggler ms-n3" id="sidebarCollapse" href="javascript:void(0)"><i class="ti ti-menu-2"></i></a></li><li class="nav-item d-none d-lg-block"><a href="index.html" class="text-nowrap nav-link"><img src="'+$+'" class="light-logo" width="180" alt=""></a></li></ul></nav></header>',1),Z={class:"body-wrapper overflow-hidden"},ee={class:"position-relative overflow-hidden min-vh-100 d-flex align-items-center justify-content-center drawise-auth-bg"},te={class:"d-flex align-items-center justify-content-center w-100"},ae={class:"row justify-content-center w-100"},se={class:"col-md-8 col-lg-8 col-xxl-8"},oe=e("i",{class:"ti ti-chevron-left fs-4 me-2"},null,-1),ne={class:"container mt-4"},le={class:"row"},ie={class:"form-floating mb-3"},ce=e("label",null,"Page name",-1),de=e("hr",null,null,-1),re=e("p",{class:"fs-8 fw-bold"},"Body text",-1),ue={class:"container"},pe={class:"row"},_e={class:"col-12 col-md-8 mb-5"},ve={class:"col-12 col-md-4 profnajafi"},ge={class:"card"},me={class:"card-body"},he=e("h1",{class:"fs-6 fw-bolder"},"Explain the Text:",-1),fe=["disabled"],be=e("i",{class:"ti ti-sparkles fs-4 me-2"},null,-1),ye=e("hr",null,null,-1),xe=e("p",{class:"fs-4"},"Generate Image",-1),we=["disabled"],ke=e("p",{class:"fs-4 mt-5"},"Select Image",-1),Te={class:"radio-tile-group"},Le={class:"checkbox-group"},Me={class:"checkbox-wrapper"},Ie=["onUpdate:modelValue"],Ce={class:"checkbox-tile"},He=["src"],Fe={class:"col-12 mb-5"},Ge=["disabled"],Ve=e("i",{class:"ti ti-device-floppy fs-4 me-2"},null,-1),Re=P({__name:"new-page",setup(je){const d=o(!1),r=o(!1),g=o(""),I=o(!1),C=o("Save"),m=E(),h=S().params.id,T=o(),n=o(),i=o(""),f=o(),H=o(),_=o(),u=o("Generate");async function F(){console.log(n.value.getHTML());try{(await p)("/create_site/pages/",{site:h,page_name:i.value,content:n.value.getHTML()}).then(a=>{console.log(a.data),m.push("pages")})}catch(a){console.error(a)}}B(()=>{W()});const G=async()=>{n.value.setHTML("<p>Generating ... (it may take up to 2 minutes)</p>"),d.value=!0;try{await J.post("https://avindev.com/bot/public/drawise",{text:g.value+" in HTML Format only <body>"}).then(a=>{console.log(a.data.text),n.value.setHTML(a.data.text),d.value=!1}).catch(()=>{n.value.setHTML("<p>Failed</p>"),d.value=!1})}catch(a){console.error("Error:",a)}},V=()=>{r.value=!0,u.value="Generating...",p("/create_site/pages/",{site:h,page_name:i.value?i.value:"sample",content:n.value.getHTML()?n.value.getHTML():"<br>"}).then(a=>{console.log(a.data),_.value=a.data.id,p("/create_site/picogen/",{prompt:f.value}).then(t=>{console.log(t.data[0]),u.value="Generate",K("/create_site/picogen/",{url:t.data[0],page_id:parseInt(_.value)}).then(l=>{console.log(l.data),r.value=!1,m.push(`../../site/page/${_.value}/edit-page`)}).catch(()=>{r.value=!1,u.value="Failed, Try Again"})}).catch(()=>{r.value=!1,u.value="Failed, Try Again"})})},L=o(null),j=async()=>{var s;const t=(s=L.value.files)==null?void 0:s[0];if(!t)return;const l=new FormData;l.append("image",t),console.log(t);try{(await p)("/create_site/pages/",{site:h,page_name:i.value?i.value:"sample",content:n.value.getHTML()?n.value.getHTML():"<br>"}).then(c=>{console.log(c.data),_.value=c.data.id,U(l,c.data.id)})}catch(c){console.error(c)}};async function U(a,t){a.append("page",t.toString()),(await p)("/create_site/images/",a).then(l=>{console.log("Image uploaded successfully:",l.data),m.push(`../../site/page/${t}/edit-page`)})}return(a,t)=>{const l=R("RouterLink");return k(),b("div",X,[Y,e("div",Z,[e("div",ee,[e("div",te,[e("div",ae,[e("div",se,[M(l,{to:"pages",class:"btn btn-outline-warning py-8 mb-4 rounded-2"},{default:D(()=>[oe,x(" Back To Pages")]),_:1}),e("div",ne,[e("div",le,[e("div",ie,[v(e("input",{type:"text",class:"form-control",placeholder:"Username","onUpdate:modelValue":t[0]||(t[0]=s=>i.value=s)},null,512),[[y,i.value]]),ce]),de,re,e("div",ue,[e("div",pe,[e("div",_e,[M(N(O),{ref_key:"quill",ref:n,content:T.value,"onUpdate:content":t[1]||(t[1]=s=>T.value=s),theme:"snow"},null,8,["content"])]),e("div",ve,[e("div",ge,[e("div",me,[he,v(e("textarea",{class:"form-control mb-4",rows:"10","onUpdate:modelValue":t[2]||(t[2]=s=>g.value=s),placeholder:`Ex: Write SEO optimized marketing copy for blogs,\r
- Facebook ads, Google Ads and more to increase clicks,\r
- conversions and sales.`},null,512),[[y,g.value]]),e("button",{type:"button",disabled:d.value,onClick:G,class:"justify-content-center w-100 btn mb-1 btn-rounded btn-danger d-flex align-items-center"},[be,x(" "+w(d.value?"Generating ...":"Generate"),1)],8,fe)])])]),ye,xe,v(e("input",{"onUpdate:modelValue":t[3]||(t[3]=s=>f.value=s),type:"text",class:"form-control",id:"nametext","aria-describedby":"name",placeholder:"Type your imagination"},null,512),[[y,f.value]]),e("button",{disabled:r.value,onClick:V,class:"btn btn-primary mt-3"},w(u.value),9,we),ke,e("input",{class:"form-control mb-4",type:"file",id:"formFile",ref_key:"imageInput",ref:L,onChange:j,accept:"image/*"},null,544),e("div",Te,[e("fieldset",Le,[(k(!0),b(q,null,z(H.value,s=>(k(),b("div",{key:s,class:"checkbox"},[e("label",Me,[v(e("input",{type:"checkbox",class:"checkbox-input","onUpdate:modelValue":c=>s.name=c},null,8,Ie),[[Q,s.name]]),e("span",Ce,[e("img",{src:s.image,alt:"",style:{"max-width":"150px"}},null,8,He)])])]))),128))])]),e("div",Fe,[e("button",{onClick:F,type:"button",disabled:I.value,class:"justify-content-center btn mb-1 btn-rounded btn-success"},[Ve,x(" "+w(C.value),1)],8,Ge)])])])])])])])])])])])}}});export{Re as default};
|