Skip to content

Commit

Permalink
[support] #68
Browse files Browse the repository at this point in the history
  • Loading branch information
yoneyan committed Jul 23, 2021
1 parent f9be267 commit ee6fb78
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/Dashboard/Service/Service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export function StatusTable(props: {
}
 
<ServiceGetDialogs
key={"service_get_dialog_"+index}
key={"service_get_dialog_" + index}
service={row}
reload={setReload}
template={template}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Group/GroupDetail/GroupDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect, useState} from 'react';
import React, {Dispatch, SetStateAction, useEffect, useState} from 'react';
import {useParams} from 'react-router-dom';
import Dashboard from "../../../components/Dashboard/Dashboard";
import {Get, GetTemplate} from "../../../api/Group";
Expand Down Expand Up @@ -124,6 +124,7 @@ export default function GroupDetail() {
<Service
key={"service_" + group.ID}
data={group}
autoMail={setOpenMailAutoSendDialog}
template={template}
reload={setReload}/>
</Grid>
Expand Down
14 changes: 11 additions & 3 deletions src/pages/Group/GroupDetail/Service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ export function ChipGet(props: {

function RowService(props: {
service: ServiceDetailData,
autoMail: Dispatch<SetStateAction<string>>,
groupID: number,
template: TemplateData,
reload: Dispatch<SetStateAction<boolean>>
}) {
const {service, groupID, template, reload} = props;
const {service, autoMail, groupID, template, reload} = props;
const [open, setOpen] = React.useState(false);
const classes = useRowStyles();
const serviceCode = groupID + "-" + service.service_template.type + ('000' + service.service_number).slice(-3);
Expand Down Expand Up @@ -118,6 +119,7 @@ function RowService(props: {
!service.pass &&
<ExaminationDialog
key={"service_examination_dialog_" + service.ID}
autoMail={autoMail}
id={service.ID}
service={service}
reload={reload}
Expand Down Expand Up @@ -166,10 +168,11 @@ function RowService(props: {

export function ExaminationDialog(props: {
id: number
autoMail?: Dispatch<SetStateAction<string>>,
service: ServiceDetailData
reload: Dispatch<SetStateAction<boolean>>
}) {
const {id, service, reload} = props;
const {id, autoMail, service, reload} = props;
const [open, setOpen] = React.useState(false);
const {enqueueSnackbar} = useSnackbar();

Expand All @@ -183,6 +186,9 @@ export function ExaminationDialog(props: {
console.log(res.error);
enqueueSnackbar(String(res.error), {variant: "error"});
}
if (autoMail !== undefined) {
autoMail("pass_service");
}
setOpen(false);
reload(true);
})
Expand Down Expand Up @@ -362,10 +368,11 @@ export function EnableDialog(props: {

export default function Service(props: {
data: GroupDetailData,
autoMail: Dispatch<SetStateAction<string>>,
template: TemplateData,
reload: Dispatch<SetStateAction<boolean>>
}): any {
const {data, template, reload} = props;
const {data, autoMail, template, reload} = props;
const classes = useStyles();

if (data.services !== undefined) {
Expand Down Expand Up @@ -400,6 +407,7 @@ export default function Service(props: {
<RowService
key={"service_row_service_" + row.ID}
template={template}
autoMail={autoMail}
service={row}
groupID={data.ID}
reload={reload}/>
Expand Down

0 comments on commit ee6fb78

Please sign in to comment.