Merge pull request #767 from Tria-plc/freight_feature/usermanagement

Freight feature/usermanagement
This commit is contained in:
marshal
2026-07-17 14:40:59 +03:00
committed by GitHub
37 changed files with 736 additions and 365 deletions

View File

@@ -19,7 +19,7 @@ import {
import { isViewable } from "@edr/ui-common";
import { PortalFileDropzone } from "@/components/contracts/PortalFileDropzone";
import { fileViewUrl } from "@/constants/apiConfig";
import { fetchViewableFile, downloadStoredFile } from "@/services/files.service";
import { BORDER, GREEN, INK } from "@/pages/contracts/contract-ui";
type ReviewStatus = "PENDING" | "APPROVED" | "QUERIED" | null;
@@ -97,11 +97,8 @@ export function ClearanceDocumentUploadCard({
const queried = reviewStatus === "QUERIED";
const approved = reviewStatus === "APPROVED";
const showUpload = canUpload && !approved && onStageFile;
const viewUrl = uploadedFile ? fileViewUrl(uploadedFile.id) : null;
const canPreviewUploaded =
uploadedFile &&
viewUrl &&
isViewable({ name: uploadedFile.name, url: viewUrl });
uploadedFile && isViewable({ name: uploadedFile.name, url: "" });
return (
<Paper
@@ -175,7 +172,9 @@ export function ClearanceDocumentUploadCard({
color="edr-green"
leftSection={<Eye size={14} />}
onClick={() =>
onPreview({ name: uploadedFile.name, url: viewUrl! })
void fetchViewableFile(uploadedFile.id, uploadedFile.name).then(
onPreview,
)
}
>
View
@@ -184,9 +183,11 @@ export function ClearanceDocumentUploadCard({
<Button
size="compact-sm"
variant="default"
component="a"
href={fileViewUrl(uploadedFile.id, true)}
download={uploadedFile.name}
component="button"
type="button"
onClick={() =>
void downloadStoredFile(uploadedFile.id, uploadedFile.name)
}
leftSection={<Download size={14} />}
>
Download

View File

@@ -4,7 +4,7 @@ import { Paperclip } from "lucide-react";
import { SmartFileInput } from "@edr/ui-common";
import type { IFileUploadSetting } from "@edr/types/freight";
import { fileViewUrl } from "@/constants/apiConfig";
import { fetchViewableFile } from "@/services/files.service";
import type { LicenseFile } from "@/services/companies.service";
const ROLE_LABELS: Record<string, string> = {
@@ -111,9 +111,13 @@ export default function RoleLicenseStep({
<Group key={f.id} gap={6} wrap="nowrap">
<Paperclip size={13} className="text-edr-muted" />
<Anchor
href={fileViewUrl(f.id)}
target="_blank"
rel="noopener noreferrer"
component="button"
type="button"
onClick={() =>
void fetchViewableFile(f.id, f.name).then((v) =>
window.open(v.url, "_blank"),
)
}
size="xs"
>
{f.name}