@powerhousedao/network-admin 0.0.51 → 0.0.53

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.
Files changed (35) hide show
  1. package/dist/style.css +1249 -0
  2. package/dist/subgraphs/networks/resolvers.js +1 -1
  3. package/dist/subgraphs/networks/schema.js +1 -1
  4. package/dist/subgraphs/workstreams/resolvers.d.ts.map +1 -1
  5. package/dist/subgraphs/workstreams/resolvers.js +207 -55
  6. package/dist/subgraphs/workstreams/schema.d.ts.map +1 -1
  7. package/dist/subgraphs/workstreams/schema.js +4 -3
  8. package/package.json +3 -2
  9. package/dist/editors/payment-terms/basic-terms-tab.d.ts +0 -10
  10. package/dist/editors/payment-terms/basic-terms-tab.d.ts.map +0 -1
  11. package/dist/editors/payment-terms/basic-terms-tab.js +0 -89
  12. package/dist/editors/payment-terms/clauses-tab.d.ts +0 -12
  13. package/dist/editors/payment-terms/clauses-tab.d.ts.map +0 -1
  14. package/dist/editors/payment-terms/clauses-tab.js +0 -214
  15. package/dist/editors/payment-terms/components/EditName.d.ts +0 -3
  16. package/dist/editors/payment-terms/components/EditName.d.ts.map +0 -1
  17. package/dist/editors/payment-terms/components/EditName.js +0 -31
  18. package/dist/editors/payment-terms/components/styles.d.ts +0 -2
  19. package/dist/editors/payment-terms/components/styles.d.ts.map +0 -1
  20. package/dist/editors/payment-terms/components/styles.js +0 -741
  21. package/dist/editors/payment-terms/cost-materials-tab.d.ts +0 -10
  22. package/dist/editors/payment-terms/cost-materials-tab.d.ts.map +0 -1
  23. package/dist/editors/payment-terms/cost-materials-tab.js +0 -63
  24. package/dist/editors/payment-terms/escrow-tab.d.ts +0 -10
  25. package/dist/editors/payment-terms/escrow-tab.d.ts.map +0 -1
  26. package/dist/editors/payment-terms/escrow-tab.js +0 -57
  27. package/dist/editors/payment-terms/evaluation-tab.d.ts +0 -10
  28. package/dist/editors/payment-terms/evaluation-tab.d.ts.map +0 -1
  29. package/dist/editors/payment-terms/evaluation-tab.js +0 -72
  30. package/dist/editors/payment-terms/milestones-tab.d.ts +0 -10
  31. package/dist/editors/payment-terms/milestones-tab.d.ts.map +0 -1
  32. package/dist/editors/payment-terms/milestones-tab.js +0 -214
  33. package/dist/editors/payment-terms/retainer-tab.d.ts +0 -10
  34. package/dist/editors/payment-terms/retainer-tab.d.ts.map +0 -1
  35. package/dist/editors/payment-terms/retainer-tab.js +0 -69
@@ -103,7 +103,7 @@ export const getResolvers = (subgraph) => {
103
103
  type: state?.type || "INDIVIDUAL",
104
104
  _contributorPhids: contributorPhids, // Internal field for resolver
105
105
  status: state?.status || null,
106
- skilss: state?.skilss || state?.skills || [],
106
+ skils: state?.skils || [],
107
107
  scopes: state?.scopes || [],
108
108
  links: state?.links || [],
109
109
  };
