diff --git a/frontend/src/components/settings/Payments.js b/frontend/src/components/settings/Payments.js
index 0061c1d..ec2266d 100644
--- a/frontend/src/components/settings/Payments.js
+++ b/frontend/src/components/settings/Payments.js
@@ -128,8 +128,14 @@ export default function Payments({
const removeCard = () => {
const remaining = user.paymentMethods.filter(method => method.last4 !== "")
+ const subscriptionPayment = user.subscriptions.find(
+ subscription => subscription.paymentMethod.last4 === card.last4
+ )
- if (hasSubscriptionActive && remaining.length === 1) {
+ if (
+ (hasSubscriptionActive && remaining.length === 1) ||
+ subscriptionPayment
+ ) {
dispatchFeedback(
setSnackbar({
status: "error",
diff --git a/frontend/src/components/settings/Subscriptions.js b/frontend/src/components/settings/Subscriptions.js
index 5a1816f..6e6af1a 100644
--- a/frontend/src/components/settings/Subscriptions.js
+++ b/frontend/src/components/settings/Subscriptions.js
@@ -1,12 +1,18 @@
import React, { useState, useEffect, useContext } from "react"
import axios from "axios"
+import clsx from "clsx"
+import Chip from "@material-ui/core/Chip"
import Grid from "@material-ui/core/Grid"
+import IconButton from "@material-ui/core/IconButton"
import Typography from "@material-ui/core/Typography"
import { makeStyles } from "@material-ui/core/styles"
import SettingsGrid from "./SettingsGrid"
import QtyButton from "../product-list/QtyButton"
+import DeleteIcon from "../../images/Delete"
+import pauseIcon from "../../images/pause.svg"
+
import { UserContext, FeedbackContext } from "../../contexts"
import { setSnackbar } from "../../contexts/actions"
@@ -18,6 +24,27 @@ const useStyles = makeStyles(theme => ({
height: "10rem",
width: "10rem",
},
+ method: {
+ color: "#fff",
+ textTransform: "uppercase",
+ marginTop: "1rem",
+ },
+ lineHeight: {
+ lineHeight: 1.1,
+ },
+ deleteWrapper: {
+ height: "3rem",
+ width: "2.5rem",
+ },
+ pause: {
+ height: "3rem",
+ width: "3rem",
+ },
+ iconButton: {
+ "&:hover": {
+ backgroundColor: "transparent",
+ },
+ },
}))
export default function Subscriptions({ setSelectedSetting }) {
@@ -82,13 +109,25 @@ export default function Subscriptions({ setSelectedSetting }) {
width: 350,
sortable: false,
renderCell: ({ value }) => (
-
- {`${value.shippingInfo.name}`}
-
- {`${value.shippingAddress.street}`}
-
- {`${value.shippingAddress.city}, ${value.shippingAddress.state} ${value.shippingAddress.zip}`}
-
+
+
+
+ {`${value.shippingInfo.name}`}
+
+ {`${value.shippingAddress.street}`}
+
+ {`${value.shippingAddress.city}, ${value.shippingAddress.state} ${value.shippingAddress.zip}`}
+
+
+
+
+ {value.paymentMethod.brand} {value.paymentMethod.last4}
+
+
+
),
},
{
@@ -135,10 +174,55 @@ export default function Subscriptions({ setSelectedSetting }) {
headerName: "Frequency",
width: 250,
sortable: false,
+ renderCell: ({ value }) => (
+
+ ),
+ },
+ {
+ field: "next_delivery",
+ headerName: "Next Order",
+ width: 250,
+ renderCell: ({ value }) => new Date(value).toLocaleDateString(),
+ },
+ {
+ field: "total",
+ headerName: "Total",
+ width: 250,
+ renderCell: ({ value }) => (
+
+ ),
+ },
+ {
+ field: "",
+ width: 250,
+ sortable: false,
+ renderCell: () => (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ),
},
- { field: "next_delivery", headerName: "Next Order", width: 250 },
- { field: "total", headerName: "Total", width: 250 },
- { field: "", width: 250, sortable: false },
]
const rows = createData(subscriptions)