ActivityDetailsModal.js
12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
import Image from "next/image";
import { Fragment, useState } from "react";
import { Button, Modal } from "react-bootstrap";
import { Loader } from "react-bootstrap-typeahead";
import { toast } from "react-toastify";
import { updateActivityStatusAdmin } from "../../redux/actions/userActions";
import ActivityDetailGallaryModal from "./ActivityDetailGallaryModal";
import { CloseCircleOutlined } from "@ant-design/icons";
const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => {
const [viewDesc, setViewDesc] = useState();
const [rejectPopUp, setrejectPopUp] = useState(false);
const [rejectionReasonText, setrejectionReasonText] = useState("");
const [showActivityImages, setShowActivityImages] = useState(false);
console.log("activityDetailInfo", activityDetailInfo);
const getUrls = (url) => {
let a = activityDetailInfo[0]?.attributes?.cancellationPolicy?.data
console.log("checking data", url)
if (a !== null) {
window.open(url, '_blank')
} else {
toast.warning("No Data Found")
}
}
return (
<Fragment>
<Modal show={show} onHide={handleClose} size="xl" aria-labelledby="contained-modal-title-vcenter" centered>
<Modal.Body>
{activityDetailInfo[0] ? (
<div className="vendorDetails">
<div className="row">
<div className="col-12 col-lg-12">
<div className="d-flex align-items-center justify-content-between mb-4">
<h4 className="mb-0">Activity Details</h4>
<span className="image-container" style={{ cursor: "pointer" }} onClick={handleClose}>
<Image width={13} height={13} alt="" src="/images/admin/icon-close.svg" className="image" />
</span>
</div>
</div>
</div>
<div className="row">
<div className="col-12 col-lg-4 borderRight">
<p className="phead">Basic Details</p>
<div className="row">
<p className="col-12 col-lg-6">Category</p>
<p className="col-12 col-lg-6">*FEATURE TO BE ADDED*</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">SubCategory</p>
<p className="col-12 col-lg-6">{activityDetailInfo[0].attributes.subCategory.data.attributes.name}</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Activity Name</p>
<p className="col-12 col-lg-6">{activityDetailInfo[0].attributes.name}</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Activity Description</p>
<p
className="col-12 col-lg-6 pview"
onClick={() => {
setViewDesc(true);
}}
>
View
</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Location</p>
<p className="col-12 col-lg-6">---|---</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Address</p>
<p className="col-12 col-lg-6">{activityDetailInfo[0].attributes.address}</p>
</div>
{/* <div className="row">
<p className="col-12 col-lg-6">Activity Name</p>
<p className="col-12 col-lg-6">Edge City Climb</p>
</div> */}
<div className="row">
<p className="col-12 col-lg-6">Price (per person)</p>
<p className="col-12 col-lg-6">$ {activityDetailInfo[0].attributes.pricePerPerson}</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Tags</p>
<p className="col-12 col-lg-6"></p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Place</p>
<p className="col-12 col-lg-6">{activityDetailInfo[0].attributes.activityType}</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Gifting to someone</p>
<p className="col-12 col-lg-6">{activityDetailInfo[0].attributes.giftSomeone ? "Allowed" : "Disallowed"}</p>
</div>
</div>
<div className="col-12 col-lg-4 borderRight ps-4">
<div>
<p className="phead">Group Information</p>
<div className="row">
<p className="col-12 col-lg-6">Contact Person for the activity</p>
<p className="col-12 col-lg-6">{activityDetailInfo[0].attributes.contactPersonForBooking}</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Size of the Group</p>
<p className="col-12 col-lg-6">
{activityDetailInfo[0].attributes.minGroupSize} - {activityDetailInfo[0].attributes.maxGroupSize}
</p>
</div>
</div>
<div>
<p className="phead">Availability</p>
{/* <div className="row">
<p className="col-12 col-lg-6">Months</p>
<p className="col-12 col-lg-6">February</p>
</div> */}
<div className="row">
<p className="col-12 col-lg-6">Time</p>
{activityDetailInfo[0].attributes.fromTime && activityDetailInfo[0].attributes.toTime && (
<p className="col-12 col-lg-6">{activityDetailInfo[0].attributes.fromTime - activityDetailInfo[0].attributes.toTime}</p>
)}
</div>
<div className="row">
<p className="col-12 col-lg-6">Duration</p>
<p className="col-12 col-lg-6">{activityDetailInfo[0].attributes.duration}</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Age Group</p>
<p className="col-12 col-lg-6">{activityDetailInfo[0].attributes.ageLowerLimit}+</p>
</div>
</div>
</div>
<div className="col-12 col-lg-4 ps-4">
<div>
<p className="phead">Booking & Activity Information</p>
<div className="row">
<p className="col-12 col-lg-6">Link of Booking</p>
<p className="col-12 col-lg-6 pview">{activityDetailInfo[0].attributes.link}</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Images of Activities</p>
<p className="col-12 col-lg-6 pview cursor-pointer" onClick={() => { setShowActivityImages(true); console.log("checking") }}>View Images</p>
</div>
<div className="row">
<p className="col-12 col-lg-6">Brand Logo</p>
<p className="col-12 col-lg-6 pview">View Logo</p>
</div>
</div>
<div>
<p className="phead">Policy & Terms</p>
<div className="row">
<div className="col-12 col-lg-6 ">
<p>Cancellation Policy</p>
</div>
<div className="col-12 col-lg-6 ">
<p
className="pview cursor-pointer"
onClick={() => getUrls(`${activityDetailInfo[0]?.attributes?.cancellationPolicy?.data?.attributes?.url}`)}
>
View
</p>
</div>
</div>
<div className="row">
<div className="col-12 col-lg-6 ">
<p>
Terms & Conditions
</p>
</div>
<div className="col-12 col-lg-6">
<p className="pview cursor-pointer"
onClick={() => getUrls(`${activityDetailInfo[0]?.attributes?.termsConditions?.data?.attributes?.url}`)}
>
View
</p>
</div>
</div>
</div>
</div>
</div>
<div className="row">
<div className="col-12 col-lg-12">
<div className="d-flex justify-content-center">
<Button
variant=""
className="btnAdd btnApprove m-0"
onClick={async () => {
await updateActivityStatusAdmin({ status: "approved", activityId: activityDetailInfo[0].id, rejectionReason: "" });
toast.success("Activity approved.");
}}
>
Approve
</Button>
<div className="px-1"></div>
<Button
variant=""
className="btnAdd btnReject m-0"
onClick={async () => {
// setrejectionId()
setrejectPopUp(true);
// await updateActivityStatusAdmin({ status: false, activityId: activityDetailInfo[0].id, rejectionReason: "" });
}}
>
Reject
</Button>
</div>
</div>
</div>
</div>
) : (
<div className="text-center my-5 p-5">
<Loader />
</div>
)}
</Modal.Body>
</Modal>
<Modal show={viewDesc} onHide={() => setViewDesc(false)}>
<Modal.Header closeButton>Activity description</Modal.Header>
<Modal.Body>{activityDetailInfo[0].attributes.description}</Modal.Body>
</Modal>
<Modal
show={rejectPopUp}
onHide={() => {
// setrejectionId(null);
setrejectPopUp(false);
}}
>
<Modal.Header closeButton>Please mention reason for rejecting the activity.</Modal.Header>
<Modal.Body>
<div className="input-group">
<textarea
style={{ width: "100%" }}
rows={4}
className="p-2"
placeholder="Eg: Not appropriate for this age group."
name="comments"
onChange={e => {
e.preventDefault();
setrejectionReasonText(e.target.value);
}}
/>
</div>
<div className="my-4">
<div className="d-flex justify-content-center">
<Button
variant=""
className="btnAdd btnApprove m-0"
disabled={rejectionReasonText == ""}
onClick={async () => {
await updateActivityStatusAdmin({ status: "rejected", activityId: activityDetailInfo[0].id, rejectionReason: rejectionReasonText });
// setrejectionId(null);
setrejectPopUp(false);
toast.success("Activity rejected.");
}}
>
Submit
</Button>
</div>
</div>
</Modal.Body>
</Modal>
<Modal size="xl" show={showActivityImages} onHide={() => setShowActivityImages(false)} centered contentClassName="p-3">
<div className="text-end">
<span className="image-container" style={{ cursor: "pointer" }} onClick={() => setShowActivityImages(false)}>
<Image width={13} height={13} alt="" src="/images/admin/icon-close.svg" className="image" />
</span>
</div>
<ActivityDetailGallaryModal activityDetailInfo={activityDetailInfo} showActivityImages={showActivityImages} setShowActivityImages={setShowActivityImages} />
</Modal>
</Fragment>
);
};
export default ActivityDetailsModal;