diff --git a/src/api/app/receipt-issuing-order.ts b/src/api/app/receipt-issuing-order.ts
index 2533efe..e2cef66 100644
--- a/src/api/app/receipt-issuing-order.ts
+++ b/src/api/app/receipt-issuing-order.ts
@@ -22,7 +22,7 @@ export type AppReceiptIssuingOrder = {
// 領収証確定
export type ConfirmRequest = {
- id: string;
+ access_token: string;
receipt_name: string;
timestamp: string;
};
diff --git a/src/api/custom/hello-techno/index.ts b/src/api/custom/hello-techno/index.ts
index 2998f6b..e49011f 100644
--- a/src/api/custom/hello-techno/index.ts
+++ b/src/api/custom/hello-techno/index.ts
@@ -15,6 +15,11 @@ export type HTAdjustData = {
parking_management_code: string;
adjust_seq_no: number;
adjust_datetime: string;
+
+ tax_charge: number;
+ putin_datetime: string;
+ adjust_type: string;
+ amount: number;
};
export type HTCustomersResponse = {
@@ -53,6 +58,8 @@ export const getHTParkings = async (data: HTParkingsRequest) => {
export type HTAdjustDataRequest = {
customer_code: string;
+ parking_management_code: string;
+ adjust_seq_no: string;
};
export type HTAdjustDataResponse = {
diff --git a/src/api/custom/hello-techno/receipt-issuing-order.ts b/src/api/custom/hello-techno/receipt-issuing-order.ts
index 7880d8f..8755247 100644
--- a/src/api/custom/hello-techno/receipt-issuing-order.ts
+++ b/src/api/custom/hello-techno/receipt-issuing-order.ts
@@ -8,22 +8,7 @@ import {
} from "api";
import { ReceiptIssuingOrder } from "api/receipt-issuing-order";
import { getUrl } from "api/url";
-
-export type HTCustomer = {
- customer_code: string;
- name: string;
-};
-export type HTParking = {
- customer_code: string;
- parking_management_code: string;
- name: string;
-};
-export type HTAdjustData = {
- customer_code: string;
- parking_management_code: string;
- adjust_seq_no: number;
- adjust_datetime: string;
-};
+import { HTCustomer } from ".";
export type CreateReceiptIssuingOrderRequest = {
customer_code: string;
diff --git a/src/pages/app/hooks/useReceiptIssuingOrderConfirm.tsx b/src/pages/app/hooks/useReceiptIssuingOrderConfirm.tsx
index a130e26..e677695 100644
--- a/src/pages/app/hooks/useReceiptIssuingOrderConfirm.tsx
+++ b/src/pages/app/hooks/useReceiptIssuingOrderConfirm.tsx
@@ -21,7 +21,7 @@ const schema = Yup.object().shape({
});
export default function useReceiptIssuingOrderConfirm() {
- const { receiptIssuingOrder: order, fetch } = useApp();
+ const { receiptIssuingOrder: order, fetch, token } = useApp();
const { success, error } = useSnackbarCustom();
const { setShowBackDrop } = useBackDrop();
@@ -46,7 +46,7 @@ export default function useReceiptIssuingOrderConfirm() {
onAgree: () => {
if (!order) return;
api.callAPI({
- id: order.id,
+ access_token: token,
receipt_name: receiptName,
timestamp: order.updated_at,
});
diff --git a/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/create.tsx b/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/create.tsx
index 9269ae1..ee16026 100644
--- a/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/create.tsx
+++ b/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/create.tsx
@@ -11,6 +11,7 @@ import { createReceiptIssuingOrder } from "api/custom/hello-techno/receipt-issui
import useSnackbarCustom from "hooks/useSnackbarCustom";
import useBackDrop from "hooks/useBackDrop";
import { getValue } from "components/hook-form/RHFAutoComplete";
+import { getHTAdjustData } from "api/custom/hello-techno";
export default function ReceiptIssuingOrderCreate() {
const { setHeaderTitle, setTabs } = useDashboard(
@@ -59,9 +60,32 @@ export default function ReceiptIssuingOrderCreate() {
};
};
+ const adjustDataAPI = useAPICall({
+ apiMethod: getHTAdjustData,
+ backDrop: true,
+ onSuccess: ({ data }) => {
+ inputReceiptStep.setAdjustData(data);
+ setMode("input_receipt");
+ },
+ onFailed: () => {
+ error("精算履歴が存在しません");
+ },
+ });
+
const selectParkingStep = useSelectParkingStep({
onNext: () => {
- setMode("input_receipt");
+ const { customerCode, parkingManagementCode, adjustSeqNo } =
+ getFormData();
+ if (adjustSeqNo) {
+ adjustDataAPI.callAPI({
+ customer_code: getValue(customerCode),
+ parking_management_code: getValue(parkingManagementCode),
+ adjust_seq_no: adjustSeqNo,
+ });
+ } else {
+ inputReceiptStep.setAdjustData(null);
+ setMode("input_receipt");
+ }
},
});
diff --git a/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/detail.tsx b/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/detail.tsx
index f3e104b..7cb39f2 100644
--- a/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/detail.tsx
+++ b/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/detail.tsx
@@ -79,7 +79,7 @@ export default function ReceiptIssuingOrderDetail() {
{
title: "担当者",
value: order.handler_name,
- end: ,
+ // end: ,
},
{ title: "SMS送信先", value: order.sms_phone_number },
{ title: "依頼日", value: formatDateStr(order.order_datetime) },
diff --git a/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/hooks/useInputReceiptStep.tsx b/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/hooks/useInputReceiptStep.tsx
index c87a5ca..d48b21a 100644
--- a/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/hooks/useInputReceiptStep.tsx
+++ b/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/hooks/useInputReceiptStep.tsx
@@ -1,6 +1,7 @@
import { yupResolver } from "@hookform/resolvers/yup";
import { Box, Button, Stack, TextField, Typography } from "@mui/material";
import { HasChildren } from "@types";
+import { HTAdjustData, getHTAdjustData } from "api/custom/hello-techno";
import {
FormProvider,
RHFAutoComplete,
@@ -12,8 +13,9 @@ import {
getValue,
} from "components/hook-form/RHFAutoComplete";
import RHFDatePicker from "components/hook-form/RHFDatePicker";
-import { useState } from "react";
+import { useEffect, useMemo, useState } from "react";
import { useForm } from "react-hook-form";
+import { dateTimeParse } from "utils/datetime";
import * as Yup from "yup";
type AreaBoxProps = {
@@ -39,7 +41,7 @@ type Props = {
onPrev?: VoidFunction;
};
export default function useInputReceiptStep({ onNext, onPrev }: Props) {
- const [adjustSeqNo, setAdjustSeqNo] = useState("");
+ const [adjustData, _setAdjustData] = useState(null);
const form = useForm({
defaultValues: {
@@ -71,19 +73,30 @@ export default function useInputReceiptStep({ onNext, onPrev }: Props) {
}
};
+ const setAdjustData = (data: HTAdjustData | null) => {
+ _setAdjustData(data);
+ };
+
+ const readOnly = useMemo(() => {
+ return adjustData !== null;
+ }, [adjustData]);
+
const element = (
-
+
円 }}
+ InputProps={{
+ endAdornment: 円
,
+ }}
sx={{ maxWidth: 150 }}
+ readOnly={readOnly}
/>
@@ -100,6 +113,20 @@ export default function useInputReceiptStep({ onNext, onPrev }: Props) {
);
+ useEffect(() => {
+ if (adjustData) {
+ form.setValue("amount", String(adjustData.amount));
+ form.setValue("date", dateTimeParse(adjustData.adjust_datetime));
+ } else {
+ form.setValue("amount", "");
+ form.setValue("date", null);
+ }
+ }, [adjustData]);
- return { element, values: form.getValues, setValue: form.setValue };
+ return {
+ element,
+ values: form.getValues,
+ setValue: form.setValue,
+ setAdjustData,
+ };
}
diff --git a/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/hooks/useSelectParkingStep.tsx b/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/hooks/useSelectParkingStep.tsx
index 6e60917..887d26c 100644
--- a/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/hooks/useSelectParkingStep.tsx
+++ b/src/pages/dashboard/receipt-issuing-order/custom/hello-techno/hooks/useSelectParkingStep.tsx
@@ -10,7 +10,6 @@ import {
import {
AutoCompleteOption,
AutoCompleteOptionType,
- getValue,
} from "components/hook-form/RHFAutoComplete";
import useAPICall from "hooks/useAPICall";
import { useEffect, useState } from "react";
diff --git a/src/routes/path.ts b/src/routes/path.ts
index 2728b51..289a519 100644
--- a/src/routes/path.ts
+++ b/src/routes/path.ts
@@ -39,9 +39,9 @@ const PATHS = {
// APP
[makePathKey(PageID.APP_RECEIPT_ISSUING_ORDER_INDEX)]:
- "/app/receipt-issuing-oreder/:token",
+ "/app/receipt-issuing-order/:token",
[makePathKey(PageID.APP_RECEIPT_ISSUING_ORDER_MAIL_ORDER)]:
- "/app/receipt-issuing-oreder/mail",
+ "/app/receipt-issuing-order/mail",
// 契約関連
[makePathKey(PageID.DASHBOARD_CONTRACT_LIST)]:
diff --git a/src/theme/index.tsx b/src/theme/index.tsx
index 8311587..9e2f988 100644
--- a/src/theme/index.tsx
+++ b/src/theme/index.tsx
@@ -155,6 +155,9 @@ theme = {
"&.Mui-disabled:before": {
borderBottomStyle: "none",
},
+ "&.Mui-disabled": {
+ WebkitTextFillColor: "black !important",
+ },
},
},
},
diff --git a/src/utils/datetime.ts b/src/utils/datetime.ts
index f3e243a..5bdf881 100644
--- a/src/utils/datetime.ts
+++ b/src/utils/datetime.ts
@@ -2,6 +2,7 @@ import { format, isValid, parse, parseISO } from "date-fns";
export const DEFAULT_DATE_FORMAT = "yyyy/MM/dd";
export const DEFAULT_DATE_TIME_FORMAT = "yyyy/MM/dd HH:mm:ss";
+export const DEFAULT_DATE_TIME_FORMAT_ANOTHER1 = "yyyy-MM-dd HH:mm:ss";
export const DEFAULT_YYYYMM_FORMAT = "yyyyMM";
type Input = Date | string | null | undefined;
@@ -35,7 +36,10 @@ export const dateParse = (source: Input): Date | null => {
};
export const dateTimeParse = (source: Input): Date | null => {
- return parseFromFormat(source, DEFAULT_DATE_TIME_FORMAT);
+ return (
+ parseFromFormat(source, DEFAULT_DATE_TIME_FORMAT) ??
+ parseFromFormat(source, DEFAULT_DATE_TIME_FORMAT_ANOTHER1)
+ );
};
const parseFromFormat = (source: Input, format: string): Date | null => {