@@ -3,13 +3,31 @@ import { ObjectSchema, Field } from '@objectstack/spec/data';
33export const OpportunityObject = ObjectSchema . create ( {
44 name : 'opportunity' ,
55 label : 'Opportunity' ,
6+ icon : 'trending-up' ,
67 fields : {
7- name : Field . text ( { label : 'Opportunity Name' , required : true } ) ,
8- amount : Field . currency ( { label : 'Amount' } ) ,
9- stage : Field . select ( [ "Prospecting" , "Proposal" , "Negotiation" , "Closed Won" , "Closed Lost" ] , { label : 'Stage' } ) ,
10- close_date : Field . date ( { label : 'Close Date' } ) ,
11- account_id : Field . lookup ( 'account' , { label : 'Account' } ) ,
12- contact_ids : Field . lookup ( 'contact' , { label : 'Contacts' , multiple : true } ) ,
8+ name : Field . text ( { label : 'Opportunity Name' , required : true , searchable : true } ) ,
9+ amount : Field . currency ( { label : 'Amount' , sortable : true } ) ,
10+ stage : Field . select ( [ "Prospecting" , "Proposal" , "Negotiation" , "Closed Won" , "Closed Lost" ] , { label : 'Stage' , filterable : true } ) ,
11+ close_date : Field . date ( { label : 'Close Date' , sortable : true } ) ,
12+ account : Field . lookup ( 'account' , { label : 'Account' } ) ,
13+ contacts : Field . lookup ( 'contact' , { label : 'Contacts' , multiple : true } ) ,
14+ probability : Field . percent ( { label : 'Probability' } ) ,
1315 description : Field . textarea ( { label : 'Description' } )
16+ } ,
17+ list_views : {
18+ all : {
19+ label : 'All Opportunities' ,
20+ columns : [ 'name' , 'account' , 'amount' , 'stage' , 'close_date' ]
21+ } ,
22+ closing_soon : {
23+ label : 'Closing Soon' ,
24+ columns : [ 'name' , 'amount' , 'stage' , 'close_date' ] ,
25+ sort : [ [ 'close_date' , 'asc' ] ]
26+ } ,
27+ won : {
28+ label : 'Won' ,
29+ columns : [ 'name' , 'amount' , 'account' , 'close_date' ] ,
30+ filter : [ [ 'stage' , '=' , 'Closed Won' ] ]
31+ }
1432 }
1533} ) ;
0 commit comments