PageSourceSearch

https://3drv.com/_assets/admin.product-groups._productGroupId.edit-BHqaCgRG.js

js 3drv.com collected 2026-10-04 11:31:14 UTC 5,993 bytes, 1 lines download raw bytes

1import{aJ as w,ah as I,j as r,L as _,ar as G,X as B,al as c}from"./vendor-DrT0ezAj.js";import{H as L}from"./Helmet-8gTvwaaE.js";import{c as T,b as D,d as U}from"./useProductGroups-DTH0YFTV.js";import{u as A,b as E}from"./useAdminProducts-Dwn9l825.js";import{P as O}from"./ProductGroupForm-C_eutZLv.js";import{S as R,a as V,b as q,c as K,e as g}from"./Select-tSJo-iXH.js";import{S as d,B as n}from"./index-xgku-_Dc.js";import"./index-BbP3371Q.js";import"./fetchError-C0tiPQM4.js";import"./Form-BMetpdkZ.js";import"./Input-D9YWtt6e.js";import"./Switch-ASw37SKW.js";import"./Textarea-gm0Jrtdn.js";import"./useAdminProductCategories-CX4sq3yy.js";import"./useProductCategories-zLo9B3ML.js";import"./Dialog-Bbkoq-CW.js";import"./Tabs-CASRLXuT.js";import"./ProductMediaFaqFields-DFgoGmQE.js";import"./useCloudinaryUpload-5ok5lDYO.js";const z="_pageContainer_iboy1_1",$="_breadcrumb_iboy1_7",H="_breadcrumbLink_iboy1_16",Q="_breadcrumbCurrent_iboy1_26",F="_header_iboy1_31",J="_backButton_iboy1_43",M="_content_iboy1_53",X="_productsCard_iboy1_60",W="_productList_iboy1_74",Y="_productRow_iboy1_81",Z="_productInfo_iboy1_91",ee="_productName_iboy1_97",re="_productSku_iboy1_101",te="_productStatus_iboy1_106",se="_emptyText_iboy1_113",oe="_addProduct_iboy1_118",ie="_errorState_iboy1_122",ae="_backButtonSkeleton_iboy1_137",ce="_titleSkeleton_iboy1_143",de="_formSkeleton_iboy1_148",t={pageContainer:z,breadcrumb:$,breadcrumbLink:H,breadcrumbCurrent:Q,header:F,backButton:J,content:M,productsCard:X,productList:W,productRow:Y,productInfo:Z,productName:ee,productSku:re,productStatus:te,emptyText:se,addProduct:oe,errorState:ie,backButtonSkeleton:ae,titleSkeleton:ce,formSkeleton:de};function we(){const{productGroupId:x}=w(),o=Number(x),i=I(),{data:a,isLoading:S,error:P}=T({productGroupId:o}),{mutate:N,isPending:j}=D(),{mutate:k,isPending:v}=U(),{data:u}=A(),{mutate:l,isPending:m}=E(),h=u?.filter(e=>e.productGroupId===o)||[],p=u?.filter(e=>e.productGroupId!==o)||[],b=(e,s)=>({id:e.id,name:e.name,description:e.description,price:Number(e.price),category:e.category,imageUrl:e.imageUrl,stockQuantity:e.stockQuantity,sku:e.sku,model:e.model,msrp:e.msrp?Number(e.msrp):void 0,map:e.map?Number(e.map):void 0,preferredPrice:e.preferredPrice?Number(e.preferredPrice):void 0,partnerPrice
1:e.partnerPrice?Number(e.partnerPrice):void 0,housePrice:e.housePrice?Number(e.housePrice):void 0,preferredPriceOverride:e.preferredPriceOverride,partnerPriceOverride:e.partnerPriceOverride,housePriceOverride:e.housePriceOverride,productGroupId:s,designerId:e.designerId,materialSupplyId:e.materialSupplyId??null,code:e.code??null,weight:e.weight?Number(e.weight):void 0,length:e.length?Number(e.length):void 0,width:e.width?Number(e.width):void 0,height:e.height?Number(e.height):void 0,hsTariffNumber:e.hsTariffNumber,originCountry:e.originCountry,requiresAssembly:e.requiresAssembly,instructionsUrl:e.instructionsUrl,images:e.images,videos:e.videos,features:e.features,specifications:e.specifications,downloads:e.downloads,faq:e.faq,status:e.status,hasVariants:e.hasVariants??!1,productType:e.productType??"product",stockingType:e.stockingType??"stocked",slug:e.slug??null,shortDescription:e.shortDescription??null}),y=e=>{N(e,{onSuccess:()=>{c.success("Product updated"),i("/admin/products")},onError:s=>{c.error(`Couldn't update this Product: ${s.message}`)}})},f=()=>{k({productGroupId:o},{onSuccess:()=>{c.success("Product deleted"),i("/admin/products")},onError:e=>{c.error(`Couldn't delete this Product: ${e.message}`)}})};return S?r.jsxs("div",{className:t.pageContainer,children:[r.jsxs("div",{className:t.header,children:[r.jsx(d,{className:t.backButtonSkeleton}),r.jsx(d,{className:t.titleSkeleton})]}),r.jsx(d,{className:t.formSkeleton})]}):P||!a?r.jsx("div",{className:t.pageContainer,children:r.jsxs("div",{className:t.errorState,children:[r.jsx("h2",{children:"Product not found"}),r.jsx("p",{children:"That Product doesn't exist, or something went wrong fetching it."}),r.jsx(n,{onClick:()=>i("/admin/products"),children:"Back to the catalog"})]})}):r.jsxs("div",{className:t.pageContainer,children:[r.jsx(L,{children:r.jsx("title",{children:`Edit ${a.name} - 3DRV Admin`})}),r.jsxs("div",{className:t.breadcrumb,children:[r.jsx(_,{to:"/admin",className:t.breadcrumbLink,children:"Admin"}),r.jsx("span",{className:t.breadcrumbSeparator,children:"/"}),r.jsx(_,{to:"/admin/products",className:t.breadcrumbLink,children:"Catalog"}),r.jsx("span",{className:t.breadcrumbSeparator,children:"/"}),r.jsx("span",{className:t.breadcrumbCurrent,children:a.name})]}),r.jsxs("div",{className:t.header,children:[r.jsxs(n,{variant:"ghost",onClick:()=>i("/admin/products"),className:t.backButton,children:[r.jsx(G,{size:16})," Back to the catalog"]}),r.jsx("h1",{children:"Edit Product"})]}),r.jsxs("div",{className:t.content,children:[r.jsx(O,{initialValues:a,onSubmit:y,onCancel:()=>i("/admin/products"),isSubmitting:j||v,showDeleteButton:!0,onDelete:f}),r.jsxs("div",{className:t.productsCard,children:[r.jsx("h2",{children:"SKUs in this Product"}),h.length>0?r.jsx("div",{className:t.productList,children:h.map(e=>r.jsxs("div",{className:t.productRow,children:[r.jsxs("div",{className:t.productInfo,children:[r.jsx("span",{className:t.productName,children:e.name}),r.jsx("span",{className:t.productSku,children:e.sku}),r.jsx("span",{className:t.productStatus,children:e.status})]}),r.jsx(n,{variant:"ghost",size:"icon-sm",onClick:()=>{l(b(e,null))},disabled:m,children:r.jsx(B,{size:16})})]},e.id))}):r.jsx("p",{className:t.emptyText,children:"No SKUs yet."}),r.jsx("div",{className:t.addProduct,children:r.jsxs(R,{value:"__empty",onValueChange:e=>{if(e!=="__empty"){const s=p.find(C=>C.id===Number(e));s&&l(b(s,o))}},disabled:m,children:[r.jsx(V,{children:r.jsx(q,{placeholder:"Move an existing SKU here…"})}),r.jsxs(K,{children:[r.jsx(g,{value:"__empty",children:"— Select a SKU —"}),p.map(e=>r.jsxs(g,{value:String(e.id),children:[e.name," (",e.sku,")"]},e.id))]})]})})]})]})]})}export{we as default};

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.