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