@@ -54,7 +54,7 @@ export const schema = gql `
54
54
  type: teamType!
55
55
  contributors: [Builder!]!
56
56
  status: BuilderStatus
57
- skilss: [BuilderSkill!]!
57
+ skils: [BuilderSkill!]!
58
58
  scopes: [BuilderScope!]!
59
59
  links: [BuilderLink!]!
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstreams/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAuC5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAoyBxE,CAAC"}
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstreams/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAuC5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAk7BxE,CAAC"}
@@ -9,6 +9,21 @@ export const getResolvers = (subgraph) => {
9
9
  // Shared state for builder profile resolution (used by field resolvers)
10
10
  let getBuilderProfileByPhid = null;
11
11
  const deriveSlug = (name) => name.toLowerCase().trim().split(/\s+/).join("-");
12
+ const extractPhid = (value) => {
13
+ if (typeof value === "string") {
14
+ // Return null for empty strings, otherwise return the string
15
+ return value.trim() || null;
16
+ }
17
+ if (value &&
18
+ typeof value === "object" &&
19
+ "id" in value &&
20
+ typeof value.id === "string") {
21
+ const id = value.id;
22
+ // Return null for empty strings
23
+ return id.trim() || null;
24
+ }
25
+ return null;
26
+ };
12
27
  const getCandidateDrives = async () => {
13
28
  try {
14
29
  const drives = await reactor.getDrives?.();
@@ -359,15 +374,33 @@ export const getResolvers = (subgraph) => {
359
374
  // Collect SOWs and their contributors
360
375
  const sowDocs = collectSowsFromWorkstreams(resolved);
361
376
  for (const sow of sowDocs) {
362
- if (sow && sow.contributors && Array.isArray(sow.contributors)) {
377
+ if (!sow || typeof sow !== "object")
378
+ continue;
379
+ if (Array.isArray(sow.contributors)) {
363
380
  sow.contributors.forEach((contributor) => {
364
- // Handle both string PHIDs and objects with id property
365
- const phid = typeof contributor === "string"
366
- ? contributor
367
- : contributor?.id;
368
- if (phid && typeof phid === "string") {
381
+ const phid = extractPhid(contributor);
382
+ if (phid)
383
+ contributorPhids.add(phid);
384
+ });
385
+ }
386
+ // Collect deliverable owners too so `SOW_Deliverable.owner` can resolve
387
+ if (Array.isArray(sow.deliverables)) {
388
+ sow.deliverables.forEach((deliverable) => {
389
+ if (!deliverable || typeof deliverable !== "object")
390
+ return;
391
+ const phid = extractPhid(deliverable.owner);
392
+ if (phid)
393
+ contributorPhids.add(phid);
394
+ });
395
+ }
396
+ // Collect project owners too so `SOW_Project.projectOwner` can resolve
397
+ if (Array.isArray(sow.projects)) {
398
+ sow.projects.forEach((project) => {
399
+ if (!project || typeof project !== "object")
400
+ return;
401
+ const phid = extractPhid(project.projectOwner);
402
+ if (phid)
369
403
  contributorPhids.add(phid);
370
- }
371
404
  });
372
405
  }
373
406
  }
@@ -380,21 +413,36 @@ export const getResolvers = (subgraph) => {
380
413
  return null;
381
414
  const state = doc.state.global;
382
415
  // Store contributor PHIDs separately - they'll be resolved by the field resolver
383
- const contributorPhids = state?.contributors || [];
416
+ const contributorPhids = state?.contributors ?? [];
417
+ // Ensure all non-nullable Builder fields are properly handled
418
+ // name: String! - non-nullable
419
+ const name = String(state?.name ?? doc.header?.name ?? "");
420
+ // icon: String! - non-nullable
421
+ const icon = String(state?.icon ?? "");
422
+ // description: String! - non-nullable
423
+ const description = String(state?.description ?? state?.slug ?? "");
424
+ // type: teamType! - non-nullable, default to "INDIVIDUAL"
425
+ const type = state?.type ?? "INDIVIDUAL";
426
+ // skils: [BuilderSkill!]! - non-nullable array
427
+ const skils = Array.isArray(state?.skils) ? state.skils : [];
428
+ // scopes: [BuilderScope!]! - non-nullable array
429
+ const scopes = Array.isArray(state?.scopes) ? state.scopes : [];
430
+ // links: [BuilderLink!]! - non-nullable array
431
+ const links = Array.isArray(state?.links) ? state.links : [];
384
432
  return {
385
433
  id: doc.header.id,
386
- code: state?.code || null,
387
- slug: state?.slug || null,
388
- name: state?.name || doc.header.name,
389
- icon: state?.icon || "",
390
- description: state?.description || state?.slug || "",
391
- lastModified: state?.lastModified || null,
392
- type: state?.type || "INDIVIDUAL",
434
+ code: state?.code ?? null,
435
+ slug: state?.slug ?? null,
436
+ name,
437
+ icon,
438
+ description,
439
+ lastModified: state?.lastModified ?? null,
440
+ type,
393
441
  _contributorPhids: contributorPhids, // Internal field for resolver
394
- status: state?.status || null,
395
- skilss: state?.skilss || state?.skills || [],
396
- scopes: state?.scopes || [],
397
- links: state?.links || [],
442
+ status: state?.status ?? null,
443
+ skils,
444
+ scopes,
445
+ links,
398
446
  };
399
447
  };
400
448
  return resolved;
@@ -434,15 +482,33 @@ export const getResolvers = (subgraph) => {
434
482
  // Collect SOWs and their contributors
435
483
  const sowDocs = collectSowsFromWorkstreams(results);
436
484
  for (const sow of sowDocs) {
437
- if (sow && sow.contributors && Array.isArray(sow.contributors)) {
485
+ if (!sow || typeof sow !== "object")
486
+ continue;
487
+ if (Array.isArray(sow.contributors)) {
438
488
  sow.contributors.forEach((contributor) => {
439
- // Handle both string PHIDs and objects with id property
440
- const phid = typeof contributor === "string"
441
- ? contributor
442
- : contributor?.id;
443
- if (phid && typeof phid === "string") {
489
+ const phid = extractPhid(contributor);
490
+ if (phid)
491
+ contributorPhids.add(phid);
492
+ });
493
+ }
494
+ // Collect deliverable owners too so `SOW_Deliverable.owner` can resolve
495
+ if (Array.isArray(sow.deliverables)) {
496
+ sow.deliverables.forEach((deliverable) => {
497
+ if (!deliverable || typeof deliverable !== "object")
498
+ return;
499
+ const phid = extractPhid(deliverable.owner);
500
+ if (phid)
501
+ contributorPhids.add(phid);
502
+ });
503
+ }
504
+ // Collect project owners too so `SOW_Project.projectOwner` can resolve
505
+ if (Array.isArray(sow.projects)) {
506
+ sow.projects.forEach((project) => {
507
+ if (!project || typeof project !== "object")
508
+ return;
509
+ const phid = extractPhid(project.projectOwner);
510
+ if (phid)
444
511
  contributorPhids.add(phid);
445
- }
446
512
  });
447
513
  }
448
514
  }
@@ -455,21 +521,36 @@ export const getResolvers = (subgraph) => {
455
521
  return null;
456
522
  const state = doc.state.global;
457
523
  // Store contributor PHIDs separately - they'll be resolved by the field resolver
458
- const contributorPhids = state?.contributors || [];
524
+ const contributorPhids = state?.contributors ?? [];
525
+ // Ensure all non-nullable Builder fields are properly handled
526
+ // name: String! - non-nullable
527
+ const name = String(state?.name ?? doc.header?.name ?? "");
528
+ // icon: String! - non-nullable
529
+ const icon = String(state?.icon ?? "");
530
+ // description: String! - non-nullable
531
+ const description = String(state?.description ?? state?.slug ?? "");
532
+ // type: teamType! - non-nullable, default to "INDIVIDUAL"
533
+ const type = state?.type ?? "INDIVIDUAL";
534
+ // skils: [BuilderSkill!]! - non-nullable array
535
+ const skils = Array.isArray(state?.skils) ? state.skils : [];
536
+ // scopes: [BuilderScope!]! - non-nullable array
537
+ const scopes = Array.isArray(state?.scopes) ? state.scopes : [];
538
+ // links: [BuilderLink!]! - non-nullable array
539
+ const links = Array.isArray(state?.links) ? state.links : [];
459
540
  return {
460
541
  id: doc.header.id,
461
- code: state?.code || null,
462
- slug: state?.slug || null,
463
- name: state?.name || doc.header.name,
464
- icon: state?.icon || "",
465
- description: state?.description || state?.slug || "",
466
- lastModified: state?.lastModified || null,
467
- type: state?.type || "INDIVIDUAL",
542
+ code: state?.code ?? null,
543
+ slug: state?.slug ?? null,
544
+ name,
545
+ icon,
546
+ description,
547
+ lastModified: state?.lastModified ?? null,
548
+ type,
468
549
  _contributorPhids: contributorPhids, // Internal field for resolver
469
- status: state?.status || null,
470
- skilss: state?.skilss || state?.skills || [],
471
- scopes: state?.scopes || [],
472
- links: state?.links || [],
550
+ status: state?.status ?? null,
551
+ skils,
552
+ scopes,
553
+ links,
473
554
  };
474
555
  };
475
556
  return results;
@@ -560,13 +641,33 @@ export const getResolvers = (subgraph) => {
560
641
  }
561
642
  // Collect contributor PHIDs from all SOWs
562
643
  for (const sow of sowDocs) {
563
- if (sow && sow.contributors && Array.isArray(sow.contributors)) {
644
+ if (!sow || typeof sow !== "object")
645
+ continue;
646
+ if (Array.isArray(sow.contributors)) {
564
647
  sow.contributors.forEach((contributor) => {
565
- // Handle both string PHIDs and objects with id property
566
- const phid = typeof contributor === "string" ? contributor : contributor?.id;
567
- if (phid && typeof phid === "string") {
648
+ const phid = extractPhid(contributor);
649
+ if (phid)
650
+ contributorPhids.add(phid);
651
+ });
652
+ }
653
+ // Collect deliverable owners too so `SOW_Deliverable.owner` can resolve
654
+ if (Array.isArray(sow.deliverables)) {
655
+ sow.deliverables.forEach((deliverable) => {
656
+ if (!deliverable || typeof deliverable !== "object")
657
+ return;
658
+ const phid = extractPhid(deliverable.owner);
659
+ if (phid)
660
+ contributorPhids.add(phid);
661
+ });
662
+ }
663
+ // Collect project owners too so `SOW_Project.projectOwner` can resolve
664
+ if (Array.isArray(sow.projects)) {
665
+ sow.projects.forEach((project) => {
666
+ if (!project || typeof project !== "object")
667
+ return;
668
+ const phid = extractPhid(project.projectOwner);
669
+ if (phid)
568
670
  contributorPhids.add(phid);
569
- }
570
671
  });
571
672
  }
572
673
  }
@@ -590,21 +691,36 @@ export const getResolvers = (subgraph) => {
590
691
  return null;
591
692
  const state = doc.state.global;
592
693
  // Store contributor PHIDs separately - they'll be resolved by the field resolver
593
- const contributorPhids = state?.contributors || [];
694
+ const contributorPhids = state?.contributors ?? [];
695
+ // Ensure all non-nullable Builder fields are properly handled
696
+ // name: String! - non-nullable
697
+ const name = String(state?.name ?? doc.header?.name ?? "");
698
+ // icon: String! - non-nullable
699
+ const icon = String(state?.icon ?? "");
700
+ // description: String! - non-nullable
701
+ const description = String(state?.description ?? state?.slug ?? "");
702
+ // type: teamType! - non-nullable, default to "INDIVIDUAL"
703
+ const type = state?.type ?? "INDIVIDUAL";
704
+ // skils: [BuilderSkill!]! - non-nullable array
705
+ const skils = Array.isArray(state?.skils) ? state.skils : [];
706
+ // scopes: [BuilderScope!]! - non-nullable array
707
+ const scopes = Array.isArray(state?.scopes) ? state.scopes : [];
708
+ // links: [BuilderLink!]! - non-nullable array
709
+ const links = Array.isArray(state?.links) ? state.links : [];
594
710
  return {
595
711
  id: doc.header.id,
596
- code: state?.code || null,
597
- slug: state?.slug || null,
598
- name: state?.name || doc.header.name,
599
- icon: state?.icon || "",
600
- description: state?.description || state?.slug || "",
601
- lastModified: state?.lastModified || null,
602
- type: state?.type || "INDIVIDUAL",
712
+ code: state?.code ?? null,
713
+ slug: state?.slug ?? null,
714
+ name,
715
+ icon,
716
+ description,
717
+ lastModified: state?.lastModified ?? null,
718
+ type,
603
719
  _contributorPhids: contributorPhids, // Internal field for resolver
604
- status: state?.status || null,
605
- skilss: state?.skilss || state?.skills || [],
606
- scopes: state?.scopes || [],
607
- links: state?.links || [],
720
+ status: state?.status ?? null,
721
+ skils,
722
+ scopes,
723
+ links,
608
724
  };
609
725
  };
610
726
  return results;
@@ -648,6 +764,42 @@ export const getResolvers = (subgraph) => {
648
764
  .filter((builder) => builder !== null);
649
765
  },
650
766
  },
767
+ SOW_Deliverable: {
768
+ owner: (parent) => {
769
+ // Handle null, undefined, or empty string cases
770
+ if (parent?.owner === null || parent?.owner === undefined) {
771
+ return null;
772
+ }
773
+ // Check if it's an empty string
774
+ if (typeof parent.owner === "string" && parent.owner.trim() === "") {
775
+ return null;
776
+ }
777
+ if (!getBuilderProfileByPhid)
778
+ return null;
779
+ const phid = extractPhid(parent.owner);
780
+ if (!phid)
781
+ return null;
782
+ return getBuilderProfileByPhid(phid);
783
+ },
784
+ },
785
+ SOW_Project: {
786
+ projectOwner: (parent) => {
787
+ // Handle null, undefined, or empty string cases
788
+ if (parent?.projectOwner === null || parent?.projectOwner === undefined) {
789
+ return null;
790
+ }
791
+ // Check if it's an empty string
792
+ if (typeof parent.projectOwner === "string" && parent.projectOwner.trim() === "") {
793
+ return null;
794
+ }
795
+ if (!getBuilderProfileByPhid)
796
+ return null;
797
+ const phid = extractPhid(parent.projectOwner);
798
+ if (!phid)
799
+ return null;
800
+ return getBuilderProfileByPhid(phid);
801
+ },
802
+ },
651
803
  Builder: {
652
804
  contributors: (parent) => {
653
805
  // Resolve contributor PHIDs to Builder objects
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstreams/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAugBpB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstreams/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAwgBpB,CAAC"}
@@ -220,7 +220,8 @@ export const schema = gql `
220
220
 
