This commit is contained in:
ivan-sim
2024-10-09 10:31:33 +07:00
parent 0c8feec075
commit 9a4e9db798
5 changed files with 37 additions and 5 deletions

View File

@@ -48,6 +48,8 @@ class OrganizationController extends Controller
public function store(Request $request)
{
$organization = [
'phone' => $request->no_hp,
'email' => $request->email,
'code' => $request->code,
'name' => $request->name,
'type' => 'hospital',
@@ -119,6 +121,8 @@ class OrganizationController extends Controller
$update_organization = Organization::find($id);
$update_organization->update([
'phone' => $request->no_hp,
'email' => $request->email,
'code' => $request->code,
'name' => $request->name,
'type' => 'hospital',
@@ -152,7 +156,7 @@ class OrganizationController extends Controller
'lat' => $request->lat,
'lng' => $request->lng,
]);
$update_organization->main_address_id = $newAddres->id;
$update_organization->save();

View File

@@ -27,12 +27,14 @@ class OrganizationResource extends JsonResource
}
$corporatePartner = implode(', ', $corporateName);
}
}
}
$organization = [
'id' => $this->id,
'name' => $this->name,
'type' => $this->type,
'no_hp' => $this->phone,
'email' => $this->email,
'code' => $this->code,
'description' => $this->description,
'kodeRs' => $this->meta->KodeRS ?? null,

View File

@@ -1,6 +1,8 @@
export type Organizations = {
id: number;
code: string;
no_hp: number;
email: string;
name: string;
address: string;
type: string;

View File

@@ -116,6 +116,8 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
name: currentOrganizations?.name || '',
code: currentOrganizations?.code || '',
phone: currentOrganizations?.phone || '',
no_hp: currentOrganizations?.no_hp || '',
email: currentOrganizations?.email || '',
lat: currentOrganizations?.lat || '',
lng: currentOrganizations?.lng || '',
address: currentOrganizations?.address || '',
@@ -185,6 +187,8 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
formData.append('name', data.name);
formData.append('code', data.code);
formData.append('phone', data.phone);
formData.append('no_hp', data.no_hp);
formData.append('email', data.email);
formData.append('lat', data.lat);
formData.append('lng', data.lng);
formData.append('address', data.address);
@@ -361,7 +365,7 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
const findValueCorporate = selectedCorporatID.find(
(item: any) => item.value === currentOrganizations?.corporate_id_partner
);
return (
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
<Stack spacing={3}>
@@ -391,6 +395,14 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
<LabelStyle>Nomor IGD</LabelStyle>
<RHFTextField name="phone" placeholder="Tuliskan No IGD" />
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>No. HP</LabelStyle>
<RHFTextField name="no_hp" placeholder="Tuliskan No. HP" />
</Grid>
<Grid item xs={12} md={6}>
<LabelStyle>Email</LabelStyle>
<RHFTextField name="email" placeholder="Tuliskan Email" />
</Grid>
<Grid item xs={12}>
<LabelStyle>Alamat</LabelStyle>
<RHFTextField name="address" placeholder="Tuliskan Alamat" />

View File

@@ -301,9 +301,21 @@ export default function List() {
<Grid item xs={10}>
: {row.code ? row.code : '-'}
</Grid>
<Grid item xs={2}>
No. HP
</Grid>
<Grid item xs={10}>
: {row.no_hp ? row.no_hp : '-'}
</Grid>
<Grid item xs={2}>
Email
</Grid>
<Grid item xs={10}>
: {row.email ? row.email : '-'}
</Grid>
<Grid item xs={2}>
Rekanan
Rekanan
</Grid>
<Grid item xs={10}>
: {row.corporate_name ? row.corporate_name : '-'}