mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-04 14:52:06 +00:00
- Sites page: Add Site modal with Site Code, Client, address, State/Area, optional Site Phone and Email, points of contact - Duplicate Site Code shows inline under the field and keeps the modal open - Row opens a non-modal detail panel; Street Address links to Google Maps; key-less map preview - Edit switches the panel in place with Site Code read-only; Save needs a valid change, Cancel makes no call - Site Phone is sent independently of the contacts; zip and title are carried through edits - Retire the separate new/edit location pages
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { Box, Typography } from "@mui/material";
|
|
import type { Location } from "@/domain/locations/types/location";
|
|
import { buildSiteMapEmbedUrl, hasCompleteSiteAddress } from "@/domain/locations/utils/site-maps";
|
|
|
|
type SiteMapPreviewProps = Pick<Location, "address" | "city" | "state" | "zipCode">;
|
|
|
|
/** Read-only key-less Google Maps embed; a placeholder until Street, City and State are set. */
|
|
export function SiteMapPreview(props: SiteMapPreviewProps) {
|
|
const complete = hasCompleteSiteAddress(props);
|
|
|
|
return (
|
|
<Box>
|
|
<Typography variant="caption" sx={{ color: "text.secondary" }}>
|
|
Location preview
|
|
</Typography>
|
|
{complete && (
|
|
<Box
|
|
component="iframe"
|
|
title="Site location map"
|
|
src={buildSiteMapEmbedUrl(props)}
|
|
loading="lazy"
|
|
referrerPolicy="no-referrer-when-downgrade"
|
|
className="mt-1 block w-full rounded border-0"
|
|
sx={{ height: 140 }}
|
|
/>
|
|
)}
|
|
{!complete && (
|
|
<Box
|
|
className="mt-1 flex items-center justify-center rounded border border-dashed"
|
|
sx={{ height: 140, borderColor: "divider" }}
|
|
>
|
|
<Typography variant="body2" sx={{ color: "text.secondary" }}>
|
|
Enter an address to preview the location
|
|
</Typography>
|
|
</Box>
|
|
)}
|
|
</Box>
|
|
);
|
|
}
|