1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8131],{1331:function(e,n,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/store-hours",function(){return i(1819)}])},8990:function(e,n,i){"use strict";var s=i(5893);i(7294);var t=i(5815),a=i.n(t),r=i(1664),l=i.n(r);n.Z=function(e){let{children:n}=e;return(0,s.jsxs)("div",{className:"".concat(a().pageContainer," container"),children:[(0,s.jsxs)("div",{className:a().sidebar,children:[(0,s.jsx)("h2",{children:"Pannello Amministratore"}),(0,s.jsxs)("ul",{children:[(0,s.jsx)("li",{children:(0,s.jsx)(l(),{href:"/admin/sales-prices",children:"Pannello Sconti"})}),(0,s.jsx)("li",{children:(0,s.jsx)(l(),{href:"/admin/backorder",children:"Riassortimenti"})}),(0,s.jsx)("li",{children:(0,s.jsx)(l(),{href:"/admin/store-hours",children:"Orari Speciali"})})]})]}),(0,s.jsx)("div",{className:a().mainContent,children:n})]})}},4740:function(e,n,i){"use strict";var s=i(5893);i(7294);var t=i(4710),a=i.n(t);let r=()=>(0,s.jsxs)("div",{className:a().loading,children:[(0,s.jsx)("span",{className:a().dots}),(0,s.jsx)("span",{className:a().dots}),(0,s.jsx)("span",{className:a().dots})]});n.Z=r},2643:function(e,n,i){"use strict";i.d(n,{Hq:function(){return o},Rx:function(){return _},t9:function(){return d},oC:function(){return r},oV:function(){return p},MD:function(){return m},zt:function(){return u},gG:function(){return t},Zu:function(){return l},lk:function(){return h},VN:function(){return c},J$:function(){return a}});var s=i(6763);let t=async(e,n)=>{let i=await s.Fq.post("",{operationName:"productsForExcel",query:"\nquery productsForExcel (\n $categoryIds: [Int!]\n $cursor: String\n $limit: Int!\n){ \n site{\n search{\n searchProducts(filters: { categoryEntityIds: $categoryIds }){\n products(first: $limit after:$cursor){\n pageInfo{\n endCursor\n startCursor\n hasPreviousPage\n hasNextPage\n }\n edges{\n cursor\n node{\n entityId \n sku\n name\n prices(includeTax: true){\n price{value}\n salePrice{value}\n basePrice{value}\n priceRange{min{value} max{value}}\n }\n availabilityV2{\n status\n }\n categories{\n edges{\n node{\n entityId\n name \n }\n }\n }\n }\n }\n }\n }\n }\n } \n}",variables:{limit:50,categoryIds:e,cursor:n}});return i.data},a=async(e,n)=>s.q8.post("admin/set-sale-prices",{product:e,password:n}),r=async e=>s.q8.get("admin/products",{params:e}),l=async()=>s.q8.get("admin/special-hours"),o=async e=>s.q8.post("admin/special-hours",e),d=async(e,n)=>s.q8.delete("admin/special-hours",{data:{store_id:e,name:n}}),c=async e=>s.q8.post("admin/sale-campaigns",e),_=async e=>s.q8.delete("admin/sale-campaigns",{data:{categoryPathPrefix:e}}),u=async e=>s.q8.get("admin/category-promo-flag",{params:{categoryId:e}}),h=async(e,n)=>s.q8.post("admin/category-promo-flag",{categoryId:e,excluded:n}),m=async()=>s.q8.get("admin/backorder/managed"),p=async e=>s.q8.get("admin/backorder/candidates",{params:e})},1819:function(e,n,i){"use strict";i.r(n),i.d(n,{__N_SSP:function(){return x},default:function(){return g}});var s=i(5893),t=i(7294),a=i(4740),r=i(8990),l=i(9065),o=i.n(l),d=i(3148),c=i(771),_=i.n(c),u=i(2643);let h=e=>{let{formData:n,setFormData:i,getSpecialHours:a,setFormIsVisible:r}=e,[l,o]=(0,t.useState)(""),d=e=>{if(e.preventDefault(),!n.name||!n.date){o("Per favore, compila tutti i campi obbligatori.");return}if(!n.allDay&&(!n.opening||!n.closing)){o("Per favore, compila gli orari di apertura e chiusura.");return}o(""),(0,u.Hq)(n).then(e=>{a(),i({store_id:n.store_id,name:"",date:"",closed:!1,allDay:!1,opening:"",closing:""}),r(!1)}).catch(e=>{var n;(null===(n=e.response)||void 0===n?void 0:n.status)===409?o("Il nome dell'orario speciale esiste gi\xe0. Usa un nome diverso."):(console.error("Errore nell'aggiunta dell'orario speciale:",e),o("Si \xe8 verificato un errore durante l'invio dei dati. Riprova pi\xf9 tardi."))})};return(0,s.jsxs)("div",{className:_().formContainer,children:[(0,s.jsxs)("div",{className:_().formField,children:[(0,s.jsxs)("label",{children:["Nome dell","'","orario speciale"]}),(0,s.jsx)("input",{type:"text",placeholder:"Nome dell'orario speciale",value:n.name,onChange:e=>i({...n,name:e.target.value}),className:_().inputField})]}),(0,s.jsxs)("div",{className:_().formField,children:[(0,s.jsx)("label",{children:"Data"}),(0,s.jsx)("input",{type:"date",value:n.date,onChange:e=>i({...n,date:e.target.value}),className:_().inputField})]}),(0,s.jsx)("div",{className:_().checkboxField,children:(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"checkbox",checked:n.closed,onChange:e=>i({...n,closed:e.target.checked})}),"Chiuso"]})}),(0,s.jsx)("div",{className:_().checkboxField,children:(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"checkbox",checked:n.allDay,onChange:e=>i({...n,allDay:e.target.checked,opening:"",closing:""})}),"Tutto il giorno?"]})}),(0,s.jsxs)("div",{className:_().timeFields,children:[(0,s.jsxs)("div",{className:_().formField,children:[(0,s.jsx)("label",{children:"Inizio"}),(0,s.jsx)("input",{type:"time",value:n.opening,disabled:n.allDay,onChange:e=>i({...n,opening:e.target.value}),className:_().inputField})]}),(0,s.jsxs)("div",{className:_().formField,children:[(0,s.jsx)("label",{children:"Fine"}),(0,s.jsx)("input",{type:"time",value:n.closing,disabled:n.allDay,onChange:e=>i({...n,closing:e.target.value}),className:_().inputField})]})]}),(0,s.jsx)("button",{type:"submit",className:_().submitButton,onClick:d,children:"Aggiungi"}),l&&(0,s.jsx)("p",{className:_().errorMessage,children:l})]})};var m=function(e){let{store:n}=e,[i,a]=(0,t.useState)(!1),[r,l]=(0,t.useState)([]),[o,d]=(0,t.useState)({store_id:n.id,name:"",date:"",closed:!1,allDay:!1,opening:"",closing:""}),c=async()=>{(0,u.Zu)().then(e=>{let i=e.data.filter(e=>e.store_id===n.id);l(i)}).catch(e=>{console.error("Errore nel recupero degli orari speciali:",e)})};(0,t.useEffect)(()=>{n&&c()},[n]);let m=(e,n)=>{(0,u.t9)(e,n).then(()=>{c()}).catch(e=>{console.error("Errore nell'eliminazione dell'orario speciale:",e)})},p={},x=[];
1Object.keys(n.operating_hours).forEach(e=>{x.push({day:e,...n.operating_hours[e]})}),x.forEach(e=>{p[e.day]={open:e.open,allDay:!0,firstTurn:"".concat(e.opening," - ").concat(e.closing)}});let g=n.special_hours;return g.length>0&&g.forEach(e=>{let n=e.label;try{p[n].allDay=!1,p[n].secondTurn="".concat(e.opening," - ").concat(e.closing)}catch(e){return}}),(0,s.jsxs)("div",{className:_().editStoreContainer,children:[(0,s.jsxs)("h3",{children:[n.address.city," - ",n.address.address1]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("label",{children:"Indirizzo Completo:"})," ",(0,s.jsx)("br",{}),(0,s.jsxs)("b",{children:[n.address.address1,","," ",n.address.city," ",n.address.state?", ":null,n.address.state]})]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("label",{children:"Tipologia:"}),(0,s.jsx)("br",{}),(0,s.jsx)("b",{children:n.label})]}),(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Giorno"}),(0,s.jsx)("th",{children:"Orario"}),(0,s.jsx)("th",{children:"Orario Staccato"}),(0,s.jsx)("th",{children:"Aperto?"}),(0,s.jsx)("th",{children:"Continuato?"})]})}),(0,s.jsx)("tbody",{children:p?["monday","tuesday","wednesday","thursday","friday","saturday","sunday"].map(e=>{var n,i,t,a;return p[e]?(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:_().bold_value,children:"monday"===e?"Luned\xec":"tuesday"===e?"Marted\xec":"wednesday"===e?"Mercoled\xec":"thursday"===e?"Gioved\xec":"friday"===e?"Venerd\xec":"saturday"===e?"Sabato":"sunday"===e?"Domenica":null}),(0,s.jsx)("td",{className:_().bold_value,children:null===(n=p[e])||void 0===n?void 0:n.firstTurn}),(0,s.jsx)("td",{className:_().bold_value,children:(null===(i=p[e])||void 0===i?void 0:i.secondTurn)||"-"}),(0,s.jsx)("td",{children:(null===(t=p[e])||void 0===t?void 0:t.open)?"S\xec":"No"}),(0,s.jsx)("td",{children:(null===(a=p[e])||void 0===a?void 0:a.allDay)?"S\xec":"No"})]},e):null}):null})]}),r.length>0?(0,s.jsxs)("div",{className:_().specialHoursContainer,children:[(0,s.jsx)("h3",{children:"Orari Speciali"}),(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Nome"}),(0,s.jsx)("th",{children:"Data"}),(0,s.jsx)("th",{children:"Chiuso?"}),(0,s.jsx)("th",{children:"Tutto il Giorno?"}),(0,s.jsx)("th",{children:"Inizio"}),(0,s.jsx)("th",{children:"Fine"}),(0,s.jsx)("th",{children:"Azioni"})]})}),(0,s.jsx)("tbody",{children:r.map((e,n)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:_().bold_value,children:e.name}),(0,s.jsx)("td",{className:_().bold_value,children:e.date?new Date(e.date).toLocaleDateString("it-IT"):"-"}),(0,s.jsx)("td",{children:e.closed?"SI":"NO"}),(0,s.jsx)("td",{children:e.allDay?"SI":"NO"}),(0,s.jsx)("td",{children:e.opening?e.opening:"-"}),(0,s.jsx)("td",{children:e.closing?e.closing:"-"}),(0,s.jsx)("td",{children:(0,s.jsx)("button",{className:_().deleteButton,onClick:()=>m(e.store_id,e.name),children:"Elimina"})})]},"".concat(e.name,"-").concat(n)))})]})]}):null,(0,s.jsx)("div",{className:_().addSpecialHours,children:(0,s.jsx)("button",{type:"button",className:_().addButton,onClick:()=>a(!i),children:i?"Nascondi il form":"Aggiungi un orario speciale"})}),i&&(0,s.jsx)(h,{formData:o,setFormData:d,getSpecialHours:c,setFormIsVisible:a})]})};let p=e=>{let{}=e,[n,i]=(0,t.useState)(!0),[l,c]=(0,t.useState)(""),[_,u]=(0,t.useState)([]),[h,p]=(0,t.useState)(null);(0,t.useEffect)(()=>{i(!0),(0,d.oX)().then(e=>{let n=e.filter(e=>"PHYSICAL"===e.type_id);u(n),i(!1)}).catch(e=>{console.error(e),c("c'\xe8 stato un errore nel caricamento dei punti vendita"),i(!1)})},[]);let x=e=>{let n=_.find(n=>n.id===Number(e));p(n||null)};return(0,s.jsxs)(r.Z,{children:[(0,s.jsx)("div",{className:o().title_page,children:(0,s.jsx)("h1",{children:"Orari Speciali Punti Vendita"})}),(0,s.jsx)("div",{className:o().select_store_section,children:(0,s.jsxs)("div",{className:o().select_store_section__tile_description,children:[(0,s.jsx)("h3",{children:"Seleziona uno store"}),(0,s.jsx)("p",{children:"Seleziona uno store nel menu a tendina per modificare gli orari speciali"}),n?(0,s.jsx)(a.Z,{}):null,l?(0,s.jsx)("p",{className:o().error_message,children:l}):null,(0,s.jsx)("div",{className:o().select_store,children:(0,s.jsxs)("select",{name:"seleziona store",id:"select-store",onCh
1ange:e=>x(e.target.value),children:[(0,s.jsx)("option",{value:"0",children:"seleziona uno store..."}),_.map(e=>(0,s.jsxs)("option",{value:e.id,children:[e.label," - ",e.address.city," - ",e.address.address1]},e.id))]})})]})}),h?(0,s.jsx)("div",{className:o().edit_store_section,children:(0,s.jsxs)("div",{className:o().select_store_section__tile_description,children:[(0,s.jsx)("h3",{children:"Modifica gli orari speciali"}),(0,s.jsx)(m,{store:h})]})}):null]})};var x=!0,g=p},771:function(e){e.exports={editStoreContainer:"EditStore_editStoreContainer__73kdd",bold_value:"EditStore_bold_value__sagxI",addSpecialHours:"EditStore_addSpecialHours__n_kJd",addButton:"EditStore_addButton__V33r_",deleteButton:"EditStore_deleteButton__7P7Pg",formContainer:"EditStore_formContainer__GtJkj",formField:"EditStore_formField__j5wt5",checkboxField:"EditStore_checkboxField__JmcYJ",timeFields:"EditStore_timeFields__2DE7j",errorMessage:"EditStore_errorMessage___1iry"}},5815:function(e){e.exports={pageContainer:"PageContainer_pageContainer__XRj4R",sidebar:"PageContainer_sidebar__lYUiQ",mainContent:"PageContainer_mainContent__iEbjT"}},4710:function(e){e.exports={loading:"DotsLoader_loading__MLj_N",dots:"DotsLoader_dots__jmq59"}},9065:function(e){e.exports={title_page:"Admin_title_page__Mucz0",download_excel_section:"Admin_download_excel_section__cGIRZ",upload_excel_section:"Admin_upload_excel_section__8_JKK",select_store_section:"Admin_select_store_section__37Zma",edit_store_section:"Admin_edit_store_section__5ePpY",download_excel_section__tile_description:"Admin_download_excel_section__tile_description__9GyIY",select_category:"Admin_select_category__T1scw",download_excel_button:"Admin_download_excel_button__k9Tc6",include_disable_products:"Admin_include_disable_products__NWShb",upload_excel_section__tile_description:"Admin_upload_excel_section__tile_description__NknK7",upload_excel_input:"Admin_upload_excel_input__houbZ",table_products:"Admin_table_products__3sHjs",errors_container:"Admin_errors_container__TKf_L",warnings_container:"Admin_warnings_container__3ddIR",error_message:"Admin_error_message__FgUv4",warning_message:"Admin_warning_message__uB_C8",password_field:"Admin_password_field__eRYqY",submit_button:"Admin_submit_button__Q0Yx6",campaign_section:"Admin_campaign_section__tHEpZ",campaign_section__tile_description:"Admin_campaign_section__tile_description__w1CBy",campaign_note:"Admin_campaign_note__YJRJG",campaign_checkbox:"Admin_campaign_checkbox__aVr8z",campaign_fields:"Admin_campaign_fields__5eV5P",campaign_save_button:"Admin_campaign_save_button__dxzfY",select_store_section__tile_description:"Admin_select_store_section__tile_description__iOJGk",select_store:"Admin_select_store__RtSYY"}}},function(e){e.O(0,[9774,2888,179],function(){return e(e.s=1331)}),_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.