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BACb,KA4NYgE,EAAAA,EAAAA,KAACgC,EAAAA,EAAY,CAACJ,QAASlF,EAASoF,YAAY,0BAKhE,C","sources":["services/API/mod_member.js","views/daftar-anggota/form.js"],"sourcesContent":["import axios from \"axios\"\r\nimport { appConfig } from \"../../config\";\r\nimport { jsonHeaderAuth, refreshAuthLogic } from \"../fetchTools\";\r\n\r\n\r\nexport const getAllDataMember = async () => {\r\n try {\r\n const {status, data} = await axios.get(`${appConfig.BASE_API}/member/getAll`, {\r\n ...jsonHeaderAuth()\r\n })\r\n\r\n return{status,data}\r\n } catch (error) {\r\n return { status: error.code, message: error.message }\r\n }\r\n}\r\n\r\nexport const createNewMember = async (req) => {\r\n try {\r\n const {status,data} = await axios.post(`${appConfig.BASE_API}/member/create`, req, {\r\n ...jsonHeaderAuth()\r\n })\r\n\r\n return{status,data}\r\n } catch (error) {\r\n return { status: error.code, message: error.message }\r\n }\r\n}\r\n\r\nexport const getDataMemberById = async (id) => {\r\n try {\r\n const {status,data} = await axios.get(`${appConfig.BASE_API}/member/getId/${id}`, {\r\n ...jsonHeaderAuth()\r\n })\r\n\r\n return{status,data}\r\n } catch (error) {\r\n return { status: error.code, message: error.message }\r\n }\r\n}\r\n\r\nexport const updateMember = async (id, req) => {\r\n try {\r\n const {status,data} = await axios.post(`${appConfig.BASE_API}/member/update/${id}`, req, {\r\n ...jsonHeaderAuth()\r\n })\r\n\r\n return{status,data}\r\n } catch (error) {\r\n return { status: error.code, message: error.message }\r\n }\r\n}\r\n\r\nexport const deleteMember = async (id) => {\r\n try {\r\n const {status,data} = await axios.get(`${appConfig.BASE_API}/member/delete/${id}`, {\r\n ...jsonHeaderAuth()\r\n })\r\n\r\n return{status,data}\r\n } catch (error) {\r\n return { status: error.code, message: error.message }\r\n }\r\n}","import React, { Component, useState, useEffect } from \"react\";\r\nimport { Link, useLocation, useNavigate, useParams } from \"react-router-dom\";\r\nimport LoadingAlert from \"../../component/alert/loadingAlert\";\r\nimport ConfirmAlert from \"../../component/alert/confirmAlert\";\r\nimport { createNewMember, getDataMemberById, updateMember } from \"../../services/API/mod_member\";\r\n\r\nfunction TambahAnggota() {\r\n const location = useLocation()\r\n const navigate = useNavigate()\r\n const params = useParams()\r\n const [showPopup, setShowPopup] = useState(false)\r\n const [alertOption, setAlertOption] = useState({title:'', message:'', redirect: false})\r\n const [loading, setLoading] = useState(false)\r\n const [password, setPassword] = useState('')\r\n const [errorPassword, setErrorPassword]= useState('')\r\n const [confirmPassword, setConfirmPassword] = useState('')\r\n const [errorConfirmPassword, setErrorConfirmPassword] = useState('')\r\n const [typeInput, setTypeInput] = useState([\r\n 'password',\r\n 'password'\r\n ])\r\n const [iconClass, setIconClass] = useState([\r\n 'fa-eye',\r\n 'fa-eye'\r\n ])\r\n const [isFormValid, setIsFormValid] = useState(false)\r\n const [nama, setNama] = useState('')\r\n const [errorNama, setErrorNama] = useState('')\r\n const [email, setEmail] = useState('')\r\n const [errorEmail, setErrorEmail] = useState('')\r\n const [noTelp, setNoTelp] = useState('')\r\n const [errorNoTelp, setErrorNoTelp] = useState('')\r\n const [isFormDisabled, setIsFormDisabled] = useState(true)\r\n\r\n useEffect(() => {\r\n if(location.state?.id) {\r\n dataMemberById()\r\n }\r\n }, []);\r\n\r\n const handleNama = (e) => {\r\n const value = e.target.value\r\n if(value === \"\") {\r\n setNama(value)\r\n setErrorNama(\"Silahkan isi nama\")\r\n } else {\r\n setNama(value)\r\n setErrorNama('')\r\n }\r\n }\r\n\r\n const emailText = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\r\n const handleEmail = (e) => {\r\n const value = e.target.value\r\n if(value === \"\") {\r\n setEmail(value)\r\n setErrorEmail(\"Silahkan isi email\")\r\n } else if (!emailText.test(value)) {\r\n setEmail(value)\r\n setErrorEmail('Format email tidak valid')\r\n } else {\r\n setEmail(value)\r\n setErrorEmail('')\r\n }\r\n }\r\n \r\n const handleNoTelp = (e) => {\r\n if(typeof e.key != 'undefined' && !e.key.match(/^\\d+$/) && e.keyCode !== 8 && e.keyCode !== 187 && e.keyCode !== 16 && e.keyCode !== 36 && e.keyCode !== 35 && e.keyCode !== 9 && e.keyCode !== 39 && e.keyCode !== 37) {\r\n e.preventDefault()\r\n setErrorNoTelp('Nomor telepon harus berupa angka')\r\n return\r\n } \r\n\r\n const value = e.target.value\r\n if(value === \"\") {\r\n setNoTelp(value)\r\n setErrorNoTelp(\"Silahkan isi nomor telepon\")\r\n } else {\r\n setNoTelp(value)\r\n setErrorNoTelp('')\r\n }\r\n }\r\n\r\n const handlePassword = (e) => {\r\n const value = e.target.value\r\n if(value === \"\") {\r\n setPassword(value)\r\n setErrorPassword(\"Silahkan isi password\")\r\n } else {\r\n setPassword(value)\r\n setErrorPassword('')\r\n }\r\n }\r\n\r\n const handleConfirmPassword = (e) => {\r\n const value = e.target.value\r\n if(value === \"\") {\r\n setConfirmPassword(value)\r\n setErrorConfirmPassword(\"Silahkan isi kembali password\")\r\n } else {\r\n if(value !== password) {\r\n setConfirmPassword(value)\r\n setErrorConfirmPassword('Masukkan sesuai password baru')\r\n } else {\r\n setConfirmPassword(value)\r\n setErrorConfirmPassword('')\r\n }\r\n }\r\n }\r\n\r\n const handlePopup = () => {\r\n setShowPopup(false)\r\n if(alertOption.redirect) {\r\n navigate('/daftar_anggota')\r\n }\r\n }\r\n\r\n const dataMemberById = async () => {\r\n // console.log(location.state?.id)\r\n setLoading(true)\r\n const res = await getDataMemberById(location.state?.id)\r\n setLoading(false)\r\n if(res.status == 200) {\r\n // console.log(res.data)\r\n setNama(res.data.Table[0].namalengkap)\r\n setEmail(res.data.Table[0].emailaddress)\r\n setNoTelp(res.data.Table[0].telp)\r\n setPassword(res.data.Table[0].password)\r\n setConfirmPassword(res.data.Table[0].password)\r\n }\r\n }\r\n\r\n const submit = async (e) => {\r\n e.preventDefault()\r\n let isValid = true\r\n\r\n if(nama === \"\") {\r\n setErrorNama(\"Silahkan isi nama\")\r\n isValid = false\r\n } else {\r\n setErrorNama('')\r\n }\r\n\r\n if(email === \"\" || !emailText.test(email)) {\r\n if(!emailText.test(email)) {\r\n setErrorEmail(\"Format email tidak valid\")\r\n } else {\r\n setErrorEmail(\"Silahkan isi email\")\r\n }\r\n isValid = false\r\n } else {\r\n setErrorEmail('')\r\n }\r\n\r\n if(!email.match(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/)) {\r\n setErrorEmail(\"Format email tidak valid\")\r\n isValid = false\r\n }\r\n\r\n if(noTelp === \"\") {\r\n setErrorNoTelp(\"Silahkan isi nomor telepon\")\r\n isValid = false\r\n } else {\r\n setErrorNoTelp('')\r\n }\r\n\r\n if(password === \"\") {\r\n setErrorPassword(\"Silahkan isi password\")\r\n isValid = false\r\n } else {\r\n setErrorPassword('')\r\n }\r\n\r\n if(confirmPassword === \"\") {\r\n setErrorConfirmPassword(\"Silahkan isi kembali password \")\r\n isValid = false\r\n } else {\r\n setErrorConfirmPassword('')\r\n }\r\n\r\n if(password !== confirmPassword) {\r\n setShowPopup(true)\r\n setAlertOption({title:'', message:'Silahkan isi ulang password sesuai password baru'})\r\n return\r\n }\r\n\r\n setIsFormValid(isValid)\r\n\r\n if(isValid) {\r\n\r\n if(location.state?.id) {\r\n var phone = noTelp\r\n if(phone.charAt(0) === '0') {\r\n phone = `+62${phone.substring(1)}`\r\n }\r\n\r\n setLoading(true)\r\n const res = await updateMember(location.state?.id,{namalengkap: nama, email: email, telp: phone})\r\n setLoading(false)\r\n if(res.status == 200 && res.data.includes('Succes update nama & email')) {\r\n setShowPopup(true)\r\n setAlertOption({title: '', message: 'Berhasil memperbarui data anggota', redirect: true})\r\n } else {\r\n setShowPopup(true)\r\n setAlertOption({title: '', message: res.data, redirect: false})\r\n }\r\n } else {\r\n var phone = noTelp\r\n if(phone.charAt(0) === '0') {\r\n phone = `+62${phone.substring(1)}`\r\n } else {\r\n if(phone !== '' && phone !== '+') {\r\n phone = `+${phone}`\r\n }\r\n }\r\n \r\n setLoading(true)\r\n const res = await createNewMember({namalengkap: nama, emailaddress: email, telp: phone, password: password})\r\n setLoading(false)\r\n if(res.status == 200 && res.data.includes('Success insert new register')) {\r\n setShowPopup(true)\r\n setAlertOption({title:'', message:'Berhasil tambah anggota', redirect: true})\r\n } else {\r\n setShowPopup(true)\r\n setAlertOption({title:'Error', message:res.data, redirect: false})\r\n }\r\n }\r\n\r\n } else {\r\n setShowPopup(true)\r\n setAlertOption({title: 'Error', message: 'please fill empty field', redirect: false})\r\n }\r\n }\r\n return (\r\n <>\r\n