|
123 |
- import{j as H,k as o,C as q,z as B,s as D,J as R,r as z,c as w,a as e,b as P,w as A,m as _,v as k,x as L,i as I,t as h,F as N,u as Q,d as J,e as O,o as T,D as W}from"./index-b3134325.js";import{g as K,p as X,Q as Y,r as Z}from"./apiFrom-f56e1afe.js";/* empty css */import{c as ee,a as te,p as F}from"./api-04371953.js";const ae={class:"page-wrapper",id:"app","data-layout":"horizontal","data-navbarbg":"skin6","data-sidebartype":"full","data-sidebar-position":"fixed","data-header-position":"fixed"},se=J('<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="'+O+'" class="light-logo" width="180" alt=""></a></li></ul></nav></header>',1),oe={class:"body-wrapper overflow-hidden"},ne={class:"position-relative overflow-hidden min-vh-100 d-flex align-items-center justify-content-center drawise-auth-bg"},le={class:"d-flex align-items-center justify-content-center w-100"},ie={class:"row justify-content-center w-100"},ce={class:"col-md-8 col-lg-8 col-xxl-8"},de=e("i",{class:"ti ti-chevron-left fs-4 me-2"},null,-1),re={class:"container mt-4"},ue={class:"row"},pe={class:"form-floating mb-3"},ve=e("label",null,"Page name",-1),ge=e("hr",null,null,-1),me=e("p",{class:"fs-8 fw-bold"},"Body text",-1),_e={class:"container"},he={class:"row"},fe={class:"col-12 col-md-8 mb-5"},be={class:"col-12 col-md-4 profnajafi"},ye={class:"card"},xe={class:"card-body"},we=e("h1",{class:"fs-6 fw-bolder"},"Explain the Text:",-1),ke=["disabled"],Ie=e("i",{class:"ti ti-sparkles fs-4 me-2"},null,-1),Te=e("hr",null,null,-1),Se=e("p",{class:"fs-4"},"Generate Image",-1),Ce=["disabled"],Pe=e("p",{class:"fs-4 mt-5"},"Select Image",-1),Le={class:"radio-tile-group"},Fe={class:"checkbox-group"},Me={class:"checkbox-wrapper"},Ve=["onUpdate:modelValue"],je={class:"checkbox-tile"},Ee=["src"],Ge=e("i",{class:"ti ti-trash fs-4"},null,-1),Ue=[Ge],$e={class:"col-12 mb-5"},He=["disabled"],qe=e("i",{class:"ti ti-device-floppy fs-4 me-2"},null,-1),Qe=H({__name:"edit-page",setup(Be){const u=o(!1),p=o("Save"),i=o(!1),v=o(!1),f=o(""),g=q(),S=o(""),m=o(""),n=o(null),c=B().params.id,d=o(),b=o(),y=o();D(()=>{ee(),M()});async function M(){try{(await K)(`/SitePages/ForEdit/${c}/`).then(t=>{console.log(t.data),t.data&&(d.value=t.data.site_id,n.value.setHTML(t.data.page_content),m.value=t.data.page_name,console.log(d.value),y.value=t.data.image)})}catch(t){console.error(t)}}async function V(){console.log(n.value.getHTML());try{u.value=!0,p.value="Saving...",(await te)(`/SitePages/${c}/`,{site:d.value,page_name:m.value,content:n.value.getHTML(),images:U.value}).then(t=>{console.log(t.data),u.value=!1,p.value="Save",g.push(`../../../dash/${d.value}/pages`)})}catch(t){u.value=!1,p.value="Failed, Try Again",console.error(t)}}const x=o("Generate"),j=()=>{v.value=!0,x.value="Generating...",F("/SitePages/picogen/",{request:b.value,pageId:c}).then(()=>{window.location.reload()}).catch(()=>{v.value=!1,x.value="Failed, Try Again"})},C=o(null),E=async()=>{var s;const a=(s=C.value.files)==null?void 0:s[0];if(!a)return;const r=new FormData;r.append("image",a),r.append("page",c.toString()),console.log(a);try{(await X)("/create_site/images/",r).then(l=>{console.log("Image uploaded successfully:",l.data),g.go(0)})}catch(l){console.error("Error uploading image:",l)}},G=async()=>{n.value.setHTML("<p>Generating ... </p>"),i.value=!0;try{F("/SitePages/gpt",{request:f.value}).then(t=>{console.log(t.data),n.value.setHTML(t.data),i.value=!1}).catch(()=>{n.value.setHTML("<p>Failed</p>"),i.value=!1})}catch(t){console.error("Error:",t)}},U=R(()=>y.value.filter(t=>t.selected).map(t=>t.id)),$=async t=>{(await Z)(`/SitePages/image/${t}`).then(a=>{console.log(a.data),g.go(0)}).catch(()=>{g.go(0)})};return(t,a)=>{const r=z("RouterLink");return T(),w("div",ae,[se,e("div",oe,[e("div",ne,[e("div",le,[e("div",ie,[e("div",ce,[P(r,{to:`../../../dash/${d.value}/pages`,class:"btn btn-outline-warning py-8 mb-4 rounded-2"},{default:A(()=>[de,I(" Back To Pages")]),_:1},8,["to"]),e("div",re,[e("div",ue,[e("div",pe,[_(e("input",{type:"text",class:"form-control",placeholder:"Username","onUpdate:modelValue":a[0]||(a[0]=s=>m.value=s)},null,512),[[k,m.value]]),ve]),ge,me,e("div",_e,[e("div",he,[e("div",fe,[P(L(Y),{ref_key:"quill",ref:n,content:S.value,"onUpdate:content":a[1]||(a[1]=s=>S.value=s),theme:"snow"},null,8,["content"])]),e("div",be,[e("div",ye,[e("div",xe,[we,_(e("textarea",{"onUpdate:modelValue":a[2]||(a[2]=s=>f.value=s),class:"form-control mb-4",rows:"10",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),[[k,f.value]]),e("button",{onClick:G,type:"button",disabled:i.value,class:"justify-content-center w-100 btn mb-1 btn-rounded btn-danger d-flex align-items-center"},[Ie,I(" "+h(i.value?"Generating ...":"Generate"),1)],8,ke)])])]),Te,Se,_(e("input",{"onUpdate:modelValue":a[3]||(a[3]=s=>b.value=s),type:"text",class:"form-control",id:"nametext","aria-describedby":"name",placeholder:"Type your imagination"},null,512),[[k,b.value]]),e("button",{disabled:v.value,onClick:j,class:"btn btn-primary mt-3"},h(x.value),9,Ce),e("p",null,h(v.value?"Creating images with AI tools may take few minutes. please do not refresh the page":""),1),Pe,e("input",{class:"form-control mb-4",type:"file",id:"formFile",ref_key:"imageInput",ref:C,onChange:E,accept:"image/*"},null,544),e("div",Le,[e("fieldset",Fe,[(T(!0),w(N,null,Q(y.value,s=>(T(),w("div",{key:s,class:"checkbox"},[e("label",Me,[_(e("input",{type:"checkbox",class:"checkbox-input","onUpdate:modelValue":l=>s.selected=l},null,8,Ve),[[W,s.selected]]),e("span",je,[e("img",{src:`${s}`,alt:"",style:{"max-width":"150px"}},null,8,Ee),e("button",{onClick:a[4]||(a[4]=l=>$(L(c))),class:"btn btn-outline-danger btn-sm p-1 m-1"},Ue)])])]))),128))])]),e("div",$e,[e("button",{onClick:V,type:"button",disabled:u.value,class:"justify-content-center btn mb-1 btn-rounded btn-success"},[qe,I(" "+h(p.value),1)],8,He)])])])])])])])])])])])}}});export{Qe as default};
|