bugs fix edit hospital
This commit is contained in:
@@ -124,6 +124,7 @@ class OrganizationController extends Controller
|
||||
'type' => 'hospital',
|
||||
'status' => $request->active == 1 ? 'active' : 'inactive',
|
||||
'description' => $request->description,
|
||||
'corporate_id_partner' => $request->corporate_id_partner
|
||||
]);
|
||||
|
||||
if ($request->phone != null) {
|
||||
|
||||
@@ -222,6 +222,7 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
console.log('formData', formData);
|
||||
const response = await axios.post('/organizations', formData);
|
||||
} else {
|
||||
|
||||
formData.append('_method', 'PUT');
|
||||
const response = await axios.post(
|
||||
'/organizations/' + currentOrganizations?.id ?? '',
|
||||
@@ -257,13 +258,14 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
const [district, setDistrict] = useState<any>([]);
|
||||
const [village, setVillage] = useState<any>([]);
|
||||
|
||||
const corporate_selected = currentOrganizations?.corporate_id_partner.split(",").map(Number);
|
||||
|
||||
const [corporate_id_partner, setCorporateIdPartner] = useState<any>([]);
|
||||
const [selectedCorporatID, setSelectedCorporateID] = useState<any>([]);
|
||||
|
||||
const [selectedCorporatID, setSelectedCorporateID] = useState<any>(corporate_selected ?? []);
|
||||
const handleSelectChange = (event, selectedOptions:any) => {
|
||||
const selectedValues = selectedOptions.map(option => option.value);
|
||||
setSelectedCorporateID(selectedValues);
|
||||
setValue('corporate_id_partner', selectedCorporatID)
|
||||
setValue('corporate_id_partner', selectedValues)
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -329,9 +331,6 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
if (values.corporate_id_partner) {
|
||||
loadCorporateIdPartner();
|
||||
}
|
||||
|
||||
console.log(corporate_id_partner, 'test');
|
||||
|
||||
}, [values.corporate_id_partner])
|
||||
|
||||
|
||||
@@ -509,7 +508,7 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
<Autocomplete
|
||||
id="combo-box-demo"
|
||||
options={corporate_id_partner}
|
||||
getOptionLabel={(option) => option.label}
|
||||
getOptionLabel={(option) => option.label ?? findValueCorporate.label ?? ''}
|
||||
value={corporate_id_partner.filter(option => selectedCorporatID.includes(option.value))}
|
||||
onChange={handleSelectChange}
|
||||
multiple // Enable multiple selections
|
||||
|
||||
Reference in New Issue
Block a user