| 1 | 'use client' |
| 2 | |
| 3 | import { useRouter } from '@bprogress/next/app' |
| 4 | import { zodResolver } |
| 5 | import { AlertTriangle, CreditCard |
| 6 | import { useAction } |
| 7 | import { useCallback, useEffect |
| 8 | import { Controller, useForm |
| 9 | import { toast } |
| 10 | import type { z |
| 11 | import { proPlanFeatures } |
| 12 | import { |
| 13 | type ClientInvolvementValue, |
| 14 | clientInvolvementEntities, |
| 15 | clientInvolvementEntityLabels, |
| 16 | defaultClientInvolvement, |
| 17 | } from '@/app/(project)/[org]/[project]/settings/common' |
| 18 | import { ConfirmDeleteDialog } |
| 19 | import { Badge } |
| 20 | import { Button } |
| 21 | import { |
| 22 | Card, |
| 23 | CardContent, |
| 24 | CardDescription, |
| 25 | CardFooter, |
| 26 | CardHeader, |
| 27 | CardTitle, |
| 28 | } from '@/components/ui/card' |
| 29 | import { Checkbox } |
| 30 | import { CurrencySelect } |
| 31 | import { |
| 32 | Field, |
| 33 | FieldDescription, |
| 34 | FieldError, |
| 35 | FieldGroup, |
| 36 | FieldLabel, |
| 37 | } from '@/components/ui/field' |
| 38 | import { Input } |
| 39 | import { |
| 40 | Select, |
| 41 | SelectContent, |
| 42 | SelectItem, |
| 43 | SelectTrigger, |
| 44 | SelectValue, |
| 45 | } from '@/components/ui/select' |
| 46 | import { authClient, useSession |
| 47 | import { ApiKeysCard } |
| 48 | import { InvoiceNumberTemplateInput } |
| 49 | import { |
| 50 | deleteOrganizationAction, |
| 51 | renameOrganizationAction, |
| 52 | updateInvoiceNumberTemplateAction, |
| 53 | updateOrgClientInvolvementAction, |
| 54 | updateTimesheetDefaultsAction, |
| 55 | } from './actions' |
| 56 | import { |
| 57 | renameOrganizationSchema, |
| 58 | type TimesheetDuration, |
| 59 | updateInvoiceNumberTemplateSchema, |
| 60 | updateOrgClientInvolvementSchema, |
| 61 | updateTimesheetDefaultsSchema, |
| 62 | } from './common' |
| 63 | |
| 64 | type RenameFormValues |
| 65 | type TimesheetFormValues |
| 66 | type InvoiceTemplateFormValues |
| 67 | typeof updateInvoiceNumberTemplateSchema |
| 68 | > |
| 69 | |
| 70 | export function SettingsPageClient({ |
| 71 | organization, |
| 72 | orgSlug, |
| 73 | canDelete, |
| 74 | defaultMemberRate, |
| 75 | defaultTimesheetDuration, |
| 76 | defaultCurrency, |
| 77 | invoiceNumberTemplate, |
| 78 | clientInvolvement, |
| 79 | }: { |
| 80 | organization: { |
| 81 | orgSlug: string |
| 82 | canDelete: boolean |
| 83 | defaultMemberRate: number |
| 84 | defaultCurrency: string |
| 85 | defaultTimesheetDuration: TimesheetDuration |
| 86 | invoiceNumberTemplate: string |
| 87 | clientInvolvement: ClientInvolvementValue |
| 88 | }) { |
| 89 | const router = |
| 90 | const session = |
| 91 | const renameForm = |
| 92 | resolver: zodResolver(renameOrganizationSchema |
| 93 | defaultValues: { |
| 94 | organizationId: organization.id |
| 95 | name: organization.name |
| 96 | slug: organization.slug |
| 97 | }, |
| 98 | }) |
| 99 | |
| 100 | const timesheetForm = |
| 101 | resolver: zodResolver(updateTimesheetDefaultsSchema |
| 102 | defaultValues: { |
| 103 | organizationId: organization.id |
| 104 | defaultMemberRate, |
| 105 | defaultCurrency, |
| 106 | defaultTimesheetDuration, |
| 107 | }, |
| 108 | }) |
| 109 | |
| 110 | const invoiceTemplateForm = |
| 111 | resolver: zodResolver(updateInvoiceNumberTemplateSchema |
| 112 | defaultValues: { |
| 113 | organizationId: organization.id |
| 114 | invoiceNumberTemplate, |
| 115 | }, |
| 116 | }) |
| 117 | |
| 118 | const clientInvolvementForm = |
| 119 | z.infer<typeof |
| 120 | >({ |
| 121 | resolver: zodResolver(updateOrgClientInvolvementSchema |
| 122 | defaultValues: { |
| 123 | organizationId: organization.id |
| 124 | clientInvolvement: clientInvolvement ?? |
| 125 | }, |
| 126 | }) |
| 127 | |
| 128 | const [slugAcknowledged, |
| 129 | const watchedSlug = |
| 130 | const slugChanged = |
| 131 | |
| 132 | const [deleteOpen, |
| 133 | |
| 134 | const [subscription, |
| 135 | status: 'loading |
| 136 | currentPeriodEnd?: string |
| 137 | productName?: string |
| 138 | }>({ status: |
| 139 | const [checkoutLoading, |
| 140 | |
| 141 | useEffect(() => |
| 142 | authClient.customer.subscriptions |
| 143 | .list({ |
| 144 | query: { |
| 145 | limit: 1, |
| 146 | active: true, |
| 147 | referenceId: session.data |
| 148 | }, |
| 149 | }) |
| 150 | .then( |
| 151 | ({ |
| 152 | data, |
| 153 | }: { |
| 154 | data: { |
| 155 | result: { |
| 156 | items: { currentPeriodEnd?: string |
| 157 | } |
| 158 | } | null |
| 159 | }) => { |
| 160 | const sub = |
| 161 | if (sub) { |
| 162 | setSubscription({ |
| 163 | status: 'active', |
| 164 | currentPeriodEnd: sub.currentPeriodEnd |
| 165 | productName: sub.productName |
| 166 | }) |
| 167 | } else { |
| 168 | setSubscription({ status: |
| 169 | } |
| 170 | } |
| 171 | ) |
| 172 | .catch(() => |
| 173 | setSubscription({ status: |
| 174 | }) |
| 175 | }, [session.data |
| 176 | |
| 177 | const handleUpgrade = |
| 178 | setCheckoutLoading(true) |
| 179 | try { |
| 180 | await authClient.checkout |
| 181 | slug: 'pro-plan', |
| 182 | referenceId: session.data |
| 183 | }) |
| 184 | } catch { |
| 185 | toast.error('Failed to start checkout |
| 186 | setCheckoutLoading(false) |
| 187 | } |
| 188 | }, [session.data |
| 189 | |
| 190 | const handleManageBilling = |
| 191 | try { |
| 192 | await authClient.customer |
| 193 | } catch { |
| 194 | toast.error('Failed to open billing portal |
| 195 | } |
| 196 | }, []) |
| 197 | |
| 198 | const { execute: |
| 199 | renameOrganizationAction, |
| 200 | { |
| 201 | onSuccess({ data |
| 202 | toast.success('Workspace updated |
| 203 | if (data?.slug |
| 204 | router.push(`/ |
| 205 | } else { |
| 206 | router.refresh() |
| 207 | } |
| 208 | }, |
| 209 | onError({ error |
| 210 | toast.error(error |
| 211 | }, |
| 212 | } |
| 213 | ) |
| 214 | |
| 215 | const { execute: |
| 216 | useAction(updateTimesheetDefaultsAction, { |
| 217 | onSuccess() { |
| 218 | toast.success('Timesheet defaults updated |
| 219 | router.refresh() |
| 220 | }, |
| 221 | onError({ error |
| 222 | toast.error(error |
| 223 | }, |
| 224 | }) |
| 225 | |
| 226 | const { |
| 227 | execute: executeInvoiceTemplate, |
| 228 | isPending: isSavingInvoiceTemplate, |
| 229 | } = useAction(updateInvoiceNumberTemplateAction |
| 230 | onSuccess() { |
| 231 | toast.success('Invoice number template updated |
| 232 | invoiceTemplateForm.reset(invoiceTemplateForm |
| 233 | router.refresh() |
| 234 | }, |
| 235 | onError({ error |
| 236 | toast.error(error |
| 237 | }, |
| 238 | }) |
| 239 | |
| 240 | const { |
| 241 | execute: executeClientInvolvement, |
| 242 | isPending: isSavingClientInvolvement, |
| 243 | } = useAction(updateOrgClientInvolvementAction |
| 244 | onSuccess() { |
| 245 | toast.success('Client approval defaults updated |
| 246 | router.refresh() |
| 247 | }, |
| 248 | onError({ error |
| 249 | toast.error(error |
| 250 | }, |
| 251 | }) |
| 252 | |
| 253 | const { execute: |
| 254 | deleteOrganizationAction, |
| 255 | { |
| 256 | onSuccess() { |
| 257 | toast.success('Workspace deleted |
| 258 | router.push('/ |
| 259 | }, |
| 260 | onError({ error |
| 261 | toast.error(error |
| 262 | }, |
| 263 | } |
| 264 | ) |
| 265 | |
| 266 | function handleRenameSubmit(data |
| 267 | executeRename({ |
| 268 | organizationId: data.organizationId |
| 269 | name: data.name |
| 270 | slug: data.slug |
| 271 | }) |
| 272 | } |
| 273 | |
| 274 | function handleTimesheetSubmit(data |
| 275 | executeTimesheetDefaults(data) |
| 276 | } |
| 277 | |
| 278 | function handleInvoiceTemplateSubmit(data |
| 279 | executeInvoiceTemplate(data) |
| 280 | } |
| 281 | |
| 282 | return ( |
| 283 | <div className='w-full |
| 284 | <div className='mb-6 |
| 285 | <h1 className='font-semibold text-2xl |
| 286 | </div> |
| 287 | |
| 288 | <div className='space-y-6 |
| 289 | <Card> |
| 290 | <CardHeader> |
| 291 | <CardTitle>General</CardTitle |
| 292 | <CardDescription> |
| 293 | Manage your workspace name and URL slug. |
| 294 | </CardDescription> |
| 295 | </CardHeader> |
| 296 | <form onSubmit={renameForm |
| 297 | <CardContent> |
| 298 | <FieldGroup> |
| 299 | <Controller |
| 300 | control={renameForm.control |
| 301 | name='name' |
| 302 | render={({ field |
| 303 | <Field className=' |
| 304 | <FieldLabel>Workspace Name</FieldLabel |
| 305 | <Input |
| 306 | {...field} |
| 307 | aria-invalid={fieldState.invalid |
| 308 | placeholder='My Workspace' |
| 309 | /> |
| 310 | {fieldState.invalid && |
| 311 | <FieldError errors={ |
| 312 | )} |
| 313 | </Field> |
| 314 | )} |
| 315 | /> |
| 316 | <Controller |
| 317 | control={renameForm.control |
| 318 | name='slug' |
| 319 | render={({ field |
| 320 | <Field className=' |
| 321 | <FieldLabel>URL Slug</FieldLabel |
| 322 | <Input |
| 323 | {...field} |
| 324 | aria-invalid={fieldState.invalid |
| 325 | onChange={(e) |
| 326 | const newSlug = |
| 327 | .toLowerCase() |
| 328 | .replace(/[^a-z0-9 |
| 329 | field.onChange(newSlug |
| 330 | if (newSlug === organization |
| 331 | setSlugAcknowledged(false) |
| 332 | } |
| 333 | }} |
| 334 | placeholder='my-workspace' |
| 335 | /> |
| 336 | <FieldDescription> |
| 337 | Your workspace will be accessible at /{field.value} |
| 338 | </FieldDescription> |
| 339 | {fieldState.invalid && |
| 340 | <FieldError errors={ |
| 341 | )} |
| 342 | </Field> |
| 343 | )} |
| 344 | /> |
| 345 | {slugChanged && ( |
| 346 | <div className='rounded-lg border border-amber-500/50 bg-amber-500/5 p-3 |
| 347 | <div className='flex items-start gap-3 |
| 348 | <Checkbox |
| 349 | checked={slugAcknowledged} |
| 350 | onCheckedChange={(checked) |
| 351 | setSlugAcknowledged(checked === |
| 352 | } |
| 353 | /> |
| 354 | <label |
| 355 | className='text-sm leading-snug' |
| 356 | htmlFor='slug-ack' |
| 357 | > |
| 358 | I acknowledge that by changing the slug of workspace, |
| 359 | links in previously sent emails and notifications will |
| 360 | stop working, as they still point to{' '} |
| 361 | <span className='font-medium |
| 362 | /{organization.slug} |
| 363 | </span> |
| 364 | . |
| 365 | </label> |
| 366 | </div> |
| 367 | </div> |
| 368 | )} |
| 369 | </FieldGroup> |
| 370 | </CardContent> |
| 371 | <CardFooter> |
| 372 | <Button |
| 373 | className='mt-4' |
| 374 | disabled={ |
| 375 | !renameForm.formState.isDirty |
| 376 | (slugChanged && !slugAcknowledged |
| 377 | } |
| 378 | loading={isRenaming} |
| 379 | type='submit' |
| 380 | > |
| 381 | <Save className=' |
| 382 | Save Changes |
| 383 | </Button> |
| 384 | </CardFooter> |
| 385 | </form> |
| 386 | </Card> |
| 387 | |
| 388 | <Card> |
| 389 | <CardHeader> |
| 390 | <CardTitle>Timesheet Defaults</CardTitle |
| 391 | <CardDescription> |
| 392 | Set the default hourly rate and currency for new members. These |
| 393 | can be overridden per project. |
| 394 | </CardDescription> |
| 395 | </CardHeader> |
| 396 | <form onSubmit={timesheetForm |
| 397 | <CardContent> |
| 398 | <div className='grid grid-cols-2 gap-4 |
| 399 | <Controller |
| 400 | control={timesheetForm.control |
| 401 | name='defaultCurrency' |
| 402 | render={({ field |
| 403 | <Field className=' |
| 404 | <FieldLabel>Default Currency</FieldLabel |
| 405 | <CurrencySelect |
| 406 | name='currency' |
| 407 | onValueChange={field.onChange |
| 408 | value={field.value |
| 409 | /> |
| 410 | {fieldState.invalid && |
| 411 | <FieldError errors={ |
| 412 | )} |
| 413 | </Field> |
| 414 | )} |
| 415 | /> |
| 416 | <Controller |
| 417 | control={timesheetForm.control |
| 418 | name='defaultMemberRate' |
| 419 | render={({ field |
| 420 | <Field className=' |
| 421 | <FieldLabel>Default Hourly Rate</FieldLabel |
| 422 | <Input |
| 423 | min={0} |
| 424 | onChange={(e) |
| 425 | field.onChange( |
| 426 | Math.round(Number |
| 427 | ) |
| 428 | } |
| 429 | placeholder='0.00' |
| 430 | step={0.01} |
| 431 | type='number' |
| 432 | value={field.value |
| 433 | /> |
| 434 | {fieldState.invalid && |
| 435 | <FieldError errors={ |
| 436 | )} |
| 437 | </Field> |
| 438 | )} |
| 439 | /> |
| 440 | </div> |
| 441 | <Controller |
| 442 | control={timesheetForm.control |
| 443 | name='defaultTimesheetDuration' |
| 444 | render={({ field |
| 445 | <Field |
| 446 | className='mt-4 gap-1' |
| 447 | data-invalid={fieldState.invalid |
| 448 | > |
| 449 | <FieldLabel>Default Duration</FieldLabel |
| 450 | <Select onValueChange={ |
| 451 | <SelectTrigger className=' |
| 452 | <SelectValue placeholder=' |
| 453 | </SelectTrigger> |
| 454 | <SelectContent> |
| 455 | <SelectItem value=' |
| 456 | <SelectItem value=' |
| 457 | <SelectItem value=' |
| 458 | </SelectContent> |
| 459 | </Select> |
| 460 | <FieldDescription> |
| 461 | The default time period for new timesheets |
| 462 | </FieldDescription> |
| 463 | {fieldState.invalid && |
| 464 | <FieldError errors={ |
| 465 | )} |
| 466 | </Field> |
| 467 | )} |
| 468 | /> |
| 469 | </CardContent> |
| 470 | <CardFooter> |
| 471 | <Button |
| 472 | className='mt-4' |
| 473 | disabled={!timesheetForm. |
| 474 | loading={isSavingDefaults} |
| 475 | type='submit' |
| 476 | > |
| 477 | <Save className=' |
| 478 | Save Defaults |
| 479 | </Button> |
| 480 | </CardFooter> |
| 481 | </form> |
| 482 | </Card> |
| 483 | |
| 484 | <Card> |
| 485 | <CardHeader> |
| 486 | <CardTitle className=' |
| 487 | Invoice Numbering |
| 488 | </CardTitle> |
| 489 | <CardDescription> |
| 490 | Define the template used to generate invoice numbers. Add |
| 491 | variables like sequence, date parts, or time, and mix them with |
| 492 | your own prefix and separators. |
| 493 | </CardDescription> |
| 494 | </CardHeader> |
| 495 | <form |
| 496 | onSubmit={invoiceTemplateForm.handleSubmit |
| 497 | handleInvoiceTemplateSubmit |
| 498 | )} |
| 499 | > |
| 500 | <CardContent> |
| 501 | <Controller |
| 502 | control={invoiceTemplateForm.control |
| 503 | name='invoiceNumberTemplate' |
| 504 | render={({ field |
| 505 | <Field className=' |
| 506 | <FieldLabel>Template</FieldLabel |
| 507 | <InvoiceNumberTemplateInput |
| 508 | onChange={field.onChange |
| 509 | value={field.value |
| 510 | /> |
| 511 | <FieldDescription> |
| 512 | Preview uses sequence #1 and the current date/time. Real |
| 513 | invoices use the next available sequence. |
| 514 | </FieldDescription> |
| 515 | {fieldState.invalid && |
| 516 | <FieldError errors={ |
| 517 | )} |
| 518 | </Field> |
| 519 | )} |
| 520 | /> |
| 521 | </CardContent> |
| 522 | <CardFooter> |
| 523 | <Button |
| 524 | className='mt-4' |
| 525 | disabled={!invoiceTemplateForm. |
| 526 | loading={isSavingInvoiceTemplate} |
| 527 | type='submit' |
| 528 | > |
| 529 | <Save className=' |
| 530 | Save Template |
| 531 | </Button> |
| 532 | </CardFooter> |
| 533 | </form> |
| 534 | </Card> |
| 535 | |
| 536 | <Card> |
| 537 | <CardHeader> |
| 538 | <CardTitle className=' |
| 539 | Client Approval |
| 540 | </CardTitle> |
| 541 | <CardDescription> |
| 542 | Workspace defaults for which parts of the workflow require client |
| 543 | approval. Individual projects can override these. |
| 544 | </CardDescription> |
| 545 | </CardHeader> |
| 546 | <form |
| 547 | onSubmit={clientInvolvementForm.handleSubmit |
| 548 | executeClientInvolvement(values) |
| 549 | )} |
| 550 | > |
| 551 | <CardContent> |
| 552 | <FieldGroup> |
| 553 | {clientInvolvementEntities.map(( |
| 554 | <Controller |
| 555 | control={clientInvolvementForm.control |
| 556 | key={entity} |
| 557 | name={`clientInvolvement.${entity |
| 558 | render={({ field |
| 559 | <Field orientation=' |
| 560 | <Checkbox |
| 561 | checked={field.value |
| 562 | id={`org-client-involvement-${entity |
| 563 | onCheckedChange={(checked) |
| 564 | field.onChange(checked |
| 565 | } |
| 566 | /> |
| 567 | <div className='flex flex-col gap-0.5 |
| 568 | <FieldLabel |
| 569 | htmlFor={`org-client-involvement-${entity |
| 570 | > |
| 571 | {clientInvolvementEntityLabels[entity]. |
| 572 | </FieldLabel> |
| 573 | <FieldDescription> |
| 574 | {clientInvolvementEntityLabels[entity]. |
| 575 | </FieldDescription> |
| 576 | </div> |
| 577 | </Field> |
| 578 | )} |
| 579 | /> |
| 580 | ))} |
| 581 | </FieldGroup> |
| 582 | </CardContent> |
| 583 | <CardFooter> |
| 584 | <Button |
| 585 | className='mt-4' |
| 586 | disabled={!clientInvolvementForm. |
| 587 | loading={isSavingClientInvolvement} |
| 588 | type='submit' |
| 589 | > |
| 590 | <Save className=' |
| 591 | Save Approval Defaults |
| 592 | </Button> |
| 593 | </CardFooter> |
| 594 | </form> |
| 595 | </Card> |
| 596 | |
| 597 | {subscription.status !== |
| 598 | <Card |
| 599 | className={ |
| 600 | subscription.status === |
| 601 | ? 'border-primary/30 bg-linear-to-br from-primary/5 to-transparent' |
| 602 | : '' |
| 603 | } |
| 604 | > |
| 605 | <CardHeader> |
| 606 | <div className='flex items-center justify-between |
| 607 | <div className='space-y-1 |
| 608 | <CardTitle className=' |
| 609 | Plan & Billing |
| 610 | {subscription.status === |
| 611 | <Badge |
| 612 | className='border-teal-300 bg-teal-100 text-teal-800 dark:border-teal-700 dark:bg-teal-900/40 dark:text-teal-300' |
| 613 | variant='outline' |
| 614 | > |
| 615 | Pro |
| 616 | </Badge> |
| 617 | ) : ( |
| 618 | <Badge variant=' |
| 619 | )} |
| 620 | </CardTitle> |
| 621 | <CardDescription> |
| 622 | {subscription.status === |
| 623 | ? 'Your workspace is on the Pro plan.' |
| 624 | : 'Upgrade to Pro to unlock premium features for your workspace.'} |
| 625 | </CardDescription> |
| 626 | </div> |
| 627 | </div> |
| 628 | </CardHeader> |
| 629 | <CardContent> |
| 630 | {subscription.status === |
| 631 | <div className='space-y-4 |
| 632 | <div className='grid grid-cols-2 gap-4 |
| 633 | <div className='rounded-lg border p-3 |
| 634 | <p className='text-muted-foreground text-sm |
| 635 | Current Plan |
| 636 | </p> |
| 637 | <p className='font-medium text-lg |
| 638 | {subscription.productName ?? |
| 639 | </p> |
| 640 | </div> |
| 641 | {subscription.currentPeriodEnd && |
| 642 | <div className='rounded-lg border p-3 |
| 643 | <p className='text-muted-foreground text-sm |
| 644 | Renews On |
| 645 | </p> |
| 646 | <p className='font-medium text-lg |
| 647 | {new Date( |
| 648 | subscription.currentPeriodEnd |
| 649 | ).toLocaleDateString('en-US' |
| 650 | month: 'long', |
| 651 | day: 'numeric', |
| 652 | year: 'numeric', |
| 653 | })} |
| 654 | </p> |
| 655 | </div> |
| 656 | )} |
| 657 | </div> |
| 658 | <Button |
| 659 | onClick={handleManageBilling} |
| 660 | type='button' |
| 661 | variant='outline' |
| 662 | > |
| 663 | <CreditCard className=' |
| 664 | Manage Billing |
| 665 | </Button> |
| 666 | </div> |
| 667 | ) : ( |
| 668 | <div className='space-y-4 |
| 669 | <ul className='space-y-2 text-muted-foreground text-sm |
| 670 | {proPlanFeatures.map(( |
| 671 | <li className='flex items-center gap-2 |
| 672 | <Sparkles className=' |
| 673 | {e} |
| 674 | </li> |
| 675 | ))} |
| 676 | </ul> |
| 677 | <Button |
| 678 | loading={checkoutLoading} |
| 679 | onClick={handleUpgrade} |
| 680 | type='button' |
| 681 | > |
| 682 | <Sparkles className=' |
| 683 | Upgrade to Pro |
| 684 | </Button> |
| 685 | </div> |
| 686 | )} |
| 687 | </CardContent> |
| 688 | </Card> |
| 689 | )} |
| 690 | |
| 691 | <ApiKeysCard |
| 692 | onUpgrade={handleUpgrade} |
| 693 | organizationId={organization.id |
| 694 | subscriptionStatus={subscription.status |
| 695 | upgrading={checkoutLoading} |
| 696 | /> |
| 697 | |
| 698 | {canDelete && ( |
| 699 | <Card className=' |
| 700 | <CardHeader> |
| 701 | <CardTitle className=' |
| 702 | <CardDescription> |
| 703 | Permanently delete this workspace and all of its data. This |
| 704 | action cannot be undone. |
| 705 | </CardDescription> |
| 706 | </CardHeader> |
| 707 | <CardContent> |
| 708 | <Button onClick={ |
| 709 | <AlertTriangle className=' |
| 710 | Delete Workspace |
| 711 | </Button> |
| 712 | </CardContent> |
| 713 | </Card> |
| 714 | )} |
| 715 | </div> |
| 716 | |
| 717 | <ConfirmDeleteDialog |
| 718 | actionLabel='Delete Workspace' |
| 719 | confirmationText={organization.name |
| 720 | description={ |
| 721 | <> |
| 722 | This will permanently delete{' '} |
| 723 | <span className='font-semibold text-foreground |
| 724 | {organization.name} |
| 725 | </span>{' '} |
| 726 | and all associated data including projects, timesheets, and |
| 727 | invoices. This action cannot be undone. |
| 728 | </> |
| 729 | } |
| 730 | loading={isDeleting} |
| 731 | onConfirm={() => |
| 732 | executeDelete({ |
| 733 | organizationId: organization.id |
| 734 | confirmName: organization.name |
| 735 | }) |
| 736 | } |
| 737 | onOpenChange={setDeleteOpen} |
| 738 | open={deleteOpen} |
| 739 | title='Delete Workspace' |
| 740 | /> |
| 741 | </div> |
| 742 | ) |
| 743 | } |