Skip to content

Commit 217f073

Browse files
committed
Add account, company cards
1 parent 1aa096e commit 217f073

16 files changed

+644
-14
lines changed

packages/base/email.gts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { FieldDef, contains, field, Component } from './card-api';
2+
import StringField from './string';
3+
4+
export class EmailAddress extends FieldDef {
5+
static displayName = 'EmailAddress';
6+
@field value = contains(StringField);
7+
// put some validation logic here
8+
9+
static embedded = class Embedded extends Component<typeof this> {
10+
<template>
11+
<address>
12+
<@fields.value />
13+
</address>
14+
</template>
15+
};
16+
}

packages/base/web-url.gts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { FieldDef, contains, field } from './card-api';
2+
import StringField from './string';
3+
4+
export class WebUrl extends FieldDef {
5+
static displayName = 'Web URL';
6+
@field value = contains(StringField);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"description": null,
6+
"thumbnailURL": null
7+
},
8+
"relationships": {
9+
"accounts.0": {
10+
"links": {
11+
"self": "../CardDef/7298c9c6-2964-41a0-87f7-42127a16e12b"
12+
}
13+
},
14+
"accounts.1": {
15+
"links": {
16+
"self": "../CardDef/992531db-9912-49eb-9b72-f710cbcdb085"
17+
}
18+
}
19+
},
20+
"meta": {
21+
"adoptsFrom": {
22+
"module": "../crm/accounts-dashboard",
23+
"name": "AccountsDashboard"
24+
}
25+
}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"username": "jane_doe88",
6+
"email": {
7+
"value": "jane.doe88@example.com"
8+
},
9+
"description": null,
10+
"thumbnailURL": null
11+
},
12+
"meta": {
13+
"adoptsFrom": {
14+
"module": "../matrix-user",
15+
"name": "MatrixUser"
16+
}
17+
}
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"accountName": "Acme Corporation",
6+
"accountAlias": "AcmeCorp",
7+
"description": "A leading provider of innovative solutions in the technology sector.",
8+
"contactInformation": {
9+
"salutation": "Mr.",
10+
"firstName": "John",
11+
"lastName": "Doe",
12+
"address": {
13+
"streetAddress": "123 Tech Road",
14+
"city": "Innovate City",
15+
"region": "Silicon Valley",
16+
"postalCode": "94016",
17+
"poBoxNumber": "456",
18+
"country": "USA"
19+
},
20+
"phoneNumber": null,
21+
"email": {
22+
"value": "contact@acmecorp.com"
23+
},
24+
"website": {
25+
"value": "www.acmecorp.com"
26+
},
27+
"company": "Acme Corporation"
28+
},
29+
"billingAddress": {
30+
"streetAddress": "123 Tech Road",
31+
"city": "Innovate City",
32+
"region": "Silicon Valley",
33+
"postalCode": "94016",
34+
"poBoxNumber": "456",
35+
"country": "USA"
36+
},
37+
"shippingAddress": {
38+
"streetAddress": "123 Tech Road",
39+
"city": "Innovate City",
40+
"region": "Silicon Valley",
41+
"postalCode": "94016",
42+
"poBoxNumber": "789",
43+
"country": "USA"
44+
},
45+
"numberOfEmployees": 500,
46+
"thumbnailURL": null
47+
},
48+
"relationships": {
49+
"owner": {
50+
"links": {
51+
"self": null
52+
}
53+
},
54+
"parentAccount": {
55+
"links": {
56+
"self": "./992531db-9912-49eb-9b72-f710cbcdb085"
57+
}
58+
},
59+
"company": {
60+
"links": {
61+
"self": null
62+
}
63+
}
64+
},
65+
"meta": {
66+
"adoptsFrom": {
67+
"module": "../crm/account",
68+
"name": "CrmAccount"
69+
}
70+
}
71+
}
72+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"accountName": "Globex Corporation",
6+
"accountAlias": "GlobexCorp",
7+
"description": "A global leader in the field of international commerce and innovation.",
8+
"contactInformation": {
9+
"salutation": "Ms.",
10+
"firstName": "Jane",
11+
"lastName": "Smith",
12+
"address": {
13+
"streetAddress": "456 Global Plaza",
14+
"city": "World City",
15+
"region": "Global District",
16+
"postalCode": "55555",
17+
"poBoxNumber": "789",
18+
"country": "Globaland"
19+
},
20+
"phoneNumber": null,
21+
"email": {
22+
"value": "info@globexcorp.com"
23+
},
24+
"website": {
25+
"value": "www.globexcorp.com"
26+
},
27+
"company": "Globex Corporation"
28+
},
29+
"billingAddress": {
30+
"streetAddress": "456 Global Plaza",
31+
"city": "World City",
32+
"region": "Global District",
33+
"postalCode": "55555",
34+
"poBoxNumber": "789",
35+
"country": "Globaland"
36+
},
37+
"shippingAddress": {
38+
"streetAddress": "789 Trade Route",
39+
"city": "Commerce Town",
40+
"region": "Trade Zone",
41+
"postalCode": "101010",
42+
"poBoxNumber": "101",
43+
"country": "Marketland"
44+
},
45+
"numberOfEmployees": 10000,
46+
"thumbnailURL": null
47+
},
48+
"relationships": {
49+
"owner": {
50+
"links": {
51+
"self": null
52+
}
53+
},
54+
"parentAccount": {
55+
"links": {
56+
"self": null
57+
}
58+
},
59+
"company": {
60+
"links": {
61+
"self": null
62+
}
63+
}
64+
},
65+
"meta": {
66+
"adoptsFrom": {
67+
"module": "../crm/account",
68+
"name": "CrmAccount"
69+
}
70+
}
71+
}
72+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"accountName": "Cardstack Malaysia",
6+
"accountAlias": "Cardstack Malaysia",
7+
"description": "Cardstack Malaysia wants to sell x1000 card templates to be used in their card catalog",
8+
"contactInformation": {
9+
"salutation": "Mrs",
10+
"firstName": "Justin",
11+
"lastName": "Thong",
12+
"address": {
13+
"streetAddress": "Jalan Permatang Gedong, Taman Sejati Indah,",
14+
"city": "Kuala Lumpur",
15+
"region": "Kuala Lumpur",
16+
"postalCode": "55200",
17+
"poBoxNumber": null,
18+
"country": "Malaysia"
19+
},
20+
"phoneNumber": {
21+
"country": 1,
22+
"area": 212,
23+
"number": 5551212
24+
},
25+
"email": {
26+
"value": null
27+
},
28+
"website": {
29+
"value": null
30+
}
31+
},
32+
"billingAddress": {
33+
"streetAddress": "Jalan Permatang Gedong, Taman Sejati Indah,",
34+
"city": "Kuala Lumpur",
35+
"region": "Kuala Lumpur",
36+
"postalCode": "55200",
37+
"poBoxNumber": null,
38+
"country": "Malaysia"
39+
},
40+
"numberOfEmployees": 4,
41+
"thumbnailURL": null
42+
},
43+
"relationships": {
44+
"owner": {
45+
"links": {
46+
"self": "../MatrixUser/ca9dbfad-633a-4911-bc09-7fe3ebcb60c1"
47+
}
48+
},
49+
"parentAccount": {
50+
"links": {
51+
"self": null
52+
}
53+
},
54+
"company": {
55+
"links": {
56+
"self": null
57+
}
58+
}
59+
},
60+
"meta": {
61+
"adoptsFrom": {
62+
"module": "../crm/account",
63+
"name": "CrmAccount"
64+
}
65+
}
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"username": "tintinthong",
6+
"email": {
7+
"value": "tintinthong@cardstack.com"
8+
},
9+
"description": null,
10+
"thumbnailURL": null
11+
},
12+
"meta": {
13+
"adoptsFrom": {
14+
"module": "../matrix-user",
15+
"name": "MatrixUser"
16+
}
17+
}
18+
}
19+
}

packages/drafts-realm/contact-card.gts

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import StringField from 'https://cardstack.com/base/string';
2-
import NumberField from 'https://cardstack.com/base/number';
32
import {
43
Component,
54
CardDef,
@@ -9,6 +8,7 @@ import {
98
containsMany,
109
linksToMany,
1110
} from 'https://cardstack.com/base/card-api';
11+
import { PhoneField } from './phone-number';
1212

1313
class Alias extends CardDef {
1414
static displayName = 'Alias';
@@ -26,19 +26,6 @@ class Alias extends CardDef {
2626
};
2727
}
2828

29-
export class PhoneField extends FieldDef {
30-
static displayName = 'Phone';
31-
@field country = contains(NumberField);
32-
@field area = contains(NumberField);
33-
@field number = contains(NumberField);
34-
35-
static embedded = class Embedded extends Component<typeof this> {
36-
<template>
37-
(+<@fields.country />) <@fields.area />-<@fields.number />
38-
</template>
39-
};
40-
}
41-
4229
export class EmergencyContactField extends FieldDef {
4330
static displayName = 'Emergency Contact';
4431
@field name = contains(StringField);

0 commit comments

Comments
 (0)