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G,YAAY,oBAC5CrD,EAAAA,EAAAA,KAACsD,EAAAA,EAAY,CAACF,QAAS5G,EAAkBqF,QAAQ,uBAAuBwB,YAAY,WAAWtC,QAASrB,KACxGM,EAAAA,EAAAA,KAACsD,EAAAA,EAAY,CAACF,QAAS1G,EAAgB6G,aAAa,QAAQ1B,QAASrD,EAAc6E,YAAY,WAAWtC,QAASrB,gBAOnI,C","sources":["views/data-diri/index.js"],"sourcesContent":["import React, { useState, useEffect } from \"react\";\r\nimport { Component } from \"react\";\r\nimport ConfirmAlert from \"../../component/alert/confirmAlert\";\r\nimport { updateDataDiriById, getDataDiri, updateWhatsapp } from \"../../services/API\";\r\nimport LoadingAlert from \"../../component/alert/loadingAlert\";\r\nimport { Link, useNavigate } from \"react-router-dom\";\r\nimport { setUser } from \"../../core/local-storage\";\r\nimport { settoken } from \"../../services/fetchTools\";\r\n\r\n\r\nfunction DataDiri() {\r\n const [ isEditName, setIsEditName ] = useState(false)\r\n const [ isEditPhone, setIsEditPhone ] = useState(false)\r\n const [ isEditEmail, setIsEditEmail ] = useState(false)\r\n const [ showSuccessPopup, setShowSuccessPopup ] = useState(false)\r\n const [ showErrorPopup, setShowErrorPopup ] = useState(false)\r\n const [ loading, setLoading ] = useState(false)\r\n const [ name, setName ] = useState('')\r\n const [ email, setEmail ] = useState('')\r\n const [ phone, setPhone ] = useState('')\r\n const [ isEmailVerified, setIsEmailVerified ] = useState(false)\r\n const [ isWhatsappVerified, setIsWhatsappVerified ] = useState(false)\r\n const [ instansi, setInstansi ] = useState('')\r\n const [ dataName, setDataName ] = useState('')\r\n const [ dataPhone, setDataPhone ] = useState('')\r\n const [ errorDataName, setErrorDataName ] = useState('')\r\n const [ errorDataPhone, setErrorDataPhone ] = useState('')\r\n const [ errorDataEmail, setErrorDataEmail ] = useState('')\r\n const [ dataCollectMeter, setDataCollectMeter ] = useState([])\r\n const [ dataDiri, setDataDiri ] = useState([])\r\n const [ errorMessage, setErrorMessage ] = useState('')\r\n\r\n const navigate = useNavigate()\r\n\r\n useEffect(() => {\r\n init()\r\n }, []);\r\n\r\n async function init() {\r\n setLoading(true)\r\n const res = await getDataDiri();\r\n\r\n setLoading(false)\r\n if (res.status === 200) {\r\n if (res.data.Table != undefined)\r\n {\r\n setName(res.data.Table[0].namalengkap)\r\n setEmail(res.data.Table[0].emailaddress)\r\n setPhone(res.data.Table[0].telp ?? '')\r\n setInstansi(res.data.Table[0].namaperusahaan)\r\n setIsEmailVerified(res.data.Table[0].isEmailVerified)\r\n setIsWhatsappVerified(res.data.Table[0].isWhatsappVerified)\r\n } \r\n }\r\n }\r\n\r\n const handlePopup = () => {\r\n setShowSuccessPopup(false)\r\n setShowErrorPopup(false)\r\n }\r\n\r\n const handleEditName = () => {\r\n setIsEditName(true)\r\n }\r\n\r\n const handleEditPhone = () => {\r\n setIsEditPhone(true)\r\n }\r\n\r\n const handleEditEmail = () => {\r\n setIsEditEmail(true)\r\n }\r\n\r\n const handleChangeName = (event) => {\r\n const value = event.target.value;\r\n if(value === \"\") {\r\n setName(event.target.value)\r\n setErrorDataName('Silahkan isi nama')\r\n } else {\r\n setName(event.target.value)\r\n setErrorDataName('')\r\n }\r\n }\r\n\r\n const handleChangePhone = (event) => {\r\n setPhone(event.target.value)\r\n const value = event.target.value;\r\n if(value === \"\") {\r\n setErrorDataPhone('Silahkan isi nomor telepon')\r\n return\r\n } else if(!value.match(/^(\\+\\d{1,3})?\\d{8,15}$/) || value.length < 9 || value.length > 16) {\r\n setErrorDataPhone('No Telepon tidak valid')\r\n return\r\n } else {\r\n setErrorDataPhone('')\r\n return\r\n }\r\n }\r\n\r\n const handleChangeEmail = (event) => {\r\n const value = event.target.value;\r\n if(value === \"\") {\r\n setEmail(event.target.value)\r\n setErrorDataEmail('Silahkan isi email')\r\n } else if (!value.match(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/)) {\r\n setEmail(value)\r\n setErrorDataEmail('Format email tidak valid')\r\n } else {\r\n setEmail(event.target.value)\r\n setErrorDataEmail('')\r\n }\r\n }\r\n\r\n const handleSubmitName = () => {\r\n setIsEditName(false)\r\n }\r\n\r\n const handleSubmitPhone = () => {\r\n setIsEditPhone(false)\r\n };\r\n\r\n const handleSubmitEmail = () => {\r\n setIsEditEmail(false)\r\n };\r\n\r\n async function submit(event) {\r\n event.preventDefault();\r\n\r\n let isValid = true;\r\n setShowSuccessPopup(false)\r\n setShowErrorPopup(false)\r\n setErrorMessage(\"\")\r\n\r\n if (name === \"\") {\r\n setErrorDataName('Silahkan isi nama')\r\n isValid = false;\r\n } else {\r\n setErrorDataName('')\r\n }\r\n\r\n var tlp = phone.toString().replaceAll(\" \",\"\")\r\n if (tlp === \"\") {\r\n setErrorDataPhone('Silahkan isi nomor telepon')\r\n isValid = false;\r\n } else if(!tlp.match(/^(\\+\\d{1,3})?\\d{8,15}$/) || tlp.length < 9 || tlp.length > 16) {\r\n setErrorDataPhone('No Telepon tidak valid')\r\n isValid = false\r\n } else {\r\n setErrorDataPhone('')\r\n }\r\n\r\n if (email === \"\") {\r\n setErrorDataEmail('Silahkan isi email')\r\n isValid = false;\r\n } else if (!email.match(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/)) {\r\n setErrorDataEmail('Format email tidak valid')\r\n isValid = false;\r\n } else {\r\n setErrorDataEmail('')\r\n }\r\n\r\n if (isValid) { \r\n setLoading(true)\r\n var telp = phone\r\n if(telp.charAt(0) === '0') {\r\n telp = `+62${telp.substring(1)}`\r\n }\r\n \r\n // console.log(telp)\r\n const res = await updateDataDiriById({namalengkap: name, emailaddress: email, telp: telp.toString().trim(), namaperusahaan: instansi})\r\n setLoading(false)\r\n if(res.status == 200 && res.data !== null) {\r\n console.log('change result',res)\r\n if(!res.data.hasOwnProperty('action')) {\r\n if(res.data.includes('Nomer telepon sudah terdaftar') || res.data.includes('Email sudah terdaftar')) {\r\n setShowErrorPopup(true)\r\n setErrorMessage(res.data)\r\n console.log(1);\r\n } else if(res.data.includes('token:')){\r\n var newToken = res.data.toString().replaceAll(\"token:\",\"\")\r\n console.log('newToken',newToken)\r\n settoken(newToken)\r\n setShowSuccessPopup(true)\r\n } else {\r\n setShowSuccessPopup(true)\r\n setUser(name)\r\n console.log(res.data);\r\n }\r\n } else {\r\n console.log(3);\r\n var data = res.data\r\n // navigate(`/kode-otp/${window.btoa(JSON.stringify({...data, email: email, telp: phone.toString().trim(), name: name}))}`)\r\n navigate('/kode-otp', {\r\n state: {\r\n firstlogin:false, \r\n email: email,\r\n name: name,\r\n phone: telp.toString().trim(),\r\n telp: telp.toString().trim(),\r\n userid: data.userid,\r\n msg: data,\r\n jenisOTP:\"whatsapp\",\r\n userLogin:localStorage.getItem('username')\r\n }\r\n })\r\n \r\n }\r\n } else {\r\n console.log(4);\r\n setShowErrorPopup(true)\r\n } \r\n } else {\r\n console.log(5);\r\n setShowErrorPopup(true)\r\n setErrorMessage(\"Data tidak valid\")\r\n }\r\n }\r\n \r\n async function verifyWhatsapp(event) {\r\n event.preventDefault();\r\n\r\n setShowErrorPopup(false)\r\n\r\n var telp = phone\r\n if(telp.charAt(0) === '0') {\r\n telp = `+62${telp.substring(1)}`\r\n } \r\n\r\n setLoading(true)\r\n const res = await updateWhatsapp({telp: phone, tipe : 'whatsapp' })\r\n setLoading(false)\r\n \r\n if(res.status == 200 && res.data !== null) {\r\n if (res.data.includes('Sukses')) {\r\n var message = {action : 'Verify Whatsapp OTP', email: email}\r\n navigate('/kode-otp', {\r\n state: {\r\n firstlogin:false, \r\n email: email,\r\n phone: telp.toString().trim(),\r\n telp: telp.toString().trim(),\r\n userid: localStorage.getItem('id'),\r\n msg: message,\r\n jenisOTP: \"whatsapp\",\r\n redirectLink:\"/data-diri\",\r\n }\r\n })\r\n } else {\r\n setErrorDataPhone('Gagal verifikasi. ' + res.data)\r\n }\r\n } else {\r\n setShowErrorPopup(true)\r\n setErrorMessage(\"Oops! Terjadi kesalahan\")\r\n } \r\n\r\n }\r\n\r\n async function verifyEmail(event) {\r\n event.preventDefault();\r\n\r\n setShowErrorPopup(false)\r\n\r\n setLoading(true)\r\n const res = await updateWhatsapp({telp: '', tipe : 'email' })\r\n setLoading(false)\r\n \r\n if(res.status == 200 && res.data !== null) {\r\n if (res.data.includes('Sukses')) {\r\n var message = {action : 'Verify Email OTP', email: email}\r\n navigate('/kode-otp', {\r\n state: {\r\n firstlogin:false, \r\n email: email,\r\n userid: localStorage.getItem('id'),\r\n msg: message,\r\n jenisOTP: \"email\",\r\n redirectLink:\"/data-diri\",\r\n }\r\n })\r\n } else {\r\n setErrorDataPhone('Gagal verifikasi. ' + res.data)\r\n }\r\n } else {\r\n setShowErrorPopup(true)\r\n setErrorMessage(\"Oops! Terjadi kesalahan\")\r\n } \r\n\r\n }\r\n\r\n async function cancel(event) {\r\n event.preventDefault();\r\n navigate('/dashboard')\r\n }\r\n\r\n async function submitTelp(event) {\r\n event.preventDefault();\r\n\r\n setIsEditPhone(false)\r\n \r\n let isValid = true;\r\n setShowSuccessPopup(false)\r\n setShowErrorPopup(false)\r\n setErrorMessage(\"\")\r\n\r\n var tlp = phone.toString().replaceAll(\" \",\"\")\r\n if (tlp === \"\") {\r\n setErrorDataPhone('Silahkan isi nomor telepon')\r\n isValid = false;\r\n } else if(!tlp.match(/^(\\+\\d{1,3})?\\d{8,15}$/) || tlp.length < 9 || tlp.length > 16) {\r\n setErrorDataPhone('No Telepon tidak valid')\r\n isValid = false\r\n } else {\r\n setErrorDataPhone('')\r\n }\r\n\r\n if (isValid) { \r\n setLoading(true)\r\n var telp = phone\r\n if(telp.charAt(0) === '0') {\r\n telp = `+62${telp.substring(1)}`\r\n }\r\n \r\n var data = {\r\n field : \"telp\",\r\n value : telp.toString().trim()\r\n }\r\n \r\n const res = await updateDataDiriById(data)\r\n setLoading(false)\r\n if(res.status == 200 && res.data !== null) {\r\n \r\n if(res.data.hasOwnProperty('action')) {\r\n var data = res.data\r\n navigate('/kode-otp', {\r\n state: {\r\n firstlogin:false, \r\n email: email,\r\n name: name,\r\n phone: telp.toString().trim(),\r\n telp: telp.toString().trim(),\r\n userid: data.userid,\r\n msg: data,\r\n jenisOTP:\"whatsapp\",\r\n userLogin:localStorage.getItem('username')\r\n }\r\n })\r\n } else {\r\n setShowSuccessPopup(true)\r\n setUser(name)\r\n console.log(res.data);\r\n }\r\n\r\n } else {\r\n console.log(4);\r\n setShowErrorPopup(true)\r\n } \r\n\r\n } else {\r\n console.log(5);\r\n setShowErrorPopup(true)\r\n setErrorMessage(\"Data tidak valid\")\r\n }\r\n }\r\n\r\n async function submitName(event) {\r\n event.preventDefault();\r\n\r\n setIsEditName(false)\r\n\r\n let isValid = true;\r\n setShowSuccessPopup(false)\r\n setShowErrorPopup(false)\r\n setErrorMessage(\"\")\r\n\r\n if (name === \"\") {\r\n setErrorDataName('Silahkan isi nama')\r\n isValid = false;\r\n } else {\r\n setErrorDataName('')\r\n }\r\n\r\n if (isValid) { \r\n setLoading(true)\r\n \r\n var data = {\r\n field : \"nama\",\r\n value : name\r\n }\r\n\r\n const res = await updateDataDiriById(data)\r\n setLoading(false)\r\n if(res.status == 200 && res.data !== null) {\r\n setShowSuccessPopup(true)\r\n setUser(name)\r\n console.log(res.data);\r\n } else {\r\n console.log(4);\r\n setShowErrorPopup(true)\r\n } \r\n\r\n } else {\r\n console.log(5);\r\n setShowErrorPopup(true)\r\n setErrorMessage(\"Data tidak valid\")\r\n }\r\n }\r\n\r\n\r\n return(\r\n <>\r\n {dataDiri.map((item) => (\r\n
{item.username}
\r\n ))}\r\n\r\n\r\n
\r\n
\r\n
\r\n

