showing more info for stripe members, showing data in proper table
This commit is contained in:
@@ -79,7 +79,6 @@ export default class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateNode(prefix, id, toEdit) {
|
updateNode(prefix, id, toEdit) {
|
||||||
console.log("update node, ", toEdit)
|
|
||||||
try {
|
try {
|
||||||
let model = nodeModels[prefix]
|
let model = nodeModels[prefix]
|
||||||
if(model) {
|
if(model) {
|
||||||
@@ -130,9 +129,7 @@ export default class Database {
|
|||||||
try {
|
try {
|
||||||
let model = edgeModels[prefix]
|
let model = edgeModels[prefix]
|
||||||
if(model) {
|
if(model) {
|
||||||
console.log(model.indices[0] + (id - 1))
|
|
||||||
this.edges[model.indices[0] + (id - 1)] = 0
|
this.edges[model.indices[0] + (id - 1)] = 0
|
||||||
console.log(this.edges[model.indices[0] + (id - 1)])
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Type does not exist for edge: " + prefix)
|
throw new Error("Type does not exist for edge: " + prefix)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class Server {
|
|||||||
const contact = contactRaw.trim() ? JSON.parse(contactRaw) : [];
|
const contact = contactRaw.trim() ? JSON.parse(contactRaw) : [];
|
||||||
const members = db.members.getByNetwork(networkId)
|
const members = db.members.getByNetwork(networkId)
|
||||||
let stripeMembers = await payments.getCustomers(networkId)
|
let stripeMembers = await payments.getCustomers(networkId)
|
||||||
stripeMembers = stripeMembers.data
|
console.log("stripemenbers: ", stripeMembers)
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
join,
|
join,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ export default class PaymentsHandler {
|
|||||||
|
|
||||||
static async finishConnectSetup(req, res) {
|
static async finishConnectSetup(req, res) {
|
||||||
const { code, networkId } = req.body;
|
const { code, networkId } = req.body;
|
||||||
console.log("onboarded", networkId)
|
|
||||||
|
|
||||||
const response = await stripe.oauth.token({
|
const response = await stripe.oauth.token({
|
||||||
grant_type: "authorization_code",
|
grant_type: "authorization_code",
|
||||||
@@ -54,10 +53,26 @@ export default class PaymentsHandler {
|
|||||||
throw new Error("Can't get customers for account that doesn't exist!")
|
throw new Error("Can't get customers for account that doesn't exist!")
|
||||||
}
|
}
|
||||||
const customers = await stripe.customers.list(
|
const customers = await stripe.customers.list(
|
||||||
{ limit: 100 },
|
{ limit: 100, expand: ['data.subscriptions'] },
|
||||||
{ stripeAccount: network.stripeAccountId }
|
{ stripeAccount: network.stripeAccountId }
|
||||||
);
|
);
|
||||||
return customers
|
console.log(customers)
|
||||||
|
|
||||||
|
return customers.data.map(customer => ({
|
||||||
|
id: customer.id,
|
||||||
|
email: customer.email,
|
||||||
|
created: customer.created,
|
||||||
|
name: customer.name,
|
||||||
|
phone: customer.phone,
|
||||||
|
city: customer.address?.city,
|
||||||
|
subscriptions: customer.subscriptions?.data.map(sub => ({
|
||||||
|
id: sub.id,
|
||||||
|
status: sub.status,
|
||||||
|
amount: sub.items.data[0]?.price.unit_amount / 100, // converts cents to dollars
|
||||||
|
currency: sub.items.data[0]?.price.currency,
|
||||||
|
interval: sub.items.data[0]?.price.recurring?.interval
|
||||||
|
}))
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
static async newSubscription(req, res) {
|
static async newSubscription(req, res) {
|
||||||
|
|||||||
@@ -4,56 +4,116 @@ class People extends Shadow {
|
|||||||
h1("Members")
|
h1("Members")
|
||||||
.fontWeight("bold")
|
.fontWeight("bold")
|
||||||
.marginBottom(2, em)
|
.marginBottom(2, em)
|
||||||
|
.marginLeft(4, em)
|
||||||
|
|
||||||
HStack(() => {
|
VStack(() => {
|
||||||
VStack(() => {
|
VStack(() => {
|
||||||
p("Officers")
|
p("Officers")
|
||||||
.marginBottom(2, vh)
|
.marginBottom(2, vh)
|
||||||
|
.marginLeft(8, em)
|
||||||
.fontStyle("italic")
|
.fontStyle("italic")
|
||||||
|
|
||||||
for(let i = 0; i < global.currentNetwork.data.members.length; i++) {
|
ZStack(() => {
|
||||||
let member = global.currentNetwork.data.members[i]
|
new gridjs.Grid({
|
||||||
HStack(() => {
|
columns: ["Name", "Email"],
|
||||||
p(member.firstName + " " + member.lastName)
|
data: global.currentNetwork.data.members.map(m => [
|
||||||
.width(10, vw)
|
m.firstName + " " + m.lastName,
|
||||||
p(member.email)
|
m.email
|
||||||
.width(10, vw)
|
]),
|
||||||
})
|
sort: true,
|
||||||
|
search: true,
|
||||||
|
style: {
|
||||||
|
table: {
|
||||||
|
'background-color': 'var(--window)',
|
||||||
|
'color': 'var(--accent)',
|
||||||
|
'box-shadow': 'none',
|
||||||
|
'font-size': '0.9em'
|
||||||
|
},
|
||||||
|
th: {
|
||||||
|
'background-color': 'var(--window)',
|
||||||
|
'color': 'var(--accent)',
|
||||||
|
'border': 'none',
|
||||||
|
'border-bottom': '1px solid rgb(69 53 53)'
|
||||||
|
},
|
||||||
|
td: {
|
||||||
|
'background-color': 'var(--window)',
|
||||||
|
'color': 'var(--accent)',
|
||||||
|
'border': 'none',
|
||||||
|
'border-bottom': '1px solid rgb(69 53 53)'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}).render(quill.rendering.last)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.gap(0.5, em)
|
.gap(0.5, em)
|
||||||
|
|
||||||
VStack(() => {
|
VStack(() => {
|
||||||
p("Stripe Subscribers")
|
p("Stripe Subscribers")
|
||||||
.marginBottom(2, vh)
|
.marginBottom(2, vh)
|
||||||
|
.marginLeft(8, em)
|
||||||
.fontStyle("italic")
|
.fontStyle("italic")
|
||||||
|
|
||||||
for(let i = 0; i < global.currentNetwork.data.stripeMembers.length; i++) {
|
ZStack(() => {
|
||||||
let member = global.currentNetwork.data.stripeMembers[i]
|
new gridjs.Grid({
|
||||||
HStack(() => {
|
columns: ["Amount", "Name", "Email", "Phone", "Area", "Created"],
|
||||||
p(member.name)
|
data: global.currentNetwork.data.stripeMembers.map(m => [
|
||||||
.width(10, vw)
|
"$" + m.subscriptions[0].amount,
|
||||||
p(member.email)
|
m.name,
|
||||||
.width(20, vw)
|
m.email,
|
||||||
p(new Date(member.created * 1000).toLocaleString('en-US', {
|
m.phone,
|
||||||
|
m.city,
|
||||||
|
new Date(m.created * 1000).toLocaleString('en-US', {
|
||||||
timeZone: 'America/Chicago',
|
timeZone: 'America/Chicago',
|
||||||
hour: 'numeric',
|
hour: 'numeric',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
month: 'numeric',
|
month: 'numeric',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
year: 'numeric'
|
year: 'numeric'
|
||||||
}))
|
|
||||||
.width(40, vw)
|
|
||||||
})
|
})
|
||||||
|
]),
|
||||||
|
sort: true,
|
||||||
|
search: true,
|
||||||
|
style: {
|
||||||
|
input: {
|
||||||
|
'background-color': 'var(--window)',
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
'background-color': 'var(--window)',
|
||||||
|
'color': 'var(--accent)',
|
||||||
|
'box-shadow': 'none',
|
||||||
|
'font-size': '0.9em'
|
||||||
|
},
|
||||||
|
th: {
|
||||||
|
'background-color': 'var(--window)',
|
||||||
|
'color': 'var(--accent)',
|
||||||
|
'border': 'none',
|
||||||
|
'border-bottom': '1px solid rgb(69 53 53)'
|
||||||
|
},
|
||||||
|
td: {
|
||||||
|
'background-color': 'var(--window)',
|
||||||
|
'color': 'var(--accent)',
|
||||||
|
'border': 'none',
|
||||||
|
'border-bottom': '1px solid rgb(69 53 53)'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}).render(quill.rendering.last)
|
||||||
|
|
||||||
|
css(`
|
||||||
|
input.gridjs-input {
|
||||||
|
background-color: var(--window);
|
||||||
|
color: var(--accent);
|
||||||
|
border: 1px solid rgb(69 53 53);
|
||||||
|
margin-left: 8em
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.gap(0.5, em)
|
.gap(0.5, em)
|
||||||
})
|
})
|
||||||
.gap(10, vw)
|
.gap(4, em)
|
||||||
})
|
})
|
||||||
.gap(0.5, em)
|
.gap(0.5, em)
|
||||||
.paddingTop(4, pct)
|
.paddingTop(4, pct)
|
||||||
.paddingLeft(5, pct)
|
|
||||||
.width(100, pct)
|
.width(100, pct)
|
||||||
.height(100, pct);
|
.height(100, pct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class Settings extends Shadow {
|
|||||||
p("Stripe Integration")
|
p("Stripe Integration")
|
||||||
|
|
||||||
if(this.stripeDetails && this.stripeDetails.data.email) {
|
if(this.stripeDetails && this.stripeDetails.data.email) {
|
||||||
p("connected")
|
p("Connected")
|
||||||
} else if(this.stripeDetails && this.stripeDetails.data.connected === false) {
|
} else if(this.stripeDetails && this.stripeDetails.data.connected === false) {
|
||||||
button("Set up Stripe")
|
button("Set up Stripe")
|
||||||
.maxWidth(10, em)
|
.maxWidth(10, em)
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Forum</title>
|
<title>Forum</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css" rel="stylesheet"/>
|
||||||
|
<script src="https://unpkg.com/gridjs/dist/gridjs.umd.js"></script>
|
||||||
<link rel="icon" href="/_/icons/columnred.svg">
|
<link rel="icon" href="/_/icons/columnred.svg">
|
||||||
<link rel="stylesheet" href="/_/code/shared.css">
|
<link rel="stylesheet" href="/_/code/shared.css">
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
Reference in New Issue
Block a user