import{u as g,R as e,L as f}from"./app-b4140d27.js";import{L as h,_ as b}from"./Layout-0576c2ba.js";import{W as E}from"./WorksTable-c502acf7.js";import{l as x,a as k}from"./axios-004a8e66.js";/* empty css            *//* empty css                           *//* empty css                                */import"./Header-487c2bfa.js";import"./Steps-b250558a.js";import"./react-select-async.esm-8108584f.js";function C(){const{fair:i,works:t,user_id:l}=g().props,c=l&&l!=="",[d,r]=e.useState(!1),[o,m]=e.useState(t),u=s=>{r(!0),k.post("/map_works",o).then(a=>{if(r(!1),a.data.error){b(a.data.message,{duration:5e3,style:{backgroundColor:"#f89406"}});return}window.location=a.data.redirect_url}).catch(()=>{r(!1)})},p=(s,a)=>{let n=o;n[s].selected_edition=a,m(n)},_=(s,a)=>{let n=o;n[s].selected_price=a,m(n)};return e.createElement(h,{step:4},e.createElement("h2",{className:"fs-6 text-center py-4 m-0"},_translations.works_data),e.createElement("div",{className:"mx-auto mt-3"},c&&e.createElement("p",null,_translations.works_msg),(!t||(t==null?void 0:t.length)===0)&&e.createElement("p",{className:"text-center py-4 m-0"},_translations.works_not_included),(!t||(t==null?void 0:t.length)===0)&&e.createElement("p",{className:"text-center py-4 m-0",dangerouslySetInnerHTML:{__html:_translations.add_works_instructions}}),(t==null?void 0:t.length)>0&&e.createElement(E,{works:t,showWorkSelector:c,showPriceSelector:!0,handleSelectWorkEdition:p,handleSelectPrice:_}),e.createElement("nav",{className:"mb-3 mt-2 d-flex justify-content-between align-items-center"},e.createElement(f,{href:"/exposition_data?c="+i.code},_translations.go_back),e.createElement("button",{type:"button",className:"btn btn-34",id:"submit-work-data-btn",onClick:u},d?e.createElement("img",{src:x,alt:"Loading...",width:"20px",height:"20px"}):_translations.next),e.createElement("input",{type:"hidden",name:"fair_code",id:"fair_code",value:i.code}))))}export{C as default};
