Only 1 project or no project is assigned then dropdown will be hide.

This commit is contained in:
Kartik Sharma 2025-09-19 19:20:01 +05:30
parent e154bac64a
commit 1ef82ad0b2

View File

@ -89,24 +89,43 @@ const ProjectInfra = ({ data, onDataChange, eachSiteEngineer }) => {
className="dataTables_length text-start py-2 px-6 col-md-4 col-12" className="dataTables_length text-start py-2 px-6 col-md-4 col-12"
id="DataTables_Table_0_length" id="DataTables_Table_0_length"
> >
<label> {servicesLoading ? (
<select <span>Loading...</span>
name="DataTables_Table_0_length" ) : assignedServices?.length > 1 ? (
aria-controls="DataTables_Table_0" <label>
className="form-select form-select-sm" <select
aria-label="Select Service" name="DataTables_Table_0_length"
value={selectedService} aria-controls="DataTables_Table_0"
onChange={handleServiceChange} className="form-select form-select-sm"
aria-label="Select Service"
value={selectedService}
onChange={handleServiceChange}
>
{assignedServices.map((service) => (
<option key={service.id} value={service.id}>
{service.name}
</option>
))}
</select>
</label>
) : (
<div
style={{
fontSize: "0.875rem",
height: "32px",
width: "190px",
border: "1px solid #ced4da",
borderRadius: "0.25rem",
padding: "4px 8px",
display: "flex",
alignItems: "center",
}}
> >
{assignedServices?.length === 1
{servicesLoading && <option>Loading...</option>} ? assignedServices[0].name
{assignedServices?.map((service) => ( : "No service available"}
<option key={service.id} value={service.id}> </div>
{service.name} )}
</option>
))}
</select>
</label>
</div> </div>
{/* Buttons Section (aligned to right) */} {/* Buttons Section (aligned to right) */}
<div className="col-md-8 col-12 text-end mb-1"> <div className="col-md-8 col-12 text-end mb-1">