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AA,EAEKC,EAGNT,CAAA,CAAAU,EAAA,CAAAhZ,IAAA,EAG2B8Y,EACnBR,CAAA,CAAAU,EAAA,CAAAhZ,IAAA,CACb+Y,EAAA,OAAAG,CAAAA,EAAAZ,CAAA,CAAAU,EAAA,CAAA7F,IAAA,GAAA+F,KAAA,IAAAA,EAAAA,EAAA,GA9B2B,CAgCpB,MACF,CACH,GAAC3P,CAAK,CAAE,CAAA4J,EACN,EACAqF,QAAM,GACNhK,KAAM6J,EACNI,KAAA,GACAC,QAAO,GACTC,MAAAN,GAAAD,EAAAC,EACF,CACE,CACJ,MAEoE3F,EAElD,CAAA1L,EAAA7J,IAAA,CADlB,IAAIkC,EACJ,IAAA2H,EAAMnG,SAAY,QAAAmG,CAAQ,CAA2C,IACnEnG,EAAK,IAAiB,GAAPxB,CAAAA,EAAA2H,EAAOnG,SAAA,GAAAxB,KAAA,IAAAA,EAAA,OAAAA,EAAAyB,KAAA,CAAAwI,MAAA,EAAAC,EAAAlC,IAAA,CACtB,IAAAA,EAAM,OAAgBkC,CAAA,CACrB,IAAY6P,EAAKtG,EAAAzL,EAAAlK,GAEjB,OAFiBoM,EAAEzO,IAAG,EAAU,GAAGuM,CAAA,CAAc,GAAA+R,CAAA,GAE9C7P,CACN,MAEA,OADAvC,EAAOnG,SAAA,CAAAC,KAAA,CAAAD,EACPmG,CAAA,CC3KwB","sources":["webpack://_N_E/./src/contexts/gantt.tsx","webpack://_N_E/./src/utils/groupReport/render/xlsx.ts","webpack://_N_E/./src/utils/groupReport/data/xlsx/project.ts","webpack://_N_E/./src/utils/groupReport/data/xlsx/product.ts","webpack://_N_E/./src/utils/groupReport/data/xlsx/invoice.ts","webpack://_N_E/./src/utils/groupReport/data/xlsx/index.ts","webpack://_N_E/./src/utils/groupReport/data/index.ts","webpack://_N_E/./src/utils/groupReport/index.ts","webpack://_N_E/./src/contexts/groupReports.tsx","webpack://_N_E/./src/hooks/query.ts","webpack://_N_E/./src/utils/gantt/dates.ts","webpack://_N_E/./src/utils/gantt/case.ts","webpack://_N_E/./src/utils/gantt/m3.ts","webpack://_N_E/./src/utils/gantt/focus.ts","webpack://_N_E/./src/utils/gantt/shift.ts","webpack://_N_E/./src/utils/gantt/sort.ts","webpack://_N_E/./src/utils/gantt/update.ts","webpack://_N_E/./src/utils/gantt/project.ts","webpack://_N_E/./src/utils/gantt/index.ts","webpack://_N_E/"],"sourcesContent":["import { ReactNode, createContext, useContext, useState } from \"react\";\nimport moment from \"moment\";\nimport { DateRange } from \"mui-daterange-picker\";\nimport { parseCookies, setCookie } from \"nookies\";\nimport { useQuery as useTanstackQuery } from \"@tanstack/react-query\";\nimport { API } from \"aws-amplify\";\n\nimport { useAuth } from \"./auth\";\nimport { useAlerts } from \"./alerts\";\n\nimport { projectsByGroupIdForManager } from \"graphql/queries\";\nimport { Project, Schedule } from \"API\";\nimport {\n enumerateDaysBetweenDates,\n getCaseSchedule,\n getM3Schedule,\n getFocusedDateRange,\n sortProjects,\n} from \"utils/gantt\";\nimport type {\n CaseSchedule,\n M3Schedule,\n ProjectDateSortName,\n VisibleKeyDates,\n} from \"utils/gantt/types\";\nimport { ganttifyProject } from \"utils/gantt\";\nimport useQuery from \"hooks/query\";\nimport { Status, getStatusText } from \"utils/status\";\nimport { defaultCookieOptions, parseCookieBooleanValue } from \"utils/cookie\";\nimport { getStatusIndex } from \"utils/status\";\nimport { CustomError } from \"utils/error\";\n\ninterface GanttContextValue {\n projects: Project[];\n refetchProjects: () => Promise;\n dateRange: DateRange;\n setDateRange: (range: DateRange) => void;\n //PAX-607 +7daysと+30daysを判別するためにdateLabelを追加\n dateLabel: string | null;\n setDateLabel: (k: string | null) => void;\n dates: string[];\n loading: boolean;\n focus: (schedule: Schedule) => void;\n m3: M3Schedule;\n cs: CaseSchedule;\n sort: ProjectDateSortName;\n setSort: (sort: ProjectDateSortName) => void;\n m3Visible: boolean;\n setM3Visible: (visible: boolean) => void;\n caseVisible: boolean;\n setCaseVisible: (visible: boolean) => void;\n visibleKeyDates: VisibleKeyDates;\n setVisibleKeyDates: (visibleKeyDates: VisibleKeyDates) => void;\n status: string[];\n setStatus: (status: string[]) => void;\n keyword: string | null;\n setKeyword: (k: string | null) => void;\n column: string[];\n setColumn: (column: string[]) => void;\n isFilterSaved: boolean;\n setIsFilterSaved: (visible: boolean) => void;\n}\n\nconst GanttContext = createContext({\n projects: [],\n refetchProjects: () => Promise.resolve(),\n dateRange: {\n startDate: moment().startOf(\"week\").toDate(),\n endDate: moment().endOf(\"week\").toDate(),\n },\n setDateRange: () => {},\n dateLabel: null,\n setDateLabel: () => null,\n dates: enumerateDaysBetweenDates(\n moment().startOf(\"week\"),\n moment().endOf(\"week\")\n ),\n focus: () => null,\n m3: {},\n cs: {},\n sort: \"sortByName\",\n setSort: () => {},\n m3Visible: true,\n setM3Visible: () => null,\n caseVisible: true,\n setCaseVisible: () => null,\n visibleKeyDates: {\n beforeStockingDate: true,\n stockingDate: true,\n beforePackagingDate: true,\n packagingDate: true,\n beforeShippingDate: true,\n shippingDate: true,\n beforeCutDate: true,\n cutDate: true,\n afterCutDate: true,\n },\n setVisibleKeyDates: () => null,\n status: [],\n setStatus: () => null,\n keyword: null,\n setKeyword: () => null,\n column: [],\n setColumn: () => null,\n isFilterSaved: false,\n setIsFilterSaved: () => null,\n loading: false,\n});\n\nconst filterProjectByKeyword = (\n data: Project[],\n keyword: string | null,\n statusFilter: Status[]\n) => {\n let projects = data;\n if (keyword)\n projects = projects.filter(\n (d: Project) =>\n d.name.includes(keyword) ||\n d.user?.firstName.includes(keyword) ||\n d.user?.lastName.includes(keyword) ||\n d.managerName?.includes(keyword) ||\n d.quoterName?.includes(keyword) ||\n d.operatorName?.includes(keyword) ||\n d.accountName?.includes(keyword) ||\n d.contactName?.includes(keyword) ||\n d.reference?.includes(keyword) ||\n d.category?.name.includes(keyword) ||\n getStatusText(d.status).includes(keyword) ||\n d.schedules?.items?.some(\n (s) =>\n s?.beforeStockingName?.includes(keyword) ||\n s?.beforePackagingName?.includes(keyword) ||\n s?.beforeShippingName?.includes(keyword) ||\n s?.beforeCutName?.includes(keyword) ||\n s?.afterCutName?.includes(keyword)\n )\n );\n if (statusFilter.length > 0) {\n projects = projects.filter((d: Project) => statusFilter.includes(d.status));\n }\n\n return projects;\n};\n\nexport const GanttProvider = ({ children }: { children: ReactNode }) => {\n const cookies = parseCookies();\n const isFilterApplied = parseCookieBooleanValue(cookies.isFilterSaved);\n\n const { currentGroup } = useAuth();\n const [keyword, setKeyword] = useState(\n isFilterApplied && cookies.ganttKeyword ? cookies.ganttKeyword : null\n );\n const [m3Visible, setM3Visible] = useQuery(\"m3\", true);\n const [caseVisible, setCaseVisible] = useQuery(\"case\", true);\n const [beforeStock, setBeforeStock] = useQuery(\"beforeStock\", true);\n const [stock, setStock] = useQuery(\"stock\", true);\n const [beforePack, setBeforePack] = useQuery(\"beforePack\", true);\n const [pack, setPack] = useQuery(\"pack\", true);\n const [beforeShip, setBeforeShip] = useQuery(\"beforeShip\", true);\n const [ship, setShip] = useQuery(\"ship\", true);\n const [beforeCut, setBeforeCut] = useQuery(\"beforeCut\", true);\n const [cut, setCut] = useQuery(\"cut\", true);\n const [afterCut, setAfterCut] = useQuery(\"afterCut\", true);\n const [status, setStatus] = useQuery(\n \"status\",\n isFilterApplied && cookies.ganttStatus\n ? cookies.ganttStatus?.split(\",\")\n : [\"ORDER\", \"STOCK\", \"PACK\", \"SHIP\"],\n (value) => value.split(\"_\"),\n (value) => value.join(\"_\")\n );\n const { addAlert } = useAlerts();\n\n // PAX-607 dateLabelをcookieから取得\n const [dateLabel, setDateLabel] = useState(\n isFilterApplied && cookies.ganttDateLabel ? cookies.ganttDateLabel : null\n );\n // PAX-360 ピンが設定されてかつcookieにDate情報があればcookie内の日付に設定\\\n // PAX-607 useQueryからuseStateに変更\n const [startDate, setStartDate] = useState(\n isFilterApplied && cookies.ganttStartDate\n ? moment(cookies.ganttStartDate).toDate()\n : moment().toDate()\n );\n\n const [endDate, setEndDate] = useState(\n isFilterApplied && cookies.ganttEndDate\n ? moment(cookies.ganttEndDate).toDate()\n : moment().add(7, \"day\").toDate()\n );\n\n const dateRange = { startDate, endDate };\n const dates = enumerateDaysBetweenDates(moment(startDate), moment(endDate));\n\n const visibleKeyDates = {\n beforeStockingDate: beforeStock,\n stockingDate: stock,\n beforePackagingDate: beforePack,\n packagingDate: pack,\n beforeShippingDate: beforeShip,\n shippingDate: ship,\n beforeCutDate: beforeCut,\n cutDate: cut,\n afterCutDate: afterCut,\n };\n\n const {\n data: filteredProjects = [],\n isLoading: loading,\n refetch,\n } = useTanstackQuery({\n queryKey: [\n \"projectsByGroupIdForManager\",\n currentGroup?.id,\n status,\n dates,\n visibleKeyDates,\n ],\n queryFn: async () => {\n let nextToken: string | null = null;\n let allItems: Project[] = [];\n try {\n while (true) {\n const res: any = await API.graphql({\n query: projectsByGroupIdForManager,\n variables: {\n groupId: currentGroup?.id,\n status,\n dates,\n visibleKeyDates,\n filter: { archived: { ne: true } },\n sortDirection: \"DESC\",\n nextToken,\n },\n authMode: \"AMAZON_COGNITO_USER_POOLS\",\n });\n const items = res.data.projectsByGroupIdForManager.items;\n allItems = allItems.concat(items);\n nextToken = res.data.projectsByGroupIdForManager.nextToken;\n if (!nextToken) break;\n }\n return allItems.sort(\n (a, b) => getStatusIndex(a.status) - getStatusIndex(b.status)\n );\n } catch (err) {\n const customError = new CustomError(err, \"get\");\n addAlert({ message: customError.message, severity: \"error\" });\n }\n },\n staleTime: 1000 * 60 * 5,\n gcTime: 1000 * 60 * 6,\n });\n\n const [sort, setSort] = useQuery(\n \"sort\",\n isFilterApplied && cookies.ganttSort\n ? (cookies.ganttSort as ProjectDateSortName)\n : \"sortByPackage\"\n );\n const [column, setColumn] = useState(\n isFilterApplied && cookies.ganttColumn\n ? cookies.ganttColumn?.split(\",\")\n : [\n \"recentlyScheduleUpdated\",\n \"name\",\n \"reference\",\n \"accountName\",\n \"s.name\",\n ]\n );\n\n // PAX-360 Gantt検索条件はCookieに保存する、そのトグル\n const [isFilterSaved, setIsFilterSaved] = useState(isFilterApplied);\n\n if (isFilterSaved) {\n setCookie(null, \"ganttStatus\", status.join(\",\"), defaultCookieOptions);\n setCookie(\n null,\n \"ganttStartDate\",\n startDate.toString(),\n defaultCookieOptions\n );\n setCookie(null, \"ganttEndDate\", endDate.toString(), defaultCookieOptions);\n setCookie(null, \"ganttDateLabel\", dateLabel ?? \"\", defaultCookieOptions); // PAX-607 dateLabelも合わせてCookieに保存\n setCookie(null, \"ganttSort\", sort, defaultCookieOptions);\n setCookie(null, \"ganttColumn\", column.join(\",\"), defaultCookieOptions);\n setCookie(null, \"ganttKeyword\", keyword ?? \"\", defaultCookieOptions);\n }\n // PAX-360 Cookieには文字列しか格納できないため,文字列\"true\", \"false\"を利用\n setCookie(\n null,\n \"isFilterSaved\",\n isFilterSaved ? \"true\" : \"false\",\n defaultCookieOptions\n );\n\n // deep copy (projects.Schedulesの表示期間対応)\n const editProjects = structuredClone(filteredProjects);\n\n const m3 = getM3Schedule(editProjects);\n const cs = getCaseSchedule(editProjects);\n\n const keywordFilteredProjects = filterProjectByKeyword(\n editProjects,\n keyword,\n status\n );\n\n // projects[]以下にbeforeIdxというパラメータがあったらscheduleのドラッグ&ドロップで更新されたものとして仕分ける\n const dndProjects = keywordFilteredProjects.filter(\n (p: any) => p.beforeIdx !== undefined\n );\n const noDndProjects = keywordFilteredProjects.filter(\n (p: any) => p.beforeIdx === undefined\n );\n\n // ドラッグ&ドロップの対象になってないのはsortを行う\n const sortedNoDndProjects = sortProjects(noDndProjects, sort);\n // ドラッグ&ドロップ対象はbeforeIdxが小さい順に挿入していくので、まずはソート\n const sortedDndProjects = dndProjects.sort((a: any, b: any) => {\n return a.beforeIdx - b.beforeIdx;\n });\n // ドラッグ&ドロップ対象の中でbeforeIdxが小さい順に挿入していく\n sortedDndProjects.forEach((p: any) => {\n sortedNoDndProjects.splice(p.beforeIdx, 0, p);\n });\n\n const processProject = (project: Project) => {\n return {\n ...project,\n ...ganttifyProject(project, dates),\n };\n };\n\n const projects = sortedNoDndProjects.map(processProject);\n\n const focusSchedule = (schedule: Schedule) => {\n const { startDate, endDate } = getFocusedDateRange(\n schedule,\n dates,\n visibleKeyDates\n );\n setStartDate(startDate);\n setEndDate(endDate);\n };\n\n const setDateRange = ({ startDate, endDate }: DateRange) => {\n setStartDate(startDate || new Date());\n setEndDate(endDate || new Date());\n };\n\n const setProjectStatus = (status: string[]) => {\n setStatus(status);\n };\n\n const setVisibleKeyDates = (visibleKeyDates: VisibleKeyDates) => {\n setBeforeStock(visibleKeyDates.beforeStockingDate);\n setStock(visibleKeyDates.stockingDate);\n setBeforePack(visibleKeyDates.beforePackagingDate);\n setPack(visibleKeyDates.packagingDate);\n setBeforeShip(visibleKeyDates.beforeShippingDate);\n setShip(visibleKeyDates.shippingDate);\n setBeforeCut(visibleKeyDates.beforeCutDate);\n setCut(visibleKeyDates.cutDate);\n setAfterCut(visibleKeyDates.afterCutDate);\n };\n\n return (\n {\n refetch();\n },\n dateRange,\n setDateRange,\n dateLabel,\n setDateLabel,\n dates,\n focus: focusSchedule,\n sort,\n setSort,\n m3,\n cs,\n m3Visible,\n setM3Visible,\n caseVisible,\n setCaseVisible,\n visibleKeyDates,\n setVisibleKeyDates,\n status,\n setStatus: setProjectStatus,\n keyword,\n setKeyword,\n column,\n setColumn,\n isFilterSaved,\n setIsFilterSaved,\n }}\n >\n {children}\n \n );\n};\n\nexport const useGantt = () => {\n const accountsContext = useContext(GanttContext);\n\n if (accountsContext === undefined) {\n throw new Error(\"useGantt must be within AuthProvider\");\n }\n\n return accountsContext;\n};\n","import axios from \"axios\";\n\nimport { GroupReport } from \"API\";\n\nexport async function renderSpreadsheet(\n blob: Blob,\n data: any,\n report: GroupReport\n) {\n const body = new FormData();\n\n body.append(\"file\", blob);\n body.append(\"data\", JSON.stringify(data));\n body.append(\"report\", JSON.stringify(report));\n\n const res = await axios.post(\"/api/xlsx\", body);\n\n return res.data;\n}\n","import { Schedule, Project } from \"API\";\n\ntype StockData = {\n stockingDate: string;\n project: ProjectStockData[];\n};\ntype ProjectStockData = {\n id: string;\n reference: string;\n name: string;\n accountName: string;\n scheduleStockingDate: string;\n scheduleId: string;\n scheduleName: string;\n scheduleCase: string;\n};\n\ntype ShipData = {\n shippingDate: string;\n project: ProjectShipCutData[];\n};\n\ntype CutData = {\n cutDate: string;\n project: ProjectShipCutData[];\n};\n\ntype ProjectShipCutData = {\n id: string;\n reference: string;\n name: string;\n accountName: string;\n scheduleCutDate: string;\n scheduleShippingDate: string;\n scheduleId: string;\n scheduleName: string;\n scheduleShipType: string;\n scheduleCase: string;\n};\n\ntype PackData = {\n packagingDate: string;\n project: ProjectPackData[];\n};\n\ntype ProjectPackData = {\n id: string;\n reference: string;\n name: string;\n accountName: string;\n scheduleId: string;\n scheduleName: string;\n schedulePackagingDate: string;\n scheduleProductName: string;\n scheduleProductPackageTypeName: string;\n scheduleProductQuantity: string;\n};\n\n// 予定の出力のためにprojectデータを集計します\nexport function makeProjectsToPlanData(\n projects: Project[],\n dates: string[]\n): {\n stockData: StockData;\n shipData: ShipData;\n cutData: CutData;\n packData: PackData;\n} {\n // 集計時に結果を入れる変数\n const pickedStockProjects: ProjectStockData[] = [];\n const pickedShipProjects: ProjectShipCutData[] = [];\n const pickedCutProjects: ProjectShipCutData[] = [];\n const pickedPackProjects: ProjectPackData[] = [];\n\n // Date中心に集計する\n // dates(= 今回対象としている日付の範囲)でloopを回し\n // scheduleのstockingDate/shippingDate/cutDateがdatesの中にあったら結果に含める\n for (const d of dates) {\n for (const p of projects) {\n // projectのscheduleの中から、stockingDateが今回対象としている日付の範囲にあるものを抽出する\n const stockSchedules = p.schedules?.items.filter(\n (s) => s?.stockingDate === d\n ) as Schedule[];\n\n // stockingDateが今回対象としている日付の範囲にあるものがなかったら終了\n if (stockSchedules.length !== 0) {\n // 今回対象としている日付の範囲にあるものがあったら、結果に含める\n for (const s of stockSchedules) {\n const project = {\n id: p.id,\n reference: p.reference || \"-\",\n name: p.name || \"-\",\n accountName: p.accountName || \"-\",\n scheduleStockingDate: s.stockingDate || \"-\",\n scheduleId: s.id || \"-\",\n scheduleName: s.name || \"-\",\n scheduleCase: getCaseCountInSchedule(s).toString(),\n };\n\n pickedStockProjects.push(project);\n }\n }\n\n // 同上の方法で、shippingDateが今回対象としている日付の範囲にあるものを抽出する\n const shipSchedules = p.schedules?.items.filter(\n (s) => s?.shippingDate === d\n ) as Schedule[];\n\n // shippingDateが今回対象としている日付の範囲にあるものがなかったら終了\n if (shipSchedules.length !== 0) {\n // 今回対象としている日付の範囲にあるものがあったら、結果に含める\n for (const s of shipSchedules) {\n const project = {\n id: p.id,\n reference: p.reference || \"-\",\n name: p.name || \"-\",\n accountName: p.accountName || \"-\",\n scheduleShippingDate: s.shippingDate || \"-\",\n scheduleId: s.id || \"-\",\n scheduleName: s.name || \"-\",\n scheduleShipType: s.shipType || \"-\",\n scheduleCase: getCaseCountInSchedule(s).toString(),\n scheduleCutDate: s.cutDate || \"-\",\n };\n\n pickedShipProjects.push(project);\n }\n }\n\n // cutDateが今回対象としている日付の範囲にあるものを抽出する\n const cutSchedules = p.schedules?.items.filter(\n (s) => s?.cutDate === d\n ) as Schedule[];\n\n // cutDateが今回対象としている日付の範囲にあるものがなかったら終了\n if (cutSchedules.length !== 0) {\n // 今回対象としている日付の範囲にあるものがあったら、結果に含める\n for (const s of cutSchedules) {\n const project = {\n id: p.id,\n reference: p.reference || \"-\",\n name: p.name || \"-\",\n accountName: p.accountName || \"-\",\n scheduleShippingDate: s.shippingDate || \"-\",\n scheduleId: s.id || \"-\",\n scheduleName: s.name || \"-\",\n scheduleShipType: s.shipType || \"-\",\n scheduleCase: getCaseCountInSchedule(s).toString(),\n scheduleCutDate: s.cutDate || \"-\",\n };\n\n pickedCutProjects.push(project);\n }\n }\n\n // packDateが今回対象としている日付と同じものを抽出\n const packSchedules = p.schedules?.items.filter(\n (s) => s?.packagingDate === d\n ) as Schedule[];\n\n // packDateが今回対象としている日付の範囲にあるものがなかったら終了\n if (packSchedules.length !== 0) {\n // 今回対象としている日付の範囲にあるものがあったら、結果に含める\n for (const s of packSchedules) {\n // productごとに作成する\n for (const product of s.products?.items || []) {\n if (product === null) continue;\n const project = {\n id: p.id,\n reference: p.reference || \"-\",\n name: p.name || \"-\",\n accountName: p.accountName || \"-\",\n scheduleId: s.id || \"-\",\n scheduleName: s.name || \"-\",\n schedulePackagingDate: s.packagingDate || \"-\",\n scheduleProductName: product.name || \"-\",\n scheduleProductPackageTypeName: product.packageTypeName || \"-\",\n scheduleProductQuantity: product.quantity?.toString() || \"-\",\n };\n\n pickedPackProjects.push(project);\n }\n }\n }\n }\n }\n\n return {\n stockData: {\n stockingDate: `${dates[0]} ~ ${dates[dates.length - 1]}`,\n project: pickedStockProjects,\n },\n shipData: {\n shippingDate: `${dates[0]} ~ ${dates[dates.length - 1]}`,\n project: pickedShipProjects,\n },\n cutData: {\n cutDate: `${dates[0]} ~ ${dates[dates.length - 1]}`,\n project: pickedCutProjects,\n },\n packData: {\n packagingDate: `${dates[0]} ~ ${dates[dates.length - 1]}`,\n project: pickedPackProjects,\n },\n };\n}\n\n// scheduleのcase数を計算する(scheduleの下のproductsのquantityの合算)\nconst getCaseCountInSchedule = (s: Schedule): number => {\n if (s.products === undefined || s.products === null) return 0;\n return s.products?.items.reduce((acc, cur) => {\n return acc + (cur?.quantity || 0);\n }, 0);\n};\n","import { API } from \"aws-amplify\";\n\nimport { Material, Product, SummarizedMaterialOutput } from \"API\";\nimport {\n productsByProjectId,\n productsByScheduleId,\n materialsByGroupId,\n listSummarizedMaterials,\n} from \"graphql/queries\";\n\nexport async function getProductDataByScheduleId(\n scheduleId: string\n): Promise {\n const p = (\n await API.graphql({\n query: productsByScheduleId,\n variables: { scheduleId },\n authMode: \"AMAZON_COGNITO_USER_POOLS\",\n })\n ).data.productsByScheduleId;\n\n const products: Product[] = p.items.map((item: any) => {\n return {\n __typename: \"Product\",\n ...item,\n };\n });\n\n return Promise.resolve(products);\n}\n\nexport async function getProductDataByProjectId(\n projectId: string\n): Promise {\n const p = (\n await API.graphql({\n query: productsByProjectId,\n variables: { projectId },\n authMode: \"AMAZON_COGNITO_USER_POOLS\",\n })\n ).data.productsByProjectId;\n\n const products: Product[] = p.items.map((item: any) => {\n return {\n __typename: \"Product\",\n ...item,\n };\n });\n\n return Promise.resolve(products);\n}\n\nexport async function listMaterials(groupId: string): Promise {\n const materials = (\n await API.graphql({\n query: materialsByGroupId,\n variables: { groupId },\n authMode: \"AMAZON_COGNITO_USER_POOLS\",\n })\n ).data.materialsByGroupId;\n\n return materials;\n}\n\nexport async function listSummarizedMaterialsQuery(\n groupId: string,\n materialTypeId: string,\n startDate: string,\n endDate: string\n): Promise {\n let nextToken: string | null = null;\n const results: SummarizedMaterialOutput[] = [];\n let index = 1;\n\n do {\n const response = await API.graphql({\n query: listSummarizedMaterials,\n variables: {\n input: {\n groupId,\n materialTypeId,\n startDate,\n endDate,\n },\n nextToken,\n },\n authMode: \"AMAZON_COGNITO_USER_POOLS\",\n });\n\n const data: any = response.data.listSummarizedMaterials;\n results.push(\n ...data.items.map((item: any) => ({\n ...item,\n index: index++,\n }))\n );\n nextToken = data.nextToken;\n } while (nextToken);\n\n return results;\n}\n","import { API } from \"aws-amplify\";\nimport moment from \"moment\";\n\nimport { SummarizedInvoicesOutput, SummarizedInvoice } from \"API\";\nimport { listSummarizedInvoices } from \"graphql/queries\";\nimport { getStatusText } from \"utils/status\";\n\nexport async function listSummarizedInvoicesQuery(\n groupId: string,\n key: string,\n startDate: string,\n endDate: string\n): Promise {\n const result: SummarizedInvoicesOutput = {\n __typename: \"SummarizedInvoicesOutput\",\n key: key,\n items: [],\n };\n const limit = 100; //PAX-651 ページネーション毎回5個の請求を取得\n let nextToken = null;\n do {\n const response = (await API.graphql({\n query: listSummarizedInvoices,\n variables: {\n input: {\n key,\n groupId,\n startDate,\n endDate,\n limit,\n nextToken,\n },\n },\n authMode: \"AMAZON_COGNITO_USER_POOLS\",\n })) as { data: { listSummarizedInvoices: SummarizedInvoicesOutput } };\n\n result.items = [\n ...(result.items || []),\n ...(response.data.listSummarizedInvoices.items?.filter(\n (item): item is SummarizedInvoice => item !== null\n ) || []),\n ];\n\n nextToken = response.data.listSummarizedInvoices.nextToken;\n } while (nextToken);\n\n return result;\n}\n\n// SummarizedInvoiceに対して以下を行う\n// 1. createdAtとupdatedAtをJST(YYYY-MM-DD HH24:MI:SS)にする\n// 2. recordingDateをJST(YYYY-MM-DD)にする\n// 3. projectStatusを日本語にする\nexport const reformatSummarizedInvoices = (\n items: SummarizedInvoice[]\n): SummarizedInvoice[] => {\n type DateTimeKeys = keyof Pick<\n SummarizedInvoice,\n \"createdAt\" | \"updatedAt\" | \"lineCreatedAt\" | \"lineUpdatedAt\"\n >;\n type DateKeys = keyof Pick<\n SummarizedInvoice,\n \"recordingDate\" | \"issueDate\" | \"billingDate\"\n >;\n\n const toDateTimeKeys: DateTimeKeys[] = [\n \"createdAt\",\n \"updatedAt\",\n \"lineCreatedAt\",\n \"lineUpdatedAt\",\n ];\n const toDateKeys: DateKeys[] = [\"recordingDate\", \"issueDate\", \"billingDate\"];\n\n return items\n .sort((a, b) => a.lineOrder - b.lineOrder)\n .map((item) => {\n toDateTimeKeys.forEach((key) => {\n // 無効な日付の場合は空文字にする\n if (!moment(item[key] as string).isValid()) {\n item[key] = \"\";\n }\n if (item[key]) {\n item[key] = moment(item[key]).format(\"YYYY-MM-DD HH:mm:ss\");\n }\n });\n toDateKeys.forEach((key) => {\n // 無効な日付の場合は空文字にする\n if (!moment(item[key]).isValid()) {\n item[key] = \"\";\n }\n if (item[key]) {\n item[key] = moment(item[key]).format(\"YYYY-MM-DD\");\n }\n });\n // 案件ステータス\n if (item[\"projectStatus\"]) {\n item[\"projectStatus\"] = getStatusText(item[\"projectStatus\"]);\n }\n return item;\n });\n};\n","import { makeProjectsToPlanData } from \"./project\";\nimport {\n getProductDataByScheduleId,\n listSummarizedMaterialsQuery,\n} from \"./product\";\nimport {\n listSummarizedInvoicesQuery,\n reformatSummarizedInvoices,\n} from \"./invoice\";\n\nimport { Project, ModelProductConnection, SummarizedInvoice } from \"API\";\nimport { GroupReportType } from \"utils/groupReport/types\";\n\nexport async function makeXlsxData(\n reportType: GroupReportType,\n groupId: string,\n projects: Project[],\n dates: string[],\n scope?: { [key: string]: string }\n) {\n if (reportType === \"PLAN\") {\n // projectsのscheduleごとにproductを持ってきてセットする\n const newProjects = projects.map(async (p) => {\n const newSchedules = p.schedules?.items.map(async (s) => {\n if (s?.id) {\n // ここで取得\n const products = await getProductDataByScheduleId(s.id);\n const connection: ModelProductConnection = {\n __typename: \"ModelProductConnection\",\n items: products,\n };\n s.products = connection;\n }\n return s;\n });\n if (\n newSchedules !== undefined &&\n p.schedules !== null &&\n p.schedules !== undefined\n ) {\n p.schedules.items = await Promise.all(newSchedules);\n }\n return p;\n });\n return makeProjectsToPlanData(await Promise.all(newProjects), dates);\n } else if (reportType === \"WOOD\") {\n const { materialTypeId } = scope || {};\n\n if (!materialTypeId) throw Error(\"materialTypeId is not defined\");\n\n const startDate = dates[0];\n const endDate = dates.at(-1) || dates[0];\n\n const summarizedMaterials = await listSummarizedMaterialsQuery(\n groupId,\n materialTypeId,\n startDate,\n endDate\n );\n\n return { materials: summarizedMaterials };\n } else if (reportType === \"GROUPINVOICE\") {\n const startDate = dates[0];\n const endDate = dates.at(-1) || dates[0];\n\n const keys = [\"issueDate\", \"billingDate\", \"recordingDate\"];\n const summarizedInvoicesPromises = keys.map((key) =>\n listSummarizedInvoicesQuery(groupId, key, startDate, endDate)\n );\n\n const summarizedInvoices = await Promise.all(summarizedInvoicesPromises);\n const data: any = {};\n const dateRange = `${startDate} ~ ${endDate}`;\n\n // レンダリング時にで参照する\n for (const invoice of summarizedInvoices) {\n const keyData = invoice.key.replace(\"Date\", \"Data\");\n data[keyData] = {\n [invoice.key]: dateRange,\n invoices: reformatSummarizedInvoices(\n invoice.items?.filter(\n (item): item is SummarizedInvoice => item !== null\n ) || []\n ),\n };\n }\n\n return data;\n }\n}\n","import { GroupReportType } from \"../types\";\n\nimport { makeXlsxData } from \"./xlsx\";\n\nimport { Project } from \"API\";\n\nexport async function makeData(\n type: string,\n reportType: GroupReportType,\n groupId: string,\n projects: Project[],\n dates: string[],\n scope?: { [key: string]: string }\n) {\n // phase2では使わない\n //if (type === \"DOCUMENT\") return getDocxData(reportType, groupId);\n if (type === \"SPREADSHEET\")\n return makeXlsxData(reportType, groupId, projects, dates, scope);\n}\n","import { Storage } from \"aws-amplify\";\nimport moment from \"moment\";\n\nimport { renderSpreadsheet } from \"./render/xlsx\";\nimport type { GroupReportType } from \"./types\";\nimport { makeData } from \"./data\";\n\nimport { downloadFile } from \"utils/files\";\nimport { GroupReport, Project } from \"API\";\nimport { replaceFileName } from \"utils/report\";\n\nexport * from \"./types\";\n\nexport async function download(\n report: GroupReport,\n groupId: string,\n projects: Project[],\n dates: string[]\n) {\n try {\n const type = report.type;\n const dataType = report.data;\n const reportScope = JSON.parse(report.scope || \"{}\");\n\n const [data, file] = await Promise.all([\n makeData(\n type,\n dataType as GroupReportType,\n groupId,\n projects,\n dates,\n reportScope\n ),\n Storage.get(report.template.key, {\n download: true,\n cacheControl: \"no-cache, no-store, must-revalidate\",\n }),\n ]);\n\n // dataがvoidだったらここで終わり\n if (!data) return;\n\n const fileName = `${report.name}_${moment().format(\"YYYYMMDDHHmmss\")}`;\n\n // phase2では使わない\n // if (type === \"DOCUMENT\") {\n // for (const d in data) {\n // const blob = await renderDocument(file.Body as Blob, d);\n // await downloadFile(fileName, blob);\n // }\n // }\n if (type === \"SPREADSHEET\") {\n const renderData = await renderSpreadsheet(\n file.Body as Blob,\n data,\n report\n );\n await downloadFile(\n replaceFileName(fileName),\n renderData.base64,\n \"base64\"\n );\n }\n } catch (e: any) {\n throw Error(e);\n }\n}\n","/* eslint-disable react-hooks/exhaustive-deps */\nimport { ReactNode, createContext, useContext, useState } from \"react\";\nimport { useEffect } from \"react\";\nimport { Storage } from \"aws-amplify\";\nimport { uuid } from \"short-uuid\";\n\nimport { useAlerts } from \"./alerts\";\nimport { useAuth } from \"./auth\";\nimport { useGantt } from \"./gantt\";\n\nimport type { GroupReport, Report } from \"API\";\nimport useDatalist from \"hooks/datalist\";\nimport { GraphQLInput } from \"hooks/datalist\";\nimport { useDialog } from \"contexts/dialog\";\nimport { download } from \"utils/groupReport\";\nimport { downloadTemplate } from \"utils/report\";\n\ninterface GroupReportsContextValue {\n loading: boolean;\n exporting: boolean;\n reports: GroupReport[];\n planReports: GroupReport[];\n woodReports: GroupReport[];\n invoiceReports: GroupReport[];\n create: (input: GraphQLInput) => Promise;\n remove: (id: string) => Promise;\n download: (report: GroupReport) => Promise;\n downloadTemplate: (report: GroupReport | Report) => Promise;\n}\n\ninterface GroupReportsContextProps {\n children: ReactNode;\n}\n\nconst GroupReportsContext = createContext({\n reports: [],\n planReports: [],\n woodReports: [],\n invoiceReports: [],\n loading: false,\n exporting: false,\n create: () => Promise.resolve(),\n remove: () => Promise.resolve(),\n download: () => Promise.resolve(),\n downloadTemplate: () => Promise.resolve(),\n});\n\nexport const GroupReportsProvider = ({\n children,\n}: GroupReportsContextProps) => {\n const { currentGroup } = useAuth();\n const { data, loading, refetch, create, remove } = useDatalist({\n query: \"groupReportsByGroupId\",\n variables: {\n groupId: currentGroup?.id,\n },\n });\n const { projects, dates } = useGantt();\n const [exporting, setExporting] = useState(false);\n const [error, setError] = useState(false);\n const [exportingReports, setExportingReports] = useState([]);\n\n const { open } = useDialog();\n const { addAlert } = useAlerts();\n\n useEffect(() => {\n refetch({\n groupId: currentGroup?.id,\n });\n }, [currentGroup?.id]);\n\n const createReport = async (input: GraphQLInput) => {\n // phase2ではDocument対応しないのでエラーを出す\n if (input.type === \"DOCUMENT\") {\n addAlert({\n message: \"Phase2では案件横断帳票はDOCUMENT(WORD)に対応していません\",\n severity: \"error\",\n });\n return;\n }\n await create(\"createGroupReport\", {\n ...input,\n groupId: currentGroup?.id,\n });\n };\n\n const removeReport = async (id: string) => {\n open({\n title: \"案件横断帳票を削除しますか?\",\n content: \"削除すると二度と戻せません\",\n okText: \"削除\",\n onOk: async () => {\n const file = data.filter((d: GroupReport) => d.id === id)[0];\n await Storage.remove(file.template.key);\n await remove(\"deleteGroupReport\", { id });\n },\n });\n };\n\n useEffect(() => {\n if (exporting && !error && exportingReports.length <= 0) {\n addAlert({\n message: `案件横断帳票が全て出力されました`,\n severity: \"success\",\n });\n setExporting(false);\n document.body.style.cursor = \"\";\n return setExportingReports([]);\n } else if (exporting && !error) {\n addAlert({\n message: `案件横断帳票を出力中です`,\n severity: \"info\",\n });\n } else if (error) {\n setError(false);\n setExporting(false);\n document.body.style.cursor = \"\";\n return setExportingReports([]);\n }\n }, [exportingReports]);\n\n const downloadGroupReport = async (report: GroupReport) => {\n setError(false);\n const exportId = uuid();\n setExporting(true);\n document.body.style.cursor = \"progress\";\n setExportingReports([...exportingReports, exportId]);\n try {\n if (currentGroup)\n await download(report, currentGroup?.id, projects, dates);\n } catch (err: any) {\n setError(true);\n if (typeof err === \"string\") {\n addAlert({\n message: `${report.name}が出力されませんでした: ${err}`,\n severity: \"error\",\n });\n } else if (err instanceof Error) {\n addAlert({\n message: `${report.name}が出力されませんでした: ${err.message}`,\n severity: \"error\",\n });\n } else {\n addAlert({\n message: `${report.name}が出力されませんでした`,\n severity: \"error\",\n });\n }\n } finally {\n setExportingReports(exportingReports.filter((e) => e !== exportId));\n }\n };\n\n return (\n d.data === \"PLAN\")\n : [],\n woodReports: data\n ? data.filter((d: GroupReport) => d.data === \"WOOD\")\n : [],\n invoiceReports: data\n ? data.filter((d: GroupReport) => d.data === \"GROUPINVOICE\")\n : [],\n loading,\n create: createReport,\n remove: removeReport,\n download: downloadGroupReport,\n downloadTemplate,\n exporting,\n }}\n >\n {children}\n \n );\n};\n\nexport const useGroupReports = () => {\n const groupReportsContext = useContext(GroupReportsContext);\n\n if (groupReportsContext === undefined) {\n throw new Error(\"useGroupReports must be within GroupReportsProvider\");\n }\n\n return groupReportsContext;\n};\n","import { useState, useEffect } from \"react\";\nimport { useRouter } from \"next/router\";\nimport moment from \"moment\";\n\nexport default function useQuery(\n query: string,\n defaultValue: QueryType,\n toData?: (data: string) => QueryType,\n toQuery?: (data: QueryType) => string\n) {\n const [data, setData] = useState(defaultValue);\n const router = useRouter();\n\n if (typeof defaultValue === \"boolean\") {\n toData = toData || (((data: string) => data === \"true\") as any);\n toQuery = toQuery || ((data) => (data as boolean).toString());\n }\n\n if (typeof defaultValue === \"number\") {\n toData = toData || (((data: string) => parseFloat(data)) as any);\n toQuery = toQuery || ((data) => (data as number).toString());\n }\n\n if (defaultValue instanceof Date) {\n toData = toData || (((data: string) => moment(data).toDate()) as any);\n toQuery = toQuery || ((data) => moment(data as Date).format(\"YYYY-MM-DD\"));\n }\n\n if (\n typeof defaultValue !== \"string\" &&\n typeof defaultValue !== \"boolean\" &&\n typeof defaultValue !== \"boolean\" &&\n defaultValue instanceof Date\n ) {\n if (!toData)\n throw new Error(\"toData is required to convert query string to data\");\n if (!toQuery)\n throw new Error(\"toQuery is required to convert data to string\");\n }\n\n useEffect(() => {\n if (!router.query[query]) return update(defaultValue);\n\n const newValue = toData\n ? toData(router.query[query] as string)\n : (router.query[query] as QueryType);\n setData(newValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router.query[query]]);\n\n const update = (newData: any) => {\n router.query[query] = toQuery ? toQuery(newData) : newData;\n router.push(router);\n };\n\n return [data, update] as const;\n}\n","import moment, { Moment } from \"moment\";\n\nimport { Holiday } from \"API\";\n\n/**\n * Formats the input date as a string using the specified format.\n * @param {string | null | undefined} date - The input date to be formatted.\n * @param {string} [format=\"MM/DD\"] - The format to use when formatting the date (default is \"MM/DD\").\n * @returns {string} - The formatted date string or \"-\" if the input date is not valid.\n */\nexport function formatDate(\n date: string | null | undefined,\n format: string = \"MM/DD\"\n): string {\n if (!moment(date).isValid()) return \"-\";\n return moment(date).format(format);\n}\n\n/**\n * Generates an array of date strings for each day between the specified start and end dates (inclusive).\n * @param {string | Moment} startDate - The start date in \"YYYY-MM-DD\" format.\n * @param {string | Moment} endDate - The end date in \"YYYY-MM-DD\" format.\n * @returns {string[]} - An array of date strings in \"YYYY-MM-DD\" format for each day between the start and end dates.\n */\nexport const enumerateDaysBetweenDates = (\n startDate: string | Moment,\n endDate: string | Moment\n): string[] => {\n const now = moment(startDate).clone();\n const retDates = [];\n\n while (now.isSameOrBefore(moment(endDate))) {\n retDates.push(now.format(\"YYYY-MM-DD\"));\n now.add(1, \"d\");\n }\n return retDates;\n};\n\nexport const isSaturday = (day: string) => moment(day).day() === 6;\nexport const isSunday = (day: string) => moment(day).day() === 0;\nexport const getHoliday = (\n day: string,\n holidays: (Holiday | null)[] | undefined\n): Holiday | null | undefined =>\n holidays?.find((holiday: Holiday | null) => holiday?.date === day);\n\n/**\n * 休日に色を塗る処理\n * - 休日カレンダーが登録されており稼働日でない日=赤(土曜含む)\n * - 休日カレンダーが登録されており稼働日でなく土曜日=青\n * - 休日カレンダーに稼働日で登録されている=未指定\n * - 休日カレンダーに登録されていない=土曜は青、日曜は赤それ以外は白\n * @param {string} day - 対象日\n * @param {(Holiday | null)[] | undefined} holidays - 休日カレンダー\n * @returns {string} - CSSの内容\n */\nexport const drawHolidayColor = (\n day: string,\n holidays: (Holiday | null)[] | undefined\n) => {\n const holiday = getHoliday(day, holidays);\n if ((holiday && !holiday?.isWorking) || (!holiday && isSunday(day))) {\n return \"!bg-rose-100 !text-rose-800\";\n } else if (\n (holiday && !holiday?.isWorking) ||\n (!holiday && isSaturday(day))\n ) {\n return \"!bg-sky-100 !text-indigo-800\";\n }\n return \"\";\n};\n\n/**\n * 平日と休日の間に白線(ボーダー)を入れる処理\n * - 本日を起点に前の日・後の日が起点日と異なる場合ボーダーを引く\n * @param {string} day - 対象日\n * @param {(Holiday | null)[] | undefined} holidays - 休日カレンダー\n * @returns {string} - CSSの内容\n */\nexport const drawHolidayBorder = (\n day: string,\n holidays: (Holiday | null)[] | undefined\n) => {\n let holiday = getHoliday(day, holidays);\n let borderValue = \"\";\n // 当日\n const today =\n (!holiday && (isSaturday(day) || isSunday(day))) ||\n (holiday && !holiday.isWorking);\n // 前日\n let targetDate = moment(day).subtract(1, \"d\").format(\"YYYY-MM-DD\");\n holiday = getHoliday(targetDate, holidays);\n const yesterday =\n (!holiday && (isSaturday(targetDate) || isSunday(targetDate))) ||\n (holiday && !holiday.isWorking) ||\n !today;\n // 翌日\n targetDate = moment(day).add(1, \"d\").format(\"YYYY-MM-DD\");\n holiday = getHoliday(targetDate, holidays);\n const tomorrow =\n (!holiday && (isSaturday(targetDate) || isSunday(targetDate))) ||\n (holiday && !holiday.isWorking) ||\n !today;\n // 設定するCSS\n if (!yesterday || !tomorrow) borderValue += \"border-solid \";\n if (!yesterday) borderValue += \"border-s-2 border-s-white \";\n if (!tomorrow) borderValue += \"border-e-2 border-e-white \";\n return borderValue.trim();\n};\n","\nimport moment from \"moment\";\n\nimport { formatDate, enumerateDaysBetweenDates } from \"./dates\";\nimport { CaseSchedule } from \"./types\";\n\nimport { Project, Schedule } from \"API\";\n\nconst updateCase = (\n date: string | null | undefined,\n value: number,\n storage: Record\n) => {\n const formattedDate = formatDate(date);\n if (!storage[formattedDate]) {\n storage[formattedDate] = 0;\n }\n storage[formattedDate] += Math.ceil(value);\n};\n\nconst updateAccumulation = (\n date: string | null | undefined,\n value: number,\n accumulation: Record\n) => {\n const formattedDate = formatDate(date);\n if (!accumulation[formattedDate]) {\n accumulation[formattedDate] = 0;\n }\n accumulation[formattedDate] += Math.ceil(value);\n};\n\ninterface Result {\n startDate: string;\n endDate: string;\n accumulation: Record;\n stockingCase: Record;\n packagingCase: Record;\n shippingCase: Record;\n cutCase: Record;\n}\n\nexport function getCaseSchedule(projects: Project[]): CaseSchedule {\n if (projects.length === 0) return {};\n\n const initialResult: Result = {\n startDate: \"2100-1-1\",\n endDate: \"1990-1-1\",\n accumulation: {},\n stockingCase: {},\n packagingCase: {},\n shippingCase: {},\n cutCase: {},\n };\n\n const calculatedCase = projects.reduce((result, project) => {\n const { schedules } = project;\n if (!schedules || !schedules.items || schedules?.items.length === 0)\n return result;\n\n (schedules.items as Schedule[]).forEach(\n ({\n case: cs,\n stockingDate,\n shippingDate,\n packagingDate,\n cutDate,\n shipType,\n }) => {\n if (moment(stockingDate).isBefore(moment(result.startDate)))\n result.startDate = stockingDate as string;\n if (moment(shippingDate).isAfter(moment(result.endDate)))\n result.endDate = shippingDate as string;\n\n if (!cs) return result;\n\n updateCase(stockingDate, cs, result.stockingCase);\n updateCase(packagingDate, cs, result.packagingCase);\n updateCase(shippingDate, cs, result.shippingCase);\n\n if (cutDate) updateCase(cutDate, cs, result.cutCase);\n\n updateAccumulation(stockingDate, cs, result.accumulation);\n\n // subtract from shipping date for normal ship type, cut date for van shipment\n if (shipType === \"バン\" && cutDate) {\n updateAccumulation(cutDate, -cs, result.accumulation);\n } else {\n updateAccumulation(shippingDate, -cs, result.accumulation);\n }\n }\n );\n return result;\n }, initialResult);\n\n const dates = enumerateDaysBetweenDates(\n calculatedCase.startDate,\n calculatedCase.endDate\n );\n\n // calculate total cases per day\n const totalCase = dates.reduce((result: any, date) => {\n const today = formatDate(date);\n const yesterday = formatDate(moment(date).subtract(1, \"d\").toString());\n // copy from previous day first, and then apply accumulation\n result[today] = result[yesterday] || 0;\n result[today] += calculatedCase.accumulation[today] || 0;\n return result;\n }, {});\n\n return {\n stockingCase: calculatedCase.stockingCase,\n packagingCase: calculatedCase.packagingCase,\n shippingCase: calculatedCase.shippingCase,\n cutCase: calculatedCase.cutCase,\n totalCase,\n };\n}\n","\nimport moment from \"moment\";\n\nimport { formatDate, enumerateDaysBetweenDates } from \"./dates\";\nimport { M3Schedule } from \"./types\";\n\nimport { Project, Schedule } from \"API\";\n\nconst updateM3 = (\n date: string | null | undefined,\n value: number,\n storage: Record\n) => {\n const formattedDate = formatDate(date);\n if (!storage[formattedDate]) {\n storage[formattedDate] = 0;\n }\n storage[formattedDate] += Math.ceil(value);\n};\n\nconst updateAccumulation = (\n date: string | null | undefined,\n value: number,\n accumulation: Record\n) => {\n const formattedDate = formatDate(date);\n if (!accumulation[formattedDate]) {\n accumulation[formattedDate] = 0;\n }\n accumulation[formattedDate] += Math.ceil(value);\n};\n\ninterface Result {\n startDate: string;\n endDate: string;\n accumulation: Record;\n stockingM3: Record;\n packagingM3: Record;\n shippingM3: Record;\n cutM3: Record;\n}\n\nexport function getM3Schedule(projects: Project[]): M3Schedule {\n if (projects.length === 0) return {};\n\n const initialResult: Result = {\n startDate: \"2100-1-1\",\n endDate: \"1990-1-1\",\n accumulation: {},\n stockingM3: {},\n packagingM3: {},\n shippingM3: {},\n cutM3: {},\n };\n\n const calculatedM3 = projects.reduce((result, project) => {\n const { schedules } = project;\n if (!schedules || !schedules.items || schedules?.items.length === 0)\n return result;\n\n (schedules.items as Schedule[]).forEach(\n ({\n m3,\n stockingDate,\n shippingDate,\n packagingDate,\n cutDate,\n shipType,\n }) => {\n if (moment(stockingDate).isBefore(moment(result.startDate)))\n result.startDate = stockingDate as string;\n if (moment(shippingDate).isAfter(moment(result.endDate)))\n result.endDate = shippingDate as string;\n\n if (!m3) return result;\n\n updateM3(stockingDate, m3, result.stockingM3);\n updateM3(packagingDate, m3, result.packagingM3);\n updateM3(shippingDate, m3, result.shippingM3);\n\n if (cutDate) updateM3(cutDate, m3, result.cutM3);\n\n updateAccumulation(stockingDate, m3, result.accumulation);\n\n // subtract from shipping date for normal ship type, cut date for van shipment\n if (shipType === \"バン\" && cutDate) {\n updateAccumulation(cutDate, -m3, result.accumulation);\n } else {\n updateAccumulation(shippingDate, -m3, result.accumulation);\n }\n }\n );\n return result;\n }, initialResult);\n\n // get a list of dates between earliest stocking date and latest shipping date\n const dates = enumerateDaysBetweenDates(\n calculatedM3.startDate,\n calculatedM3.endDate\n );\n\n // calculate total m3 per day\n const totalM3 = dates.reduce((result: any, date) => {\n const today = formatDate(date);\n const yesterday = formatDate(moment(date).subtract(1, \"d\").toString());\n // copy from previous day first, and then apply accumulation\n result[today] = result[yesterday] || 0;\n result[today] += calculatedM3.accumulation[today] || 0;\n return result;\n }, {});\n\n return {\n stockingM3: calculatedM3.stockingM3,\n packagingM3: calculatedM3.packagingM3,\n shippingM3: calculatedM3.shippingM3,\n cutM3: calculatedM3.cutM3,\n totalM3,\n };\n}\n","import moment, { Moment } from \"moment\";\n\nimport type { VisibleKeyDates } from \"./types\";\n\nimport { Schedule } from \"API\";\n\n/**\n * Returns an object with the start and end dates for the focused schedule.\n * @param {Schedule} schedule - The schedule of interest.\n * @param {string[]} dates - The array of date strings.\n * @param {KeyDatesVisibility} visibleKeyDates - The visibility of the key dates.\n * @returns {{startDate: Date, endDate: Date}} - An object containing the start and end dates.\n */\nexport function getFocusedDateRange(\n schedule: Schedule,\n dates: string[],\n visibleKeyDates: VisibleKeyDates\n): { startDate: Date; endDate: Date } {\n const keyDateMoments = getKeyDateMoments(schedule);\n const [initialStartDate, initialEndDate] = getInitialDateRange(dates);\n\n const startDate = getNewStartDate(\n initialStartDate,\n keyDateMoments,\n visibleKeyDates\n );\n const endDate = getNewEndDate(\n initialEndDate,\n keyDateMoments,\n visibleKeyDates\n );\n\n const adjustedDates = adjustDateRange(startDate, endDate);\n\n return {\n startDate: adjustedDates.startDate.toDate(),\n endDate: adjustedDates.endDate.toDate(),\n };\n}\n\n/**\n * Converts schedule key dates in a schedule to Moment.js objects.\n * @param {Schedule} keyDate - The key dates of the schedule.\n * @returns {Record} - An object with key date names and their Moment.js representations.\n */\nfunction getKeyDateMoments(keyDate: Schedule): Record {\n return {\n beforeStock: moment(keyDate.beforeStockingDate),\n stock: moment(keyDate.stockingDate),\n beforePkg: moment(keyDate.beforePackagingDate),\n pkg: moment(keyDate.packagingDate),\n beforeShip: moment(keyDate.beforeShippingDate),\n ship: moment(keyDate.shippingDate),\n beforeCut: moment(keyDate.beforeCutDate),\n cut: moment(keyDate.cutDate),\n afterCut: moment(keyDate.afterCutDate),\n };\n}\n\n/**\n * Extracts the initial start and end dates from the given date strings array.\n * @param {string[]} dates - The array of date strings.\n * @returns {[Moment, Moment]} - A tuple containing the initial start and end dates as Moment.js objects.\n */\nfunction getInitialDateRange(dates: string[]): [Moment, Moment] {\n return [moment(dates[0]), moment(dates[dates.length - 1])];\n}\n\n/**\n * Determines the new start date based on key date visibility and validity.\n * @param {Moment} initialStartDate - The initial start date.\n * @param {Record} keyDateMoments - The key date moments.\n * @param {KeyDatesVisibility} visibleKeyDates - The visibility of the key dates.\n * @returns {Moment} - The new start date.\n */\nfunction getNewStartDate(\n initialStartDate: Moment,\n keyDateMoments: Record,\n visibleKeyDates: VisibleKeyDates\n): Moment {\n if (\n keyDateMoments.beforeStock.isValid() &&\n visibleKeyDates.beforeStockingDate\n ) {\n // 入荷前\n return keyDateMoments.beforeStock;\n } else if (keyDateMoments.stock.isValid() && visibleKeyDates.stockingDate) {\n // 入荷\n return keyDateMoments.stock;\n }\n // 画面表示範囲の開始日\n return initialStartDate;\n}\n\n/**\n * Determines the new end date based on key date visibility and validity.\n * @param {Moment} initialEndDate - The initial end date.\n * @param {Record} keyDateMoments - The key date moments.\n * @param {KeyDatesVisibility} visibleKeyDates - The visibility of the key dates.\n * @returns {Moment} - The new end date.\n */\nfunction getNewEndDate(\n initialEndDate: Moment,\n keyDateMoments: Record,\n visibleKeyDates: VisibleKeyDates\n): Moment {\n if (keyDateMoments.afterCut.isValid() && visibleKeyDates.afterCutDate) {\n // CUT後\n return keyDateMoments.afterCut;\n } else if (keyDateMoments.cut.isValid() && visibleKeyDates.cutDate) {\n // CUT\n return keyDateMoments.cut;\n } else if (\n keyDateMoments.beforeCut.isValid() &&\n visibleKeyDates.beforeCutDate\n ) {\n // CUT前\n return keyDateMoments.beforeCut;\n } else if (keyDateMoments.ship.isValid() && visibleKeyDates.shippingDate) {\n // 出荷\n return keyDateMoments.ship;\n }\n // 画面表示範囲の終了日\n return initialEndDate;\n}\n\n/**\n * Adjusts the start and end dates to ensure a minimum range of 7 days.\n * @param {Moment} startDate - The current start date.\n * @param {Moment} endDate - The current end date.\n * @returns {{startDate: Moment, endDate: Moment}} - An object containing the adjusted start and end dates.\n */\nfunction adjustDateRange(\n startDate: Moment,\n endDate: Moment\n): { startDate: Moment; endDate: Moment } {\n const diff = endDate.diff(startDate, \"d\");\n\n if (diff < 7) {\n const adjustment = (7 - diff) / 2;\n endDate = endDate.add(adjustment, \"d\");\n startDate = startDate.subtract(adjustment, \"d\");\n }\n\n return { startDate, endDate };\n}\n","\nimport moment from \"moment\";\n\n// shift 1 day forward\nexport const shiftOneDay = (dateList: string[]) => {\n const startDate = moment(dateList[0]).add(1, \"d\").toDate();\n\n const endDate = moment(dateList[dateList.length - 1])\n .add(1, \"d\")\n .toDate();\n\n return {\n startDate,\n endDate,\n };\n};\n\n// shift 1 day behind\nexport const unshiftOneDay = (dateList: string[]) => {\n const startDate = moment(dateList[0]).subtract(1, \"d\").toDate();\n\n const endDate = moment(dateList[dateList.length - 1])\n .subtract(1, \"d\")\n .toDate();\n\n return {\n startDate,\n endDate,\n };\n};\n","import _ from \"lodash\";\nimport moment from \"moment\";\n\nimport type { SortedProjectDates, KeyDate, ProjectDateSortName } from \"./types\";\n\nimport { Project } from \"API\";\nimport { getStatusIndex } from \"utils/status\";\n\n/**\n * 案件のスケジュールを指定された日付キーでソートします。\n *\n * @param {Project} project - ソート対象の案件\n * @param {KeyDate} dateName - ソートに使用する日付のキー。\n * @param {\"asc\" | \"desc\"} direction - ソート方向 (昇順,降順)\n * @returns {Project} ソートされたスケジュールを持つ案件。\n */\nconst sortSchedulesByDate = (\n project: Project,\n dateName: KeyDate,\n direction: \"asc\" | \"desc\"\n) => {\n // 指定された方向にスケジュール個別のソートを行う\n project.schedules?.items.sort((a, b) => {\n if (direction === \"asc\") {\n return (\n moment(a && a[dateName]).valueOf() - moment(b && b[dateName]).valueOf()\n );\n } else if (direction === \"desc\") {\n return (\n moment(b && b[dateName]).valueOf() - moment(a && a[dateName]).valueOf()\n );\n }\n return 0;\n });\n\n return project;\n};\n\n/**\n * 案件を指定された日付フィールドとソート方向に基づいてソートします。\n *\n * @param {Project[]} projects - ソート対象の案件配列\n * @param {KeyDate} dateName - ソート基準の日付フィールド名\n * @param {\"asc\" | \"desc\"} direction - ソート方向 (昇順,降順)\n * @returns {Project[]} ソートされた案件配列\n */\nconst sortProjectsByDate = (\n projects: Project[],\n dateName: KeyDate,\n direction: \"asc\" | \"desc\"\n) => {\n const defaultOrder: string = direction === \"asc\" ? \"2100-1-1\" : \"2100-1-1\";\n\n // 各プロジェクトごとに複数のスケジュールがあるため、最も早いスケジュールの日付を探す\n const earliestDatesByProject = projects.reduce(\n (result: SortedProjectDates[], project) => {\n if (!project.schedules || project.schedules.items.length === 0)\n return result.concat({\n id: project.id,\n earliestTargetDate: defaultOrder,\n });\n\n const earliestTargetDate = project.schedules?.items.map((item) =>\n item && item[dateName] ? item[dateName] : defaultOrder\n );\n\n // 指定された方向にスケジュール個別のソートを行う\n sortSchedulesByDate(project, dateName, direction);\n\n result.push({\n id: project.id,\n earliestTargetDate: _.min([\n ...earliestTargetDate,\n defaultOrder,\n ]) as string,\n });\n return result;\n },\n []\n );\n // 指定された方向に応じてプロジェクトをソートし、プロジェクトの配列を返す\n if (direction === \"asc\") {\n return earliestDatesByProject\n .sort(\n (a, b) =>\n moment(a.earliestTargetDate).valueOf() -\n moment(b.earliestTargetDate).valueOf()\n )\n .map((d) => projects.filter((p) => p.id === d.id)[0]);\n }\n if (direction === \"desc\") {\n return earliestDatesByProject\n .sort(\n (a, b) =>\n moment(b.earliestTargetDate).valueOf() -\n moment(a.earliestTargetDate).valueOf()\n )\n .map((d) => projects.filter((p) => p.id === d.id)[0]);\n }\n return projects;\n};\n\nexport const sortProjects = (\n projects: Project[],\n sortName: ProjectDateSortName\n) => {\n if (sortName === \"sortByName\") {\n return projects.sort((a, b) => a.name.localeCompare(b.name));\n }\n if (sortName === \"sortByNameDesc\") {\n return projects.sort((a, b) => b.name.localeCompare(a.name));\n }\n if (sortName === \"sortByStatus\") {\n return projects.sort(\n (a, b) => getStatusIndex(a.status) - getStatusIndex(b.status)\n );\n }\n if (sortName === \"sortByStatusDesc\") {\n return projects.sort(\n (a, b) => getStatusIndex(b.status) - getStatusIndex(a.status)\n );\n }\n if (sortName === \"sortByStock\") {\n return sortProjectsByDate(projects, \"stockingDate\", \"asc\");\n }\n if (sortName === \"sortByPackage\") {\n return sortProjectsByDate(projects, \"packagingDate\", \"asc\");\n }\n if (sortName === \"sortByShip\") {\n return sortProjectsByDate(projects, \"shippingDate\", \"asc\");\n }\n if (sortName === \"sortByCut\") {\n return sortProjectsByDate(projects, \"cutDate\", \"asc\");\n }\n if (sortName === \"sortByCreate\") {\n return projects.sort(\n (a, b) => moment(a.createdAt).valueOf() - moment(b.createdAt).valueOf()\n );\n }\n if (sortName === \"sortByUpdate\") {\n return projects.sort(\n (a, b) => moment(a.updatedAt).valueOf() - moment(b.updatedAt).valueOf()\n );\n }\n if (sortName === \"sortByStockDesc\") {\n return sortProjectsByDate(projects, \"stockingDate\", \"desc\");\n }\n if (sortName === \"sortByPackageDesc\") {\n return sortProjectsByDate(projects, \"packagingDate\", \"desc\");\n }\n if (sortName === \"sortByShipDesc\") {\n return sortProjectsByDate(projects, \"shippingDate\", \"desc\");\n }\n if (sortName === \"sortByCutDesc\") {\n return sortProjectsByDate(projects, \"cutDate\", \"desc\");\n }\n if (sortName === \"sortByCreateDesc\") {\n return projects.sort(\n (a, b) => moment(b.createdAt).valueOf() - moment(a.createdAt).valueOf()\n );\n }\n if (sortName === \"sortByUpdateDesc\") {\n return projects.sort(\n (a, b) => moment(b.updatedAt).valueOf() - moment(a.updatedAt).valueOf()\n );\n }\n\n return projects;\n};\n\nexport const removeBeforeIdx = (projects: any) => {\n projects\n .filter((p: any) => p.beforeIdx !== undefined)\n .forEach((p: any) => {\n delete p.beforeIdx;\n });\n};\n","\nimport moment, { Moment } from \"moment\";\n\nimport { formatDate } from \"./dates\";\nimport type { ScheduleUpdateParams, KeyDate } from \"./types\";\n\nimport { Schedule } from \"API\";\n\nexport function updateSchedule({\n schedule,\n field,\n date,\n}: ScheduleUpdateParams): Schedule {\n let stock = moment(schedule.stockingDate);\n let pkg = moment(schedule.packagingDate);\n let ship = moment(schedule.shippingDate);\n let cut = moment(schedule.cutDate);\n\n const updateDate = (field: KeyDate, date: Moment): void => {\n schedule[field] = formatDate(date.toString(), \"YYYY-MM-DD\");\n };\n\n const newDate = moment(date);\n\n // never goes pass cut date\n if (newDate.isAfter(cut, \"d\")) {\n updateDate(field, cut);\n } else {\n updateDate(field, newDate);\n }\n\n switch (field) {\n case \"stockingDate\":\n if (stock.isAfter(pkg, \"d\")) updateDate(\"packagingDate\", stock);\n if (stock.isAfter(ship, \"d\")) updateDate(\"shippingDate\", stock);\n break;\n case \"packagingDate\":\n if (pkg.isAfter(ship, \"d\")) updateDate(\"shippingDate\", pkg);\n if (pkg.isBefore(stock, \"d\")) updateDate(\"stockingDate\", pkg);\n break;\n case \"shippingDate\":\n if (ship.isBefore(pkg, \"d\")) updateDate(\"packagingDate\", ship);\n if (ship.isBefore(stock, \"d\")) updateDate(\"stockingDate\", ship);\n break;\n default:\n break;\n }\n\n return schedule;\n}\n","import moment from \"moment\";\n\nimport { Project, Schedule } from \"API\";\nimport { getStatusText, getStatusInitial } from \"utils/status\";\n\nexport type ScheduleDate = {\n hasData: boolean;\n type: string;\n text: string;\n initial: string;\n color: string;\n};\n\n// ステータスを出力する。出荷はスケジュールの出荷方法を出力する。\nexport function getCustomStatusText(\n isInitial: boolean,\n status: string,\n schedule: Schedule\n) {\n let retVal: string = \"\";\n if (status === \"SHIP\") {\n retVal = schedule.shipType ?? \"\";\n } else if (!isInitial && getStatusText(status) !== \"?\") {\n retVal = getStatusText(status);\n } else if (isInitial && getStatusInitial(status) !== \"?\") {\n retVal = getStatusInitial(status);\n } else {\n switch (status) {\n case \"BEFORESTOCK\":\n retVal = schedule.beforeStockingName ?? \"\";\n break;\n case \"BEFOREPACK\":\n retVal = schedule.beforePackagingName ?? \"\";\n break;\n case \"BEFORESHIP\":\n retVal = schedule.beforeShippingName ?? \"\";\n break;\n case \"BEFORECUT\":\n retVal = schedule.beforeCutName ?? \"\";\n break;\n case \"AFTERCUT\":\n retVal = schedule.afterCutName ?? \"\";\n break;\n default:\n retVal = status;\n break;\n }\n }\n return isInitial ? retVal.substring(0, 1) : retVal.substring(0, 3);\n}\n\nexport function getFillerColor(status: string) {\n switch (status) {\n case \"STOCK\":\n return \"#29BF12\";\n case \"PACK\":\n return \"#3E6EB3\";\n case \"SHIP\":\n return \"#D18643\";\n case \"CUT\":\n return \"#bd3993\";\n case \"\":\n return \"transparent\";\n default:\n return \"#888\";\n }\n}\n\nexport const getScheduleDates = (schedule: Schedule, dates: string[]) => {\n return dates.reduce((acc, date) => {\n /** 該当フェーズ名 */\n let phase = \"\";\n\n /** スケジュール項目名 名前,日付のオブジェクト */\n const phaseArray: Array<{ name: string; date: string | null | undefined }> =\n [\n { name: \"BEFORESTOCK\", date: schedule.beforeStockingDate }, // 入荷前\n { name: \"STOCK\", date: schedule.stockingDate }, // 入荷\n { name: \"BEFOREPACK\", date: schedule.beforePackagingDate }, // 梱包前\n { name: \"PACK\", date: schedule.packagingDate }, // 梱包\n { name: \"BEFORESHIP\", date: schedule.beforeShippingDate }, // 出荷前\n { name: \"SHIP\", date: schedule.shippingDate }, // 出荷\n { name: \"BEFORECUT\", date: schedule.beforeCutDate }, // CUT前\n { name: \"CUT\", date: schedule.cutDate }, // CUT\n { name: \"AFTERCUT\", date: schedule.afterCutDate }, // CUT後\n ];\n\n // ////////////////////////////////////////\n // ★基準日の判定★\n\n // その日付で一番最後にくるフェーズ名を取得\n for (let i = 0; i < phaseArray.length; i++) {\n if (phaseArray[i].date === date) {\n phase = phaseArray[i].name;\n }\n }\n\n // スケジュールで指定した日付に該当する場合はここから返す\n if (phase) {\n return {\n ...acc,\n [date]: {\n hasData: !!phase,\n type: phase,\n text: phase && getCustomStatusText(false, phase, schedule),\n initial: phase && getCustomStatusText(true, phase, schedule),\n color: phase && getFillerColor(phase),\n m3: schedule.m3 || 0,\n case: schedule.case || 0,\n },\n };\n }\n\n // ////////////////////////////////////////\n // ★基準日間のデータ判定★\n\n // スケジュール日の中間かどうかを判定する(~ING)\n const target = moment(date);\n // 案件タイプ=その他の場合は梱包日がないため、別に判定する\n const isPkg = !!schedule.packagingDate;\n let fromPhase = \"\";\n let fromDate = \"\";\n // どのスケジュールに該当するのか確認\n for (let i = 0; i <= phaseArray.length; i++) {\n if (!phaseArray[i]?.date || !phaseArray[i]?.name) continue;\n // 始まりのデータ。最初はデータを登録して終わり\n if (!fromDate) {\n fromPhase = phaseArray[i].name;\n fromDate = phaseArray[i].date ?? \"\";\n continue;\n }\n // その他案件の場合は梱包前・梱包は梱包フェーズがないため処理しない\n if (\n !isPkg &&\n (phaseArray[i].name === \"PACK\" || phaseArray[i].name === \"BEFOREPACK\")\n ) {\n continue;\n }\n // 出荷方法がバン以外の場合はCUT以降の処理をしない\n if (schedule.shipType !== \"バン\" && phaseArray[i].name === \"CUT\") {\n break;\n }\n // 対象日が被っているかを確認。被っていればそのフェーズの範囲。\n if (target.isBetween(fromDate, phaseArray[i].date, \"day\", \"[]\")) {\n if (fromPhase === \"BEFORESTOCK\") {\n // StockingとbeforeStockingの間はbeforeStockingの領域にする\n phase = fromDate;\n } else {\n // 上記以外は次のフェーズの色を塗る\n phase = phaseArray[i].name;\n }\n }\n // 次のフェーズが空の場合もあるため今回のフェーズを取っておく\n fromPhase = phaseArray[i].name;\n fromDate = phaseArray[i].date ?? \"\";\n }\n\n return {\n ...acc,\n [date]: {\n hasData: false,\n type: phase,\n text: \"\",\n initial: \"\",\n color: phase && getFillerColor(phase),\n },\n };\n }, {});\n};\n\nexport const ganttifyProject = (project: Project, dates: string[]) => {\n if (!project.schedules) return project;\n const schedules = project.schedules?.items.reduce((acc, schedule) => {\n if (!schedule) return acc;\n const scheduleDates = getScheduleDates(schedule, dates);\n (acc as any).push({ ...schedule, ...scheduleDates });\n return acc;\n }, []);\n project.schedules.items = schedules;\n return project;\n};\n","export * from \"./case\";\nexport * from \"./m3\";\nexport * from \"./dates\";\nexport * from \"./filter\";\nexport * from \"./focus\";\nexport * from \"./shift\";\nexport * from \"./sort\";\nexport * from \"./types\";\nexport * from \"./update\";\nexport * from \"./project\";\n","\"use strict\";\n(self[\"webpackChunk_N_E\"] = self[\"webpackChunk_N_E\"] || []).push([[4729],{\n\n/***/ 94890:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"F\": function() { return /* binding */ GanttProvider; },\n/* harmony export */ \"Y\": function() { return /* binding */ useGantt; }\n/* harmony export */ });\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294);\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30381);\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var nookies__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(62286);\n/* harmony import */ var nookies__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(nookies__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(87633);\n/* harmony import */ var aws_amplify__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(10552);\n/* harmony import */ var _auth__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(17297);\n/* harmony import */ var _alerts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(75313);\n/* harmony import */ var graphql_queries__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(18490);\n/* harmony import */ var utils_gantt__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4486);\n/* harmony import */ var hooks_query__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(92945);\n/* harmony import */ var utils_status__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(58142);\n/* harmony import */ var utils_cookie__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(41392);\n/* harmony import */ var utils_error__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(78191);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst GanttContext = /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)({\n projects: [],\n refetchProjects: ()=>Promise.resolve(),\n dateRange: {\n startDate: moment__WEBPACK_IMPORTED_MODULE_2___default()().startOf(\"week\").toDate(),\n endDate: moment__WEBPACK_IMPORTED_MODULE_2___default()().endOf(\"week\").toDate()\n },\n setDateRange: ()=>{},\n dateLabel: null,\n setDateLabel: ()=>null,\n dates: (0,utils_gantt__WEBPACK_IMPORTED_MODULE_6__/* .enumerateDaysBetweenDates */ .F9)(moment__WEBPACK_IMPORTED_MODULE_2___default()().startOf(\"week\"), moment__WEBPACK_IMPORTED_MODULE_2___default()().endOf(\"week\")),\n focus: ()=>null,\n m3: {},\n cs: {},\n sort: \"sortByName\",\n setSort: ()=>{},\n m3Visible: true,\n setM3Visible: ()=>null,\n caseVisible: true,\n setCaseVisible: ()=>null,\n visibleKeyDates: {\n beforeStockingDate: true,\n stockingDate: true,\n beforePackagingDate: true,\n packagingDate: true,\n beforeShippingDate: true,\n shippingDate: true,\n beforeCutDate: true,\n cutDate: true,\n afterCutDate: true\n },\n setVisibleKeyDates: ()=>null,\n status: [],\n setStatus: ()=>null,\n keyword: null,\n setKeyword: ()=>null,\n column: [],\n setColumn: ()=>null,\n isFilterSaved: false,\n setIsFilterSaved: ()=>null,\n loading: false\n});\nconst filterProjectByKeyword = (data, keyword, statusFilter)=>{\n let projects = data;\n if (keyword) projects = projects.filter((d)=>{\n var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10;\n return d.name.includes(keyword) || ((ref = d.user) === null || ref === void 0 ? void 0 : ref.firstName.includes(keyword)) || ((ref1 = d.user) === null || ref1 === void 0 ? void 0 : ref1.lastName.includes(keyword)) || ((ref2 = d.managerName) === null || ref2 === void 0 ? void 0 : ref2.includes(keyword)) || ((ref3 = d.quoterName) === null || ref3 === void 0 ? void 0 : ref3.includes(keyword)) || ((ref4 = d.operatorName) === null || ref4 === void 0 ? void 0 : ref4.includes(keyword)) || ((ref5 = d.accountName) === null || ref5 === void 0 ? void 0 : ref5.includes(keyword)) || ((ref6 = d.contactName) === null || ref6 === void 0 ? void 0 : ref6.includes(keyword)) || ((ref7 = d.reference) === null || ref7 === void 0 ? void 0 : ref7.includes(keyword)) || ((ref8 = d.category) === null || ref8 === void 0 ? void 0 : ref8.name.includes(keyword)) || (0,utils_status__WEBPACK_IMPORTED_MODULE_8__/* .getStatusText */ .li)(d.status).includes(keyword) || ((ref9 = d.schedules) === null || ref9 === void 0 ? void 0 : (ref10 = ref9.items) === null || ref10 === void 0 ? void 0 : ref10.some((s)=>{\n var ref, ref1, ref2, ref3, ref4;\n return (s === null || s === void 0 ? void 0 : (ref = s.beforeStockingName) === null || ref === void 0 ? void 0 : ref.includes(keyword)) || (s === null || s === void 0 ? void 0 : (ref1 = s.beforePackagingName) === null || ref1 === void 0 ? void 0 : ref1.includes(keyword)) || (s === null || s === void 0 ? void 0 : (ref2 = s.beforeShippingName) === null || ref2 === void 0 ? void 0 : ref2.includes(keyword)) || (s === null || s === void 0 ? void 0 : (ref3 = s.beforeCutName) === null || ref3 === void 0 ? void 0 : ref3.includes(keyword)) || (s === null || s === void 0 ? void 0 : (ref4 = s.afterCutName) === null || ref4 === void 0 ? void 0 : ref4.includes(keyword));\n }));\n });\n if (statusFilter.length > 0) {\n projects = projects.filter((d)=>statusFilter.includes(d.status));\n }\n return projects;\n};\nconst GanttProvider = (param)=>{\n let { children } = param;\n var ref, ref1;\n const cookies = (0,nookies__WEBPACK_IMPORTED_MODULE_3__.parseCookies)();\n const isFilterApplied = (0,utils_cookie__WEBPACK_IMPORTED_MODULE_9__/* .parseCookieBooleanValue */ .u)(cookies.isFilterSaved);\n const { currentGroup } = (0,_auth__WEBPACK_IMPORTED_MODULE_4__/* .useAuth */ .a)();\n const [keyword, setKeyword] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(isFilterApplied && cookies.ganttKeyword ? cookies.ganttKeyword : null);\n const [m3Visible, setM3Visible] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"m3\", true);\n const [caseVisible, setCaseVisible] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"case\", true);\n const [beforeStock, setBeforeStock] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"beforeStock\", true);\n const [stock, setStock] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"stock\", true);\n const [beforePack, setBeforePack] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"beforePack\", true);\n const [pack, setPack] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"pack\", true);\n const [beforeShip, setBeforeShip] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"beforeShip\", true);\n const [ship, setShip] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"ship\", true);\n const [beforeCut, setBeforeCut] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"beforeCut\", true);\n const [cut, setCut] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"cut\", true);\n const [afterCut, setAfterCut] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"afterCut\", true);\n const [status, setStatus] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"status\", isFilterApplied && cookies.ganttStatus ? (ref = cookies.ganttStatus) === null || ref === void 0 ? void 0 : ref.split(\",\") : [\n \"ORDER\",\n \"STOCK\",\n \"PACK\",\n \"SHIP\"\n ], (value)=>value.split(\"_\"), (value)=>value.join(\"_\"));\n const { addAlert } = (0,_alerts__WEBPACK_IMPORTED_MODULE_5__/* .useAlerts */ .Z)();\n // PAX-607 dateLabelをcookieから取得\n const [dateLabel, setDateLabel] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(isFilterApplied && cookies.ganttDateLabel ? cookies.ganttDateLabel : null);\n // PAX-360 ピンが設定されてかつcookieにDate情報があればcookie内の日付に設定\\\n // PAX-607 useQueryからuseStateに変更\n const [startDate, setStartDate] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(isFilterApplied && cookies.ganttStartDate ? moment__WEBPACK_IMPORTED_MODULE_2___default()(cookies.ganttStartDate).toDate() : moment__WEBPACK_IMPORTED_MODULE_2___default()().toDate());\n const [endDate, setEndDate] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(isFilterApplied && cookies.ganttEndDate ? moment__WEBPACK_IMPORTED_MODULE_2___default()(cookies.ganttEndDate).toDate() : moment__WEBPACK_IMPORTED_MODULE_2___default()().add(7, \"day\").toDate());\n const dateRange = {\n startDate,\n endDate\n };\n const dates = (0,utils_gantt__WEBPACK_IMPORTED_MODULE_6__/* .enumerateDaysBetweenDates */ .F9)(moment__WEBPACK_IMPORTED_MODULE_2___default()(startDate), moment__WEBPACK_IMPORTED_MODULE_2___default()(endDate));\n const visibleKeyDates = {\n beforeStockingDate: beforeStock,\n stockingDate: stock,\n beforePackagingDate: beforePack,\n packagingDate: pack,\n beforeShippingDate: beforeShip,\n shippingDate: ship,\n beforeCutDate: beforeCut,\n cutDate: cut,\n afterCutDate: afterCut\n };\n const { data: filteredProjects = [] , isLoading: loading , refetch } = (0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_11__/* .useQuery */ .a)({\n queryKey: [\n \"projectsByGroupIdForManager\",\n currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id,\n status,\n dates,\n visibleKeyDates\n ],\n queryFn: async ()=>{\n let nextToken = null;\n let allItems = [];\n try {\n while(true){\n const res = await aws_amplify__WEBPACK_IMPORTED_MODULE_12__/* .API.graphql */ .b.graphql({\n query: graphql_queries__WEBPACK_IMPORTED_MODULE_13__.projectsByGroupIdForManager,\n variables: {\n groupId: currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id,\n status,\n dates,\n visibleKeyDates,\n filter: {\n archived: {\n ne: true\n }\n },\n sortDirection: \"DESC\",\n nextToken\n },\n authMode: \"AMAZON_COGNITO_USER_POOLS\"\n });\n const items = res.data.projectsByGroupIdForManager.items;\n allItems = allItems.concat(items);\n nextToken = res.data.projectsByGroupIdForManager.nextToken;\n if (!nextToken) break;\n }\n return allItems.sort((a, b)=>(0,utils_status__WEBPACK_IMPORTED_MODULE_8__/* .getStatusIndex */ .Nz)(a.status) - (0,utils_status__WEBPACK_IMPORTED_MODULE_8__/* .getStatusIndex */ .Nz)(b.status));\n } catch (err) {\n const customError = new utils_error__WEBPACK_IMPORTED_MODULE_10__/* .CustomError */ .s(err, \"get\");\n addAlert({\n message: customError.message,\n severity: \"error\"\n });\n }\n },\n staleTime: 1000 * 60 * 5,\n gcTime: 1000 * 60 * 6\n });\n const [sort, setSort] = (0,hooks_query__WEBPACK_IMPORTED_MODULE_7__/* [\"default\"] */ .Z)(\"sort\", isFilterApplied && cookies.ganttSort ? cookies.ganttSort : \"sortByPackage\");\n const [column, setColumn] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(isFilterApplied && cookies.ganttColumn ? (ref1 = cookies.ganttColumn) === null || ref1 === void 0 ? void 0 : ref1.split(\",\") : [\n \"recentlyScheduleUpdated\",\n \"name\",\n \"reference\",\n \"accountName\",\n \"s.name\"\n ]);\n // PAX-360 Gantt検索条件はCookieに保存する、そのトグル\n const [isFilterSaved, setIsFilterSaved] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(isFilterApplied);\n if (isFilterSaved) {\n (0,nookies__WEBPACK_IMPORTED_MODULE_3__.setCookie)(null, \"ganttStatus\", status.join(\",\"), utils_cookie__WEBPACK_IMPORTED_MODULE_9__/* .defaultCookieOptions */ .R);\n (0,nookies__WEBPACK_IMPORTED_MODULE_3__.setCookie)(null, \"ganttStartDate\", startDate.toString(), utils_cookie__WEBPACK_IMPORTED_MODULE_9__/* .defaultCookieOptions */ .R);\n (0,nookies__WEBPACK_IMPORTED_MODULE_3__.setCookie)(null, \"ganttEndDate\", endDate.toString(), utils_cookie__WEBPACK_IMPORTED_MODULE_9__/* .defaultCookieOptions */ .R);\n (0,nookies__WEBPACK_IMPORTED_MODULE_3__.setCookie)(null, \"ganttDateLabel\", dateLabel !== null && dateLabel !== void 0 ? dateLabel : \"\", utils_cookie__WEBPACK_IMPORTED_MODULE_9__/* .defaultCookieOptions */ .R); // PAX-607 dateLabelも合わせてCookieに保存\n (0,nookies__WEBPACK_IMPORTED_MODULE_3__.setCookie)(null, \"ganttSort\", sort, utils_cookie__WEBPACK_IMPORTED_MODULE_9__/* .defaultCookieOptions */ .R);\n (0,nookies__WEBPACK_IMPORTED_MODULE_3__.setCookie)(null, \"ganttColumn\", column.join(\",\"), utils_cookie__WEBPACK_IMPORTED_MODULE_9__/* .defaultCookieOptions */ .R);\n (0,nookies__WEBPACK_IMPORTED_MODULE_3__.setCookie)(null, \"ganttKeyword\", keyword !== null && keyword !== void 0 ? keyword : \"\", utils_cookie__WEBPACK_IMPORTED_MODULE_9__/* .defaultCookieOptions */ .R);\n }\n // PAX-360 Cookieには文字列しか格納できないため,文字列\"true\", \"false\"を利用\n (0,nookies__WEBPACK_IMPORTED_MODULE_3__.setCookie)(null, \"isFilterSaved\", isFilterSaved ? \"true\" : \"false\", utils_cookie__WEBPACK_IMPORTED_MODULE_9__/* .defaultCookieOptions */ .R);\n // deep copy (projects.Schedulesの表示期間対応)\n const editProjects = structuredClone(filteredProjects);\n const m3 = (0,utils_gantt__WEBPACK_IMPORTED_MODULE_6__/* .getM3Schedule */ .zI)(editProjects);\n const cs = (0,utils_gantt__WEBPACK_IMPORTED_MODULE_6__/* .getCaseSchedule */ .LI)(editProjects);\n const keywordFilteredProjects = filterProjectByKeyword(editProjects, keyword, status);\n // projects[]以下にbeforeIdxというパラメータがあったらscheduleのドラッグ&ドロップで更新されたものとして仕分ける\n const dndProjects = keywordFilteredProjects.filter((p)=>p.beforeIdx !== undefined);\n const noDndProjects = keywordFilteredProjects.filter((p)=>p.beforeIdx === undefined);\n // ドラッグ&ドロップの対象になってないのはsortを行う\n const sortedNoDndProjects = (0,utils_gantt__WEBPACK_IMPORTED_MODULE_6__/* .sortProjects */ .Mx)(noDndProjects, sort);\n // ドラッグ&ドロップ対象はbeforeIdxが小さい順に挿入していくので、まずはソート\n const sortedDndProjects = dndProjects.sort((a, b)=>{\n return a.beforeIdx - b.beforeIdx;\n });\n // ドラッグ&ドロップ対象の中でbeforeIdxが小さい順に挿入していく\n sortedDndProjects.forEach((p)=>{\n sortedNoDndProjects.splice(p.beforeIdx, 0, p);\n });\n const processProject = (project)=>{\n return {\n ...project,\n ...(0,utils_gantt__WEBPACK_IMPORTED_MODULE_6__/* .ganttifyProject */ .bx)(project, dates)\n };\n };\n const projects = sortedNoDndProjects.map(processProject);\n const focusSchedule = (schedule)=>{\n const { startDate , endDate } = (0,utils_gantt__WEBPACK_IMPORTED_MODULE_6__/* .getFocusedDateRange */ .ug)(schedule, dates, visibleKeyDates);\n setStartDate(startDate);\n setEndDate(endDate);\n };\n const setDateRange = (param)=>{\n let { startDate , endDate } = param;\n setStartDate(startDate || new Date());\n setEndDate(endDate || new Date());\n };\n const setProjectStatus = (status)=>{\n setStatus(status);\n };\n const setVisibleKeyDates = (visibleKeyDates)=>{\n setBeforeStock(visibleKeyDates.beforeStockingDate);\n setStock(visibleKeyDates.stockingDate);\n setBeforePack(visibleKeyDates.beforePackagingDate);\n setPack(visibleKeyDates.packagingDate);\n setBeforeShip(visibleKeyDates.beforeShippingDate);\n setShip(visibleKeyDates.shippingDate);\n setBeforeCut(visibleKeyDates.beforeCutDate);\n setCut(visibleKeyDates.cutDate);\n setAfterCut(visibleKeyDates.afterCutDate);\n };\n return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(GanttContext.Provider, {\n value: {\n projects,\n loading,\n refetchProjects: async ()=>{\n refetch();\n },\n dateRange,\n setDateRange,\n dateLabel,\n setDateLabel,\n dates,\n focus: focusSchedule,\n sort,\n setSort,\n m3,\n cs,\n m3Visible,\n setM3Visible,\n caseVisible,\n setCaseVisible,\n visibleKeyDates,\n setVisibleKeyDates,\n status,\n setStatus: setProjectStatus,\n keyword,\n setKeyword,\n column,\n setColumn,\n isFilterSaved,\n setIsFilterSaved\n },\n children: children\n });\n};\nconst useGantt = ()=>{\n const accountsContext = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(GanttContext);\n if (accountsContext === undefined) {\n throw new Error(\"useGantt must be within AuthProvider\");\n }\n return accountsContext;\n};\n\n\n/***/ }),\n\n/***/ 84729:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, {\n \"e\": function() { return /* binding */ GroupReportsProvider; },\n \"L\": function() { return /* binding */ useGroupReports; }\n});\n\n// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js\nvar jsx_runtime = __webpack_require__(85893);\n// EXTERNAL MODULE: ./node_modules/react/index.js\nvar react = __webpack_require__(67294);\n// EXTERNAL MODULE: ./node_modules/@aws-amplify/storage/lib-esm/index.js + 94 modules\nvar lib_esm = __webpack_require__(7370);\n// EXTERNAL MODULE: ./node_modules/short-uuid/index.js\nvar short_uuid = __webpack_require__(7597);\n// EXTERNAL MODULE: ./src/contexts/alerts.tsx + 6 modules\nvar alerts = __webpack_require__(75313);\n// EXTERNAL MODULE: ./src/contexts/auth.tsx + 2 modules\nvar auth = __webpack_require__(17297);\n// EXTERNAL MODULE: ./src/contexts/gantt.tsx\nvar gantt = __webpack_require__(94890);\n// EXTERNAL MODULE: ./src/hooks/datalist.ts\nvar datalist = __webpack_require__(32380);\n// EXTERNAL MODULE: ./src/contexts/dialog.tsx\nvar dialog = __webpack_require__(3780);\n// EXTERNAL MODULE: ./node_modules/moment/moment.js\nvar moment = __webpack_require__(30381);\nvar moment_default = /*#__PURE__*/__webpack_require__.n(moment);\n// EXTERNAL MODULE: ./node_modules/axios/lib/axios.js + 42 modules\nvar axios = __webpack_require__(5121);\n;// CONCATENATED MODULE: ./src/utils/groupReport/render/xlsx.ts\n\nasync function renderSpreadsheet(blob, data, report) {\n const body = new FormData();\n body.append(\"file\", blob);\n body.append(\"data\", JSON.stringify(data));\n body.append(\"report\", JSON.stringify(report));\n const res = await axios/* default.post */.Z.post(\"/api/xlsx\", body);\n return res.data;\n}\n\n;// CONCATENATED MODULE: ./src/utils/groupReport/data/xlsx/project.ts\n// 予定の出力のためにprojectデータを集計します\nfunction makeProjectsToPlanData(projects, dates) {\n // 集計時に結果を入れる変数\n const pickedStockProjects = [];\n const pickedShipProjects = [];\n const pickedCutProjects = [];\n const pickedPackProjects = [];\n // Date中心に集計する\n // dates(= 今回対象としている日付の範囲)でloopを回し\n // scheduleのstockingDate/shippingDate/cutDateがdatesの中にあったら結果に含める\n for (const d of dates){\n for (const p of projects){\n var ref, ref1, ref2, ref3;\n // projectのscheduleの中から、stockingDateが今回対象としている日付の範囲にあるものを抽出する\n const stockSchedules = (ref = p.schedules) === null || ref === void 0 ? void 0 : ref.items.filter((s)=>{\n return (s === null || s === void 0 ? void 0 : s.stockingDate) === d;\n });\n // stockingDateが今回対象としている日付の範囲にあるものがなかったら終了\n if (stockSchedules.length !== 0) {\n // 今回対象としている日付の範囲にあるものがあったら、結果に含める\n for (const s of stockSchedules){\n const project = {\n id: p.id,\n reference: p.reference || \"-\",\n name: p.name || \"-\",\n accountName: p.accountName || \"-\",\n scheduleStockingDate: s.stockingDate || \"-\",\n scheduleId: s.id || \"-\",\n scheduleName: s.name || \"-\",\n scheduleCase: getCaseCountInSchedule(s).toString()\n };\n pickedStockProjects.push(project);\n }\n }\n // 同上の方法で、shippingDateが今回対象としている日付の範囲にあるものを抽出する\n const shipSchedules = (ref1 = p.schedules) === null || ref1 === void 0 ? void 0 : ref1.items.filter((s)=>{\n return (s === null || s === void 0 ? void 0 : s.shippingDate) === d;\n });\n // shippingDateが今回対象としている日付の範囲にあるものがなかったら終了\n if (shipSchedules.length !== 0) {\n // 今回対象としている日付の範囲にあるものがあったら、結果に含める\n for (const s1 of shipSchedules){\n const project1 = {\n id: p.id,\n reference: p.reference || \"-\",\n name: p.name || \"-\",\n accountName: p.accountName || \"-\",\n scheduleShippingDate: s1.shippingDate || \"-\",\n scheduleId: s1.id || \"-\",\n scheduleName: s1.name || \"-\",\n scheduleShipType: s1.shipType || \"-\",\n scheduleCase: getCaseCountInSchedule(s1).toString(),\n scheduleCutDate: s1.cutDate || \"-\"\n };\n pickedShipProjects.push(project1);\n }\n }\n // cutDateが今回対象としている日付の範囲にあるものを抽出する\n const cutSchedules = (ref2 = p.schedules) === null || ref2 === void 0 ? void 0 : ref2.items.filter((s)=>{\n return (s === null || s === void 0 ? void 0 : s.cutDate) === d;\n });\n // cutDateが今回対象としている日付の範囲にあるものがなかったら終了\n if (cutSchedules.length !== 0) {\n // 今回対象としている日付の範囲にあるものがあったら、結果に含める\n for (const s2 of cutSchedules){\n const project2 = {\n id: p.id,\n reference: p.reference || \"-\",\n name: p.name || \"-\",\n accountName: p.accountName || \"-\",\n scheduleShippingDate: s2.shippingDate || \"-\",\n scheduleId: s2.id || \"-\",\n scheduleName: s2.name || \"-\",\n scheduleShipType: s2.shipType || \"-\",\n scheduleCase: getCaseCountInSchedule(s2).toString(),\n scheduleCutDate: s2.cutDate || \"-\"\n };\n pickedCutProjects.push(project2);\n }\n }\n // packDateが今回対象としている日付と同じものを抽出\n const packSchedules = (ref3 = p.schedules) === null || ref3 === void 0 ? void 0 : ref3.items.filter((s)=>{\n return (s === null || s === void 0 ? void 0 : s.packagingDate) === d;\n });\n // packDateが今回対象としている日付の範囲にあるものがなかったら終了\n if (packSchedules.length !== 0) {\n // 今回対象としている日付の範囲にあるものがあったら、結果に含める\n for (const s3 of packSchedules){\n var ref4;\n // productごとに作成する\n for (const product of ((ref4 = s3.products) === null || ref4 === void 0 ? void 0 : ref4.items) || []){\n var ref5;\n if (product === null) continue;\n const project3 = {\n id: p.id,\n reference: p.reference || \"-\",\n name: p.name || \"-\",\n accountName: p.accountName || \"-\",\n scheduleId: s3.id || \"-\",\n scheduleName: s3.name || \"-\",\n schedulePackagingDate: s3.packagingDate || \"-\",\n scheduleProductName: product.name || \"-\",\n scheduleProductPackageTypeName: product.packageTypeName || \"-\",\n scheduleProductQuantity: ((ref5 = product.quantity) === null || ref5 === void 0 ? void 0 : ref5.toString()) || \"-\"\n };\n pickedPackProjects.push(project3);\n }\n }\n }\n }\n }\n return {\n stockData: {\n stockingDate: \"\".concat(dates[0], \" ~ \").concat(dates[dates.length - 1]),\n project: pickedStockProjects\n },\n shipData: {\n shippingDate: \"\".concat(dates[0], \" ~ \").concat(dates[dates.length - 1]),\n project: pickedShipProjects\n },\n cutData: {\n cutDate: \"\".concat(dates[0], \" ~ \").concat(dates[dates.length - 1]),\n project: pickedCutProjects\n },\n packData: {\n packagingDate: \"\".concat(dates[0], \" ~ \").concat(dates[dates.length - 1]),\n project: pickedPackProjects\n }\n };\n}\n// scheduleのcase数を計算する(scheduleの下のproductsのquantityの合算)\nconst getCaseCountInSchedule = (s)=>{\n var ref;\n if (s.products === undefined || s.products === null) return 0;\n return (ref = s.products) === null || ref === void 0 ? void 0 : ref.items.reduce((acc, cur)=>{\n return acc + ((cur === null || cur === void 0 ? void 0 : cur.quantity) || 0);\n }, 0);\n};\n\n// EXTERNAL MODULE: ./node_modules/@aws-amplify/api/lib-esm/API.js + 1 modules\nvar lib_esm_API = __webpack_require__(10552);\n// EXTERNAL MODULE: ./src/graphql/queries.ts\nvar queries = __webpack_require__(18490);\n;// CONCATENATED MODULE: ./src/utils/groupReport/data/xlsx/product.ts\n\n\nasync function getProductDataByScheduleId(scheduleId) {\n const p = (await lib_esm_API/* API.graphql */.b.graphql({\n query: queries.productsByScheduleId,\n variables: {\n scheduleId\n },\n authMode: \"AMAZON_COGNITO_USER_POOLS\"\n })).data.productsByScheduleId;\n const products = p.items.map((item)=>{\n return {\n __typename: \"Product\",\n ...item\n };\n });\n return Promise.resolve(products);\n}\nasync function getProductDataByProjectId(projectId) {\n const p = (await API.graphql({\n query: productsByProjectId,\n variables: {\n projectId\n },\n authMode: \"AMAZON_COGNITO_USER_POOLS\"\n })).data.productsByProjectId;\n const products = p.items.map((item)=>{\n return {\n __typename: \"Product\",\n ...item\n };\n });\n return Promise.resolve(products);\n}\nasync function listMaterials(groupId) {\n const materials = (await API.graphql({\n query: materialsByGroupId,\n variables: {\n groupId\n },\n authMode: \"AMAZON_COGNITO_USER_POOLS\"\n })).data.materialsByGroupId;\n return materials;\n}\nasync function listSummarizedMaterialsQuery(groupId, materialTypeId, startDate, endDate) {\n let nextToken = null;\n const results = [];\n let index = 1;\n do {\n const response = await lib_esm_API/* API.graphql */.b.graphql({\n query: queries.listSummarizedMaterials,\n variables: {\n input: {\n groupId,\n materialTypeId,\n startDate,\n endDate\n },\n nextToken\n },\n authMode: \"AMAZON_COGNITO_USER_POOLS\"\n });\n const data = response.data.listSummarizedMaterials;\n results.push(...data.items.map((item)=>({\n ...item,\n index: index++\n })));\n nextToken = data.nextToken;\n }while (nextToken);\n return results;\n}\n\n// EXTERNAL MODULE: ./src/utils/status.ts\nvar utils_status = __webpack_require__(58142);\n;// CONCATENATED MODULE: ./src/utils/groupReport/data/xlsx/invoice.ts\n\n\n\n\nasync function listSummarizedInvoicesQuery(groupId, key, startDate, endDate) {\n const result = {\n __typename: \"SummarizedInvoicesOutput\",\n key: key,\n items: []\n };\n const limit = 100; //PAX-651 ページネーション毎回5個の請求を取得\n let nextToken = null;\n do {\n var ref;\n const response = await lib_esm_API/* API.graphql */.b.graphql({\n query: queries.listSummarizedInvoices,\n variables: {\n input: {\n key,\n groupId,\n startDate,\n endDate,\n limit,\n nextToken\n }\n },\n authMode: \"AMAZON_COGNITO_USER_POOLS\"\n });\n result.items = [\n ...result.items || [],\n ...((ref = response.data.listSummarizedInvoices.items) === null || ref === void 0 ? void 0 : ref.filter((item)=>item !== null)) || []\n ];\n nextToken = response.data.listSummarizedInvoices.nextToken;\n }while (nextToken);\n return result;\n}\n// SummarizedInvoiceに対して以下を行う\n// 1. createdAtとupdatedAtをJST(YYYY-MM-DD HH24:MI:SS)にする\n// 2. recordingDateをJST(YYYY-MM-DD)にする\n// 3. projectStatusを日本語にする\nconst reformatSummarizedInvoices = (items)=>{\n const toDateTimeKeys = [\n \"createdAt\",\n \"updatedAt\",\n \"lineCreatedAt\",\n \"lineUpdatedAt\"\n ];\n const toDateKeys = [\n \"recordingDate\",\n \"issueDate\",\n \"billingDate\"\n ];\n return items.sort((a, b)=>a.lineOrder - b.lineOrder).map((item)=>{\n toDateTimeKeys.forEach((key)=>{\n // 無効な日付の場合は空文字にする\n if (!moment_default()(item[key]).isValid()) {\n item[key] = \"\";\n }\n if (item[key]) {\n item[key] = moment_default()(item[key]).format(\"YYYY-MM-DD HH:mm:ss\");\n }\n });\n toDateKeys.forEach((key)=>{\n // 無効な日付の場合は空文字にする\n if (!moment_default()(item[key]).isValid()) {\n item[key] = \"\";\n }\n if (item[key]) {\n item[key] = moment_default()(item[key]).format(\"YYYY-MM-DD\");\n }\n });\n // 案件ステータス\n if (item[\"projectStatus\"]) {\n item[\"projectStatus\"] = (0,utils_status/* getStatusText */.li)(item[\"projectStatus\"]);\n }\n return item;\n });\n};\n\n;// CONCATENATED MODULE: ./src/utils/groupReport/data/xlsx/index.ts\n\n\n\nasync function makeXlsxData(reportType, groupId, projects, dates, scope) {\n if (reportType === \"PLAN\") {\n // projectsのscheduleごとにproductを持ってきてセットする\n const newProjects = projects.map(async (p)=>{\n var ref;\n const newSchedules = (ref = p.schedules) === null || ref === void 0 ? void 0 : ref.items.map(async (s)=>{\n if (s === null || s === void 0 ? void 0 : s.id) {\n // ここで取得\n const products = await getProductDataByScheduleId(s.id);\n const connection = {\n __typename: \"ModelProductConnection\",\n items: products\n };\n s.products = connection;\n }\n return s;\n });\n if (newSchedules !== undefined && p.schedules !== null && p.schedules !== undefined) {\n p.schedules.items = await Promise.all(newSchedules);\n }\n return p;\n });\n return makeProjectsToPlanData(await Promise.all(newProjects), dates);\n } else if (reportType === \"WOOD\") {\n const { materialTypeId } = scope || {};\n if (!materialTypeId) throw Error(\"materialTypeId is not defined\");\n const startDate = dates[0];\n const endDate = dates.at(-1) || dates[0];\n const summarizedMaterials = await listSummarizedMaterialsQuery(groupId, materialTypeId, startDate, endDate);\n return {\n materials: summarizedMaterials\n };\n } else if (reportType === \"GROUPINVOICE\") {\n const startDate1 = dates[0];\n const endDate1 = dates.at(-1) || dates[0];\n const keys = [\n \"issueDate\",\n \"billingDate\",\n \"recordingDate\"\n ];\n const summarizedInvoicesPromises = keys.map((key)=>listSummarizedInvoicesQuery(groupId, key, startDate1, endDate1));\n const summarizedInvoices = await Promise.all(summarizedInvoicesPromises);\n const data = {};\n const dateRange = \"\".concat(startDate1, \" ~ \").concat(endDate1);\n // レンダリング時にで参照する\n for (const invoice of summarizedInvoices){\n var ref;\n const keyData = invoice.key.replace(\"Date\", \"Data\");\n data[keyData] = {\n [invoice.key]: dateRange,\n invoices: reformatSummarizedInvoices(((ref = invoice.items) === null || ref === void 0 ? void 0 : ref.filter((item)=>item !== null)) || [])\n };\n }\n return data;\n }\n}\n\n;// CONCATENATED MODULE: ./src/utils/groupReport/data/index.ts\n\nasync function makeData(type, reportType, groupId, projects, dates, scope) {\n // phase2では使わない\n //if (type === \"DOCUMENT\") return getDocxData(reportType, groupId);\n if (type === \"SPREADSHEET\") return makeXlsxData(reportType, groupId, projects, dates, scope);\n}\n\n// EXTERNAL MODULE: ./src/utils/files.tsx\nvar files = __webpack_require__(61142);\n// EXTERNAL MODULE: ./src/utils/report/index.ts + 16 modules\nvar utils_report = __webpack_require__(73228);\n;// CONCATENATED MODULE: ./src/utils/groupReport/index.ts\n\n\n\n\n\n\n\nasync function download(report, groupId, projects, dates) {\n try {\n const type = report.type;\n const dataType = report.data;\n const reportScope = JSON.parse(report.scope || \"{}\");\n const [data, file] = await Promise.all([\n makeData(type, dataType, groupId, projects, dates, reportScope),\n lib_esm/* Storage.get */.Ke.get(report.template.key, {\n download: true,\n cacheControl: \"no-cache, no-store, must-revalidate\"\n })\n ]);\n // dataがvoidだったらここで終わり\n if (!data) return;\n const fileName = \"\".concat(report.name, \"_\").concat(moment_default()().format(\"YYYYMMDDHHmmss\"));\n // phase2では使わない\n // if (type === \"DOCUMENT\") {\n // for (const d in data) {\n // const blob = await renderDocument(file.Body as Blob, d);\n // await downloadFile(fileName, blob);\n // }\n // }\n if (type === \"SPREADSHEET\") {\n const renderData = await renderSpreadsheet(file.Body, data, report);\n await (0,files/* downloadFile */.Sv)((0,utils_report/* replaceFileName */.Lz)(fileName), renderData.base64, \"base64\");\n }\n } catch (e) {\n throw Error(e);\n }\n}\n\n;// CONCATENATED MODULE: ./src/contexts/groupReports.tsx\n/* eslint-disable react-hooks/exhaustive-deps */ \n\n\n\n\n\n\n\n\n\n\n\nconst GroupReportsContext = /*#__PURE__*/ (0,react.createContext)({\n reports: [],\n planReports: [],\n woodReports: [],\n invoiceReports: [],\n loading: false,\n exporting: false,\n create: ()=>Promise.resolve(),\n remove: ()=>Promise.resolve(),\n download: ()=>Promise.resolve(),\n downloadTemplate: ()=>Promise.resolve()\n});\nconst GroupReportsProvider = (param)=>{\n let { children } = param;\n const { currentGroup } = (0,auth/* useAuth */.a)();\n const { data , loading , refetch , create , remove } = (0,datalist/* default */.Z)({\n query: \"groupReportsByGroupId\",\n variables: {\n groupId: currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id\n }\n });\n const { projects , dates } = (0,gantt/* useGantt */.Y)();\n const [exporting, setExporting] = (0,react.useState)(false);\n const [error, setError] = (0,react.useState)(false);\n const [exportingReports, setExportingReports] = (0,react.useState)([]);\n const { open } = (0,dialog/* useDialog */.R)();\n const { addAlert } = (0,alerts/* useAlerts */.Z)();\n (0,react.useEffect)(()=>{\n refetch({\n groupId: currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id\n });\n }, [\n currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id\n ]);\n const createReport = async (input)=>{\n // phase2ではDocument対応しないのでエラーを出す\n if (input.type === \"DOCUMENT\") {\n addAlert({\n message: \"Phase2では案件横断帳票はDOCUMENT(WORD)に対応していません\",\n severity: \"error\"\n });\n return;\n }\n await create(\"createGroupReport\", {\n ...input,\n groupId: currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id\n });\n };\n const removeReport = async (id)=>{\n open({\n title: \"案件横断帳票を削除しますか?\",\n content: \"削除すると二度と戻せません\",\n okText: \"削除\",\n onOk: async ()=>{\n const file = data.filter((d)=>d.id === id)[0];\n await lib_esm/* Storage.remove */.Ke.remove(file.template.key);\n await remove(\"deleteGroupReport\", {\n id\n });\n }\n });\n };\n (0,react.useEffect)(()=>{\n if (exporting && !error && exportingReports.length <= 0) {\n addAlert({\n message: \"案件横断帳票が全て出力されました\",\n severity: \"success\"\n });\n setExporting(false);\n document.body.style.cursor = \"\";\n return setExportingReports([]);\n } else if (exporting && !error) {\n addAlert({\n message: \"案件横断帳票を出力中です\",\n severity: \"info\"\n });\n } else if (error) {\n setError(false);\n setExporting(false);\n document.body.style.cursor = \"\";\n return setExportingReports([]);\n }\n }, [\n exportingReports\n ]);\n const downloadGroupReport = async (report)=>{\n setError(false);\n const exportId = (0,short_uuid.uuid)();\n setExporting(true);\n document.body.style.cursor = \"progress\";\n setExportingReports([\n ...exportingReports,\n exportId\n ]);\n try {\n if (currentGroup) await download(report, currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id, projects, dates);\n } catch (err) {\n setError(true);\n if (typeof err === \"string\") {\n addAlert({\n message: \"\".concat(report.name, \"が出力されませんでした: \").concat(err),\n severity: \"error\"\n });\n } else if (err instanceof Error) {\n addAlert({\n message: \"\".concat(report.name, \"が出力されませんでした: \").concat(err.message),\n severity: \"error\"\n });\n } else {\n addAlert({\n message: \"\".concat(report.name, \"が出力されませんでした\"),\n severity: \"error\"\n });\n }\n } finally{\n setExportingReports(exportingReports.filter((e)=>e !== exportId));\n }\n };\n return /*#__PURE__*/ (0,jsx_runtime.jsx)(GroupReportsContext.Provider, {\n value: {\n reports: data,\n planReports: data ? data.filter((d)=>d.data === \"PLAN\") : [],\n woodReports: data ? data.filter((d)=>d.data === \"WOOD\") : [],\n invoiceReports: data ? data.filter((d)=>d.data === \"GROUPINVOICE\") : [],\n loading,\n create: createReport,\n remove: removeReport,\n download: downloadGroupReport,\n downloadTemplate: utils_report/* downloadTemplate */.fQ,\n exporting\n },\n children: children\n });\n};\nconst useGroupReports = ()=>{\n const groupReportsContext = (0,react.useContext)(GroupReportsContext);\n if (groupReportsContext === undefined) {\n throw new Error(\"useGroupReports must be within GroupReportsProvider\");\n }\n return groupReportsContext;\n};\n\n\n/***/ }),\n\n/***/ 92945:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Z\": function() { return /* binding */ useQuery; }\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294);\n/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11163);\n/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(next_router__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30381);\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_2__);\n\n\n\nfunction useQuery(query, defaultValue, toData, toQuery) {\n const [data, setData] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultValue);\n const router = (0,next_router__WEBPACK_IMPORTED_MODULE_1__.useRouter)();\n if (typeof defaultValue === \"boolean\") {\n toData = toData || ((data)=>data === \"true\");\n toQuery = toQuery || ((data)=>data.toString());\n }\n if (typeof defaultValue === \"number\") {\n toData = toData || ((data)=>parseFloat(data));\n toQuery = toQuery || ((data)=>data.toString());\n }\n if (defaultValue instanceof Date) {\n toData = toData || ((data)=>moment__WEBPACK_IMPORTED_MODULE_2___default()(data).toDate());\n toQuery = toQuery || ((data)=>moment__WEBPACK_IMPORTED_MODULE_2___default()(data).format(\"YYYY-MM-DD\"));\n }\n if (typeof defaultValue !== \"string\" && typeof defaultValue !== \"boolean\" && typeof defaultValue !== \"boolean\" && defaultValue instanceof Date) {\n if (!toData) throw new Error(\"toData is required to convert query string to data\");\n if (!toQuery) throw new Error(\"toQuery is required to convert data to string\");\n }\n (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{\n if (!router.query[query]) return update(defaultValue);\n const newValue = toData ? toData(router.query[query]) : router.query[query];\n setData(newValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n router.query[query]\n ]);\n const update = (newData)=>{\n router.query[query] = toQuery ? toQuery(newData) : newData;\n router.push(router);\n };\n return [\n data,\n update\n ];\n}\n\n\n/***/ }),\n\n/***/ 4486:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, {\n \"yw\": function() { return /* reexport */ drawHolidayBorder; },\n \"gT\": function() { return /* reexport */ drawHolidayColor; },\n \"F9\": function() { return /* reexport */ enumerateDaysBetweenDates; },\n \"bx\": function() { return /* reexport */ ganttifyProject; },\n \"LI\": function() { return /* reexport */ getCaseSchedule; },\n \"ug\": function() { return /* reexport */ getFocusedDateRange; },\n \"zI\": function() { return /* reexport */ getM3Schedule; },\n \"NR\": function() { return /* reexport */ getScheduleDates; },\n \"_M\": function() { return /* reexport */ removeBeforeIdx; },\n \"Mx\": function() { return /* reexport */ sortProjects; }\n});\n\n// UNUSED EXPORTS: filterProjects, filterProjectsByDates, filterProjectsByStatus, formatDate, getCustomStatusText, getFillerColor, getHoliday, isSaturday, isSunday, shiftOneDay, unshiftOneDay, updateSchedule\n\n// EXTERNAL MODULE: ./node_modules/moment/moment.js\nvar moment_moment = __webpack_require__(30381);\nvar moment_default = /*#__PURE__*/__webpack_require__.n(moment_moment);\n;// CONCATENATED MODULE: ./src/utils/gantt/dates.ts\n\n/**\n * Formats the input date as a string using the specified format.\n * @param {string | null | undefined} date - The input date to be formatted.\n * @param {string} [format=\"MM/DD\"] - The format to use when formatting the date (default is \"MM/DD\").\n * @returns {string} - The formatted date string or \"-\" if the input date is not valid.\n */ function dates_formatDate(date) {\n let format = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"MM/DD\";\n if (!moment_default()(date).isValid()) return \"-\";\n return moment_default()(date).format(format);\n}\n/**\n * Generates an array of date strings for each day between the specified start and end dates (inclusive).\n * @param {string | Moment} startDate - The start date in \"YYYY-MM-DD\" format.\n * @param {string | Moment} endDate - The end date in \"YYYY-MM-DD\" format.\n * @returns {string[]} - An array of date strings in \"YYYY-MM-DD\" format for each day between the start and end dates.\n */ const enumerateDaysBetweenDates = (startDate, endDate)=>{\n const now = moment_default()(startDate).clone();\n const retDates = [];\n while(now.isSameOrBefore(moment_default()(endDate))){\n retDates.push(now.format(\"YYYY-MM-DD\"));\n now.add(1, \"d\");\n }\n return retDates;\n};\nconst isSaturday = (day)=>moment_default()(day).day() === 6;\nconst isSunday = (day)=>moment_default()(day).day() === 0;\nconst getHoliday = (day, holidays)=>{\n return holidays === null || holidays === void 0 ? void 0 : holidays.find((holiday)=>{\n return (holiday === null || holiday === void 0 ? void 0 : holiday.date) === day;\n });\n};\n/**\n * 休日に色を塗る処理\n * - 休日カレンダーが登録されており稼働日でない日=赤(土曜含む)\n * - 休日カレンダーが登録されており稼働日でなく土曜日=青\n * - 休日カレンダーに稼働日で登録されている=未指定\n * - 休日カレンダーに登録されていない=土曜は青、日曜は赤それ以外は白\n * @param {string} day - 対象日\n * @param {(Holiday | null)[] | undefined} holidays - 休日カレンダー\n * @returns {string} - CSSの内容\n */ const drawHolidayColor = (day, holidays)=>{\n const holiday = getHoliday(day, holidays);\n if (holiday && !(holiday === null || holiday === void 0 ? void 0 : holiday.isWorking) || !holiday && isSunday(day)) {\n return \"!bg-rose-100 !text-rose-800\";\n } else if (holiday && !(holiday === null || holiday === void 0 ? void 0 : holiday.isWorking) || !holiday && isSaturday(day)) {\n return \"!bg-sky-100 !text-indigo-800\";\n }\n return \"\";\n};\n/**\n * 平日と休日の間に白線(ボーダー)を入れる処理\n * - 本日を起点に前の日・後の日が起点日と異なる場合ボーダーを引く\n * @param {string} day - 対象日\n * @param {(Holiday | null)[] | undefined} holidays - 休日カレンダー\n * @returns {string} - CSSの内容\n */ const drawHolidayBorder = (day, holidays)=>{\n let holiday = getHoliday(day, holidays);\n let borderValue = \"\";\n // 当日\n const today = !holiday && (isSaturday(day) || isSunday(day)) || holiday && !holiday.isWorking;\n // 前日\n let targetDate = moment_default()(day).subtract(1, \"d\").format(\"YYYY-MM-DD\");\n holiday = getHoliday(targetDate, holidays);\n const yesterday = !holiday && (isSaturday(targetDate) || isSunday(targetDate)) || holiday && !holiday.isWorking || !today;\n // 翌日\n targetDate = moment_default()(day).add(1, \"d\").format(\"YYYY-MM-DD\");\n holiday = getHoliday(targetDate, holidays);\n const tomorrow = !holiday && (isSaturday(targetDate) || isSunday(targetDate)) || holiday && !holiday.isWorking || !today;\n // 設定するCSS\n if (!yesterday || !tomorrow) borderValue += \"border-solid \";\n if (!yesterday) borderValue += \"border-s-2 border-s-white \";\n if (!tomorrow) borderValue += \"border-e-2 border-e-white \";\n return borderValue.trim();\n};\n\n;// CONCATENATED MODULE: ./src/utils/gantt/case.ts\n\n\nconst updateCase = (date, value, storage)=>{\n const formattedDate = dates_formatDate(date);\n if (!storage[formattedDate]) {\n storage[formattedDate] = 0;\n }\n storage[formattedDate] += Math.ceil(value);\n};\nconst updateAccumulation = (date, value, accumulation)=>{\n const formattedDate = dates_formatDate(date);\n if (!accumulation[formattedDate]) {\n accumulation[formattedDate] = 0;\n }\n accumulation[formattedDate] += Math.ceil(value);\n};\nfunction getCaseSchedule(projects) {\n if (projects.length === 0) return {};\n const initialResult = {\n startDate: \"2100-1-1\",\n endDate: \"1990-1-1\",\n accumulation: {},\n stockingCase: {},\n packagingCase: {},\n shippingCase: {},\n cutCase: {}\n };\n const calculatedCase = projects.reduce((result, project)=>{\n const { schedules } = project;\n if (!schedules || !schedules.items || (schedules === null || schedules === void 0 ? void 0 : schedules.items.length) === 0) return result;\n schedules.items.forEach((param)=>{\n let { case: cs , stockingDate , shippingDate , packagingDate , cutDate , shipType } = param;\n if (moment_default()(stockingDate).isBefore(moment_default()(result.startDate))) result.startDate = stockingDate;\n if (moment_default()(shippingDate).isAfter(moment_default()(result.endDate))) result.endDate = shippingDate;\n if (!cs) return result;\n updateCase(stockingDate, cs, result.stockingCase);\n updateCase(packagingDate, cs, result.packagingCase);\n updateCase(shippingDate, cs, result.shippingCase);\n if (cutDate) updateCase(cutDate, cs, result.cutCase);\n updateAccumulation(stockingDate, cs, result.accumulation);\n // subtract from shipping date for normal ship type, cut date for van shipment\n if (shipType === \"バン\" && cutDate) {\n updateAccumulation(cutDate, -cs, result.accumulation);\n } else {\n updateAccumulation(shippingDate, -cs, result.accumulation);\n }\n });\n return result;\n }, initialResult);\n const dates = enumerateDaysBetweenDates(calculatedCase.startDate, calculatedCase.endDate);\n // calculate total cases per day\n const totalCase = dates.reduce((result, date)=>{\n const today = dates_formatDate(date);\n const yesterday = dates_formatDate(moment_default()(date).subtract(1, \"d\").toString());\n // copy from previous day first, and then apply accumulation\n result[today] = result[yesterday] || 0;\n result[today] += calculatedCase.accumulation[today] || 0;\n return result;\n }, {});\n return {\n stockingCase: calculatedCase.stockingCase,\n packagingCase: calculatedCase.packagingCase,\n shippingCase: calculatedCase.shippingCase,\n cutCase: calculatedCase.cutCase,\n totalCase\n };\n}\n\n;// CONCATENATED MODULE: ./src/utils/gantt/m3.ts\n\n\nconst updateM3 = (date, value, storage)=>{\n const formattedDate = dates_formatDate(date);\n if (!storage[formattedDate]) {\n storage[formattedDate] = 0;\n }\n storage[formattedDate] += Math.ceil(value);\n};\nconst m3_updateAccumulation = (date, value, accumulation)=>{\n const formattedDate = dates_formatDate(date);\n if (!accumulation[formattedDate]) {\n accumulation[formattedDate] = 0;\n }\n accumulation[formattedDate] += Math.ceil(value);\n};\nfunction getM3Schedule(projects) {\n if (projects.length === 0) return {};\n const initialResult = {\n startDate: \"2100-1-1\",\n endDate: \"1990-1-1\",\n accumulation: {},\n stockingM3: {},\n packagingM3: {},\n shippingM3: {},\n cutM3: {}\n };\n const calculatedM3 = projects.reduce((result, project)=>{\n const { schedules } = project;\n if (!schedules || !schedules.items || (schedules === null || schedules === void 0 ? void 0 : schedules.items.length) === 0) return result;\n schedules.items.forEach((param)=>{\n let { m3 , stockingDate , shippingDate , packagingDate , cutDate , shipType } = param;\n if (moment_default()(stockingDate).isBefore(moment_default()(result.startDate))) result.startDate = stockingDate;\n if (moment_default()(shippingDate).isAfter(moment_default()(result.endDate))) result.endDate = shippingDate;\n if (!m3) return result;\n updateM3(stockingDate, m3, result.stockingM3);\n updateM3(packagingDate, m3, result.packagingM3);\n updateM3(shippingDate, m3, result.shippingM3);\n if (cutDate) updateM3(cutDate, m3, result.cutM3);\n m3_updateAccumulation(stockingDate, m3, result.accumulation);\n // subtract from shipping date for normal ship type, cut date for van shipment\n if (shipType === \"バン\" && cutDate) {\n m3_updateAccumulation(cutDate, -m3, result.accumulation);\n } else {\n m3_updateAccumulation(shippingDate, -m3, result.accumulation);\n }\n });\n return result;\n }, initialResult);\n // get a list of dates between earliest stocking date and latest shipping date\n const dates = enumerateDaysBetweenDates(calculatedM3.startDate, calculatedM3.endDate);\n // calculate total m3 per day\n const totalM3 = dates.reduce((result, date)=>{\n const today = dates_formatDate(date);\n const yesterday = dates_formatDate(moment_default()(date).subtract(1, \"d\").toString());\n // copy from previous day first, and then apply accumulation\n result[today] = result[yesterday] || 0;\n result[today] += calculatedM3.accumulation[today] || 0;\n return result;\n }, {});\n return {\n stockingM3: calculatedM3.stockingM3,\n packagingM3: calculatedM3.packagingM3,\n shippingM3: calculatedM3.shippingM3,\n cutM3: calculatedM3.cutM3,\n totalM3\n };\n}\n\n;// CONCATENATED MODULE: ./src/utils/gantt/focus.ts\n\n/**\n * Returns an object with the start and end dates for the focused schedule.\n * @param {Schedule} schedule - The schedule of interest.\n * @param {string[]} dates - The array of date strings.\n * @param {KeyDatesVisibility} visibleKeyDates - The visibility of the key dates.\n * @returns {{startDate: Date, endDate: Date}} - An object containing the start and end dates.\n */ function getFocusedDateRange(schedule, dates, visibleKeyDates) {\n const keyDateMoments = getKeyDateMoments(schedule);\n const [initialStartDate, initialEndDate] = getInitialDateRange(dates);\n const startDate = getNewStartDate(initialStartDate, keyDateMoments, visibleKeyDates);\n const endDate = getNewEndDate(initialEndDate, keyDateMoments, visibleKeyDates);\n const adjustedDates = adjustDateRange(startDate, endDate);\n return {\n startDate: adjustedDates.startDate.toDate(),\n endDate: adjustedDates.endDate.toDate()\n };\n}\n/**\n * Converts schedule key dates in a schedule to Moment.js objects.\n * @param {Schedule} keyDate - The key dates of the schedule.\n * @returns {Record} - An object with key date names and their Moment.js representations.\n */ function getKeyDateMoments(keyDate) {\n return {\n beforeStock: moment_default()(keyDate.beforeStockingDate),\n stock: moment_default()(keyDate.stockingDate),\n beforePkg: moment_default()(keyDate.beforePackagingDate),\n pkg: moment_default()(keyDate.packagingDate),\n beforeShip: moment_default()(keyDate.beforeShippingDate),\n ship: moment_default()(keyDate.shippingDate),\n beforeCut: moment_default()(keyDate.beforeCutDate),\n cut: moment_default()(keyDate.cutDate),\n afterCut: moment_default()(keyDate.afterCutDate)\n };\n}\n/**\n * Extracts the initial start and end dates from the given date strings array.\n * @param {string[]} dates - The array of date strings.\n * @returns {[Moment, Moment]} - A tuple containing the initial start and end dates as Moment.js objects.\n */ function getInitialDateRange(dates) {\n return [\n moment_default()(dates[0]),\n moment_default()(dates[dates.length - 1])\n ];\n}\n/**\n * Determines the new start date based on key date visibility and validity.\n * @param {Moment} initialStartDate - The initial start date.\n * @param {Record} keyDateMoments - The key date moments.\n * @param {KeyDatesVisibility} visibleKeyDates - The visibility of the key dates.\n * @returns {Moment} - The new start date.\n */ function getNewStartDate(initialStartDate, keyDateMoments, visibleKeyDates) {\n if (keyDateMoments.beforeStock.isValid() && visibleKeyDates.beforeStockingDate) {\n // 入荷前\n return keyDateMoments.beforeStock;\n } else if (keyDateMoments.stock.isValid() && visibleKeyDates.stockingDate) {\n // 入荷\n return keyDateMoments.stock;\n }\n // 画面表示範囲の開始日\n return initialStartDate;\n}\n/**\n * Determines the new end date based on key date visibility and validity.\n * @param {Moment} initialEndDate - The initial end date.\n * @param {Record} keyDateMoments - The key date moments.\n * @param {KeyDatesVisibility} visibleKeyDates - The visibility of the key dates.\n * @returns {Moment} - The new end date.\n */ function getNewEndDate(initialEndDate, keyDateMoments, visibleKeyDates) {\n if (keyDateMoments.afterCut.isValid() && visibleKeyDates.afterCutDate) {\n // CUT後\n return keyDateMoments.afterCut;\n } else if (keyDateMoments.cut.isValid() && visibleKeyDates.cutDate) {\n // CUT\n return keyDateMoments.cut;\n } else if (keyDateMoments.beforeCut.isValid() && visibleKeyDates.beforeCutDate) {\n // CUT前\n return keyDateMoments.beforeCut;\n } else if (keyDateMoments.ship.isValid() && visibleKeyDates.shippingDate) {\n // 出荷\n return keyDateMoments.ship;\n }\n // 画面表示範囲の終了日\n return initialEndDate;\n}\n/**\n * Adjusts the start and end dates to ensure a minimum range of 7 days.\n * @param {Moment} startDate - The current start date.\n * @param {Moment} endDate - The current end date.\n * @returns {{startDate: Moment, endDate: Moment}} - An object containing the adjusted start and end dates.\n */ function adjustDateRange(startDate, endDate) {\n const diff = endDate.diff(startDate, \"d\");\n if (diff < 7) {\n const adjustment = (7 - diff) / 2;\n endDate = endDate.add(adjustment, \"d\");\n startDate = startDate.subtract(adjustment, \"d\");\n }\n return {\n startDate,\n endDate\n };\n}\n\n;// CONCATENATED MODULE: ./src/utils/gantt/shift.ts\n\n// shift 1 day forward\nconst shiftOneDay = (dateList)=>{\n const startDate = moment(dateList[0]).add(1, \"d\").toDate();\n const endDate = moment(dateList[dateList.length - 1]).add(1, \"d\").toDate();\n return {\n startDate,\n endDate\n };\n};\n// shift 1 day behind\nconst unshiftOneDay = (dateList)=>{\n const startDate = moment(dateList[0]).subtract(1, \"d\").toDate();\n const endDate = moment(dateList[dateList.length - 1]).subtract(1, \"d\").toDate();\n return {\n startDate,\n endDate\n };\n};\n\n// EXTERNAL MODULE: ./node_modules/lodash/lodash.js\nvar lodash = __webpack_require__(96486);\nvar lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);\n// EXTERNAL MODULE: ./src/utils/status.ts\nvar utils_status = __webpack_require__(58142);\n;// CONCATENATED MODULE: ./src/utils/gantt/sort.ts\n\n\n\n/**\n * 案件のスケジュールを指定された日付キーでソートします。\n *\n * @param {Project} project - ソート対象の案件\n * @param {KeyDate} dateName - ソートに使用する日付のキー。\n * @param {\"asc\" | \"desc\"} direction - ソート方向 (昇順,降順)\n * @returns {Project} ソートされたスケジュールを持つ案件。\n */ const sortSchedulesByDate = (project, dateName, direction)=>{\n var // 指定された方向にスケジュール個別のソートを行う\n ref;\n (ref = project.schedules) === null || ref === void 0 ? void 0 : ref.items.sort((a, b)=>{\n if (direction === \"asc\") {\n return moment_default()(a && a[dateName]).valueOf() - moment_default()(b && b[dateName]).valueOf();\n } else if (direction === \"desc\") {\n return moment_default()(b && b[dateName]).valueOf() - moment_default()(a && a[dateName]).valueOf();\n }\n return 0;\n });\n return project;\n};\n/**\n * 案件を指定された日付フィールドとソート方向に基づいてソートします。\n *\n * @param {Project[]} projects - ソート対象の案件配列\n * @param {KeyDate} dateName - ソート基準の日付フィールド名\n * @param {\"asc\" | \"desc\"} direction - ソート方向 (昇順,降順)\n * @returns {Project[]} ソートされた案件配列\n */ const sortProjectsByDate = (projects, dateName, direction)=>{\n const defaultOrder = direction === \"asc\" ? \"2100-1-1\" : \"2100-1-1\";\n // 各プロジェクトごとに複数のスケジュールがあるため、最も早いスケジュールの日付を探す\n const earliestDatesByProject = projects.reduce((result, project)=>{\n var ref;\n if (!project.schedules || project.schedules.items.length === 0) return result.concat({\n id: project.id,\n earliestTargetDate: defaultOrder\n });\n const earliestTargetDate = (ref = project.schedules) === null || ref === void 0 ? void 0 : ref.items.map((item)=>item && item[dateName] ? item[dateName] : defaultOrder);\n // 指定された方向にスケジュール個別のソートを行う\n sortSchedulesByDate(project, dateName, direction);\n result.push({\n id: project.id,\n earliestTargetDate: lodash_default().min([\n ...earliestTargetDate,\n defaultOrder\n ])\n });\n return result;\n }, []);\n // 指定された方向に応じてプロジェクトをソートし、プロジェクトの配列を返す\n if (direction === \"asc\") {\n return earliestDatesByProject.sort((a, b)=>moment_default()(a.earliestTargetDate).valueOf() - moment_default()(b.earliestTargetDate).valueOf()).map((d)=>projects.filter((p)=>p.id === d.id)[0]);\n }\n if (direction === \"desc\") {\n return earliestDatesByProject.sort((a, b)=>moment_default()(b.earliestTargetDate).valueOf() - moment_default()(a.earliestTargetDate).valueOf()).map((d)=>projects.filter((p)=>p.id === d.id)[0]);\n }\n return projects;\n};\nconst sortProjects = (projects, sortName)=>{\n if (sortName === \"sortByName\") {\n return projects.sort((a, b)=>a.name.localeCompare(b.name));\n }\n if (sortName === \"sortByNameDesc\") {\n return projects.sort((a, b)=>b.name.localeCompare(a.name));\n }\n if (sortName === \"sortByStatus\") {\n return projects.sort((a, b)=>(0,utils_status/* getStatusIndex */.Nz)(a.status) - (0,utils_status/* getStatusIndex */.Nz)(b.status));\n }\n if (sortName === \"sortByStatusDesc\") {\n return projects.sort((a, b)=>(0,utils_status/* getStatusIndex */.Nz)(b.status) - (0,utils_status/* getStatusIndex */.Nz)(a.status));\n }\n if (sortName === \"sortByStock\") {\n return sortProjectsByDate(projects, \"stockingDate\", \"asc\");\n }\n if (sortName === \"sortByPackage\") {\n return sortProjectsByDate(projects, \"packagingDate\", \"asc\");\n }\n if (sortName === \"sortByShip\") {\n return sortProjectsByDate(projects, \"shippingDate\", \"asc\");\n }\n if (sortName === \"sortByCut\") {\n return sortProjectsByDate(projects, \"cutDate\", \"asc\");\n }\n if (sortName === \"sortByCreate\") {\n return projects.sort((a, b)=>moment_default()(a.createdAt).valueOf() - moment_default()(b.createdAt).valueOf());\n }\n if (sortName === \"sortByUpdate\") {\n return projects.sort((a, b)=>moment_default()(a.updatedAt).valueOf() - moment_default()(b.updatedAt).valueOf());\n }\n if (sortName === \"sortByStockDesc\") {\n return sortProjectsByDate(projects, \"stockingDate\", \"desc\");\n }\n if (sortName === \"sortByPackageDesc\") {\n return sortProjectsByDate(projects, \"packagingDate\", \"desc\");\n }\n if (sortName === \"sortByShipDesc\") {\n return sortProjectsByDate(projects, \"shippingDate\", \"desc\");\n }\n if (sortName === \"sortByCutDesc\") {\n return sortProjectsByDate(projects, \"cutDate\", \"desc\");\n }\n if (sortName === \"sortByCreateDesc\") {\n return projects.sort((a, b)=>moment_default()(b.createdAt).valueOf() - moment_default()(a.createdAt).valueOf());\n }\n if (sortName === \"sortByUpdateDesc\") {\n return projects.sort((a, b)=>moment_default()(b.updatedAt).valueOf() - moment_default()(a.updatedAt).valueOf());\n }\n return projects;\n};\nconst removeBeforeIdx = (projects)=>{\n projects.filter((p)=>p.beforeIdx !== undefined).forEach((p)=>{\n delete p.beforeIdx;\n });\n};\n\n;// CONCATENATED MODULE: ./src/utils/gantt/update.ts\n\n\nfunction updateSchedule(param) {\n let { schedule , field , date } = param;\n let stock = moment(schedule.stockingDate);\n let pkg = moment(schedule.packagingDate);\n let ship = moment(schedule.shippingDate);\n let cut = moment(schedule.cutDate);\n const updateDate = (field, date)=>{\n schedule[field] = formatDate(date.toString(), \"YYYY-MM-DD\");\n };\n const newDate = moment(date);\n // never goes pass cut date\n if (newDate.isAfter(cut, \"d\")) {\n updateDate(field, cut);\n } else {\n updateDate(field, newDate);\n }\n switch(field){\n case \"stockingDate\":\n if (stock.isAfter(pkg, \"d\")) updateDate(\"packagingDate\", stock);\n if (stock.isAfter(ship, \"d\")) updateDate(\"shippingDate\", stock);\n break;\n case \"packagingDate\":\n if (pkg.isAfter(ship, \"d\")) updateDate(\"shippingDate\", pkg);\n if (pkg.isBefore(stock, \"d\")) updateDate(\"stockingDate\", pkg);\n break;\n case \"shippingDate\":\n if (ship.isBefore(pkg, \"d\")) updateDate(\"packagingDate\", ship);\n if (ship.isBefore(stock, \"d\")) updateDate(\"stockingDate\", ship);\n break;\n default:\n break;\n }\n return schedule;\n}\n\n;// CONCATENATED MODULE: ./src/utils/gantt/project.ts\n\n\n// ステータスを出力する。出荷はスケジュールの出荷方法を出力する。\nfunction getCustomStatusText(isInitial, status, schedule) {\n let retVal = \"\";\n if (status === \"SHIP\") {\n var _shipType;\n retVal = (_shipType = schedule.shipType) !== null && _shipType !== void 0 ? _shipType : \"\";\n } else if (!isInitial && (0,utils_status/* getStatusText */.li)(status) !== \"?\") {\n retVal = (0,utils_status/* getStatusText */.li)(status);\n } else if (isInitial && (0,utils_status/* getStatusInitial */.Y0)(status) !== \"?\") {\n retVal = (0,utils_status/* getStatusInitial */.Y0)(status);\n } else {\n switch(status){\n case \"BEFORESTOCK\":\n var _beforeStockingName;\n retVal = (_beforeStockingName = schedule.beforeStockingName) !== null && _beforeStockingName !== void 0 ? _beforeStockingName : \"\";\n break;\n case \"BEFOREPACK\":\n var _beforePackagingName;\n retVal = (_beforePackagingName = schedule.beforePackagingName) !== null && _beforePackagingName !== void 0 ? _beforePackagingName : \"\";\n break;\n case \"BEFORESHIP\":\n var _beforeShippingName;\n retVal = (_beforeShippingName = schedule.beforeShippingName) !== null && _beforeShippingName !== void 0 ? _beforeShippingName : \"\";\n break;\n case \"BEFORECUT\":\n var _beforeCutName;\n retVal = (_beforeCutName = schedule.beforeCutName) !== null && _beforeCutName !== void 0 ? _beforeCutName : \"\";\n break;\n case \"AFTERCUT\":\n var _afterCutName;\n retVal = (_afterCutName = schedule.afterCutName) !== null && _afterCutName !== void 0 ? _afterCutName : \"\";\n break;\n default:\n retVal = status;\n break;\n }\n }\n return isInitial ? retVal.substring(0, 1) : retVal.substring(0, 3);\n}\nfunction getFillerColor(status) {\n switch(status){\n case \"STOCK\":\n return \"#29BF12\";\n case \"PACK\":\n return \"#3E6EB3\";\n case \"SHIP\":\n return \"#D18643\";\n case \"CUT\":\n return \"#bd3993\";\n case \"\":\n return \"transparent\";\n default:\n return \"#888\";\n }\n}\nconst getScheduleDates = (schedule, dates)=>{\n return dates.reduce((acc, date)=>{\n /** 該当フェーズ名 */ let phase = \"\";\n /** スケジュール項目名 名前,日付のオブジェクト */ const phaseArray = [\n {\n name: \"BEFORESTOCK\",\n date: schedule.beforeStockingDate\n },\n {\n name: \"STOCK\",\n date: schedule.stockingDate\n },\n {\n name: \"BEFOREPACK\",\n date: schedule.beforePackagingDate\n },\n {\n name: \"PACK\",\n date: schedule.packagingDate\n },\n {\n name: \"BEFORESHIP\",\n date: schedule.beforeShippingDate\n },\n {\n name: \"SHIP\",\n date: schedule.shippingDate\n },\n {\n name: \"BEFORECUT\",\n date: schedule.beforeCutDate\n },\n {\n name: \"CUT\",\n date: schedule.cutDate\n },\n {\n name: \"AFTERCUT\",\n date: schedule.afterCutDate\n }\n ];\n // ////////////////////////////////////////\n // ★基準日の判定★\n // その日付で一番最後にくるフェーズ名を取得\n for(let i = 0; i < phaseArray.length; i++){\n if (phaseArray[i].date === date) {\n phase = phaseArray[i].name;\n }\n }\n // スケジュールで指定した日付に該当する場合はここから返す\n if (phase) {\n return {\n ...acc,\n [date]: {\n hasData: !!phase,\n type: phase,\n text: phase && getCustomStatusText(false, phase, schedule),\n initial: phase && getCustomStatusText(true, phase, schedule),\n color: phase && getFillerColor(phase),\n m3: schedule.m3 || 0,\n case: schedule.case || 0\n }\n };\n }\n // ////////////////////////////////////////\n // ★基準日間のデータ判定★\n // スケジュール日の中間かどうかを判定する(~ING)\n const target = moment_default()(date);\n // 案件タイプ=その他の場合は梱包日がないため、別に判定する\n const isPkg = !!schedule.packagingDate;\n let fromPhase = \"\";\n let fromDate = \"\";\n // どのスケジュールに該当するのか確認\n for(let i1 = 0; i1 <= phaseArray.length; i1++){\n var ref, ref1;\n if (!((ref = phaseArray[i1]) === null || ref === void 0 ? void 0 : ref.date) || !((ref1 = phaseArray[i1]) === null || ref1 === void 0 ? void 0 : ref1.name)) continue;\n // 始まりのデータ。最初はデータを登録して終わり\n if (!fromDate) {\n fromPhase = phaseArray[i1].name;\n var _date;\n fromDate = (_date = phaseArray[i1].date) !== null && _date !== void 0 ? _date : \"\";\n continue;\n }\n // その他案件の場合は梱包前・梱包は梱包フェーズがないため処理しない\n if (!isPkg && (phaseArray[i1].name === \"PACK\" || phaseArray[i1].name === \"BEFOREPACK\")) {\n continue;\n }\n // 出荷方法がバン以外の場合はCUT以降の処理をしない\n if (schedule.shipType !== \"バン\" && phaseArray[i1].name === \"CUT\") {\n break;\n }\n // 対象日が被っているかを確認。被っていればそのフェーズの範囲。\n if (target.isBetween(fromDate, phaseArray[i1].date, \"day\", \"[]\")) {\n if (fromPhase === \"BEFORESTOCK\") {\n // StockingとbeforeStockingの間はbeforeStockingの領域にする\n phase = fromDate;\n } else {\n // 上記以外は次のフェーズの色を塗る\n phase = phaseArray[i1].name;\n }\n }\n // 次のフェーズが空の場合もあるため今回のフェーズを取っておく\n fromPhase = phaseArray[i1].name;\n var _date1;\n fromDate = (_date1 = phaseArray[i1].date) !== null && _date1 !== void 0 ? _date1 : \"\";\n }\n return {\n ...acc,\n [date]: {\n hasData: false,\n type: phase,\n text: \"\",\n initial: \"\",\n color: phase && getFillerColor(phase)\n }\n };\n }, {});\n};\nconst ganttifyProject = (project, dates)=>{\n var ref;\n if (!project.schedules) return project;\n const schedules = (ref = project.schedules) === null || ref === void 0 ? void 0 : ref.items.reduce((acc, schedule)=>{\n if (!schedule) return acc;\n const scheduleDates = getScheduleDates(schedule, dates);\n acc.push({\n ...schedule,\n ...scheduleDates\n });\n return acc;\n }, []);\n project.schedules.items = schedules;\n return project;\n};\n\n;// CONCATENATED MODULE: ./src/utils/gantt/index.ts\n\n\n\n\n\n\n\n\n\n\n\n\n/***/ })\n\n}]);"],"names":["self","push","__unused_webpack_module","__webpack_exports__","__webpack_require__","d","GanttProvider","useGantt","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","react__WEBPACK_IMPORTED_MODULE_1__","moment__WEBPACK_IMPORTED_MODULE_2__","moment__WEBPACK_IMPORTED_MODULE_2___default","n","nookies__WEBPACK_IMPORTED_MODULE_3__","_tanstack_react_query__WEBPACK_IMPORTED_MODULE_11__","aws_amplify__WEBPACK_IMPORTED_MODULE_12__","_auth__WEBPACK_IMPORTED_MODULE_4__","_alerts__WEBPACK_IMPORTED_MODULE_5__","graphql_queries__WEBPACK_IMPORTED_MODULE_13__","utils_gantt__WEBPACK_IMPORTED_MODULE_6__","hooks_query__WEBPACK_IMPORTED_MODULE_7__","utils_status__WEBPACK_IMPORTED_MODULE_8__","utils_cookie__WEBPACK_IMPORTED_MODULE_9__","utils_error__WEBPACK_IMPORTED_MODULE_10__","GanttContext","createContext","projects","refetchProjects","Promise","resolve","dateRange","startDate","startOf","toDate","endDate","endOf","dateLabel","setDateLabel","dates","F9","focus","m3","cs","sort","m3Visible","setM3Visible","caseVisible","setCaseVisible","visibleKeyDates","beforeStockingDate","stockingDate","beforePackagingDate","packagingDate","beforeShippingDate","shippingDate","beforeCutDate","cutDate","afterCutDate","setVisibleKeyDates","status","setStatus","keyword","setKeyword","column","setColumn","isFilterSaved","setIsFilterSaved","loading","filterProjectByKeyword","data","statusFilter","filter","ref","ref1","ref2","ref3","ref4","ref5","ref6","ref7","ref8","ref9","ref10","name","includes","user","firstName","lastName","managerName","quoterName","operatorName","accountName","contactName","reference","category","li","schedules","items","some","s","beforeStockingName","beforePackagingName","beforeShippingName","beforeCutName","afterCutName","length","children","param","cookies","parseCookies","isFilterApplied","u","currentGroup","a","useState","ganttKeyword","Z","beforeStock","setBeforeStock","stock","setStock","beforePack","setBeforePack","pack","setPack","beforeShip","setBeforeShip","ship","setShip","beforeCut","setBeforeCut","cut","setCut","afterCut","setAfterCut","ganttStatus","split","value","join","addAlert","ganttDateLabel","setStartDate","ganttStartDate","setEndDate","ganttEndDate","add","filteredProjects","isLoading","refetch","queryKey","id","queryFn","nextToken","allItems","res","b","graphql","query","projectsByGroupIdForManager","variables","groupId","archived","ne","sortDirection","authMode","concat","Nz","err","customError","message","severity","staleTime","gcTime","setSort","ganttSort","ganttColumn","setCookie","R","toString","editProjects","structuredClone","zI","LI","keywordFilteredProjects","dndProjects","p","undefined","beforeIdx","noDndProjects","sortedNoDndProjects","Mx","sortedDndProjects","forEach","splice","processProject","project","bx","map","focusSchedule","ug","schedule","setDateRange","Date","setProjectStatus","jsx","Provider","accountsContext","useContext","GroupReportsProvider","useGroupReports","jsx_runtime","react","lib_esm","short_uuid","alerts","auth","gantt","datalist","dialog","moment","moment_default","axios","renderSpreadsheet","blob","report","body","FormData","append","JSON","stringify","post","getCaseCountInSchedule","products","reduce","acc","cur","quantity","lib_esm_API","queries","getProductDataByScheduleId","scheduleId","productsByScheduleId","__typename","item","listSummarizedMaterialsQuery","materialTypeId","results","index","response","listSummarizedMaterials","input","utils_status","listSummarizedInvoicesQuery","key","result","listSummarizedInvoices","limit","reformatSummarizedInvoices","toDateTimeKeys","toDateKeys","lineOrder","isValid","format","makeXlsxData","reportType","scope","newProjects","newSchedules","all","makeProjectsToPlanData","pickedStockProjects","pickedShipProjects","pickedCutProjects","pickedPackProjects","stockSchedules","scheduleStockingDate","scheduleName","scheduleCase","shipSchedules","s1","project1","scheduleShippingDate","scheduleShipType","shipType","scheduleCutDate","cutSchedules","s2","project2","packSchedules","s3","product","project3","schedulePackagingDate","scheduleProductName","scheduleProductPackageTypeName","packageTypeName","scheduleProductQuantity","stockData","shipData","cutData","packData","Error","at","summarizedMaterials","materials","startDate1","endDate1","summarizedInvoicesPromises","keys","summarizedInvoices","invoice","keyData","replace","invoices","makeData","type","files","utils_report","download","dataType","reportScope","parse","file","Ke","get","template","cacheControl","fileName","renderData","Body","Sv","Lz","base64","e","GroupReportsContext","reports","planReports","woodReports","invoiceReports","exporting","create","remove","downloadTemplate","Y","setExporting","error","setError","exportingReports","setExportingReports","open","useEffect","createReport","removeReport","title","content","okText","onOk","document","style","cursor","downloadGroupReport","exportId","uuid","fQ","groupReportsContext","useQuery","react__WEBPACK_IMPORTED_MODULE_0__","next_router__WEBPACK_IMPORTED_MODULE_1__","defaultValue","toData","toQuery","setData","router","useRouter","parseFloat","update","newValue","newData","drawHolidayBorder","drawHolidayColor","enumerateDaysBetweenDates","ganttifyProject","getCaseSchedule","getFocusedDateRange","getM3Schedule","getScheduleDates","removeBeforeIdx","sortProjects","moment_moment","dates_formatDate","date","arguments","now","clone","retDates","isSameOrBefore","isSaturday","day","isSunday","getHoliday","holidays","find","holiday","isWorking","borderValue","today","targetDate","subtract","yesterday","tomorrow","trim","updateCase","storage","formattedDate","Math","ceil","updateAccumulation","accumulation","calculatedCase","case","isBefore","isAfter","stockingCase","packagingCase","shippingCase","cutCase","totalCase","updateM3","m3_updateAccumulation","calculatedM3","stockingM3","packagingM3","shippingM3","cutM3","totalM3","keyDateMoments","keyDate","beforePkg","pkg","initialStartDate","initialEndDate","adjustedDates","adjustDateRange","diff","adjustment","lodash","lodash_default","sortSchedulesByDate","dateName","direction","valueOf","sortProjectsByDate","defaultOrder","earliestDatesByProject","earliestTargetDate","min","sortName","localeCompare","createdAt","updatedAt","getCustomStatusText","isInitial","_shipType","_beforeStockingName","_beforePackagingName","_beforeShippingName","_beforeCutName","_afterCutName","retVal","Y0","substring","getFillerColor","phase","phaseArray","i","hasData","text","initial","color","target","isPkg","fromPhase","fromDate","i1","_date","_date1","isBetween","scheduleDates"],"sourceRoot":""}