25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

420 lines
20 KiB

  1. import React from 'react';
  2. import { makeStyles } from '@material-ui/core/styles';
  3. import clsx from 'clsx';
  4. import SnackbarContent from "components/Snackbar/SnackbarContent.js";
  5. import Button1 from "components/CustomButtons/Button.js";
  6. import image1 from "../../../assets/img/mail.png"
  7. import GridContainer from "components/Grid/GridContainer.js";
  8. import classNames from "classnames";
  9. import Icon from "@material-ui/core/Icon";
  10. import Grid from '@material-ui/core/Grid';
  11. import TextField from '@material-ui/core/TextField';
  12. import Button from '@material-ui/core/Button';
  13. import Dialog from '@material-ui/core/Dialog';
  14. import ListItemText from '@material-ui/core/ListItemText';
  15. import ListItem from '@material-ui/core/ListItem';
  16. import List from '@material-ui/core/List';
  17. import Divider from '@material-ui/core/Divider';
  18. import AppBar from '@material-ui/core/AppBar';
  19. import Toolbar from '@material-ui/core/Toolbar';
  20. import IconButton from '@material-ui/core/IconButton';
  21. import Typography from '@material-ui/core/Typography';
  22. import CloseIcon from '@material-ui/icons/Close';
  23. import Slide from '@material-ui/core/Slide';
  24. import Radio from '@material-ui/core/Radio';
  25. import RadioGroup from '@material-ui/core/RadioGroup';
  26. import FormControlLabel from '@material-ui/core/FormControlLabel';
  27. import FormControl from '@material-ui/core/FormControl';
  28. import Select from '@material-ui/core/Select';
  29. import MenuItem from '@material-ui/core/MenuItem';
  30. import Card from "components/Card/Card.js";
  31. import CardBody from "components/Card/CardBody.js";
  32. const useStyles = makeStyles((theme) => ({
  33. root: {
  34. width: '100%',
  35. },
  36. button: {
  37. marginTop: theme.spacing(1),
  38. marginRight: theme.spacing(1),
  39. },
  40. actionsContainer: {
  41. marginBottom: theme.spacing(2),
  42. },
  43. resetContainer: {
  44. padding: theme.spacing(3),
  45. },
  46. appBar: {
  47. position: 'relative',
  48. },
  49. title: {
  50. marginLeft: theme.spacing(2),
  51. flex: 1,
  52. },
  53. root: {
  54. '&:hover': {
  55. backgroundColor: 'transparent',
  56. },
  57. },
  58. icon: {
  59. borderRadius: '50%',
  60. width: 16,
  61. height: 16,
  62. boxShadow: 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)',
  63. backgroundColor: '#f5f8fa',
  64. backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))',
  65. '$root.Mui-focusVisible &': {
  66. outline: '2px auto rgba(19,124,189,.6)',
  67. outlineOffset: 2,
  68. },
  69. 'input:hover ~ &': {
  70. backgroundColor: '#ebf1f5',
  71. },
  72. 'input:disabled ~ &': {
  73. boxShadow: 'none',
  74. background: 'rgba(206,217,224,.5)',
  75. },
  76. },
  77. checkedIcon: {
  78. backgroundColor: '#137cbd',
  79. backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
  80. '&:before': {
  81. display: 'block',
  82. width: 16,
  83. height: 16,
  84. backgroundImage: 'radial-gradient(#fff,#fff 28%,transparent 32%)',
  85. content: '""',
  86. },
  87. 'input:hover ~ &': {
  88. backgroundColor: '#106ba3',
  89. },
  90. },
  91. }));
  92. function StyledRadio(props) {
  93. const classes = useStyles();
  94. return (
  95. <Radio
  96. className={classes.root}
  97. disableRipple
  98. color="default"
  99. checkedIcon={<span className={clsx(classes.icon, classes.checkedIcon)} />}
  100. icon={<span className={classes.icon} />}
  101. {...props}
  102. />
  103. );
  104. }
  105. const Transition = React.forwardRef(function Transition(props, ref) {
  106. return <Slide direction="up" ref={ref} {...props} />;
  107. });
  108. const DataCheckout = function ({ backend, checkoutproduct, ...props }) {
  109. const classes = useStyles();
  110. const [open, setOpen] = React.useState(false);
  111. const handleClickOpen = () => {
  112. setOpen(true);
  113. };
  114. const handleClose = () => {
  115. setOpen(false);
  116. };
  117. const { ...rest } = props;
  118. const imageClasses = classNames(
  119. classes.imgRaised,
  120. classes.imgRoundedCircle,
  121. classes.imgFluid
  122. );
  123. const navImageClasses = classNames(classes.imgRounded, classes.imgGallery);
  124. const CheckoutAlamat = checkoutproduct.map((data) => {
  125. return (
  126. <div align="center">
  127. <Card className={classes.textCenter} align="center">
  128. <CardBody>
  129. <div style={{padding:"10px"}}>
  130. <Typography variant="h6" align="left" className={classes.title}>
  131. Alamat Pengiriman
  132. </Typography><br></br>
  133. <img src={image1} style={{width:"1100px"}}/><br></br>
  134. <h5>Yusmar</h5>
  135. <h5>087797315685</h5>
  136. <h5>Thamrin Indrapura Jl.Aipda Karel Satsuit Tubun,17 Ilir, Kec.Ilir Tim.I, Palembang, KOTA PALEMBANG - ILIR TIMUR II, SUMATERA SELATAN, ID 30114</h5>
  137. <Button1 color="info" href={"/yamaha/profile/profile"}>
  138. <Icon className={classes.icons}>cached</Icon>
  139. Ubah Alamat
  140. </Button1>
  141. </div>
  142. </CardBody>
  143. </Card>
  144. </div>
  145. );
  146. })
  147. const CheckoutProdukPesanan = checkoutproduct.map((data) => {
  148. const handleChange = (event) => {
  149. setAge(event.target.value);
  150. };
  151. const [age, setAge] = React.useState('');
  152. return (
  153. <div align="center">
  154. <Card className={classes.textCenter} align="center">
  155. <CardBody>
  156. <div style={{padding:"10px"}}>
  157. <Typography variant="h6" align="left" className={classes.title}>
  158. Pesanan Produk
  159. </Typography><br></br><hr></hr>
  160. <GridContainer>
  161. <Grid item xs>
  162. <div align="center">
  163. <h4>Produk Dipesan</h4>
  164. <img className={navImageClasses} width="200px" alt="First slide" src={`${backend}${data.img[0]["url"]}`} />
  165. </div>
  166. </Grid>
  167. <Grid item xs>
  168. <div align="center">
  169. <h4></h4><br></br><br></br><br></br><br></br>
  170. <h5>{data.name}</h5>
  171. </div>
  172. </Grid>
  173. <Grid item xs>
  174. <div align="center">
  175. <h4>Warna</h4><br></br><br></br><br></br>
  176. <FormControl className={classes.formControl}>
  177. <Select
  178. labelId="demo-simple-select-label"
  179. id="demo-simple-select"
  180. value={age}
  181. onChange={handleChange}
  182. >
  183. <MenuItem value={10}>Hitam</MenuItem>
  184. <MenuItem value={20}>Merah</MenuItem>
  185. <MenuItem value={30}>Biru</MenuItem>
  186. <MenuItem value={30}>Putih</MenuItem>
  187. </Select>
  188. </FormControl>
  189. </div>
  190. </Grid>
  191. <Grid item xs>
  192. <div align="center">
  193. <h4>Harga Satuan</h4><br></br><br></br><br></br>
  194. <h5>Rp.{data.price}</h5>
  195. </div>
  196. </Grid>
  197. <Grid item xs>
  198. <div align="center">
  199. <h4>Jumlah Unit</h4><br></br><br></br><br></br>
  200. <FormControl className={classes.formControl}>
  201. <TextField
  202. id="outlined-number"
  203. type="number"
  204. align="center"
  205. InputLabelProps={{
  206. shrink: true,
  207. }}
  208. />
  209. </FormControl>
  210. </div>
  211. </Grid>
  212. <Grid item xs>
  213. <div align="center">
  214. <h4>Sub Total Produk</h4><br></br><br></br><br></br>
  215. <h5>Total Rp.{data.price}</h5>
  216. </div>
  217. </Grid>
  218. </GridContainer>
  219. <GridContainer style={{padding:"20px"}}>
  220. <Grid item xs style={{padding:"20px"}}>
  221. <TextField
  222. id="outlined-full-width"
  223. label="Pesan"
  224. style={{ margin: 8 }}
  225. placeholder="( Opsional ) Tinggalkan Pesan Kepada Dealer"
  226. fullWidth
  227. margin="normal"
  228. InputLabelProps={{
  229. shrink: true,
  230. }}
  231. variant="outlined"
  232. />
  233. </Grid>
  234. <Grid item xs style={{padding:"20px"}}><br></br>
  235. <Button variant="outlined" color="primary" onClick={handleClickOpen}>
  236. Pilih Opsi Pengiriman
  237. </Button>
  238. <Dialog fullScreen open={open} onClose={handleClose} TransitionComponent={Transition}>
  239. <AppBar className={classes.appBar}>
  240. <Toolbar>
  241. <IconButton edge="start" color="inherit" onClick={handleClose} aria-label="close">
  242. <CloseIcon />
  243. </IconButton>
  244. <Typography variant="h6" className={classes.title}>
  245. Pilih Opsi Pengiriman
  246. </Typography>
  247. <Button autoFocus color="inherit" onClick={handleClose}>
  248. Pilih
  249. </Button>
  250. </Toolbar>
  251. </AppBar>
  252. <List>
  253. <ListItem button>
  254. <ListItemText primary="Reguler" secondary="Akan diterima pada tanggal 2 Apr - 6 Apr" />
  255. </ListItem>
  256. <Divider />
  257. <ListItem button>
  258. <ListItemText primary="Kargo" secondary="Akan diterima pada tanggal 30 Mar - 2 Apr" />
  259. </ListItem>
  260. <ListItem button>
  261. <ListItemText primary="Hemat" secondary="Akan diterima pada tanggal 1 Apr - 4 Apr, COD (Bayar di Tempat) tidak didukung" />
  262. </ListItem>
  263. </List>
  264. </Dialog>
  265. </Grid>
  266. <Grid item xs align="right" style={{padding:"20px"}}><br></br>
  267. Total Rp. {data.price}
  268. </Grid>
  269. </GridContainer>
  270. </div>
  271. </CardBody>
  272. </Card>
  273. </div>
  274. );
  275. })
  276. const CheckoutMetodePembayaran = checkoutproduct.map((data) => {
  277. return (
  278. <div>
  279. <div align="center">
  280. <Card className={classes.textCenter} align="center">
  281. <CardBody>
  282. <div style={{padding:"10px"}}>
  283. <Typography variant="h6" align="left" className={classes.title}>
  284. Pilih Metode Pembayaran
  285. </Typography><br></br><hr></hr>
  286. <FormControl component="fieldset">
  287. <RadioGroup defaultValue="female" aria-label="gender">
  288. <GridContainer justify="center" style={{marginTop:"-50px"}}>
  289. <Grid style={{padding:"25px"}}>
  290. <Card style={{width: "200px"}}>
  291. <div align="center">
  292. <FormControlLabel value="1" style={{marginLeft:"20px"}} control={<StyledRadio />} /><br></br>
  293. <img src="https://1.bp.blogspot.com/-ghcXZfSaQBI/X6I02Zg-NfI/AAAAAAAAHaY/OxF9Klx83zQGKNETJ9qEnZCCmjsJ1DifQCLcBGAsYHQ/s1000/logo%2Bbank%2Bbca-01.png" width="100px"/>
  294. <h4>Bank BCA</h4>
  295. </div>
  296. </Card>
  297. </Grid>
  298. <Grid style={{padding:"25px"}}>
  299. <Card style={{width: "200px"}}>
  300. <div align="center">
  301. <FormControlLabel value="2" style={{marginLeft:"20px"}} control={<StyledRadio />} /><br></br>
  302. <img src="https://cdn.ayobandung.com/images-bandung/post/articles/2020/02/03/78361/logo-bri-bank-rakyat-indonesia-png-terbaru.png" width="120px"/>
  303. <h4>Bank BRI</h4>
  304. </div>
  305. </Card>
  306. </Grid>
  307. <Grid style={{padding:"25px"}}>
  308. <Card style={{width: "200px"}}>
  309. <div align="center">
  310. <FormControlLabel value="3" style={{marginLeft:"20px"}} control={<StyledRadio />} /><br></br>
  311. <img src="https://cdn3.iconfinder.com/data/icons/banks-in-indonesia-logo-badge/100/Mandiri-512.png" width="140px"/>
  312. <h4>Bank Mandiri</h4>
  313. </div>
  314. </Card>
  315. </Grid>
  316. <Grid style={{padding:"25px"}}>
  317. <Card style={{width: "200px"}}>
  318. <div align="center">
  319. <FormControlLabel value="4" style={{marginLeft:"20px"}} control={<StyledRadio />} /><br></br>
  320. <img src="https://cdn3.iconfinder.com/data/icons/banks-in-indonesia-logo-badge/100/BNI-512.png" width="140px"/>
  321. <h4>Bank BNI</h4>
  322. </div>
  323. </Card>
  324. </Grid>
  325. </GridContainer>
  326. <GridContainer justify="center" style={{marginTop:"-50px"}}>
  327. <Grid style={{padding:"25px"}}>
  328. <Card style={{width: "200px"}}>
  329. <div align="center">
  330. <FormControlLabel value="5" style={{marginLeft:"20px"}} control={<StyledRadio />} /><br></br>
  331. <img src="https://statik.tempo.co/?id=997833&width=650" width="140px"/>
  332. <h4>Bank BSI</h4>
  333. </div>
  334. </Card>
  335. </Grid>
  336. <Grid style={{padding:"25px"}}>
  337. <Card style={{width: "200px"}}>
  338. <div align="center">
  339. <FormControlLabel value="6" style={{marginLeft:"20px"}} control={<StyledRadio />} /><br></br>
  340. <img src="https://internationalinvestorclub.com/wp-content/uploads/2020/10/BNLI-Bank-Permata.jpg" width="150px"/>
  341. <h4>Bank Permata</h4>
  342. </div>
  343. </Card>
  344. </Grid>
  345. <Grid style={{padding:"25px"}}>
  346. <Card style={{width: "200px"}}>
  347. <div align="center">
  348. <FormControlLabel value="7" style={{marginLeft:"20px"}} control={<StyledRadio />} /><br></br>
  349. <img src="https://cdn.ayobandung.com/images-bandung/post/articles/2018/11/10/40370/images.png" width="135px"/>
  350. <h4>Bank Danamon</h4>
  351. </div>
  352. </Card>
  353. </Grid>
  354. <Grid style={{padding:"25px"}}>
  355. <Card style={{width: "200px"}}>
  356. <div align="center">
  357. <FormControlLabel value="8" style={{marginLeft:"20px"}} control={<StyledRadio />} /><br></br>
  358. <img src="https://seekvectorlogo.com/wp-content/uploads/2020/04/maybank-vector-logo.png" width="145px"/>
  359. <h4>Bank Maybank</h4>
  360. </div>
  361. </Card>
  362. </Grid>
  363. </GridContainer>
  364. </RadioGroup>
  365. </FormControl>
  366. </div>
  367. </CardBody>
  368. </Card>
  369. </div>
  370. </div>
  371. );
  372. })
  373. return (
  374. <div style={{padding:"50px"}}>
  375. <div align="center" className={classes.section} id="notifications">
  376. <SnackbarContent
  377. message={
  378. <h2><b>Checkout</b></h2>
  379. }
  380. align="center"
  381. color="danger"
  382. />
  383. </div>
  384. <div>
  385. {CheckoutAlamat}
  386. </div>
  387. <div>
  388. {CheckoutProdukPesanan}
  389. </div>
  390. <div>
  391. {CheckoutMetodePembayaran}
  392. </div>
  393. <div>
  394. <Card className={classes.textCenter} align="center">
  395. <CardBody>
  396. <div style={{padding:"10px"}}>
  397. <Button1 color="info" href={"/yamaha/profile/profile"} style={{width:"100%"}}>
  398. <Icon className={classes.icons}>shop</Icon>
  399. Buat Pesanan
  400. </Button1>
  401. </div>
  402. </CardBody>
  403. </Card>
  404. </div>
  405. </div>
  406. );
  407. }
  408. export default DataCheckout;