Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

425 рядки
20 KiB

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