PageSourceSearch

https://www.pdgroup.in/_next/static/chunks/pages/dashboard/blogs/create-640d0ce1f487fc52.js

js pdgroup.in collected 2026-10-02 11:43:20 UTC 12,089 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1328,6606,8188,9460,2045],{50263:function(e,t,l){"use strict";l.d(t,{z:function(){return o}});var a=l(87462),s=l(67294),i=l(54142),o=s.forwardRef(function(e,t){return s.createElement(i.r,(0,a.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 16 16"},e,{ref:t}),s.createElement("path",{d:"M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707zm2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708zm5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708zm2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM10 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"}))});o.displayName="Broadcast"},25137:function(e,t,l){"use strict";l.d(t,{r:function(){return o}});var a=l(87462),s=l(67294),i=l(54142),o=s.forwardRef(function(e,t){return s.createElement(i.r,(0,a.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 16 16"},e,{ref:t}),s.createElement("path",{d:"M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"}),s.createElement("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"}))});o.displayName="Trash"},81058:function(e,t,l){"use strict";l.d(t,{g:function(){return o}});var a=l(87462),s=l(67294),i=l(54142),o=s.forwardRef(function(e,t){return s.createElement(i.r,(0,a.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 16 16"},e,{ref:t}),s.createElement("path",{d:"M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"}),s.createElement("path",{d:"M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708l3-3z"}))});o.displayName="Upload"},68238:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/blogs/create",function(){return l(41562)}])},21619:function(e,t,l){"use strict";var a=l(85893),s=l(67294),i=l(73935),o=l(33007),n=l(110),r=l.n(n);t.Z=e=>{let{isOpen:t,onClose:l,previewData:n}=e;return((0,s.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow;document.body.style.overflow="hidden";let onKeyDown=e=>{"Escape"===e.key&&l()};return window.addEventListener("keydown",onKeyDown),()=>{document.body.style.overflow=e,window.removeEventListener("keydown",onKeyDown)}},[t,l]),t&&"undefined"!=typeof document)?(0,i.createPortal)((0,a.jsxs)("div",{className:r().overlay,role:"dialog","aria-modal":"true","aria-label":"Blog preview",children:[(0,a.jsxs)("div",{className:r().toolbar,children:[(0,a.jsx)("p",{className:r().title,children:"Blog Preview"}),(0,a.jsx)("button",{type:"button",className:r().closeButton,onClick:l,children:"Close"})]}),(0,a.jsx)("div",{className:r().frame,children:(0,a.jsx)(o.Z,{isPreview:!0,previewData:n,detailsURL:"/blog",type:"Blogs"})})]}),document.body):null}},49460:function(e,t,l){"use strict";l.r(t);var a=l(85893),s=l(5152),i=l.n(s);l(34926);let o=i()(()=>Promise.all([l.e(5714),l.e(4625),l.e(3829)]).then(l.t.bind(l,21288,23)),{loadableGenerated:{webpack:()=>[21288]},ssr:!1});t.default=e=>{let{previousValue:t="",updatedValue:l,height:s,spellCheck:i=!0}=e;return(0,a.jsx)(o,{setContents:t,onChange:e=>{l(e)},getSunEditorInstance:e=>{if(!i)try{var t,l,a;let s=null==e?void 0:null===(a=e.core)||void 0===a?void 0:null===(l=a.context)||void 0===l?void 0:null===(t=l.element)||void 0===t?void 0:t.wysiwyg;(null==s?void 0:s.setAttribute)&&s.setAttribute("spellcheck","false")}catch(e){}},setDefaultStyle:"font-size: 18px; line-height: 1.7;",setOptions:{height:s||500,buttonList:[["undo","redo","font","fontSize","formatBlock","align"],["bold","underline","italic","strike","subscript","superscript","removeFormat"],["fontColor","hiliteColor","outdent","indent","align","horizontalRule","list","table"],["link","image","video","fullScreen","showBlocks","codeView","preview","print","save"]]}})}},76606:function(e,t,l){"use strict";l.r(t);var a=l(85893),s=l(50263),i=l(67294),o=l(86425),n=l.n(o);t.default=e=>{let{text:t,type:l,state:o,clickEvent:r,className:c}=e,[d,u]=(0,i.useState)("");return(0,i.useEffect)(()=>{u(o)}
1,[o]),(0,a.jsx)("button",{className:c||"btn btn-primary px-4 w-100",onClick:r,type:l||"button",disabled:"loading"===o,style:{maxWidth:c?void 0:"200px",minHeight:48},children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{children:[t," "]}),"loading"===d&&(0,a.jsx)(s.z,{width:25,height:25,className:n().svg})]})})}},41562:function(e,t,l){"use strict";l.r(t);var a=l(85893),s=l(67294),i=l(67421),o=l(22107),n=l(76606),r=l(64385),c=l(25909),d=l(94504),u=l(49460),m=l(11163),h=l(37781),p=l(21619),v=l(54397);let NewBlogs=()=>{let{t:e}=(0,i.$G)(),t=(0,m.useRouter)(),[l,b]=(0,s.useState)(""),[f,g]=(0,s.useState)(""),[x,w]=(0,s.useState)([]),[y,N]=(0,s.useState)([]),[j,S]=(0,s.useState)([]),[_,C]=(0,s.useState)(""),[k,E]=(0,s.useState)(""),[V,B]=(0,s.useState)(!1),[P,z]=(0,s.useState)(null),[A,O]=(0,s.useState)([]),[D,F]=(0,s.useState)([]),[R,H]=(0,s.useState)([]),[M,L]=(0,s.useState)([]),[Z,q]=(0,s.useState)([]),[T,X]=(0,s.useState)([]),[J,W]=(0,s.useState)([]),[I,K]=(0,s.useState)([]),[U,G]=(0,s.useState)("");(0,s.useRef)(""),(0,s.useRef)(""),(0,s.useRef)("");(0,s.useEffect)(()=>{(async function(){try{let[e,t,l,a]=await Promise.all([(0,c.gN)("/api/blogs/categories"),(0,c.gN)("/api/product"),(0,c.gN)("/api/blogs/tags"),(0,c.gN)("/api/blogs/seo")]);e.success&&w(e.blogCategory),t.success&&O(t.product),l.success&&N(l.blogtag),a.success&&S(a.blogSeo)}catch(e){console.error("Error fetching data:",e)}})()},[]),(0,s.useEffect)(()=>{F(x.map(e=>{let{_id:t,name:l}=e;return{value:t,label:l}})),H(y.map(e=>{let{_id:t,name:l}=e;return{value:t,label:l}})),L(j.map(e=>{let{_id:t,name:l}=e;return{value:t,label:l}}))},[x,y,j]);let submitHandler=async function(e){let l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(null==e?void 0:e.preventDefault)&&e.preventDefault();try{var a,s,i;let e=document.querySelector("#discount_form"),n=(null==e?void 0:null===(s=e.title)||void 0===s?void 0:null===(a=s.value)||void 0===a?void 0:a.trim())||"",r=(null==e?void 0:null===(i=e.publishOn)||void 0===i?void 0:i.value)||"";if(!l){let e=(0,v.JN)({title:n,publishOn:r,categories:Z,tags:T,shortDescription:k,images:I});if(e.length)return o.Am.warn("Please fill required fields to publish: ".concat(e.join(", ")))}b(l?"draft":"publish");let d=new FormData(e);d.set("publish",l?"false":"true"),d.append("imges",JSON.stringify(I)),d.append("blogType",f),d.append("categories",JSON.stringify(Z.map(e=>e.value))),d.append("tags",JSON.stringify(T.map(e=>e.value))),d.append("seo",JSON.stringify(J.map(e=>e.value))),d.append("shortDescription",(0,v.OX)(k)),d.append("description",(0,v.OX)(_));let u=await (0,c.qC)("/api/blogs/create",d);u.success?(o.Am.success(l?"Draft saved successfully":"Blogs Added Successfully"),e.reset(),g(""),q([]),X([]),W([]),G("reset"),C(""),E(""),await (0,h.j)("/api/blogs"),t.push("/dashboard/blogs")):u.dup?o.Am.error("Blogs with the same name already exists"):o.Am.error(u.message||"Something Went Wrong")}catch(e){console.log(e),o.Am.error("Something Went Wrong")}b("")},Q={control:(e,t)=>({...e,border:"1px solid #ccc",borderRadius:"4px",boxShadow:"none",padding:"5px",transition:"all 0.3s ease",background:"#f5f5f5","&:hover":{borderColor:"#aaa"},...t.isFocused&&{borderColor:"#007bff",boxShadow:"none"}})};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-center pt-3 pb-5",children:e("Create New Blogs")}),(0,a.jsxs)("form",{id:"discount_form",onSubmit:e=>submitHandler(e,!1),noValidate:!0,children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-12 ",children:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("label",{htmlFor:"title",className:"form-label",children:[e("Title"),"*"]}),(0,a.jsx)("input",{type:"text",id:"title",name:"title",className:" form-control"})]})}),(0,a.jsx)("div",{className:"col-12 col-md-6",children:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{htmlFor:"author",className:"form-label",children:e("Author")}),(0,a.jsx)("input",{type:"text",id:"author",name:"author",className:"form-control",placeholder:e("Author name")})]})}),(0,a.jsx)("div",{className:"col-12 col-md-6",children:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("label",{htmlFor:"Publish",className:"form-label",children:[e("Publish On"),"*"]}),(0,a.jsx)("input",{type:"date",id:"publishOn",name:"publishOn",className:"form-control"})]})}),(0,a.jsx)("div",{className:"col-12 ",children:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("label",{className:"form-label",children:[e("Select Category"),"*"]}),(0,a.jsx)(r.ZP,{options:D,isMulti:!0,onChange:q,value:Z,styles:Q})]})}),(0,a.jsx)("div",{className:"col-12 ",children:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("label",{className:"form-label",children:[e("Select Tags"),"*"]}),(0,a.jsx)(r.ZP,{options:R,isMulti:!0,onChange:X,value:T,styles:Q})]})})]}),(0,a.jsxs)("div",{className:"card mb-5 border-0 shadow",children:[(0,a.jsx)("div",{className:"card-header bg-white py-3 fw-bold",children:e("Content")}),(0,a.jsxs)("div",{className:"card-body",children:[(0,a.jsxs)("div",{className:"py-3",children:[(0,a.jsxs)("label",{htmlFor:"inp-7",className:"form-label",children:[e("Short Description"),"*"]}),(0,a.jsx)(u.default,{previousValue:k,updatedValue:E,height:180,spellCheck:!1})]}),(0,a.jsx)("label",{className:"form-label",children:e("description")}),(0,a.jsx)(u.default,{previousValue:_,updatedValue:C,height:300,spellCheck:!1})]})]}),(0,a.jsxs)("div",{className:"card border-0 shadow",children:[(0,a.jsxs)("div",{className:"card-header bg-white py-3 fw-bold",children:[e("Blogs Image"),"*"]}),(0,a.jsx)("div",{className:"card-body",children:(0,a.jsx)(d.default,{accept:".jpg,.png,.jpeg",label:"".concat(e("Display Image"),"*"),maxFileSizeInBytes:2e6,updateFilesCb:e=>K(e),resetCb:U})})]}),(0,a.jsxs)("div",{className:"mb-4 mt-2 d-flex flex-wrap gap-2 align-items-center",children:[(0,a.jsx)("button",{type:"button",className:"btn btn-outline-secondary",onClick:()=>{var e,t,l;let a=document.querySelector("#discount_form");z((0,v.xu)({title:null==a?void 0:null===(e=a.title)||void 0===e?void 0:e.value,shortDe
1scription:(0,v.OX)(k),description:(0,v.OX)(_),imges:I,publishOn:null==a?void 0:null===(t=a.publishOn)||void 0===t?void 0:t.value,author:null==a?void 0:null===(l=a.author)||void 0===l?void 0:l.value,tags:T,categories:Z})),B(!0)},style:{minHeight:48},children:e("Preview Blog")}),(0,a.jsx)(n.default,{type:"button",text:e("draft"===l?"Saving Draft...":"Save as Draft"),clickEvent:()=>submitHandler(null,!0),state:"draft"===l?"loading":"",className:"btn btn-secondary px-4"}),(0,a.jsx)(n.default,{type:"submit",text:e("Publish"),state:"publish"===l?"loading":"",className:"btn btn-primary px-4"})]}),(0,a.jsx)("p",{className:"text-muted small mb-4",children:e("Fields marked * are required only when publishing. Drafts can be saved incomplete.")})]}),(0,a.jsx)(p.Z,{isOpen:V,onClose:()=>B(!1),previewData:P})]})};NewBlogs.requireAuthAdmin=!0,NewBlogs.dashboard=!0,t.default=NewBlogs},34926:function(){},110:function(e){e.exports={overlay:"blogPreview_overlay__kqKQn",toolbar:"blogPreview_toolbar__i6hH0",title:"blogPreview_title__ewLa0",closeButton:"blogPreview_closeButton__MxllV",frame:"blogPreview_frame___WF0O"}},86425:function(e){e.exports={button:"button_button__8rPLr",svg:"button_svg__Um2Tk",spin:"button_spin__X5iRJ"}}},function(e){e.O(0,[4142,1664,5675,8764,7066,4385,9810,4504,3007,9774,2888,179],function(){return e(e.s=68238)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.