| 1 | import z from 'zod' |
| 2 | import { updateTimesheetDefaultsSchema as |
| 3 | import { projectStatus } |
| 4 | |
| 5 | export const clientInvolvementEntities = |
| 6 | 'proposals', |
| 7 | 'requirements', |
| 8 | 'milestones', |
| 9 | 'timesheets', |
| 10 | 'expenses', |
| 11 | 'invoices', |
| 12 | ] as const |
| 13 | |
| 14 | export type ClientInvolvementEntity |
| 15 | |
| 16 | export const clientInvolvementToggleSchema = |
| 17 | |
| 18 | export const clientInvolvementValueSchema = |
| 19 | proposals: clientInvolvementToggleSchema, |
| 20 | requirements: clientInvolvementToggleSchema, |
| 21 | milestones: clientInvolvementToggleSchema, |
| 22 | timesheets: clientInvolvementToggleSchema, |
| 23 | expenses: clientInvolvementToggleSchema, |
| 24 | invoices: clientInvolvementToggleSchema, |
| 25 | }) |
| 26 | |
| 27 | export type ClientInvolvementValue |
| 28 | typeof clientInvolvementValueSchema |
| 29 | > |
| 30 | |
| 31 | export const defaultClientInvolvement: |
| 32 | proposals: 'on', |
| 33 | requirements: 'on', |
| 34 | milestones: 'on', |
| 35 | timesheets: 'on', |
| 36 | expenses: 'on', |
| 37 | invoices: 'on', |
| 38 | } |
| 39 | |
| 40 | export const clientInvolvementEntityLabels: |
| 41 | ClientInvolvementEntity, |
| 42 | { label: |
| 43 | > = { |
| 44 | proposals: { |
| 45 | label: 'Proposals', |
| 46 | description: 'Client signs proposals before work begins.', |
| 47 | }, |
| 48 | requirements: { |
| 49 | label: 'Requirements', |
| 50 | description: 'Client approves requirements before they can be built.', |
| 51 | }, |
| 52 | milestones: { |
| 53 | label: 'Milestones', |
| 54 | description: 'Client accepts milestone deliveries.', |
| 55 | }, |
| 56 | timesheets: { |
| 57 | label: 'Timesheets', |
| 58 | description: |
| 59 | 'Client approves timesheet reports before they can be invoiced.', |
| 60 | }, |
| 61 | expenses: { |
| 62 | label: 'Expenses', |
| 63 | description: 'Client approves expenses before they can be invoiced.', |
| 64 | }, |
| 65 | invoices: { |
| 66 | label: 'Invoices', |
| 67 | description: |
| 68 | 'Client receives invoices and marks them paid. If off, you mark invoices paid yourself.', |
| 69 | }, |
| 70 | } |
| 71 | |
| 72 | export { |
| 73 | type TimesheetDuration, |
| 74 | timesheetDurationOptions, |
| 75 | } from '@/app/(organization)/[org]/settings/common' |
| 76 | |
| 77 | export const updateProjectTimesheetDefaultsSchema = |
| 78 | orgTimesheetDefaultsSchema.extend({ |
| 79 | projectId: z.string |
| 80 | }) |
| 81 | |
| 82 | export const renameProjectSchema = |
| 83 | projectId: z.string |
| 84 | organizationId: z.string |
| 85 | name: z.string |
| 86 | dueDate: z.date |
| 87 | slug: z |
| 88 | .string() |
| 89 | .min(1, ' |
| 90 | .max(100) |
| 91 | .regex(/^[a-z0-9 |
| 92 | }) |
| 93 | |
| 94 | export const updateProjectStatusSchema = |
| 95 | projectId: z.string |
| 96 | organizationId: z.string |
| 97 | status: z.enum |
| 98 | }) |
| 99 | |
| 100 | export const deleteProjectSchema = |
| 101 | projectId: z.string |
| 102 | organizationId: z.string |
| 103 | confirmName: z.string |
| 104 | }) |
| 105 | |
| 106 | export const clientInvolvementProjectSchema = |
| 107 | clientInvolvement: clientInvolvementValueSchema, |
| 108 | projectId: z.string |
| 109 | organizationId: z.string |
| 110 | }) |