refactore SelectMult Tag for label display is required or optional
This commit is contained in:
parent
979293ad90
commit
3c4c25b449
@ -12,7 +12,6 @@ import {
|
||||
} from "../../hooks/useOrganization";
|
||||
import Label from "../common/Label";
|
||||
import SelectMultiple from "../common/SelectMultiple";
|
||||
import { useServices } from "../../hooks/masterHook/useMaster";
|
||||
|
||||
const ManageOrganization = () => {
|
||||
const orgModal = useOrganizationModal();
|
||||
@ -86,30 +85,18 @@ const ManageOrganization = () => {
|
||||
<Label htmlFor="email" required>
|
||||
Email Address
|
||||
</Label>
|
||||
<input
|
||||
className="form-control form-control-sm"
|
||||
{...register("email")}
|
||||
/>
|
||||
{errors.email && (
|
||||
<span className="danger-text">{errors.email.message}</span>
|
||||
)}
|
||||
<input className="form-control form-control-sm" />
|
||||
</div>
|
||||
|
||||
<div className="mb-1 text-start">
|
||||
<SelectMultiple
|
||||
name="serviceIds"
|
||||
label="Services"
|
||||
required={true}
|
||||
valueKey="id"
|
||||
options={services?.data || []}
|
||||
/>
|
||||
{errors.serviceIds && (
|
||||
<span className="danger-text">{errors.serviceIds.message}</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mb-1 text-start">
|
||||
<Label htmlFor="address" required>
|
||||
<Label htmlFor="organization" required>
|
||||
Address
|
||||
</Label>
|
||||
<textarea
|
||||
@ -147,7 +134,9 @@ const ManageOrganization = () => {
|
||||
<Modal
|
||||
isOpen={orgModal.isOpen}
|
||||
onClose={orgModal.onClose}
|
||||
title="Manage Organization"
|
||||
onSubmit={onSubmit}
|
||||
title={"Manage Organization"}
|
||||
actionLabel={"Submit"}
|
||||
body={contentBody}
|
||||
/>
|
||||
);
|
||||
|
@ -12,6 +12,7 @@ const SelectMultiple = ({
|
||||
valueKey = "id",
|
||||
placeholder = "Please select...",
|
||||
IsLoading = false,
|
||||
required = false,
|
||||
}) => {
|
||||
const { setValue, watch } = useFormContext();
|
||||
const selectedValues = watch(name) || [];
|
||||
@ -146,7 +147,9 @@ const SelectMultiple = ({
|
||||
className="multi-select-dropdown-container"
|
||||
style={{ position: "relative" }}
|
||||
>
|
||||
<label>{label}</label>
|
||||
<Label htmlFor={name} required={required}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div
|
||||
className="multi-select-dropdown-header"
|
||||
|
Loading…
x
Reference in New Issue
Block a user