From 4f280912db1b5a345e9218136961b0baa616f44a Mon Sep 17 00:00:00 2001 From: Seyed Mahdi Hosseini Zade Date: Wed, 5 Apr 2023 01:23:07 +0430 Subject: [PATCH] [ref]: changing editDiscountCode --- .../Tours/DiscountSystemTab/index.jsx | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/components/Tours/DiscountSystemTab/index.jsx b/src/components/Tours/DiscountSystemTab/index.jsx index 1e3e241..9131210 100644 --- a/src/components/Tours/DiscountSystemTab/index.jsx +++ b/src/components/Tours/DiscountSystemTab/index.jsx @@ -7,6 +7,7 @@ import persian_fa from 'react-date-object/locales/persian_fa'; import Button from 'src/components/Button'; import Input from 'src/components/Input'; import apiInstance from 'src/config/axios'; +import { Dialog ,DialogActions,DialogContent,DialogContentText,DialogTitle} from '@mui/material'; import { convertNumberToPersian, convertNumberToEnglish, @@ -16,6 +17,7 @@ import { } from 'src/utils/formatters'; import './style.scss'; import 'react-multi-date-picker/styles/layouts/mobile.css'; +import axios from 'axios'; function DiscountSystemTab() { const { id } = useParams(); @@ -33,9 +35,23 @@ function DiscountSystemTab() { const [loading, setLoading] = useState(false); + const [open,setOpen] = useState(false); + const [changeCode,setChangeCode] = useState(""); + const [selectedId,setSelectedId] = useState(null); + const handleClickOpen = () =>{ + setOpen(true); + } + const handleClose = () =>{ + setOpen(false); + } + const getSelectedTourId = async() =>{ + + } + const endDatePickerRef = useRef(null); useEffect(() => { + apiInstance .get(`/tours/${id}/discount-codes`) .then(res => res.data) @@ -47,6 +63,8 @@ function DiscountSystemTab() { console.log(error); }) .finally(() => setPageLoading(false)); + // const {data} = apiInstance.get(`/tours/${id}`) ; + // console.log('data is : ',data); }, []); const handlePercentageChange = e => { @@ -125,6 +143,12 @@ function DiscountSystemTab() { }) .finally(() => setLoading(false)); }; + const handleChangeCode = (discId) =>{ + console.log('changeCode is : ',changeCode); + axios.put(`https://api.quilco.ir/tours/${id}/discount-codes/${discId}/`,{ + code:changeCode, + }) + } return (
@@ -212,6 +236,28 @@ function DiscountSystemTab() { > حذف + + setOpen(false)}> + ویرایش کد تخفیف + + setChangeCode(e.target.value)} + + + /> + + + + + +
))}