|
| 1 | +import { PageSchema } from "@object-ui/types"; |
| 2 | + |
| 3 | +/** |
| 4 | + * Opportunity Detail Schema |
| 5 | + * Demonstrates the new field widgets: CurrencyField, LookupField, and action execution |
| 6 | + */ |
| 7 | +export const opportunityDetailSchema: PageSchema = { |
| 8 | + type: "page", |
| 9 | + props: { title: "Opportunity Details" }, |
| 10 | + children: [ |
| 11 | + { |
| 12 | + type: "page:header", |
| 13 | + props: { |
| 14 | + title: "${data.name}", |
| 15 | + description: "Deal Amount: ${data.amount}" |
| 16 | + }, |
| 17 | + children: [ |
| 18 | + { |
| 19 | + type: "action:button", |
| 20 | + props: { label: "Edit", variant: "outline" } |
| 21 | + }, |
| 22 | + { |
| 23 | + type: "action:button", |
| 24 | + props: { |
| 25 | + label: "Mark as Won", |
| 26 | + variant: "default", |
| 27 | + confirmText: "Are you sure you want to mark this as won?", |
| 28 | + successMessage: "Opportunity marked as won!", |
| 29 | + api: "/api/opportunities/${data.id}/win", |
| 30 | + reload: true |
| 31 | + } |
| 32 | + } |
| 33 | + ] |
| 34 | + }, |
| 35 | + { |
| 36 | + type: "page:card", |
| 37 | + className: "mt-6", |
| 38 | + props: { title: "Deal Information" }, |
| 39 | + children: [ |
| 40 | + { |
| 41 | + type: "view:simple", |
| 42 | + props: { columns: 2 }, |
| 43 | + children: [ |
| 44 | + { |
| 45 | + type: "field:text", |
| 46 | + bind: "name", |
| 47 | + props: { label: "Opportunity Name" } |
| 48 | + }, |
| 49 | + { |
| 50 | + type: "field:select", |
| 51 | + bind: "stage", |
| 52 | + props: { |
| 53 | + label: "Stage", |
| 54 | + options: [ |
| 55 | + { value: "Prospecting", label: "Prospecting" }, |
| 56 | + { value: "Proposal", label: "Proposal" }, |
| 57 | + { value: "Negotiation", label: "Negotiation" }, |
| 58 | + { value: "Closed Won", label: "Closed Won" }, |
| 59 | + { value: "Closed Lost", label: "Closed Lost" } |
| 60 | + ] |
| 61 | + } |
| 62 | + }, |
| 63 | + { |
| 64 | + type: "field:currency", |
| 65 | + bind: "amount", |
| 66 | + props: { |
| 67 | + label: "Amount", |
| 68 | + currency: "USD", |
| 69 | + precision: 2 |
| 70 | + } |
| 71 | + }, |
| 72 | + { |
| 73 | + type: "field:date", |
| 74 | + bind: "closeDate", |
| 75 | + props: { label: "Close Date" } |
| 76 | + }, |
| 77 | + { |
| 78 | + type: "field:lookup", |
| 79 | + bind: "accountId", |
| 80 | + props: { |
| 81 | + label: "Account", |
| 82 | + options: [ |
| 83 | + { value: "1", label: "Acme Corp" }, |
| 84 | + { value: "2", label: "TechStart Inc" }, |
| 85 | + { value: "3", label: "Global Solutions" } |
| 86 | + ], |
| 87 | + display_field: "label" |
| 88 | + } |
| 89 | + }, |
| 90 | + { |
| 91 | + type: "field:lookup", |
| 92 | + bind: "contactIds", |
| 93 | + props: { |
| 94 | + label: "Contacts", |
| 95 | + multiple: true, |
| 96 | + options: [ |
| 97 | + { value: "c1", label: "John Doe" }, |
| 98 | + { value: "c2", label: "Jane Smith" }, |
| 99 | + { value: "c3", label: "Bob Johnson" } |
| 100 | + ] |
| 101 | + } |
| 102 | + } |
| 103 | + ] |
| 104 | + } |
| 105 | + ] |
| 106 | + }, |
| 107 | + { |
| 108 | + type: "page:card", |
| 109 | + className: "mt-6", |
| 110 | + props: { title: "Description" }, |
| 111 | + children: [ |
| 112 | + { |
| 113 | + type: "field:textarea", |
| 114 | + bind: "description", |
| 115 | + props: { |
| 116 | + label: "Notes", |
| 117 | + rows: 6, |
| 118 | + placeholder: "Enter opportunity notes..." |
| 119 | + } |
| 120 | + } |
| 121 | + ] |
| 122 | + } |
| 123 | + ] |
| 124 | +}; |
0 commit comments