11import React from 'react' ;
22import { makeStyles } from '@material-ui/core/styles' ;
3+ import Avatar from '@material-ui/core/Avatar' ;
34import Card from '@material-ui/core/Card' ;
45import CardActionArea from '@material-ui/core/CardActionArea' ;
56import CardContent from '@material-ui/core/CardContent' ;
6- import CardMedia from '@material-ui/core/CardMedia' ;
77import { CopyToClipboard } from 'react-copy-to-clipboard' ;
88import Button from '@material-ui/core/Button' ;
9- import FileCopyIcon from '@material-ui/icons/FileCopy' ;
10- import Grid from "@material-ui/core/Grid" ;
11- import Typography from '@material-ui/core/Typography' ;
9+ import EmailOutlinedIcon from '@material-ui/icons/EmailOutlined' ;
10+ import FileCopyOutlinedIcon from '@material-ui/icons/FileCopyOutlined' ;
1211import Snackbar from '@material-ui/core/Snackbar' ;
1312import IconButton from '@material-ui/core/IconButton' ;
1413import CloseIcon from '@material-ui/icons/Close' ;
1514import config from "../config" ;
15+ import Table from '@material-ui/core/Table' ;
16+ import TableBody from '@material-ui/core/TableBody' ;
17+ import TableCell from '@material-ui/core/TableCell' ;
18+ import TableContainer from '@material-ui/core/TableContainer' ;
19+ import Paper from '@material-ui/core/Paper' ;
20+ import TableHead from '@material-ui/core/TableHead' ;
21+ import TableRow from '@material-ui/core/TableRow' ;
22+ import Typography from '@material-ui/core/Typography' ;
1623
1724
18- const useStyles = makeStyles ( {
19- root : {
20- maxWidth : 400 ,
21- } ,
22- media : {
23- objectFit : 'cover' ,
24- } ,
25- } ) ;
26-
27- const ProductLinkCard = ( { product, user, useCredits } ) => {
25+ const ProductLinkCard = ( { link, product, user, onSendEmailClick, calculatedAmountDetails } ) => {
2826
2927 const [ open , setOpen ] = React . useState ( false ) ;
3028
31- const generatedLink = useCredits
32- ? `https://dukaan.codingblocks.com/buy?productId=${ product . id } &oneauthId=${ user . oneauth_id } &useCredits=true`
33- : `https://dukaan.codingblocks.com/buy?productId=${ product . id } &oneauthId=${ user . oneauth_id } `
34-
3529 const handleClick = ( ) => {
36- setOpen ( true ) ;
37- } ;
30+ setOpen ( true ) ;
31+ }
3832
3933 const handleClose = ( event , reason ) => {
40- if ( reason === 'clickaway' ) {
41- return ;
42- }
34+ if ( reason === 'clickaway' ) {
35+ return ;
36+ }
4337
4438 setOpen ( false ) ;
45- } ;
46-
47- const classes = useStyles ( ) ;
39+ }
4840
4941 return (
50- < div className = { "d-flex col-md-8 offset-1 mt-5" } >
51-
52- < Card className = { classes . root } style = { { width : '100%' } } >
42+ < Card style = { { width : '100%' } } >
5343 < CardActionArea >
54- < CardMedia
55- className = { classes . media }
56- component = "img"
57- alt = ""
58- height = "180"
59- image = { product . image_url }
60- title = "Link"
61- />
6244 < CardContent >
63- < Grid container wrap = "wrap" spacing = { 2 } >
64- < Grid item xs = { 6 } >
65- < b > Product </ b >
66- < ul >
67- < li > Name: { product . name } </ li >
68- < li > Description: { product . description } </ li >
69- < li className = "red" > Type: { product . type } </ li >
70- < li > Mrp: { product . mrp / 100 } </ li >
71-
72- </ ul >
73- </ Grid >
74- < Grid item xs = { 6 } >
75- < b > User </ b >
76- < ul >
77- < li > UserName: { user . username } </ li >
78- < li > OneauthId: { user . oneauth_id } </ li >
79- < li > Email: { user . email } </ li >
80- < li > Wallet Amount: { user . wallet_amount / 100 } </ li >
81- </ ul >
82- </ Grid >
83- </ Grid >
84- < hr />
85- < Grid container wrap = "wrap" >
86- < Grid item xs = { 10 } >
87- < Typography >
88- { generatedLink }
89- </ Typography >
90- </ Grid >
91- < Grid item xs = { 2 } >
92- < CopyToClipboard text = { generatedLink } >
93- < Button onClick = { handleClick } title = "copy to clipboard" >
94- < FileCopyIcon />
95- </ Button >
96- </ CopyToClipboard >
97- </ Grid >
98- </ Grid >
45+
46+ < TableContainer >
47+ < Typography className = { "ml-5 mt-2" } variant = "h5" id = "tableTitle" component = "div" >
48+ < b > { product . description } </ b >
49+ </ Typography >
50+
51+ < Table aria-label = "simple table" >
52+ < TableHead >
53+ < TableRow >
54+ < TableCell align = "center" > Product Name</ TableCell >
55+ < TableCell align = "center" > Product Mrp</ TableCell >
56+ < TableCell align = "center" > Discount</ TableCell >
57+ < TableCell align = "center" > Taxes</ TableCell >
58+ < TableCell align = "center" > Credits</ TableCell >
59+ < TableCell align = "center" > Amount To Pay</ TableCell >
60+ < TableCell align = "center" > Type</ TableCell >
61+ </ TableRow >
62+ </ TableHead >
63+ < TableBody >
64+ < TableRow key = { product . id } >
65+ < TableCell component = "th" scope = "row" align = "center" >
66+ { product . name }
67+ </ TableCell >
68+ < TableCell align = "center" > { product . mrp / 100 } </ TableCell >
69+ < TableCell align = "center" > { calculatedAmountDetails . discount / 100 } </ TableCell >
70+ < TableCell align = "center" > { calculatedAmountDetails . tax / 100 } </ TableCell >
71+ < TableCell align = "center" > { calculatedAmountDetails . creditsApplied / 100 } </ TableCell >
72+ < TableCell align = "center" className = { "red" } > { calculatedAmountDetails . amount / 100 } </ TableCell >
73+ < TableCell align = "center" className = { "red" } > < b > { product . type } </ b > </ TableCell >
74+ </ TableRow >
75+ </ TableBody >
76+ </ Table >
77+ </ TableContainer >
78+
79+
80+ < div className = { "row mt-4" } >
81+ < div className = { "col-md-2 offset-1" } >
82+ < b > Product Buy Link: </ b >
83+ </ div >
84+
85+ < div className = { "col-md-6" } >
86+ < b style = { { color : '#509EE3' } } > { link } </ b >
87+ < CopyToClipboard text = { link } >
88+ < Button onClick = { handleClick } title = "copy to clipboard" >
89+ < FileCopyOutlinedIcon />
90+ </ Button >
91+ </ CopyToClipboard >
92+ </ div >
93+
94+
95+ </ div >
96+
97+ < div className = { "divider-h mt-1" } > </ div >
98+
9999 < Snackbar
100100 anchorOrigin = { {
101101 vertical : 'bottom' ,
@@ -113,10 +113,10 @@ const ProductLinkCard = ({ product, user, useCredits }) => {
113113 </ React . Fragment >
114114 }
115115 />
116- </ CardContent >
116+
117+ </ CardContent >
117118 </ CardActionArea >
118119 </ Card >
119- </ div >
120120 ) ;
121121}
122122
0 commit comments