PageSourceSearch

https://club.touchtight.com/assets/BulkImportFixturesV2--8D368hu.js

js touchtight.com collected 2026-10-02 00:04:35 UTC 6,564 bytes, 1 lines download raw bytes

1import{a as c,j as gt}from"./react-vendor-DJtAp8P_.js";import{F as Mt,c as Ct,u as Tt,d as yt}from"./app-DT7WuczB.js";import{F as St}from"./mutation--iSLlBrt.js";import{a as ht,J as vt,L as At}from"./query-CcmDMjHA.js";import{aW as Dt,bQ as P,cM as V}from"./index-CyS3LFy6.js";import{f as wt}from"./fixtures-import-D2qsSBTS.js";import{B as It}from"./index-Dji-P8Wa.js";import{n as M,f as B,p as Lt,a as L,b as j,i as Ft,c as Rt}from"./bulkImportUtils-DTvpHAsI.js";import{n as Ot,e as I}from"./apollo-DL0KWP0Y.js";import"./mui-styles-C9F12l22.js";import"./babel-helpers-D2wBBc1I.js";import"./dayjs-CFxoC4n5.js";import"./check-njpSxvzl.js";import"./triangle-alert-BdPscC9S.js";import"./download-avhwAJjG.js";import"./file-spreadsheet-DIz94-rN.js";try{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="c205540d-c52a-4fc1-99d7-5e8843bf9095",t._sentryDebugIdIdentifier="sentry-dbid-c205540d-c52a-4fc1-99d7-5e8843bf9095")}catch{}const p="There is an error in your fixtures import, please make sure formats, formations, dates and any other information is correct before your import.",q="Team*",G="Opposition Team*",F="Format*",X="Formation*",J="Date*(MM/DD/YYYY)",Q="Venue",W="Surface",$="Match Duration (Mins)",z="Time (24hr HH:MM)",K="Location",kt=[{key:"team",label:q,required:!0,validate:(t,o,{teams:r})=>r.some(({name:s})=>M(s.toLowerCase().trim())===M(String(t).toLowerCase().trim())),errorMsg:"Column A (Team*) contains invalid values, please update this column in the file."},{key:"opposition",label:G,required:!0,validate:t=>!!String(t??"").trim(),errorMsg:"Column B (Opposition Team*) is required, but has missing values. Please update your file."},{key:"format",label:F,required:!0,validate:(t,o,{formats:r})=>{const s=String(t??"").trim();return s?r.some(({formate_type:l})=>l.toLowerCase().trim()===s.toLowerCase()):!1},errorMsg:"Column C (Format*) contains invalid values, please update this column in the file."},{key:"formation",label:X,required:!0,validate:(t,o,{formats:r,formations:s})=>{const l=String(o[F]??"").trim(),i=r.find(({formate_type:C})=>C.toLowerCase().trim()===l.toLowerCase());if(!i)return!0;const n=t;return n==null||String(n).trim()===""?!1:!!B(n,i.id,s)},errorMsg:"Column D (Formation*) does not match the selected Format*, please update your file."},{key:"date",label:J,required:!0,validate:(t,o,{seasonStart:r,seasonEnd:s})=>Rt(t,r,s)===null,explain:(t,{seasonStart:o,seasonEnd:r})=>Ft(t,o,r),errorMsg:"Column E (Date*) must be a valid date (e.g. MM/DD/YYYY, or a date-formatted Excel cell)."},{key:"venue",label:Q,validate:t=>{const o=String(t??"").trim();return o?V.some(({name:r})=>r.toLowerCase().trim()===o.toLowerCase()):!0},errorMsg:"Column F (Venue) must be Home or Away."},{key:"surface",label:W,validate:t=>{const o=String(t??"").trim();return o?P.some(({name:r})=>r.toLowerCase().trim()===o.toLowerCase()):!0},errorMsg:"Column G (Surface) contains invalid values."},{key:"duration",label:$,validate:t=>t==null||String(t).trim()===""?!0:j(t)!==null,errorMsg:"Column H (Match Duration (Mins)) must be a number from 1 to 200."},{key:"time",label:z,validate:t=>L(t).ok,errorMsg:"Column I (Time (24hr HH:MM)) must be a 24-hour time like 17:30 (HH:MM).",format:t=>{const{parts:o}=L(t);return o?`${String(o.h).padStart(2,"0")}:${String(o.m).padStart(2,"0")}`:""}},{key:"location",label:K,validate:()=>
1!0,errorMsg:"Column J (Location) is invalid."}],zt=({open:t,handleCloseModal:o,refetchFixtureList:r,fixturePermissions:s})=>{const[l]=Mt(),i=Ct(),n=Tt(a=>a.club),C=yt(),{currentSeason:e,isAllSeasonSelected:E,isArchived:R}=C,[Z]=Ot(St),[T,tt]=c.useState([]),[y,et]=c.useState([]),[S,ot]=c.useState([]),{data:d}=I(ht,{variables:{club_id:i!=null&&i.club_id?i==null?void 0:i.club_id:0,...E?{}:{season_id:e==null?void 0:e.id}},fetchPolicy:"no-cache",skip:!t||!(e!=null&&e.id)}),{data:u}=I(vt,{skip:!t,fetchPolicy:"no-cache"}),{data:f}=I(At,{variables:{format_id:0},skip:!t,fetchPolicy:"no-cache"});c.useEffect(()=>{var a;(a=d==null?void 0:d.getClubTeamsLite)!=null&&a.success&&tt(d.getClubTeamsLite.data.map(({name:h,id:v})=>({id:v,name:h})))},[d]),c.useEffect(()=>{var a;(a=u==null?void 0:u.formatDetails)!=null&&a.data&&et(u.formatDetails.data)},[u]),c.useEffect(()=>{f!=null&&f.formationListing&&ot(f.formationListing)},[f]);const at=(s==null?void 0:s.add)===Dt.YES&&!E&&!R,rt=c.useMemo(()=>({teams:T,formats:y,formations:S,seasonStart:e==null?void 0:e.start_date,seasonEnd:e==null?void 0:e.end_date}),[T,y,S,e==null?void 0:e.start_date,e==null?void 0:e.end_date]),it=async()=>{await(r==null?void 0:r()),o()};return gt.jsx(It,{open:t,onClose:o,entity:"FIXTURES",title:"Import Fixtures",templateUrl:wt,columns:kt,lookups:rt,canImport:at,canImportReason:!(e!=null&&e.id)||E?"Please select an active season to import fixtures.":R?"This season is archived, so imports are disabled.":void 0,submit:{mode:"row",errorMessage:p,run:async a=>{var x,Y;if(!(e!=null&&e.id)||E)throw new Error(p);const h=a[q],v=a[G],st=a[F],nt=a[X],mt=a[J],O=a[Q],k=a[W],_=a[$],ct=a[z],lt=a[K],H=T.find(({name:m})=>M(m.toLowerCase().trim())===M(String(h).toLowerCase().trim())),b=y.find(({formate_type:m})=>m.toLowerCase().trim()===String(st||"").toLowerCase().trim()),U=b?B(nt,b.id,S):null;if(!H||!b||!U)throw new Error(p);const A=Lt(mt);if(!A||!A.isValid())throw new Error(p);const g=L(ct).parts,dt=g?g.h:10,ut=g?g.m:0,ft=A.hour(dt).minute(ut).second(0).millisecond(0).valueOf(),pt=String(k??"").trim()===""?"":((x=P.find(({name:m})=>m.toLowerCase().trim()===String(k??"").toLowerCase().trim()))==null?void 0:x.name)||"",Et=_==null||String(_).trim()===""?0:j(_)??0,D=String(O??"").trim()===""?void 0:V.find(({name:m})=>m.toLowerCase().trim()===String(O??"").toLowerCase().trim()),N=(D==null?void 0:D.id)||"",_t=n!=null&&n.club_created_by?[n.club_created_by]:[],w=await Z({variables:{id:0,team_ids:[H.id],fixture_created_by:i!=null&&i.id?i.id:0,club_id:i!=null&&i.club_id?i.club_id:0,season_id:e.id,homeAway:N,venue:N,surface:pt,competition:"",isUpdated:!1,opposition:String(v).trim(),fixture_date_time:ft,location:String(lt??"").trim(),Format_id:b.id,Formation_id:U.id,coach_ids:_t,matchDuration:Et}}),{success:bt}=((Y=w==null?void 0:w.data)==null?void 0:Y.createFixture)||{};if(!bt)throw new Error(p)}},onSuccess:()=>void it(),onSuccessToast:a=>l({msg:a,variant:"success"}),onErrorToast:a=>l({msg:a,variant:"error"}),successMessage:"Fixtures imported successfully."})};export{zt as BulkImportFixturesV2};

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.