|
|
|
@@ -78,7 +78,7 @@ const DSOverview: React.FC<Props> = ({ type, defaultInputs }) => { |
|
|
|
// paramName: "schedulePeriod", |
|
|
|
// type: "dateRange", |
|
|
|
// }, |
|
|
|
{ label: t("Production Date"), paramName: "scheduleAt", type: "date" }, |
|
|
|
{ label: t("Production Date"), paramName: "produceAt", type: "date" }, |
|
|
|
//{ |
|
|
|
// label: t("Product Count"), |
|
|
|
// paramName: "totalEstProdCount", |
|
|
|
@@ -179,9 +179,9 @@ const DSOverview: React.FC<Props> = ({ type, defaultInputs }) => { |
|
|
|
) as ScheduleType[]; |
|
|
|
|
|
|
|
const params: SearchProdSchedule = { |
|
|
|
//scheduleAt: dayjs(query?.scheduleAt).isValid() |
|
|
|
// ? query?.scheduleAt |
|
|
|
// : undefined, |
|
|
|
produceAt: dayjs(query?.produceAt).isValid() |
|
|
|
? query?.produceAt |
|
|
|
: undefined, |
|
|
|
//schedulePeriod: dayjs(query?.schedulePeriod).isValid() |
|
|
|
// ? query?.schedulePeriod |
|
|
|
// : undefined, |
|
|
|
@@ -304,7 +304,35 @@ const DSOverview: React.FC<Props> = ({ type, defaultInputs }) => { |
|
|
|
try { |
|
|
|
const token = localStorage.getItem("accessToken"); |
|
|
|
// 1. Get Base64 string from server |
|
|
|
const base64String = await exportProdSchedule(token); |
|
|
|
// 1. Prepare translated headers using the t() function |
|
|
|
|
|
|
|
const prodHeaders = [ |
|
|
|
t("Item Name"), |
|
|
|
t("Avg Qty Last Month"), |
|
|
|
t("Stock Qty"), |
|
|
|
t("Days Left"), |
|
|
|
t("Output Qty"), |
|
|
|
t("Batch Need"), |
|
|
|
t("Priority") |
|
|
|
]; |
|
|
|
|
|
|
|
const matHeaders = [ |
|
|
|
t("Mat Code"), |
|
|
|
t("Mat Name"), |
|
|
|
t("Required Qty"), |
|
|
|
t("Total Qty Need"), |
|
|
|
t("UoM"), |
|
|
|
t("Purchased Qty"), |
|
|
|
t("On Hand Qty"), |
|
|
|
t("Unavailable Qty"), |
|
|
|
t("Related Item Code"), |
|
|
|
t("Related Item Name"), |
|
|
|
t("Material Summary") // The last one can be used as the Sheet Name |
|
|
|
]; |
|
|
|
|
|
|
|
// 2. Pass these arrays to your server action |
|
|
|
// 'inputs' contains your filters (scheduleAt, types, etc.) |
|
|
|
const base64String = await exportProdSchedule(token, inputs, prodHeaders, matHeaders); |
|
|
|
|
|
|
|
// 2. Convert Base64 back to Blob |
|
|
|
const byteCharacters = atob(base64String); |
|
|
|
|