\r\n \r\n \r\n \r\n Data Diri\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
\r\n
\r\n {isEditName ? (\r\n
\r\n \r\n \r\n
\r\n ) : (\r\n
\r\n
{name}
\r\n
\r\n )}\r\n
\r\n {isEditName ? (\r\n \r\n ) : (\r\n \r\n )}\r\n
\r\n
\r\n
\r\n
\r\n {errorDataName} \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
\r\n
\r\n
{email}
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n {isEmailVerified ? 'Email sudah diverifikasi' : 'Email belum diverifikasi '}\r\n {!isEmailVerified && }\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n {isEditPhone ? (\r\n
\r\n \r\n \r\n
\r\n ) : (\r\n
\r\n
{phone}
\r\n
\r\n )}\r\n
\r\n {isEditPhone ? (\r\n \r\n ) : (\r\n \r\n )}\r\n
\r\n
\r\n
\r\n
\r\n
\r\n {errorDataPhone} \r\n
\r\n
\r\n {isWhatsappVerified ? 'No Telepon sudah diverifikasi' : 'No Telepon belum diverifikasi '}\r\n {!isWhatsappVerified && }\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
{instansi}
\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 \r\n
\r\n
\r\n
\r\n
\r\n \r\n )\r\n}\r\n\r\nexport default DataDiri"],"names":["isEditName","setIsEditName","useState","isEditPhone","setIsEditPhone","isEditEmail","setIsEditEmail","showSuccessPopup","setShowSuccessPopup","showErrorPopup","setShowErrorPopup","loading","setLoading","name","setName","email","setEmail","phone","setPhone","isEmailVerified","setIsEmailVerified","isWhatsappVerified","setIsWhatsappVerified","instansi","setInstansi","dataName","setDataName","dataPhone","setDataPhone","errorDataName","setErrorDataName","errorDataPhone","setErrorDataPhone","errorDataEmail","setErrorDataEmail","dataCollectMeter","setDataCollectMeter","dataDiri","setDataDiri","errorMessage","setErrorMessage","navigate","useNavigate","useEffect","async","res","getDataDiri","status","_res$data$Table$0$tel","undefined","data","Table","namalengkap","emailaddress","telp","namaperusahaan","init","handlePopup","_jsxs","_Fragment","children","map","item","_jsx","username","className","style","fontSize","Link","to","borderBottom","borderRadius","color","type","value","onChange","event","target","onClick","preventDefault","isValid","field","updateDataDiriById","setUser","console","log","handleEditName","backgroundColor","border","updateWhatsapp","tipe","includes","message","action","state","firstlogin","userid","localStorage","getItem","msg","jenisOTP","redirectLink","toString","trim","match","length","tlp","replaceAll","charAt","substring","hasOwnProperty","userLogin","handleEditPhone","maxWidth","LoadingAlert","visible","customClass","ConfirmAlert","titleMessage"],"sourceRoot":""}