PageSourceSearch

https://brainstox-com.vercel.app/_next/static/chunks/pages/dashboard/attributes/[id]-59efe7b758ce308d.js

js brainstox-com.vercel.app collected 2026-10-03 06:19:39 UTC 3,544 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1116,8214],{45922:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/attributes/[id]",function(){return a(77597)}])},18214:function(e,t,a){"use strict";a.r(t);var s=a(85893);t.default=e=>{let{color:t}=e;return(0,s.jsx)(s.Fragment,{})}},77597:function(e,t,a){"use strict";a.r(t);var s=a(85893),n=a(12918),l=a.n(n),r=a(11163),i=a(67294),u=a(22120),c=a(91444),d=a(16976),o=a(83490),m=a.n(o),b=a(18214),p=a(2022);let EditAttribute=e=>{let t=(0,r.useRouter)(),a="/api/attributes/edit?id=".concat(t.query.id),{data:n,error:o}=(0,d.ZP)(t.query.id?a:null,p.gN),h=(0,i.useRef)(),x=(0,i.useRef)(),[f,v]=(0,i.useState)({}),[j,N]=(0,i.useState)([]),{t:g}=(0,u.$G)();(0,i.useEffect)(()=>{if(n&&n.attr){let e=n.attr.values?n.attr.values:[{name:"",value:""}];v(n.attr),N(e)}},[n]);let handleInputChange=(e,t)=>{let{name:a,value:s}=e.target,n=[...j];n[t][a]=s,N(n)},handleRemoveClick=e=>{let t=[...j];t.splice(e,1),N(t)},submitHandler=async e=>{e.preventDefault();try{let e=new FormData;e.append("id",x.current.value),e.append("name",h.current.value),e.append("value",JSON.stringify(j));let t=await (0,p.qC)("/api/attributes/edit",e);t.success?c.toast.success("Attribute Updated Successfully"):c.toast.error("Something Went Wrong")}catch(e){console.log(e),c.toast.error("Something Went Wrong")}};return(0,s.jsx)(s.Fragment,{children:o?(0,s.jsx)(l(),{statusCode:500}):n?f._id?(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"text-center pt-3 pb-5",children:g("Edit Attribute")}),(0,s.jsxs)("form",{onSubmit:submitHandler,children:[(0,s.jsx)("input",{type:"hidden",ref:x,defaultValue:f._id}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("label",{htmlFor:"inp-1",className:"form-label",children:[g("Attribute Name"),"*"]}),(0,s.jsx)("input",{type:"text",id:"inp-1",ref:h,defaultValue:f.name,className:m().input+" form-control",required:!0})]}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsx)("div",{className:"card-header",children:g("Attribute Value")}),(0,s.jsxs)("div",{className:"card-body",children:[j.map((e,t)=>(0,s.jsxs)("div",{className:"row mb-4",children:[(0,s.jsxs)("div",{className:"col-12 col-sm-5",children:[(0,s.jsx)("label",{className:"form-label",children:g("name")}),(0,s.jsx)("input",{type:"text",className:m().input+" form-control",name:"name",value:e.name,onChange:e=>handleInputChange(e,t)})]}),(0,s.jsxs)("div",{className:"col-12 col-sm-5",children:[(0,s.jsx)("label",{className:"form-label",children:g("Value")}),(0,s.jsx)("input",{type:"text",className:m().input+" form-control",name:"value",value:e.value,onChange:e=>handleInputChange(e,t)})]}),(0,s.jsx)("div",{className:"col-12 col-sm-2 d-flex align-items-end",children:(0,s.jsx)("button",{className:"btn btn-danger",type:"button",onClick:()=>handleRemoveClick(t),children:g("Remove")})})]},t)),(0,s.jsx)("button",{type:"button",className:"btn btn-success my-2",onClick:()=>{N([...j,{name:"",value:""}])},children:g("Add Value")})]})]}),(0,s.jsx)("div",{className:"my-4",children:(0,s.jsx)("input",{type:"submit",value:g("Update Attribute"),className:"btn btn-lg btn-success"})})]})]}):(0,s.jsx)(l(),{statusCode:404}):(0,s.jsx)(b.default,{})})};EditAttribute.requireAuthAdmin=!0,EditAttribute.dashboard=!0,t.default=EditAttribute},83490:function(e){e.exports={button_danger:"productForm_button_danger__HuxDf"}},12918:function(e,t,a){e.exports=a(66908)},11163:function(e,t,a){e.exports=a(59974)}},function(e){e.O(0,[6976,9774,2888,179],function(){return e(e.s=45922)}),_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.