1"use strict";(self.webpackChunkgloss=self.webpackChunkgloss||[]).push([[4354],{94354(e,i,t){t.d(i,{FPAJobEdit:()=>D});var l=t(89379),o=t(10467),n=t(5544),d=t(77265),a=t(34546),s=t(65030),r=t(27565),u=t(26248),v=t(84702),c=t(30462),h=t(22529),m=t(83361),p=t(23627),g=t(70161),y=t(25758),f=t(26709),b=t(21093),x=t(59531),j=t(40217),A=t(286),T=t(42746),C=t(62890),E=t(55334),w=t(27929),F=e=>{var i;if((0,v.isEmpty)(e))return(0,h.gH)(new Date,[]);var t=new Date(null===e||void 0===e?void 0:e.startDate),l=new Date(null===e||void 0===e?void 0:e.endDate);return{name:null===e||void 0===e?void 0:e.name,brand:null===e||void 0===e?void 0:e.brand,kind:null===e||void 0===e?void 0:e.kind,location:null===e||void 0===e?void 0:e.location,description:null===e||void 0===e?void 0:e.description,startDate:t,startDay:t.getDate(),startMonth:t.getMonth()+1,startYear:t.getFullYear(),endDate:l,endDay:l.getDate(),endMonth:l.getMonth()+1,endYear:l.getFullYear(),spansMultipleDays:null===e||void 0===e?void 0:e.spansMultipleDays,virtual:null===e||void 0===e?void 0:e.virtual,talentIds:(null===e||void 0===e||null===(i=e.talent)||void 0===i?void 0:i.map(e=>null===e||void 0===e?void 0:e.id))||[],usage:(null===e||void 0===e?void 0:e.usage)||"",usages:(null===e||void 0===e?void 0:e.usages)||[],headcountEstimate:null===e||void 0===e?void 0:e.headcountEstimate,allTravelFeesCovered:null===e||void 0===e?void 0:e.allTravelFeesCovered,travelExpenseCover:null===e||void 0===e?void 0:e.travelExpenseCover,nudityType:null===e||void 0===e?void 0:e.nudityType,additionalNotes:null===e||void 0===e?void 0:e.additionalNotes,jobVerticals:null===e||void 0===e?void 0:e.jobVerticals,existingDeckFiles:null===e||void 0===e?void 0:e.deckFiles,selfTapeRequired:null===e||void 0===e?void 0:e.selfTapeRequired,cateringProvided:null===e||void 0===e?void 0:e.cateringProvided,invoiceBillingName:null===e||void 0===e?void 0:e.invoiceBillingName,invoiceBillingAddress:null===e||void 0===e?void 0:e.invoiceBillingAddress,excludeVat:null===e||void 0===e?void 0:e.excludeVat}},D=()=>{var e,i=(0,s.W6)(),t=(0,p.wm)("jobs").draftV2,v=(0,s.g)().slug,D=(0,a.I)(m.z3,{variables:{jobId:v||""},fetchPolicy:"network-only",nextFetchPolicy:"cache-first"}),k=D.loading,S=D.error,I=D.data,M=(0,d.n)(T.F$),N=(0,n.A)(M,2),q=N[0],V=N[1],B=V.loading,R=V.error,_=(0,d.n)(T.M4),Y=(0,n.A)(_,2),z=Y[0],L=Y[1].loading,P=(0,d.n)(T.yC),$=(0,n.A)(P,2),H=$[0],J=$[1].loading,U=(0,r.useState)(!1),O=(0,n.A)(U,2),W=O[0],X=O[1],K=(0,r.useState)(!1),G=(0,n.A)(K,2),Q=G[0],Z=G[1],ee=(0,r.useState)([]),ie=(0,n.A)(ee,2),te=ie[0],le=ie[1],oe=(0,r.useState)([]),ne=(0,n.A)(oe,2),de=ne[0],ae=ne[1],se=(0,r.useState)(!1),re=(0,n.A)(se,2),ue=re[0],ve=re[1],ce=(0,r.useState)(null),he=(0,n.A)(ce,2),me=he[0],pe=he[1],ge=t.setTalentUsers,ye=t.customisedTimeslots,fe=null===I||void 0===I?void 0:I.job;(0,p.rI)({title:"Edit ".concat((null===fe||void 0===fe?void 0:fe.name)||"Job")});var be=(0,r.useState)(),xe=(0,n.A)(be,2),je=xe[0],Ae=xe[1],Te=null!==je&&void 0!==je?je:fe&&(0,x.jf)(fe)?"flex":"none",Ce=(0,r.useState)(),Ee=(0,n.A)(Ce,2),we=Ee[0],Fe=Ee[1],De=null!==we&&void 0!==we?we:!fe||(0,x.BE)(fe),ke=(0,r.useState)(),Se=(0,n.A)(ke,2),Ie=Se[0],Me=Se[1],Ne=null!==Ie&&void 0!==Ie?Ie:null!==fe&&void 0!==fe&&fe.nudityType?"flex":"none",qe=(0,p.NK)().configurations,Ve=(0,j.o)(qe||[],f.XX.FashionModel),Be=(null===Ve||void 0===Ve?void 0:Ve.jobCreationSchema.detailsFormFields)||[],Re=(0,r.useState)(ye),_e=(0,n.A)(Re,2),Ye=_e[0],ze=_e[1],Le=e=>{if(null===Ye||void 0===Ye||!Ye.includes(e)){var i=[];i.push(e),null===Ye||void 0===Ye||Ye.map(e=>i.push(e)),ze(i)}},Pe=null===fe||void 0===fe||null===(e=fe.talent)||void 0===e?void 0:e.filter(e=>!t.talentUsers.some(i=>i.id===e.talent.id)).map(e=>e.talent.id),$e=function(){var e=(0,o.A)(function*(e){if(fe&&!J){pe(null);try{yield H({variables:{jobId:fe.id,deckFileId:e.id}}),ae(i=>[...i,e.id]),ve(!0)}catch(S){pe("We couldn't delete that attachment. Try again.")}}});return function(i){return e.apply(this,arguments)}}();return(0,r.useEffect)(()=>{if(fe){var e;Z(!0);var i=null===fe||void 0===fe||null===(e=fe.talent)||void 0===e?void 0:e.map(e=>null===e||void 0===e?void 0:e.talent);i&&ge(i)}return()=>{ge([])}},[fe]),(0,r.useEffect)(()=>
1{if(ue){var e=window.setTimeout(()=>{ve(!1)},3e3);return()=>{window.clearTimeout(e)}}},[ue]),k?(0,w.jsx)(E.az,{css:{py:"$12"},children:(0,w.jsx)(g.Rh,{css:{minHeight:"60vh"}})}):fe?S?(0,w.jsxs)(E.az,{css:{py:"$12"},children:[(0,w.jsx)(A.EY,{variant:"h4",children:"Oops, something went wrong"}),";"]}):(0,w.jsx)(u.l1,{initialValues:F(fe),validateOnChange:!0,validate:function(){var e=(0,o.A)(function*(e){return(0,l.A)((0,l.A)({},yield(0,b.l)(e,{shouldStartAfterToday:!0,travelExpenseRequired:"flex"===Te&&De,nudityTypeRequired:"flex"===Ne,revampFieldsActivated:!0})),yield(0,b.rn)(e))});return function(i){return e.apply(this,arguments)}}(),onSubmit:function(){var e=(0,o.A)(function*(e){var t;yield q({variables:(0,l.A)((0,l.A)((0,l.A)((0,l.A)({jobId:fe.id,removeTalentIds:Pe},e),e.usages&&{usages:e.usages.map(e=>(0,c.q)(e))}),{},{nudityType:"flex"===Ne?e.nudityType:null},(0,x.a9)(Te,De,e.travelExpenseCover)),{},{deckFiles:te.map(e=>(delete e.mediaUrl,e))})}),yield z({variables:{jobId:fe.id,jobVerticals:null===e||void 0===e||null===(t=e.jobVerticals)||void 0===t?void 0:t.map(e=>{var i=e.vertical,t=e.budget,l=e.jobLength,o=e.talentRequired,n=e.deliverables,d=e.timeslots;return{vertical:i,budget:t,jobLength:String(l),talentRequired:o,deliverables:n,timeslots:null===d||void 0===d?void 0:d.map(e=>({from:e.from,to:e.to}))}})}}),i.push("/dashboard/agent/jobs/".concat(fe.slug))});return function(i){return e.apply(this,arguments)}}(),children:e=>(0,w.jsxs)(w.Fragment,{children:[ue&&(0,w.jsx)(g.M_,{showClose:!0,onClose:()=>ve(!1),children:(0,w.jsx)(A.EY,{children:"Attachment deleted"})}),me&&(0,w.jsx)(g.M_,{showClose:!0,onClose:()=>pe(null),children:(0,w.jsx)(C.z2,{variant:"error",title:"Couldn't delete attachment",body:me,css:{m:"$0"}})}),R&&(0,w.jsx)(g.M_,{showClose:!0,onClose:()=>X(!1),children:(0,w.jsx)(C.z2,{variant:"error",title:R.name,body:R.message,css:{m:"$0"}})}),(0,w.jsx)(h.IE,{isEdit:!0,isLoading:B||L,formik:e,showError:W,setShowError:X,mounted:Q,fields:Be,setCustomisedTimeslotsList:ze,markJobTimesAsCustom:Le,travelExpenseCovered:Te,setTravelExpenseCovered:Ae,hasMaxTravelBudget:De,setHasMaxTravelBudget:Fe,setShowNudityTypeInput:Me,showNudityTypeInput:Ne,customTimeslotsList:Ye,setNewDeckFiles:le,onDeleteExistingDeckFile:$e,deletedDeckFileIds:de,backCta:{text:"All jobs",goto:"/dashboard/agent/jobs"}})]})}):(0,w.jsx)(y.NotFoundError,{})}},30462(e,i,t){t.d(i,{q:()=>n});var l=t(80045),o=["__typename"];function n(e){if(e&&"object"===typeof e){var i=e;i.__typename;return(0,l.A)(i,o)}return e}}}]); 2//# sourceMappingURL=4354.23e6f7cf.chunk.js.map
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.