@hed-hog/contact 0.0.329 → 0.0.331
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/proposal/proposal.controller.d.ts +2 -2
- package/dist/proposal/proposal.controller.d.ts.map +1 -1
- package/dist/proposal/proposal.controller.js +8 -6
- package/dist/proposal/proposal.controller.js.map +1 -1
- package/dist/proposal/proposal.service.d.ts +8 -2
- package/dist/proposal/proposal.service.d.ts.map +1 -1
- package/dist/proposal/proposal.service.js +595 -162
- package/dist/proposal/proposal.service.js.map +1 -1
- package/hedhog/data/role.yaml +9 -1
- package/hedhog/data/route.yaml +4 -1
- package/hedhog/data/setting_group.yaml +16 -5
- package/hedhog/frontend/app/_components/person-picker.tsx.ejs +71 -16
- package/hedhog/frontend/app/accounts/_components/account-form-sheet.tsx.ejs +7 -2
- package/hedhog/frontend/app/accounts/page.tsx.ejs +1 -1
- package/hedhog/frontend/app/activities/page.tsx.ejs +1 -1
- package/hedhog/frontend/app/follow-ups/page.tsx.ejs +1 -1
- package/hedhog/frontend/app/person/page.tsx.ejs +1 -1
- package/hedhog/frontend/app/pipeline/_components/lead-proposals-tab.tsx.ejs +103 -1302
- package/hedhog/frontend/app/proposals/_components/proposal-form-sheet.tsx.ejs +1306 -0
- package/hedhog/frontend/app/proposals/_components/proposal-types.ts.ejs +172 -0
- package/hedhog/frontend/app/proposals/_components/proposals-management-page.tsx.ejs +316 -113
- package/hedhog/frontend/messages/en.json +21 -2
- package/hedhog/frontend/messages/pt.json +21 -2
- package/package.json +7 -6
- package/src/proposal/proposal.controller.ts +7 -5
- package/src/proposal/proposal.service.ts +662 -192
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export type ProposalStatus =
|
|
2
|
+
| 'draft'
|
|
3
|
+
| 'pending_approval'
|
|
4
|
+
| 'approved'
|
|
5
|
+
| 'rejected'
|
|
6
|
+
| 'cancelled'
|
|
7
|
+
| 'expired'
|
|
8
|
+
| 'contract_generated';
|
|
9
|
+
|
|
10
|
+
export type ProposalContractCategory =
|
|
11
|
+
| 'employee'
|
|
12
|
+
| 'contractor'
|
|
13
|
+
| 'client'
|
|
14
|
+
| 'supplier'
|
|
15
|
+
| 'vendor'
|
|
16
|
+
| 'partner'
|
|
17
|
+
| 'internal'
|
|
18
|
+
| 'other';
|
|
19
|
+
|
|
20
|
+
export type ProposalContractType =
|
|
21
|
+
| 'clt'
|
|
22
|
+
| 'pj'
|
|
23
|
+
| 'freelancer_agreement'
|
|
24
|
+
| 'service_agreement'
|
|
25
|
+
| 'fixed_term'
|
|
26
|
+
| 'recurring_service'
|
|
27
|
+
| 'nda'
|
|
28
|
+
| 'amendment'
|
|
29
|
+
| 'addendum'
|
|
30
|
+
| 'other';
|
|
31
|
+
|
|
32
|
+
export type ProposalBillingModel =
|
|
33
|
+
| 'time_and_material'
|
|
34
|
+
| 'monthly_retainer'
|
|
35
|
+
| 'fixed_price';
|
|
36
|
+
|
|
37
|
+
export type ProposalItemType =
|
|
38
|
+
| 'service'
|
|
39
|
+
| 'product'
|
|
40
|
+
| 'fee'
|
|
41
|
+
| 'discount'
|
|
42
|
+
| 'note'
|
|
43
|
+
| 'other';
|
|
44
|
+
|
|
45
|
+
export type ProposalRecurrence =
|
|
46
|
+
| 'one_time'
|
|
47
|
+
| 'monthly'
|
|
48
|
+
| 'quarterly'
|
|
49
|
+
| 'yearly'
|
|
50
|
+
| 'other';
|
|
51
|
+
|
|
52
|
+
export type ProposalItem = {
|
|
53
|
+
id?: number;
|
|
54
|
+
name: string;
|
|
55
|
+
description?: string | null;
|
|
56
|
+
quantity?: number | null;
|
|
57
|
+
unit_amount_cents?: number | null;
|
|
58
|
+
total_amount_cents?: number | null;
|
|
59
|
+
item_type?: ProposalItemType | string | null;
|
|
60
|
+
term_type?: string | null;
|
|
61
|
+
recurrence?: ProposalRecurrence | string | null;
|
|
62
|
+
start_date?: string | null;
|
|
63
|
+
end_date?: string | null;
|
|
64
|
+
due_day?: number | null;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type ProposalRevision = {
|
|
68
|
+
id: number;
|
|
69
|
+
revision_number: number;
|
|
70
|
+
is_current?: boolean;
|
|
71
|
+
title: string;
|
|
72
|
+
summary?: string | null;
|
|
73
|
+
valid_until?: string | null;
|
|
74
|
+
status?: ProposalStatus | string;
|
|
75
|
+
proposal_item?: ProposalItem[];
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type ProposalApproval = {
|
|
79
|
+
id: number;
|
|
80
|
+
status?: string | null;
|
|
81
|
+
decision_note?: string | null;
|
|
82
|
+
submitted_at?: string | null;
|
|
83
|
+
decided_at?: string | null;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type ProposalDocument = {
|
|
87
|
+
id: number;
|
|
88
|
+
file_id?: number | null;
|
|
89
|
+
file_name?: string | null;
|
|
90
|
+
mime_type?: string | null;
|
|
91
|
+
document_type?: string | null;
|
|
92
|
+
is_current?: boolean | null;
|
|
93
|
+
created_at?: string | null;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export type ProposalIntegrationLink = {
|
|
97
|
+
targetModule?: string;
|
|
98
|
+
targetEntityType?: string;
|
|
99
|
+
targetEntityId?: string;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type ProposalRecord = {
|
|
103
|
+
id: number;
|
|
104
|
+
person_id: number;
|
|
105
|
+
code?: string | null;
|
|
106
|
+
title: string;
|
|
107
|
+
status: ProposalStatus;
|
|
108
|
+
contract_category?: ProposalContractCategory | null;
|
|
109
|
+
contract_type?: ProposalContractType | null;
|
|
110
|
+
billing_model?: ProposalBillingModel | null;
|
|
111
|
+
currency_code?: string | null;
|
|
112
|
+
subtotal_amount_cents?: number | null;
|
|
113
|
+
discount_amount_cents?: number | null;
|
|
114
|
+
tax_amount_cents?: number | null;
|
|
115
|
+
total_amount_cents?: number | null;
|
|
116
|
+
valid_until?: string | null;
|
|
117
|
+
current_revision_number?: number | null;
|
|
118
|
+
approval_count?: number | null;
|
|
119
|
+
required_approvals?: number | null;
|
|
120
|
+
current_user_has_approved?: boolean | null;
|
|
121
|
+
notes?: string | null;
|
|
122
|
+
created_at?: string | null;
|
|
123
|
+
updated_at?: string | null;
|
|
124
|
+
approved_at?: string | null;
|
|
125
|
+
person?: {
|
|
126
|
+
id: number;
|
|
127
|
+
name?: string | null;
|
|
128
|
+
trade_name?: string | null;
|
|
129
|
+
email?: string | null;
|
|
130
|
+
phone?: string | null;
|
|
131
|
+
avatar_id?: number | null;
|
|
132
|
+
} | null;
|
|
133
|
+
proposal_revision?: ProposalRevision[];
|
|
134
|
+
proposal_approval?: ProposalApproval[];
|
|
135
|
+
proposal_document?: ProposalDocument[];
|
|
136
|
+
integration_links?: ProposalIntegrationLink[];
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type GenerateProposalDocumentResponse = {
|
|
140
|
+
fileId?: number | null;
|
|
141
|
+
fileName?: string | null;
|
|
142
|
+
downloadUrl?: string | null;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// ─── Shared utilities ────────────────────────────────────────────────────────
|
|
146
|
+
|
|
147
|
+
export function formatEnumLabel(value?: string | null) {
|
|
148
|
+
if (!value) return '—';
|
|
149
|
+
return value
|
|
150
|
+
.split('_')
|
|
151
|
+
.filter(Boolean)
|
|
152
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
153
|
+
.join(' ');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function getCurrentRevision(proposal?: ProposalRecord | null) {
|
|
157
|
+
if (!proposal?.proposal_revision?.length) return null;
|
|
158
|
+
return (
|
|
159
|
+
proposal.proposal_revision.find((revision) => revision.is_current) ??
|
|
160
|
+
proposal.proposal_revision[0]
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function openStoredFile(fileId?: number | null) {
|
|
165
|
+
if (!fileId) return;
|
|
166
|
+
const baseUrl = String(process.env.NEXT_PUBLIC_API_BASE_URL || '');
|
|
167
|
+
window.open(
|
|
168
|
+
`${baseUrl}/file/open/${fileId}`,
|
|
169
|
+
'_blank',
|
|
170
|
+
'noopener,noreferrer'
|
|
171
|
+
);
|
|
172
|
+
}
|