- {data && (
-
+
+
+ {!editing && (
+
+
- Save
+ color="primary"
+ type="button"
+ Icon={DeleteIcon}
+ InverseIcon={DeleteReversedIcon}
+ onClick={() => deleteEditedData()}>
+ {`Delete`}
- )}
-
+
- Cancel
+ color="primary"
+ Icon={EditIcon}
+ InverseIcon={EditReversedIcon}
+ onClick={() => setEditing(true)}>
+ {`Edit`}
- {authorized.label !== 'Accepted' && (
-
-
authorize()}>
- {'Authorize'}
-
+ )}
+ {editing && (
+
+
+ {hasImage && (
+
triggerInput()}>
+ {
+
+ setInput(fileInput)}
+ onChange={event => {
+ // need to store it locally if we want to display it even after saving to db
+
+ const file = R.head(event.target.files)
+
+ reader.onloadend = () => {
+ // use a regex to remove data url part
+ setFieldValue(
+ R.head(fields).name,
+ reader.result
+ .replace('data:', '')
+ .replace(/^.+,/, '')
+ )
+ }
+ reader.readAsDataURL(file)
+ event.target.value = null
+ }}
+ />
+ Replace
+
+ }
+
+ )}
- )}
- {authorized.label !== 'Rejected' && (
-
reject()}>
- {'Reject'}
-
- )}
- {error && (
-
Failed to save changes
- )}
-
- )}
-
-
+
+ {fields && (
+
+ )}
+
+ {authorized.label !== 'Accepted' && (
+
+
authorize()}>
+ Authorize
+
+
+ )}
+ {authorized.label !== 'Rejected' && (
+
reject()}>
+ Reject
+
+ )}
+ {error && (
+
Failed to save changes
+ )}
+
+
+ )}
+
+
+ )}
diff --git a/new-lamassu-admin/src/pages/Customers/components/EditableCard.styles.js b/new-lamassu-admin/src/pages/Customers/components/EditableCard.styles.js
index 1c2a8603..f97fea44 100644
--- a/new-lamassu-admin/src/pages/Customers/components/EditableCard.styles.js
+++ b/new-lamassu-admin/src/pages/Customers/components/EditableCard.styles.js
@@ -20,6 +20,20 @@ export default {
display: 'flex',
justifyContent: 'right'
},
+ deleteButton: {
+ marginRight: 8
+ },
+ editingWrapper: {
+ display: 'flex',
+ flexDirection: 'row',
+ justifyContent: 'space-between'
+ },
+ replace: {
+ marginTop: 30
+ },
+ input: {
+ display: 'none'
+ },
button: {
marginRight: 8
},
diff --git a/new-lamassu-admin/src/styling/variables.js b/new-lamassu-admin/src/styling/variables.js
index 5c27fb7f..c2fb2a9b 100644
--- a/new-lamassu-admin/src/styling/variables.js
+++ b/new-lamassu-admin/src/styling/variables.js
@@ -25,6 +25,7 @@ const white = '#ffffff'
// Error
const tomato = '#ff584a'
+const tomato1 = '#E45043'
const mistyRose = '#ffeceb'
const pumpkin = '#ff7311'
const linen = '#fbf3ec'
@@ -47,6 +48,7 @@ const offColor = comet
const offDarkColor = comet2
const placeholderColor = comet
const errorColor = tomato
+const errorColorDarker = tomato1
const offErrorColor = mistyRose
const inputBorderColor = primaryColor
@@ -148,6 +150,7 @@ export {
linkPrimaryColor,
linkSecondaryColor,
errorColor,
+ errorColorDarker,
offErrorColor,
inputBorderColor,
// font sizes