You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

474 regels
22 KiB

  1. import React from "react";
  2. import classNames from "classnames";
  3. import { withStyles, makeStyles } from "@material-ui/core/styles";
  4. import Dashboard from "@material-ui/icons/Dashboard";
  5. import GridContainer from "components/Grid/GridContainer.js";
  6. import Grid from '@material-ui/core/Grid';
  7. import GridItem from "components/Grid/GridItem.js";
  8. import NavPills from "components/NavPills/NavPills.js";
  9. import Card from "components/Card/Card.js";
  10. import CardBody from "components/Card/CardBody.js";
  11. import CardHeader from "components/Card/CardHeader.js";
  12. import Button from "components/CustomButtons/Button.js";
  13. import Icon from "@material-ui/core/Icon";
  14. import styles from "assets/jss/nextjs-material-kit/pages/profilePage.js";
  15. import Image from "assets/img/sosmed/yt.jpg";
  16. import NumberFormat from 'react-number-format';
  17. import Table from '@material-ui/core/Table';
  18. import TableBody from '@material-ui/core/TableBody';
  19. import TableCell from '@material-ui/core/TableCell';
  20. import TableContainer from '@material-ui/core/TableContainer';
  21. import TableHead from '@material-ui/core/TableHead';
  22. import TableRow from '@material-ui/core/TableRow';
  23. import Logo from "assets/img/Black.png";
  24. const useStyles = makeStyles(styles);
  25. const DataCheckout = function ({ midtransClient, transactionToken, backend, order, unpaid, prepared, sending, finished, ...props }) {
  26. const classes = useStyles();
  27. const StyledTableCell = withStyles((theme) => ({
  28. head: {
  29. backgroundColor: theme.palette.common.black,
  30. color: theme.palette.common.white,
  31. },
  32. body: {
  33. fontSize: 14,
  34. },
  35. }))(TableCell);
  36. const StyledTableRow = withStyles((theme) => ({
  37. root: {
  38. '&:nth-of-type(odd)': {
  39. backgroundColor: theme.palette.action.hover,
  40. },
  41. },
  42. }))(TableRow);
  43. const navImageClasses = classNames(classes.imgRounded, classes.imgGallery);
  44. const SemuaOrder = order.map((data) => {
  45. return (
  46. <div className={classes.root}>
  47. <Card className={classes.textCenter} align="center">
  48. <TableContainer>
  49. <Table className={classes.table} aria-label="customized table">
  50. <TableHead>
  51. <TableRow>
  52. <StyledTableCell align="left">Produk Dipesan</StyledTableCell>
  53. <StyledTableCell align="center">Rincian Produk</StyledTableCell>
  54. <StyledTableCell align="center">Rincian Pemesan</StyledTableCell>
  55. <StyledTableCell align="center"></StyledTableCell>
  56. <StyledTableCell align="center">Subtotal Harga</StyledTableCell>
  57. </TableRow>
  58. </TableHead>
  59. <TableBody>
  60. <StyledTableRow>
  61. <StyledTableCell align="left">
  62. {/* <img className={navImageClasses} width="200px" alt="First slide" src={`${backend}${data.img[0]["url"]}`} /> */}
  63. <img src={Image} width="200px" />
  64. </StyledTableCell>
  65. <StyledTableCell align="center">
  66. <p><b>Nama Produk : {data.product_name}</b><br /></p>
  67. <p><b>Warna : {data.product_color}</b><br /></p>
  68. <p><b>Jumlah : {data.product_quantity} Unit</b></p>
  69. </StyledTableCell>
  70. <StyledTableCell align="center">
  71. <p><b>Nama Pemesan : {data.cust_name}</b><br /></p>
  72. <p><b>Telpon : {data.cust_telp}</b><br /></p>
  73. <p><b>Alamat : {data.cust_address}</b></p>
  74. </StyledTableCell>
  75. <StyledTableCell align="center"></StyledTableCell>
  76. <StyledTableCell align="center">
  77. <h5>
  78. <b><NumberFormat value={data.product_price} displayType={'text'} thousandSeparator={true} prefix={'Rp.'} /></b>
  79. </h5>
  80. </StyledTableCell>
  81. </StyledTableRow>
  82. <StyledTableRow>
  83. <StyledTableCell align="center"></StyledTableCell>
  84. <StyledTableCell align="center"></StyledTableCell>
  85. <StyledTableCell align="right">
  86. <Button color="danger" href={"/yamaha/product/product_detail?s="}>
  87. <Icon className={classes.icons}>shopping_cart</Icon>Beli Lagi Produk
  88. </Button>
  89. </StyledTableCell>
  90. <StyledTableCell align="center"></StyledTableCell>
  91. <StyledTableCell align="center">
  92. <Button
  93. color="info"
  94. href={"/yamaha/product/product_detail?s="}
  95. >
  96. <Icon className={classes.icons}>open_in_new</Icon>Beri Nilai Produk
  97. </Button>
  98. </StyledTableCell>
  99. </StyledTableRow>
  100. </TableBody>
  101. </Table>
  102. </TableContainer>
  103. </Card>
  104. </div>
  105. );
  106. })
  107. const BelumBayar = unpaid.map((data) => {
  108. return (
  109. <div className={classes.root}>
  110. <Card className={classes.textCenter} align="center">
  111. <TableContainer>
  112. <Table className={classes.table} aria-label="customized table">
  113. <TableHead>
  114. <TableRow>
  115. <StyledTableCell align="left">Produk Dipesan</StyledTableCell>
  116. <StyledTableCell align="center">Rincian Produk</StyledTableCell>
  117. <StyledTableCell align="center">Rincian Pemesan</StyledTableCell>
  118. <StyledTableCell align="center"></StyledTableCell>
  119. <StyledTableCell align="center">Subtotal Harga</StyledTableCell>
  120. </TableRow>
  121. </TableHead>
  122. <TableBody>
  123. <StyledTableRow>
  124. <StyledTableCell align="left">
  125. {/* <img className={navImageClasses} width="200px" alt="First slide" src={`${backend}${data.img[0]["url"]}`} /> */}
  126. <img src={Image} width="200px" />
  127. </StyledTableCell>
  128. <StyledTableCell align="center">
  129. <p><b>Nama Produk : {data.product_name}</b><br /></p>
  130. <p><b>Warna : {data.product_color}</b><br /></p>
  131. <p><b>Jumlah : {data.product_quantity} Unit</b></p>
  132. </StyledTableCell>
  133. <StyledTableCell align="center">
  134. <p><b>Nama Pemesan : {data.cust_name}</b><br /></p>
  135. <p><b>Telpon : {data.cust_telp}</b><br /></p>
  136. <p><b>Alamat : {data.cust_address}</b></p>
  137. </StyledTableCell>
  138. <StyledTableCell align="center"></StyledTableCell>
  139. <StyledTableCell align="center">
  140. <h5>
  141. <b><NumberFormat value={data.product_price} displayType={'text'} thousandSeparator={true} prefix={'Rp.'} /></b>
  142. </h5>
  143. </StyledTableCell>
  144. </StyledTableRow>
  145. <StyledTableRow>
  146. <StyledTableCell align="center"></StyledTableCell>
  147. <StyledTableCell align="center"></StyledTableCell>
  148. <StyledTableCell align="right">
  149. <Button color="info" onClick={(e) => { snap.pay(transactionToken); }} style={{ width: "100%" }}>
  150. <Icon className={classes.icons}>attach_money</Icon>Bayar Pesanan
  151. </Button>
  152. </StyledTableCell>
  153. <StyledTableCell align="center"></StyledTableCell>
  154. <StyledTableCell align="center">
  155. <Button
  156. color="danger"
  157. href={"/yamaha/product/product_detail?s="}
  158. >
  159. <Icon className={classes.icons}>open_in_new</Icon>Batalkan Pesanan
  160. </Button>
  161. </StyledTableCell>
  162. </StyledTableRow>
  163. </TableBody>
  164. </Table>
  165. </TableContainer>
  166. </Card>
  167. </div>
  168. );
  169. })
  170. const Dikemas = prepared.map((data) => {
  171. return (
  172. <div className={classes.root}>
  173. <Card style={{ padding: "10px" }}>
  174. <Grid container spacing={3}>
  175. <Grid item xs={6}>
  176. <h4>Dealer A.Rivai | Thamrin Brothers - Yamaha</h4>
  177. </Grid>
  178. <Grid item xs={6}>
  179. <div align="right">
  180. <h4>Paket Telah Diterima | Selesai</h4>
  181. </div>
  182. </Grid>
  183. </Grid>
  184. <hr />
  185. <Grid container spacing={3}>
  186. <Grid item xs={4}><br />
  187. <img src={Image} width="80%" />
  188. </Grid>
  189. <Grid item xs={4}>
  190. <h3>All New NMAX 155 Connected / ABS Version</h3>
  191. <h5>Variasi = Hitam</h5>
  192. <h5>Jumlah = 1 Unit</h5>
  193. </Grid>
  194. <Grid item xs={4}>
  195. <div align="left">
  196. <h3>Rp.32.000.000,-</h3><br /><br /><br /><br />
  197. <h3>Total Pesanan = Rp.32.000.000,-</h3>
  198. </div>
  199. </Grid>
  200. </Grid>
  201. <hr /><br />
  202. <Grid container>
  203. <Grid item xs={4}>
  204. <h5>Nilai produk sebelum 30-10-2021</h5>
  205. <h5>Nilai sekarang & dapatkan 100 Koin Loyalty!</h5>
  206. </Grid>
  207. <Grid item xs={2}>
  208. </Grid>
  209. <Grid item xs={2}>
  210. </Grid>
  211. <Grid item xs={2}>
  212. <div align="right">
  213. <Button
  214. color="danger"
  215. href={"/yamaha/product/product_detail?s="}
  216. >
  217. <Icon className={classes.icons}>shopping_cart</Icon>Beli Lagi Produk
  218. </Button>
  219. </div>
  220. </Grid>
  221. <Grid item xs={2}>
  222. <div align="right">
  223. <Button
  224. color="info"
  225. href={"/yamaha/product/product_detail?s="}
  226. >
  227. <Icon className={classes.icons}>open_in_new</Icon>Beri Nilai Produk
  228. </Button>
  229. </div>
  230. </Grid>
  231. </Grid>
  232. </Card>
  233. </div>
  234. );
  235. })
  236. const Dikirim = sending.map((data) => {
  237. return (
  238. <div className={classes.root}>
  239. <Card style={{ padding: "10px" }}>
  240. <Grid container spacing={3}>
  241. <Grid item xs={6}>
  242. <h4>Dealer A.Rivai | Thamrin Brothers - Yamaha</h4>
  243. </Grid>
  244. <Grid item xs={6}>
  245. <div align="right">
  246. <h4>Paket Telah Diterima | Selesai</h4>
  247. </div>
  248. </Grid>
  249. </Grid>
  250. <hr />
  251. <Grid container spacing={3}>
  252. <Grid item xs={4}><br />
  253. <img src={Image} width="80%" />
  254. </Grid>
  255. <Grid item xs={4}>
  256. <h3>All New NMAX 155 Connected / ABS Version</h3>
  257. <h5>Variasi = Hitam</h5>
  258. <h5>Jumlah = 1 Unit</h5>
  259. </Grid>
  260. <Grid item xs={4}>
  261. <div align="left">
  262. <h3>Rp.32.000.000,-</h3><br /><br /><br /><br />
  263. <h3>Total Pesanan = Rp.32.000.000,-</h3>
  264. </div>
  265. </Grid>
  266. </Grid>
  267. <hr /><br />
  268. <Grid container>
  269. <Grid item xs={4}>
  270. <h5>Nilai produk sebelum 30-10-2021</h5>
  271. <h5>Nilai sekarang & dapatkan 100 Koin Loyalty!</h5>
  272. </Grid>
  273. <Grid item xs={2}>
  274. </Grid>
  275. <Grid item xs={2}>
  276. </Grid>
  277. <Grid item xs={2}>
  278. <div align="right">
  279. <Button
  280. color="danger"
  281. href={"/yamaha/product/product_detail?s="}
  282. >
  283. <Icon className={classes.icons}>shopping_cart</Icon>Beli Lagi Produk
  284. </Button>
  285. </div>
  286. </Grid>
  287. <Grid item xs={2}>
  288. <div align="right">
  289. <Button
  290. color="info"
  291. href={"/yamaha/product/product_detail?s="}
  292. >
  293. <Icon className={classes.icons}>open_in_new</Icon>Beri Nilai Produk
  294. </Button>
  295. </div>
  296. </Grid>
  297. </Grid>
  298. </Card>
  299. </div>
  300. );
  301. })
  302. const Selesai = finished.map((data) => {
  303. return (
  304. <div className={classes.root}>
  305. <Card style={{ padding: "10px" }}>
  306. <Grid container spacing={3}>
  307. <Grid item xs={6}>
  308. <h4>Dealer A.Rivai | Thamrin Brothers - Yamaha</h4>
  309. </Grid>
  310. <Grid item xs={6}>
  311. <div align="right">
  312. <h4>Paket Telah Diterima | Selesai</h4>
  313. </div>
  314. </Grid>
  315. </Grid>
  316. <hr />
  317. <Grid container spacing={3}>
  318. <Grid item xs={4}><br />
  319. <img src={Image} width="80%" />
  320. </Grid>
  321. <Grid item xs={4}>
  322. <h3>All New NMAX 155 Connected / ABS Version</h3>
  323. <h5>Variasi = Hitam</h5>
  324. <h5>Jumlah = 1 Unit</h5>
  325. </Grid>
  326. <Grid item xs={4}>
  327. <div align="left">
  328. <h3>Rp.32.000.000,-</h3><br /><br /><br /><br />
  329. <h3>Total Pesanan = Rp.32.000.000,-</h3>
  330. </div>
  331. </Grid>
  332. </Grid>
  333. <hr /><br />
  334. <Grid container>
  335. <Grid item xs={4}>
  336. <h5>Nilai produk sebelum 30-10-2021</h5>
  337. <h5>Nilai sekarang & dapatkan 100 Koin Loyalty!</h5>
  338. </Grid>
  339. <Grid item xs={2}>
  340. </Grid>
  341. <Grid item xs={2}>
  342. </Grid>
  343. <Grid item xs={2}>
  344. <div align="right">
  345. <Button
  346. color="danger"
  347. href={"/yamaha/product/product_detail?s="}
  348. >
  349. <Icon className={classes.icons}>shopping_cart</Icon>Beli Lagi Produk
  350. </Button>
  351. </div>
  352. </Grid>
  353. <Grid item xs={2}>
  354. <div align="right">
  355. <Button
  356. color="info"
  357. href={"/yamaha/product/product_detail?s="}
  358. >
  359. <Icon className={classes.icons}>open_in_new</Icon>Beri Nilai Produk
  360. </Button>
  361. </div>
  362. </Grid>
  363. </Grid>
  364. </Card>
  365. </div>
  366. );
  367. })
  368. return (
  369. <Card className={classes.textCenter}>
  370. <script type="text/javascript" src="https://app.sandbox.midtrans.com/snap/snap.js" data-client-key="SB-Mid-client-srx674LjNbEybd4-" />
  371. <div align="center">
  372. <CardHeader color="info">Pesanan Saya</CardHeader>
  373. </div>
  374. <CardBody>
  375. <div align="center">
  376. <h2>Pesayanan Saya</h2>
  377. </div>
  378. <GridContainer justify="center">
  379. <GridItem>
  380. <NavPills
  381. alignCenter
  382. color="primary"
  383. tabs={[
  384. {
  385. tabButton: "Semua",
  386. tabIcon: Dashboard,
  387. tabContent: (
  388. <div>
  389. <h2>Semua Pesanan</h2><hr />
  390. <div style={{ padding: "20px" }}>
  391. {SemuaOrder}
  392. </div>
  393. </div>
  394. ),
  395. },
  396. {
  397. tabButton: "Belum Bayar",
  398. tabIcon: Dashboard,
  399. tabContent: (
  400. <div>
  401. <h2>Belum Bayar</h2><hr />
  402. <div >
  403. {BelumBayar}
  404. </div>
  405. </div>
  406. ),
  407. },
  408. {
  409. tabButton: "Dikemas",
  410. tabIcon: Dashboard,
  411. tabContent: (
  412. <div>
  413. <h2>Dikemas</h2><hr />
  414. <div >
  415. {Dikemas}
  416. </div>
  417. </div>
  418. ),
  419. },
  420. {
  421. tabButton: "Dikirim",
  422. tabIcon: Dashboard,
  423. tabContent: (
  424. <div>
  425. <h2>Dikirim</h2><hr />
  426. <div >
  427. {Dikirim}
  428. </div>
  429. </div>
  430. ),
  431. },
  432. {
  433. tabButton: "Selesai",
  434. tabIcon: Dashboard,
  435. tabContent: (
  436. <div>
  437. <h2>Selesai</h2><hr />
  438. <div >
  439. {Selesai}
  440. </div>
  441. </div>
  442. ),
  443. },
  444. ]}
  445. />
  446. </GridItem>
  447. </GridContainer>
  448. </CardBody>
  449. </Card>
  450. );
  451. }
  452. export default DataCheckout;