221
221
  type SOW_Deliverable {
222
222
  id: OID!
223
- owner: ID
223
+ owner: Builder
224
+ icon: String
224
225
  title: String!
225
226
  code: String!
226
227
  description: String!
@@ -277,7 +278,7 @@ export const schema = gql `
277
278
  code: String!
278
279
  title: String!
279
280
  slug: String!
280
- projectOwner: ID
281
+ projectOwner: Builder
281
282
  abstract: String
282
283
  imageUrl: URL
283
284
  scope: SOW_DeliverablesSet
@@ -472,7 +473,7 @@ export const schema = gql `
472
473
  type: teamType!
473
474
  contributors: [Builder!]!
474
475
  status: BuilderStatus
475
- skilss: [BuilderSkill!]!
476
+ skils: [BuilderSkill!]!
476
477
  scopes: [BuilderScope!]!
477
478
  links: [BuilderLink!]!
478
479
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/network-admin",
3
3
  "description": "Network Admin package for Powerhouse",
4
- "version": "0.0.51",
4
+ "version": "0.0.53",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [
@@ -62,11 +62,12 @@
62
62
  "service-unstartup": "bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh"
63
63
  },
64
64
  "dependencies": {
65
+ "@powerhousedao/builder-profile": "0.0.5",
65
66
  "@powerhousedao/builder-tools": "^5.0.12",
66
67
  "@powerhousedao/common": "^5.0.12",
67
68
  "@powerhousedao/design-system": "^5.0.12",
68
69
  "@powerhousedao/document-engineering": "^1.39.0",
69
- "@powerhousedao/project-management": "0.0.65",
70
+ "@powerhousedao/project-management": "0.0.66",
70
71
  "@uiw/react-md-editor": "^4.0.8",
71
72
  "document-model": "^5.0.12",
72
73
  "error": "^10.4.0",
@@ -1,10 +0,0 @@
1
- import type { PaymentTermsState } from "../../document-models/payment-terms/gen/types.js";
2
- import type { PaymentTermsAction } from "../../document-models/payment-terms/gen/actions.js";
3
- import { type actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
4
- export interface BasicTermsTabProps {
5
- state: PaymentTermsState;
6
- dispatch: (action: PaymentTermsAction) => void;
7
- actions: typeof paymentTermsActions;
8
- }
9
- export declare function BasicTermsTab({ state, dispatch, actions, }: BasicTermsTabProps): import("react/jsx-runtime").JSX.Element;
10
- //# sourceMappingURL=basic-terms-tab.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"basic-terms-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/basic-terms-tab.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,KAAK,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnG,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,OAAO,GACR,EAAE,kBAAkB,2CA4SpB"}
@@ -1,89 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useCallback } from "react";
3
- import { toast } from "@powerhousedao/design-system/connect";
4
- import { Select, TextInput, Button } from "@powerhousedao/document-engineering";
5
- import {} from "../../document-models/payment-terms/index.js";
6
- export function BasicTermsTab({ state, dispatch, actions, }) {
7
- const [isEditing, setIsEditing] = useState(false);
8
- const [formData, setFormData] = useState({
9
- proposer: state.proposer || "",
10
- payer: state.payer || "",
11
- currency: state.currency || "USD",
12
- paymentModel: state.paymentModel || "MILESTONE",
13
- totalAmount: state.totalAmount?.value?.toString() || "",
14
- status: state.status || "DRAFT",
15
- useEscrow: !!(state.escrowDetails && state.escrowDetails.releaseConditions),
16
- });
17
- const handleSubmit = useCallback((e) => {
18
- e.preventDefault();
19
- dispatch(actions.setBasicTerms({
20
- proposer: formData.proposer,
21
- payer: formData.payer,
22
- currency: formData.currency,
23
- paymentModel: formData.paymentModel,
24
- totalAmount: formData.totalAmount
25
- ? {
26
- value: parseFloat(formData.totalAmount),
27
- unit: formData.currency,
28
- }
29
- : undefined,
30
- }));
31
- if (formData.status !== state.status) {
32
- dispatch(actions.updateStatus({ status: formData.status }));
33
- }
34
- // Handle escrow toggle
35
- if (formData.useEscrow && !state.escrowDetails) {
36
- dispatch(actions.setEscrowDetails({
37
- amountHeld: { value: 0, unit: formData.currency },
38
- releaseConditions: "Upon project completion",
39
- escrowProvider: "",
40
- proofOfFundsDocumentId: "",
41
- }));
42
- }
43
- else if (!formData.useEscrow && state.escrowDetails) {
44
- dispatch(actions.setEscrowDetails({
45
- amountHeld: { value: 0, unit: formData.currency },
46
- releaseConditions: "",
47
- escrowProvider: "",
48
- proofOfFundsDocumentId: "",
49
- }));
50
- }
51
- toast("Basic terms updated successfully", {
52
- type: "success",
53
- });
54
- setIsEditing(false);
55
- }, [formData, dispatch, actions, state.status, state.escrowDetails]);
56
- const handleCancel = useCallback(() => {
57
- setFormData({
58
- proposer: state.proposer || "",
59
- payer: state.payer || "",
60
- currency: state.currency || "USD",
61
- paymentModel: state.paymentModel || "MILESTONE",
62
- totalAmount: state.totalAmount?.value?.toString() || "",
63
- status: state.status || "DRAFT",
64
- useEscrow: !!(state.escrowDetails && state.escrowDetails.releaseConditions),
65
- });
66
- setIsEditing(false);
67
- }, [state]);
68
- if (!isEditing) {
69
- return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between items-center mb-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "Basic Information" }), _jsx(Button, { onClick: () => setIsEditing(true), color: "light", size: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Edit Terms" })] }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Proposer" }), _jsx("p", { className: "text-lg", children: state.proposer || "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payer" }), _jsx("p", { className: "text-lg", children: state.payer || "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Currency" }), _jsx("p", { className: "text-lg", children: state.currency })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payment Model" }), _jsx("p", { className: "text-lg", children: state.paymentModel.replace(/_/g, " ") })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Total Amount" }), _jsx("p", { className: "text-lg", children: state.totalAmount
70
- ? `${state.totalAmount.value} ${state.totalAmount.unit}`
71
- : "Not set" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Status" }), _jsx("p", { className: "text-lg", children: state.status })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Escrow" }), _jsx("p", { className: "text-lg", children: state.escrowDetails && state.escrowDetails.releaseConditions
72
- ? "Enabled"
73
- : "Disabled" })] })] })] }));
74
- }
75
- return (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [_jsx("div", { className: "flex justify-between items-center mb-4", children: _jsx("h2", { className: "text-xl font-semibold", children: "Edit Basic Terms" }) }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Proposer *" }), _jsx(TextInput, { value: formData.proposer, onChange: (e) => setFormData({ ...formData, proposer: e.target.value }), placeholder: "Enter proposer name", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payer *" }), _jsx(TextInput, { value: formData.payer, onChange: (e) => setFormData({ ...formData, payer: e.target.value }), placeholder: "Enter payer name", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Currency *" }), _jsx(Select, { value: formData.currency, onChange: (value) => setFormData({ ...formData, currency: value }), options: [
76
- { value: "USD", label: "USD" },
77
- { value: "EUR", label: "EUR" },
78
- { value: "GBP", label: "GBP" },
79
- ], placeholder: "Select currency", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Payment Model *" }), _jsx(Select, { value: formData.paymentModel, onChange: (value) => setFormData({ ...formData, paymentModel: value }), options: [
80
- { value: "MILESTONE", label: "Milestone" },
81
- { value: "COST_AND_MATERIALS", label: "Cost & Materials" },
82
- { value: "RETAINER", label: "Retainer" },
83
- ], placeholder: "Select payment model", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Total Amount" }), _jsx(TextInput, { value: formData.totalAmount, onChange: (e) => setFormData({ ...formData, totalAmount: e.target.value }), placeholder: "0.00", type: "number", step: "0.01" })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Status *" }), _jsx(Select, { value: formData.status, onChange: (value) => setFormData({ ...formData, status: value }), options: [
84
- { value: "DRAFT", label: "Draft" },
85
- { value: "SUBMITTED", label: "Submitted" },
86
- { value: "ACCEPTED", label: "Accepted" },
87
- { value: "CANCELLED", label: "Cancelled" },
88
- ], placeholder: "Select status", required: true })] }), _jsx("div", { className: "col-span-2", children: _jsxs("div", { className: "flex items-center", children: [_jsx("input", { type: "checkbox", id: "useEscrow", checked: formData.useEscrow, onChange: (e) => setFormData({ ...formData, useEscrow: e.target.checked }), className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), _jsx("label", { htmlFor: "useEscrow", className: "text-sm font-medium text-gray-700", children: "Use Escrow" })] }) })] }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { type: "submit", color: "light", size: "sm", className: "cursor-pointer hover:bg-blue-600 hover:text-white", children: "Save Terms" }), _jsx(Button, { type: "button", onClick: handleCancel, color: "light", size: "sm", className: "cursor-pointer hover:bg-gray-600 hover:text-white", children: "Cancel" })] })] }));
89
- }
@@ -1,12 +0,0 @@
1
- import type { BonusClause, PenaltyClause } from "../../document-models/payment-terms/gen/types.js";
2
- import type { PaymentTermsAction } from "../../document-models/payment-terms/gen/actions.js";
3
- import { type actions as paymentTermsActions } from "../../document-models/payment-terms/index.js";
4
- export interface ClausesTabProps {
5
- bonusClauses: BonusClause[];
6
- penaltyClauses: PenaltyClause[];
7
- dispatch: (action: PaymentTermsAction) => void;
8
- actions: typeof paymentTermsActions;
9
- currency: string;
10
- }
11
- export declare function ClausesTab({ bonusClauses, penaltyClauses, dispatch, actions, currency, }: ClausesTabProps): import("react/jsx-runtime").JSX.Element;
12
- //# sourceMappingURL=clauses-tab.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clauses-tab.d.ts","sourceRoot":"","sources":["../../../editors/payment-terms/clauses-tab.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,KAAK,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnG,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,UAAU,CAAC,EACzB,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,OAAO,EACP,QAAgB,GACjB,EAAE,eAAe,2CA+XjB"}