From 053c801a8c43688c2c4eec6800368898a81bfc39 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Thu, 31 Oct 2024 16:55:07 +0700
Subject: integrasi google maps service

---
 src/lib/address/components/EditAddress.jsx | 116 ++++++++++++++++++++++-------
 1 file changed, 88 insertions(+), 28 deletions(-)

(limited to 'src/lib/address/components/EditAddress.jsx')

diff --git a/src/lib/address/components/EditAddress.jsx b/src/lib/address/components/EditAddress.jsx
index 23cf72a9..0b3b0aa3 100644
--- a/src/lib/address/components/EditAddress.jsx
+++ b/src/lib/address/components/EditAddress.jsx
@@ -14,6 +14,12 @@ import Menu from '@/lib/auth/components/Menu';
 import useAuth from '@/core/hooks/useAuth';
 import odooApi from '@/core/api/odooApi';
 import stateApi from '../api/stateApi';
+import { MapPinIcon } from 'lucide-react';
+import { Button } from '@chakra-ui/react';
+import { useMaps } from '../../maps/stores/useMaps';
+
+import PinPointMap from '../../maps/components/PinPointMap';
+import BottomPopup from '@/core/components/elements/Popup/BottomPopup';
 
 const EditAddress = ({ id, defaultValues }) => {
   const auth = useAuth();
@@ -34,7 +40,19 @@ const EditAddress = ({ id, defaultValues }) => {
   const [states, setStates] = useState([]);
   const [cities, setCities] = useState([]);
   const [districts, setDistricts] = useState([]);
-  const [subDistricts, setSubDistricts] = useState([]); 
+  const [subDistricts, setSubDistricts] = useState([]);
+  const [pinedMaps, setPinedMaps] = useState(false);
+  const [tempAddress, setTempAddress] = useState(getValues('address_maps'));
+  const { addressMaps, selectedPosition, detailAddress } = useMaps();
+
+  useEffect(() => {
+    if (addressMaps) {
+      setTempAddress(addressMaps);
+      setValue('address_map', addressMaps);
+      setValue('longtitude', selectedPosition.lng);
+      setValue('latitude', selectedPosition.lat);
+    }
+  }, [addressMaps, selectedPosition, setValue]);
 
   useEffect(() => {
     const loadProfile = async () => {
@@ -60,12 +78,12 @@ const EditAddress = ({ id, defaultValues }) => {
       setStates(dataStates);
     };
     loadStates();
-  },[])
+  }, []);
 
   const watchState = watch('state');
   useEffect(() => {
     setValue('city', '');
-    if(watchState) {
+    if (watchState) {
       const loadCities = async () => {
         let dataCities = await cityApi({ stateId: watchState });
         dataCities = dataCities.map((city) => ({
@@ -81,7 +99,6 @@ const EditAddress = ({ id, defaultValues }) => {
       };
       loadCities();
     }
-    
   }, [watchState, setValue, getValues]);
 
   const watchCity = watch('city');
@@ -136,40 +153,65 @@ const EditAddress = ({ id, defaultValues }) => {
       city_id: values.city,
       district_id: values.district,
       sub_district_id: values.subDistrict,
+      longtitude: selectedPosition?.lng,
+      latitude: selectedPosition?.lat,
+      address_map: addressMaps,
     };
     if (!auth.company) {
       data.alamat_lengkap_text = values.street;
     }
-    const address = await editAddressApi({ id, data });
-    let dataAlamat;
-    let isUpdated = true;
-    if (auth.company) {
-      if (auth?.partnerId == id) {
-        dataAlamat = {
-          id_user: auth.partnerId,
-          alamat_lengkap_text: values.alamat_wajib_pajak,
-          street: values.street,
-        };
-        isUpdated = await odooApi(
-          'PUT',
-          `/api/v1/partner/${auth.parentId}`,
-          dataAlamat
-        );
+    try {
+      const address = await editAddressApi({ id, data });
+      let dataAlamat;
+      let isUpdated = true;
+      if (auth.company) {
+        if (auth?.partnerId == id) {
+          dataAlamat = {
+            id_user: auth.partnerId,
+            alamat_lengkap_text: values.alamat_wajib_pajak,
+            street: values.street,
+          };
+          isUpdated = await odooApi(
+            'PUT',
+            `/api/v1/partner/${auth.parentId}`,
+            dataAlamat
+          );
+        }
       }
-    }
-
-    // if (isUpdated?.id) {
-    if (address?.id && auth.company ? isUpdated?.id : true) {
-      toast.success('Berhasil mengubah alamat');
-      router.back();
-    } else {
+      if (address?.id) {
+        toast.success('Berhasil mengubah alamat');
+        router.back();
+      } else {
+        toast.error('Terjadi kesalahan internal');
+        router.back();
+      }
+    } catch (error) {
       toast.error('Terjadi kesalahan internal');
       router.back();
     }
+
+    // if (isUpdated?.id) {
+    // if (address?.id && auth.company ? isUpdated?.id : true) {
+    //   toast.success('Berhasil mengubah alamat');
+    //   router.back();
+    // } else {
+    //   toast.error('Terjadi kesalahan internal');
+    //   router.back();
+    // }
   };
 
   return (
     <>
+      <BottomPopup
+        className=' !h-[75%]'
+        title='Pin Maps Address'
+        active={pinedMaps}
+        close={() => setPinedMaps(false)}
+      >
+        <div className='flex mt-4'>
+          <PinPointMap />
+        </div>
+      </BottomPopup>
       <div className='max-w-none md:container mx-auto flex p-0 md:py-10'>
         <div className='hidden md:block w-3/12 pr-4'>
           <Menu />
@@ -182,6 +224,20 @@ const EditAddress = ({ id, defaultValues }) => {
             {auth?.partnerId == id && <div className='badge-green'>Utama</div>}
           </div>
           <form onSubmit={handleSubmit(onSubmitHandler)}>
+            <div className='mb-4 items-start'>
+              <label className='form-label mb-2'>PinPoint</label>
+              {tempAddress ? (
+                <div className='flex gap-x-2 items-center'>
+                  <MapPinIcon class='h-6 w-6 text-gray-500 mr-3' />{' '}
+                  <span> {tempAddress} </span>
+                </div>
+              ) : (
+                <Button variant='plain' onClick={() => setPinedMaps(true)}>
+                  <MapPinIcon class='h-6 w-6 text-gray-500 mr-3' />
+                  Pin Alamat
+                </Button>
+              )}
+            </div>
             <div className='grid grid-cols-1 md:grid-cols-2 gap-4'>
               <div>
                 <label className='form-label mb-2'>Label Alamat</label>
@@ -287,7 +343,11 @@ const EditAddress = ({ id, defaultValues }) => {
                   name='city'
                   control={control}
                   render={(props) => (
-                    <HookFormSelect {...props} options={cities} disabled={!watchState} />
+                    <HookFormSelect
+                      {...props}
+                      options={cities}
+                      disabled={!watchState}
+                    />
                   )}
                 />
                 <div className='text-caption-2 text-danger-500 mt-1'>
@@ -348,7 +408,7 @@ const validationSchema = Yup.object().shape({
   mobile: Yup.string().required('Harus di-isi'),
   street: Yup.string().required('Harus di-isi'),
   zip: Yup.string().required('Harus di-isi'),
-  state : Yup.string().required('Harus di-pilih'),
+  state: Yup.string().required('Harus di-pilih'),
   city: Yup.string().required('Harus di-pilih'),
   district: Yup.string().required('Harus di-pilih'),
 });
-- 
cgit v1.2.3


From d1592286eef165533c21d52aec70dbb703cdcfd3 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Wed, 18 Dec 2024 15:03:52 +0700
Subject: feedback uat

---
 src/lib/address/components/EditAddress.jsx | 71 ++++++++++++++++++++++++++++--
 1 file changed, 68 insertions(+), 3 deletions(-)

(limited to 'src/lib/address/components/EditAddress.jsx')

diff --git a/src/lib/address/components/EditAddress.jsx b/src/lib/address/components/EditAddress.jsx
index 0b3b0aa3..7675db9d 100644
--- a/src/lib/address/components/EditAddress.jsx
+++ b/src/lib/address/components/EditAddress.jsx
@@ -42,18 +42,33 @@ const EditAddress = ({ id, defaultValues }) => {
   const [districts, setDistricts] = useState([]);
   const [subDistricts, setSubDistricts] = useState([]);
   const [pinedMaps, setPinedMaps] = useState(false);
-  const [tempAddress, setTempAddress] = useState(getValues('address_maps'));
+  const [tempAddress, setTempAddress] = useState(getValues('addressMap'));
   const { addressMaps, selectedPosition, detailAddress } = useMaps();
 
+  console.log('ini adalah',);
+
   useEffect(() => {
     if (addressMaps) {
       setTempAddress(addressMaps);
-      setValue('address_map', addressMaps);
+      setValue('addressMap', addressMaps);
       setValue('longtitude', selectedPosition.lng);
       setValue('latitude', selectedPosition.lat);
     }
   }, [addressMaps, selectedPosition, setValue]);
 
+  useEffect(() => {
+    if (Object.keys(detailAddress).length > 0) {
+      setValue('zip', detailAddress.postalCode);
+      const selectedState = states.find(
+        (state) =>
+          detailAddress?.province.includes(state.label) ||
+          state.label.includes(detailAddress?.province)
+      );
+      setValue('state', selectedState?.value);  
+      setValue('street', detailAddress?.route);      
+    }
+  }, [detailAddress, setValue]);
+
   useEffect(() => {
     const loadProfile = async () => {
       const dataProfile = await addressApi({ id: auth.parentId });
@@ -101,6 +116,21 @@ const EditAddress = ({ id, defaultValues }) => {
     }
   }, [watchState, setValue, getValues]);
 
+  useEffect(() => {
+    if (Object.keys(detailAddress).length > 0) {
+      const selectedCities = cities.find(
+        (city) =>
+          detailAddress?.district
+            .toLowerCase()
+            .includes(city.label.toLowerCase()) ||
+          city.label
+            .toLowerCase()
+            .includes(detailAddress?.district.toLowerCase())
+      );
+      setValue('city', selectedCities?.value);
+    }
+  }, [cities, detailAddress, setValue]);
+
   const watchCity = watch('city');
   useEffect(() => {
     setValue('district', '');
@@ -122,6 +152,23 @@ const EditAddress = ({ id, defaultValues }) => {
     }
   }, [watchCity, setValue, getValues]);
 
+  useEffect(() => {
+    if (Object.keys(detailAddress).length > 0) {
+      const selectedDistrict = districts.find(
+        (district) =>
+          detailAddress.subDistrict
+            .toLowerCase()
+            .includes(district.label.toLowerCase()) ||
+          district.label
+            .toLowerCase()
+            .includes(detailAddress.subDistrict.toLowerCase())
+      );
+      setValue('district', selectedDistrict?.value);
+    }
+  }, [districts, detailAddress, setValue]);
+
+
+
   const watchDistrict = watch('district');
   useEffect(() => {
     setValue('subDistrict', '');
@@ -145,6 +192,24 @@ const EditAddress = ({ id, defaultValues }) => {
       loadSubDistricts();
     }
   }, [watchDistrict, setValue, getValues]);
+
+  
+  useEffect(() => {
+    if (Object.keys(detailAddress).length > 0) {
+      const selectedSubDistrict = subDistricts.find(
+        (district) =>
+          detailAddress.village
+            .toLowerCase()
+            .includes(district.label.toLowerCase()) ||
+          district.label
+            .toLowerCase()
+            .includes(detailAddress.village.toLowerCase())
+      );
+
+      setValue('subDistrict', selectedSubDistrict?.value);
+    }
+  }, [subDistricts, detailAddress, setValue]);
+
   const onSubmitHandler = async (values) => {
     const data = {
       ...values,
@@ -228,7 +293,7 @@ const EditAddress = ({ id, defaultValues }) => {
               <label className='form-label mb-2'>PinPoint</label>
               {tempAddress ? (
                 <div className='flex gap-x-2 items-center'>
-                  <MapPinIcon class='h-6 w-6 text-gray-500 mr-3' />{' '}
+                  <MapPinIcon class='h-6 w-6 text-gray-500 mr-3 cursor-pointer' onClick={() => setPinedMaps(true)} />{' '}
                   <span> {tempAddress} </span>
                 </div>
               ) : (
-- 
cgit v1.2.3


From 2e507ccbc92f18a0d7f8ebc59112a0337a0bd678 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Jun 2025 13:40:45 +0700
Subject: <hafid> Pinpoint done

---
 src/lib/address/components/EditAddress.jsx | 150 +++++++++++++++++------------
 1 file changed, 90 insertions(+), 60 deletions(-)

(limited to 'src/lib/address/components/EditAddress.jsx')

diff --git a/src/lib/address/components/EditAddress.jsx b/src/lib/address/components/EditAddress.jsx
index 9f038b74..cfb35fbd 100644
--- a/src/lib/address/components/EditAddress.jsx
+++ b/src/lib/address/components/EditAddress.jsx
@@ -8,6 +8,7 @@ import districtApi from '../api/districtApi';
 import subDistrictApi from '../api/subDistrictApi';
 import addressApi from '@/lib/address/api/addressApi';
 import editAddressApi from '../api/editAddressApi';
+import editPartnerApi from '../api/editPartnerApi';
 import HookFormSelect from '@/core/components/elements/Select/HookFormSelect';
 import { toast } from 'react-hot-toast';
 import Menu from '@/lib/auth/components/Menu';
@@ -20,6 +21,7 @@ import { useMaps } from '../../maps/stores/useMaps';
 
 import PinPointMap from '../../maps/components/PinPointMap';
 import BottomPopup from '@/core/components/elements/Popup/BottomPopup';
+import { data } from 'autoprefixer';
 
 const EditAddress = ({ id, defaultValues }) => {
   const auth = useAuth();
@@ -41,12 +43,14 @@ const EditAddress = ({ id, defaultValues }) => {
   const [cities, setCities] = useState([]);
   const [districts, setDistricts] = useState([]);
   const [subDistricts, setSubDistricts] = useState([]);
-  const [pinedMaps, setPinedMaps] = useState(false);
   const [tempAddress, setTempAddress] = useState(getValues('addressMap'));
-  const { addressMaps, selectedPosition, detailAddress } = useMaps();
-
-  console.log('ini adalah',);
+  const { addressMaps,
+    selectedPosition,
+    detailAddress,
+    pinedMaps,
+    setPinedMaps } = useMaps();
 
+  
   useEffect(() => {
     if (addressMaps) {
       setTempAddress(addressMaps);
@@ -55,20 +59,20 @@ const EditAddress = ({ id, defaultValues }) => {
       setValue('latitude', selectedPosition.lat);
     }
   }, [addressMaps, selectedPosition, setValue]);
-
+  
   useEffect(() => {
     if (Object.keys(detailAddress).length > 0) {
       setValue('zip', detailAddress.postalCode);
       const selectedState = states.find(
         (state) =>
           detailAddress?.province.includes(state.label) ||
-          state.label.includes(detailAddress?.province)
+        state.label.includes(detailAddress?.province)
       );
       setValue('state', selectedState?.value);  
-      setValue('street', detailAddress?.route);      
+      setValue('street', detailAddress?.street);      
     }
   }, [detailAddress, setValue]);
-
+  
   useEffect(() => {
     const loadProfile = async () => {
       const dataProfile = await addressApi({ id: auth.partnerId });
@@ -85,7 +89,7 @@ const EditAddress = ({ id, defaultValues }) => {
     };
     if (auth) loadProfile();
   }, [auth?.parentId]);
-
+  
   useEffect(() => {
     const loadStates = async () => {
       let dataStates = await stateApi({ tempo: false });
@@ -97,7 +101,7 @@ const EditAddress = ({ id, defaultValues }) => {
     };
     loadStates();
   }, []);
-
+  
   const watchState = watch('state');
   useEffect(() => {
     setValue('city', '');
@@ -118,7 +122,7 @@ const EditAddress = ({ id, defaultValues }) => {
       loadCities();
     }
   }, [watchState, setValue, getValues]);
-
+  
   useEffect(() => {
     if (Object.keys(detailAddress).length > 0) {
       const selectedCities = cities.find(
@@ -126,23 +130,23 @@ const EditAddress = ({ id, defaultValues }) => {
           detailAddress?.district
             .toLowerCase()
             .includes(city.label.toLowerCase()) ||
-          city.label
+            city.label
             .toLowerCase()
             .includes(detailAddress?.district.toLowerCase())
-      );
-      setValue('city', selectedCities?.value);
-    }
-  }, [cities, detailAddress, setValue]);
-
-  const watchCity = watch('city');
-  useEffect(() => {
-    if (watchCity) {
-      // setValue('district', '');
-      const loadDistricts = async () => {
-        let dataDistricts = await districtApi({ cityId: watchCity });
-        dataDistricts = dataDistricts.map((district) => ({
-          value: district.id,
-          label: district.name,
+          );
+          setValue('city', selectedCities?.value);
+        }
+      }, [cities, detailAddress, setValue]);
+      
+      const watchCity = watch('city');
+      useEffect(() => {
+        if (watchCity) {
+          // setValue('district', '');
+          const loadDistricts = async () => {
+            let dataDistricts = await districtApi({ cityId: watchCity });
+            dataDistricts = dataDistricts.map((district) => ({
+              value: district.id,
+              label: district.name,
         }));
         setDistricts(dataDistricts);
         let oldDistrict = getValues('oldDistrict');
@@ -154,7 +158,7 @@ const EditAddress = ({ id, defaultValues }) => {
       loadDistricts();
     }
   }, [watchCity, setValue, getValues]);
-
+  
   useEffect(() => {
     if (Object.keys(detailAddress).length > 0) {
       const selectedDistrict = districts.find(
@@ -169,9 +173,9 @@ const EditAddress = ({ id, defaultValues }) => {
       setValue('district', selectedDistrict?.value);
     }
   }, [districts, detailAddress, setValue]);
-
-
-
+  
+  
+  
   const watchDistrict = watch('district');
   useEffect(() => {
     if (watchDistrict) {
@@ -204,23 +208,29 @@ const EditAddress = ({ id, defaultValues }) => {
           detailAddress.village
             .toLowerCase()
             .includes(district.label.toLowerCase()) ||
-          district.label
+            district.label
             .toLowerCase()
             .includes(detailAddress.village.toLowerCase())
-      );
+          );
 
-      setValue('subDistrict', selectedSubDistrict?.value);
+          setValue('subDistrict', selectedSubDistrict?.value);
     }
   }, [subDistricts, detailAddress, setValue]);
 
+  useEffect(() => {
+    if (id) {
+      setValue('id', id);
+    }
+  }, [id, setValue]);
+  
   const onSubmitHandler = async (values) => {
     const data = {
       ...values,
       phone: values.mobile,
-      state_id: values.state,
-      city_id: values.city,
-      district_id: values.district,
-      sub_district_id: values.subDistrict,
+      state_id: parseInt(values.state, 10),
+      city_id: parseInt(values.city, 10),
+      district_id: parseInt(values.district, 10),
+      sub_district_id: parseInt(values.subDistrict, 10),
       longtitude: selectedPosition?.lng,
       latitude: selectedPosition?.lat,
       address_map: addressMaps,
@@ -230,37 +240,57 @@ const EditAddress = ({ id, defaultValues }) => {
     }
     try {
       const address = await editAddressApi({ id, data });
-      let dataAlamat;
-      let isUpdated = true;
-      if (auth.company) {
-        if (auth?.partnerId == id) {
-          dataAlamat = {
-            id_user: auth.partnerId,
-            alamat_lengkap_text: values.alamat_wajib_pajak,
-            street: values.street,
-          };
-          isUpdated = await odooApi(
-            'PUT',
-            `/api/v1/partner/${auth.parentId}`,
-            dataAlamat
-          );
-        }
+      console.log('Response address:', address);
+
+      let isUpdated = null;
+
+      // Jika company dan partnerId sama dengan id, maka update data alamat wajib pajak
+      const isCompanyEditingSelf = auth.company && auth.partnerId == id;
+
+      if (isCompanyEditingSelf) {
+        const dataProfile = await addressApi({ id: auth.partnerId });
+        const dataAlamat = {
+          id_user: auth.id,
+          company_type_id: dataProfile.companyTypeId,
+          industry_id: dataProfile.industryId,
+          tax_name: values.taxName,
+          npwp: values.npwp,
+          alamat_lengkap_text: values.alamat_wajib_pajak || values.street,
+          street: values.street,
+          email: values.email,
+          mobile: values.mobile,
+        };
+
+        const isUpdated = await editPartnerApi({
+          id: auth.partnerId,
+          data: dataAlamat,
+        });
+
+        console.log('Response isUpdated:', isUpdated);
       }
-      // if (isUpdated?.id) {
-      if (address?.id && (auth.company && auth?.partnerId == id ? isUpdated?.id : true)) {
+
+      // Validasi kondisi sukses
+      const isSuccess = !!address?.id;
+
+      if (isSuccess) {
         toast.success('Berhasil mengubah alamat');
         router.back();
       } else {
-        toast.error('Terjadi kesalahan internal');
-        router.back();
+        const errorMsg =
+          address?.message ||
+          isUpdated?.message ||
+          'Gagal memperbarui alamat, silakan coba lagi.';
+        toast.error(errorMsg);
       }
     } catch (error) {
-      console.log(error);
-      toast.error('Terjadi kesalahan internal');
-      router.back();
+      console.error('Catch error:', error);
+      toast.error(error?.message || 'Terjadi kesalahan tidak terduga.');
     }
 
-   
+    
+    const dataProfile = await addressApi({ id: auth.partnerId });
+    console.log('ini adalah', dataProfile);
+
 
     // if (isUpdated?.id) {
     // if (address?.id && auth.company ? isUpdated?.id : true) {
-- 
cgit v1.2.3


From e0e0729ee57d2f9b1188a0604e3cc4a51317b0ed Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 12 Jun 2025 11:00:00 +0700
Subject: <hafid> fix pinpoint

---
 src/lib/address/components/EditAddress.jsx | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

(limited to 'src/lib/address/components/EditAddress.jsx')

diff --git a/src/lib/address/components/EditAddress.jsx b/src/lib/address/components/EditAddress.jsx
index cfb35fbd..743bb4c8 100644
--- a/src/lib/address/components/EditAddress.jsx
+++ b/src/lib/address/components/EditAddress.jsx
@@ -311,7 +311,12 @@ const EditAddress = ({ id, defaultValues }) => {
         close={() => setPinedMaps(false)}
       >
         <div className='flex mt-4'>
-          <PinPointMap />
+          <PinPointMap 
+              initialLatitude={selectedPosition?.lat} 
+              initialLongitude={selectedPosition?.lng} 
+              initialAddress={tempAddress} 
+            />
+
         </div>
       </BottomPopup>
       <div className='max-w-none md:container mx-auto flex p-0 md:py-10'>
@@ -327,16 +332,20 @@ const EditAddress = ({ id, defaultValues }) => {
           </div>
           <form onSubmit={handleSubmit(onSubmitHandler)}>
             <div className='mb-4 items-start'>
-              <label className='form-label mb-2'>PinPoint</label>
+              <label className='form-label mb-2'>Koordinat Alamat</label>
               {tempAddress ? (
                 <div className='flex gap-x-2 items-center'>
-                  <MapPinIcon class='h-6 w-6 text-gray-500 mr-3 cursor-pointer' onClick={() => setPinedMaps(true)} />{' '}
+                  <button type='button' className="flex items-center justify-center me-3 p-2 bg-red-500 text-white rounded-full hover:bg-red-600 transition">
+                  <MapPinIcon class='h-6 w-6' onClick={() => setPinedMaps(true)} />{' '}
+                    </button>
                   <span> {tempAddress} </span>
                 </div>
               ) : (
-                <Button variant='plain' onClick={() => setPinedMaps(true)}>
-                  <MapPinIcon class='h-6 w-6 text-gray-500 mr-3' />
-                  Pin Alamat
+                <Button variant='plain' style={{ padding: 0 }} onClick={() => setPinedMaps(true)}>
+                  <button type='button' className="flex items-center justify-center me-3 p-2 bg-red-500 text-white rounded-full hover:bg-red-600 transition">
+                    <MapPinIcon className="h-6 w-6" />
+                  </button>
+                  Pin Koordinat Alamat
                 </Button>
               )}
             </div>
-- 
cgit v1.2.3


From 8ca6c0aa1b2a578332ff1c3706f58530f549352e Mon Sep 17 00:00:00 2001
From: "Indoteknik ." <andrifebriyadiputra@gmail.com>
Date: Thu, 12 Jun 2025 18:36:58 +0700
Subject: (miqdad) fix icon color pin pont

---
 src/lib/address/components/EditAddress.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/address/components/EditAddress.jsx')

diff --git a/src/lib/address/components/EditAddress.jsx b/src/lib/address/components/EditAddress.jsx
index 743bb4c8..217be867 100644
--- a/src/lib/address/components/EditAddress.jsx
+++ b/src/lib/address/components/EditAddress.jsx
@@ -335,14 +335,14 @@ const EditAddress = ({ id, defaultValues }) => {
               <label className='form-label mb-2'>Koordinat Alamat</label>
               {tempAddress ? (
                 <div className='flex gap-x-2 items-center'>
-                  <button type='button' className="flex items-center justify-center me-3 p-2 bg-red-500 text-white rounded-full hover:bg-red-600 transition">
+                  <button type='button' className="flex items-center justify-center me-3 p-2 badge-solid-red text-white rounded-full hover:bg-red-500 transition">
                   <MapPinIcon class='h-6 w-6' onClick={() => setPinedMaps(true)} />{' '}
                     </button>
                   <span> {tempAddress} </span>
                 </div>
               ) : (
                 <Button variant='plain' style={{ padding: 0 }} onClick={() => setPinedMaps(true)}>
-                  <button type='button' className="flex items-center justify-center me-3 p-2 bg-red-500 text-white rounded-full hover:bg-red-600 transition">
+                  <button type='button' className="flex items-center justify-center me-3 p-2 badge-solid-red text-white rounded-full hover:bg-red-500 transition">
                     <MapPinIcon className="h-6 w-6" />
                   </button>
                   Pin Koordinat Alamat
-- 
cgit v1.2.3


From 6720e02766441036d872203216a1d9a45025f5a9 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 28 Jun 2025 10:35:02 +0700
Subject: <hafid> fix cities address

---
 src/lib/address/components/EditAddress.jsx | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

(limited to 'src/lib/address/components/EditAddress.jsx')

diff --git a/src/lib/address/components/EditAddress.jsx b/src/lib/address/components/EditAddress.jsx
index 217be867..deaa8a3e 100644
--- a/src/lib/address/components/EditAddress.jsx
+++ b/src/lib/address/components/EditAddress.jsx
@@ -126,14 +126,13 @@ const EditAddress = ({ id, defaultValues }) => {
   useEffect(() => {
     if (Object.keys(detailAddress).length > 0) {
       const selectedCities = cities.find(
-        (city) =>
-          detailAddress?.district
-            .toLowerCase()
-            .includes(city.label.toLowerCase()) ||
-            city.label
-            .toLowerCase()
-            .includes(detailAddress?.district.toLowerCase())
-          );
+          (city) => 
+            city.label.toLowerCase() === detailAddress?.district.toLowerCase()
+        ) || cities.find(
+          (city) =>
+            detailAddress?.district.toLowerCase().includes(city.label.toLowerCase()) ||
+            city.label.toLowerCase().includes(detailAddress?.district.toLowerCase())
+        );
           setValue('city', selectedCities?.value);
         }
       }, [cities, detailAddress, setValue]);
-- 
cgit v1.2.3

