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AAe,GACZL,EAAYG,UACXV,EAAS,aACb,KAiHgBiD,EAAAA,EAAAA,KAACwD,EAAAA,EAAY,CAACH,QAASzF,EAAS0F,YAAY,4BAMpE,C","sources":["views/riwayat/tulis-review.js"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\r\nimport { Link, useLocation, useNavigate } from \"react-router-dom\";\r\nimport ConfirmAlert from \"../../component/alert/confirmAlert\";\r\nimport { createReview } from \"../../services/API/mod_riwayatOrder\";\r\nimport LoadingAlert from \"../../component/alert/loadingAlert\";\r\n\r\nfunction Review() {\r\n const navigate = useNavigate()\r\n const location = useLocation()\r\n const [showPopup, setShowPopup] = useState(false)\r\n const [alertOption, setAlertOption] = useState({message: '', redirect: false})\r\n const [errorRating, setErrorRating] = useState(false)\r\n const [loading, setLoading] = useState(false)\r\n const [requestId, setRequestId] = useState(location.state.id)\r\n const [requestNo, setRequestNo] = useState(location.state.serviceRequest)\r\n const [equipment, setEquipment] = useState(location.state.eq)\r\n const [namaRequest, setNamaRequest] = useState(location.state.requestName)\r\n const [description, setDescription] = useState('')\r\n const [rating, setRating] = useState(0)\r\n const [textareaHeight, setTextareaHeight] = useState('auto')\r\n const [inputDescriptionRows, setInputDescriptionRows] = useState(1)\r\n const [scrollMode, setScrollMode] = useState(false)\r\n const activeStatus = location.state?.activeStatus || 'all'\r\n\r\n // console.log(location.state);\r\n\r\n useEffect(() => {\r\n const setInitialHeight = () => {\r\n if(window.innerWidth <= 768) {\r\n setTextareaHeight(`${inputDescriptionRows * 25}px`)\r\n } else {\r\n setTextareaHeight('200px')\r\n }\r\n }\r\n\r\n setInitialHeight()\r\n window.addEventListener('resize', setInitialHeight)\r\n\r\n return () => {\r\n window.removeEventListener('resize', setInitialHeight)\r\n }\r\n }, [inputDescriptionRows])\r\n\r\n const handleRatingClick = (rating) => {\r\n setRating(rating);\r\n\r\n if (window.innerWidth <= 768) {\r\n setTextareaHeight(`${inputDescriptionRows * 25}px`);\r\n }\r\n }\r\n\r\n const handleDescription = (e) => {\r\n setDescription(e.target.value);\r\n \r\n const lineCount = (e.target.value.match(/\\n/g) || []).length + 1;\r\n setInputDescriptionRows(lineCount > 4 ? 4 : lineCount);\r\n \r\n if (window.innerWidth <= 768) {\r\n setTextareaHeight(`${inputDescriptionRows * 25}px`);\r\n }\r\n }\r\n\r\n const handleKeyDown = (e) => {\r\n if (e.key === 'Enter' && !e.shiftKey) {\r\n } else if (e.key === 'Backspace' && inputDescriptionRows > 1) {\r\n if (description.endsWith('\\n')) {\r\n setDescription((prevMessage) => prevMessage.slice(0, -1));\r\n } else {\r\n setDescription((prevMessage) => prevMessage.slice(0, -1));\r\n }\r\n setInputDescriptionRows((prevRows) => prevRows - 1);\r\n \r\n if (window.innerWidth <= 768) {\r\n setTextareaHeight(`${(inputDescriptionRows - 1) * 25}px`);\r\n }\r\n }\r\n }\r\n\r\n const handlePopup = () => {\r\n setShowPopup(false);\r\n setErrorRating(false)\r\n if(alertOption.redirect) {\r\n navigate(\"/dashboard\")\r\n }\r\n }\r\n\r\n const handleSubmit = async () => {\r\n if (rating === 0) {\r\n setErrorRating(true);\r\n setShowPopup(true);\r\n setAlertOption({message:'Mohon isi rating', redirect: false})\r\n } else {\r\n setLoading(true)\r\n const res = await createReview({trequestid: requestId, review: rating.toString(), description: description})\r\n setLoading(false)\r\n if(res.status = 200 && res.data.includes('Succes insert review')) {\r\n // console.log('berhasil harusnya');\r\n setShowPopup(true);\r\n setAlertOption({message:'Berhasil berikan review', redirect: true})\r\n }\r\n }\r\n }\r\n\r\n const renderStars = () => {\r\n const maxStars = 5;\r\n const stars = [];\r\n\r\n for (let i = 1; i <= maxStars; i++) {\r\n const className = i <= rating ? \"fa fa-star yellow\" : \"fa fa-star\";\r\n stars.push(\r\n handleRatingClick(i)} \r\n style={{marginRight:'15px'}} \r\n />\r\n );\r\n }\r\n // console.log(stars);\r\n return stars;\r\n }\r\n\r\n const handleGoBack = (e) => {\r\n e.preventDefault()\r\n \r\n navigate(location.state?.back, {\r\n state: {\r\n currentTabActive: location.state?.currentTabActive,\r\n currentSkip: location.state?.currentSkip\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <>\r\n
\r\n
\r\n

\r\n \r\n \r\n \r\n Tulis Review\r\n

\r\n {/* Tulis Review */}\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n {namaRequest}\r\n \r\n \r\n EQ\r\n \r\n \r\n \r\n \r\n :\r\n \r\n \r\n :\r\n \r\n \r\n \r\n \r\n {requestNo}\r\n \r\n \r\n {equipment}\r\n \r\n \r\n \r\n
\r\n Bagaimana penilaian anda dengan pelayanan dari Astragraphia\r\n
\r\n {renderStars()}\r\n
\r\n
\r\n
\r\n
\r\n Berikan Review\r\n
\r\n
\r\n