mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 16:00:56 +00:00
add company stamp upload functionality for contract signing
- Introduced StampUpload component for uploading company stamp images. - Integrated stamp upload in contract signing modal, supporting PNG and JPG formats. - Implemented validation for file type and size (max 5 MB). - Added visual feedback for drag-and-drop functionality. - Updated contract-related pages to handle duplicate contract alerts and pricing notices. - Enhanced contract expiry management with a nightly sweep service. - Added unit tests for new features and updated existing tests for contract handling.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import type { Contract } from '../entities/contract.entity';
|
||||
|
||||
/** Statuses that already mean "done/void" — a contract in one of these never blocks a duplicate. */
|
||||
export const TERMINAL_CONTRACT_STATUSES = [
|
||||
'REJECTED',
|
||||
'CANCELLED',
|
||||
'CONTRACT_CLOSED',
|
||||
'ARCHIVED',
|
||||
'EXPIRED',
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* True once a contract is done, either explicitly (terminal status) or by date
|
||||
* (past contractValidUntil). Checked by date too because the nightly expiry
|
||||
* cron only flips the status once a day — this keeps same-day checks correct
|
||||
* even a few hours before the cron runs.
|
||||
*/
|
||||
export function isEffectivelyExpired(
|
||||
contract: Pick<Contract, 'status' | 'contractValidUntil'>,
|
||||
): boolean {
|
||||
if ((TERMINAL_CONTRACT_STATUSES as readonly string[]).includes(contract.status)) {
|
||||
return true;
|
||||
}
|
||||
return Boolean(contract.contractValidUntil && contract.contractValidUntil < new Date());
|
||||
}
|
||||
Reference in New Issue
Block a user