Adding placeholder and adding in TagInput a background color.
This commit is contained in:
parent
679ae95b8c
commit
6598ec9f73
@ -23,7 +23,7 @@ import Label from "../common/Label";
|
|||||||
const ManageContact = ({ contactId, closeModal }) => {
|
const ManageContact = ({ contactId, closeModal }) => {
|
||||||
// fetch master data
|
// fetch master data
|
||||||
const { buckets, loading: bucketsLoaging } = useBuckets();
|
const { buckets, loading: bucketsLoaging } = useBuckets();
|
||||||
const { data:projects, loading: projectLoading } = useProjects();
|
const { data: projects, loading: projectLoading } = useProjects();
|
||||||
const { contactCategory, loading: contactCategoryLoading } =
|
const { contactCategory, loading: contactCategoryLoading } =
|
||||||
useContactCategory();
|
useContactCategory();
|
||||||
const { organizationList } = useOrganization();
|
const { organizationList } = useOrganization();
|
||||||
@ -205,12 +205,12 @@ const ManageContact = ({ contactId, closeModal }) => {
|
|||||||
<Label htmlFor={"organization"} required>
|
<Label htmlFor={"organization"} required>
|
||||||
Organization
|
Organization
|
||||||
</Label>
|
</Label>
|
||||||
<InputSuggestions
|
<InputSuggestions
|
||||||
organizationList={organizationList}
|
organizationList={organizationList}
|
||||||
value={watch("organization") || ""}
|
value={watch("organization") || ""}
|
||||||
onChange={(val) => setValue("organization", val, { shouldValidate: true })}
|
onChange={(val) => setValue("organization", val, { shouldValidate: true })}
|
||||||
error={errors.organization?.message}
|
error={errors.organization?.message}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -408,6 +408,7 @@ const ManageContact = ({ contactId, closeModal }) => {
|
|||||||
label="Tags"
|
label="Tags"
|
||||||
options={contactTags}
|
options={contactTags}
|
||||||
isRequired={true}
|
isRequired={true}
|
||||||
|
placeholder="Enter Tag"
|
||||||
/>
|
/>
|
||||||
{errors.tags && (
|
{errors.tags && (
|
||||||
<small className="danger-text">{errors.tags.message}</small>
|
<small className="danger-text">{errors.tags.message}</small>
|
||||||
@ -482,7 +483,7 @@ const ManageContact = ({ contactId, closeModal }) => {
|
|||||||
<button className="btn btn-sm btn-primary" type="submit" disabled={isPending}>
|
<button className="btn btn-sm btn-primary" type="submit" disabled={isPending}>
|
||||||
{isPending ? "Please Wait..." : "Submit"}
|
{isPending ? "Please Wait..." : "Submit"}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</FormProvider>
|
</FormProvider>
|
||||||
|
|||||||
@ -108,6 +108,7 @@ const ManageJob = ({ Job }) => {
|
|||||||
type="text"
|
type="text"
|
||||||
{...register("title")}
|
{...register("title")}
|
||||||
className="form-control form-control"
|
className="form-control form-control"
|
||||||
|
placeholder="Enter Title"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -144,6 +145,7 @@ const ManageJob = ({ Job }) => {
|
|||||||
options={JobTags?.data}
|
options={JobTags?.data}
|
||||||
name="tags"
|
name="tags"
|
||||||
label="Tag"
|
label="Tag"
|
||||||
|
placeholder="Enter Tag"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { useFormContext, useWatch } from "react-hook-form";
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import Label from "./Label";
|
import Label from "./Label";
|
||||||
|
|
||||||
const TagInput = ({ label, name, placeholder, color = "#e9ecef", required=false, options = [] }) => {
|
const TagInput = ({ label, name, placeholder, color = "#e9ecef", required = false, options = [] }) => {
|
||||||
const { setValue, watch } = useFormContext();
|
const { setValue, watch } = useFormContext();
|
||||||
const tags = watch(name) || [];
|
const tags = watch(name) || [];
|
||||||
const [input, setInput] = useState("");
|
const [input, setInput] = useState("");
|
||||||
@ -33,29 +33,29 @@ const TagInput = ({ label, name, placeholder, color = "#e9ecef", required=false,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChange = (e) => {
|
const handleChange = (e) => {
|
||||||
const val = e.target.value;
|
const val = e.target.value;
|
||||||
setInput(val);
|
setInput(val);
|
||||||
|
|
||||||
if (val) {
|
if (val) {
|
||||||
setSuggestions(
|
setSuggestions(
|
||||||
options
|
options
|
||||||
.filter((opt) => {
|
.filter((opt) => {
|
||||||
const label = typeof opt === "string" ? opt : opt.name;
|
const label = typeof opt === "string" ? opt : opt.name;
|
||||||
return (
|
return (
|
||||||
label.toLowerCase().includes(val.toLowerCase()) &&
|
label.toLowerCase().includes(val.toLowerCase()) &&
|
||||||
!tags.some((t) => t.name === label)
|
!tags.some((t) => t.name === label)
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.map((opt) => ({
|
.map((opt) => ({
|
||||||
name: typeof opt === "string" ? opt : opt.name,
|
name: typeof opt === "string" ? opt : opt.name,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setSuggestions([]);
|
setSuggestions([]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSuggestionClick = (sugg) => {
|
const handleSuggestionClick = (sugg) => {
|
||||||
handleAdd(sugg);
|
handleAdd(sugg);
|
||||||
@ -105,6 +105,9 @@ const handleChange = (e) => {
|
|||||||
outline: "none",
|
outline: "none",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: "120px",
|
minWidth: "120px",
|
||||||
|
backgroundColor: "white",
|
||||||
|
color: "black"
|
||||||
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user