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.
 
 

186 line
9.0 KiB

  1. import React, { useState } from 'react';
  2. import * as Icon from 'react-feather';
  3. import NumberFormat from 'react-number-format';
  4. const Checkout = function ({ transactionToken, backend, review, ...props }) {
  5. const ReviewContens = review.map((data) => {
  6. const Checkin = data.checkIn;
  7. const [Checkinyear, Checkinmonth, Checkinday] = Checkin.split('-')
  8. const Checkout = data.checkOut;
  9. const [Checkoutnyear, Checkoutnmonth, Checkoutnday] = Checkout.split('-')
  10. const date = (new Date(data.checkIn)).getTime();
  11. const today = (new Date(data.checkOut)).getTime();
  12. const msDay = 24 * 60 * 60 * 1000; // milliseconds per day
  13. const days = Math.floor((today - date) / msDay);
  14. return (
  15. <div className="row">
  16. <div className="col-lg-12 col-md-6">
  17. <div className="billing-details">
  18. <div className="row">
  19. <div className="col-lg-4 col-md-6">
  20. <img style={{ borderRadius: "10px" }} src="https://origin.pegipegi.com/jalan/images/pictM/Y4/Y972594/Y972594002.jpg" width="100%" />
  21. </div>
  22. <div className="col-lg-6 col-md-6">
  23. <h2 className="title">{data.namaKamar}</h2>
  24. <div className="row">
  25. <div className="col-lg-3 col-md-6">
  26. <p>Fasilitas : </p>
  27. </div>
  28. </div>
  29. <div className="row">
  30. <div className="col-lg-3 col-md-6">
  31. <p><Icon.Wifi /> Free Wifi</p>
  32. </div>
  33. <div className="col-lg-3 col-md-6">
  34. <p><Icon.Phone /> Telepon</p>
  35. </div>
  36. </div><br /><br />
  37. <div className="row">
  38. <div className="col-lg-3 col-md-6">
  39. <h6>Check In </h6>
  40. <h6><p>{`${Checkinday}/${Checkinmonth}/${Checkinyear}`}</p></h6>
  41. <h6><p>Setelah 14:00</p></h6>
  42. </div>
  43. <div className="col-lg-3 col-md-6">
  44. <h6>Check Out </h6>
  45. <h6><p>{`${Checkoutnday}/${Checkoutnmonth}/${Checkoutnyear}`}</p></h6>
  46. <h6><p>Sebelum 14:00</p></h6>
  47. </div>
  48. <div className="col-lg-3 col-md-6">
  49. <h6>Durasi Hari </h6>
  50. <h6><p>{days} Hari</p></h6>
  51. </div>
  52. <div className="col-lg-2 col-md-6">
  53. <h6>Pengunjung </h6>
  54. <h6><p>1 Orang</p></h6>
  55. </div>
  56. </div>
  57. </div>
  58. </div><br />
  59. </div>
  60. </div>
  61. <div className="col-lg-12 col-md-6" style={{ marginTop: "50px" }}>
  62. <div className="billing-details">
  63. <h3 className="title">Informasi Pemesan</h3>
  64. <div className="row">
  65. <div className="col-lg-7 col-md-4">
  66. <div className="row">
  67. <div className="col-lg-12 col-md-4">
  68. <h6>Nama Pemesan : {data.namaPemesan}</h6>
  69. </div>
  70. <div className="col-lg-12 col-md-4">
  71. <h6>Nomer HP Pemesan : {data.teleponPemesan} </h6>
  72. </div>
  73. <div className="col-lg-12 col-md-4">
  74. <h6>Alamat Email Pemesan : {data.emailPemesan}</h6>
  75. </div>
  76. </div>
  77. </div>
  78. <div className="col-lg-5 col-md-4">
  79. <div className="row">
  80. <div className="col-lg-12 col-md-4">
  81. <h6>Pesan Khusus : {data.requestKamar}</h6>
  82. </div>
  83. <div className="col-lg-12 col-md-4">
  84. <h6>Jumlah Pengunjung : {data.jumlahPengunjung} Orang</h6>
  85. </div>
  86. <div className="col-lg-12 col-md-4">
  87. <h6>Catatan : {data.catatan} Orang</h6>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <div className="col-lg-12 col-md-6" style={{ marginTop: "50px" }}>
  95. <div className="order-details">
  96. <h3 className="title">Total Pesanan</h3>
  97. <div className="order-table table-responsive">
  98. <table className="table table-bordered">
  99. <thead>
  100. <tr>
  101. <th scope="col">Jenis Kamar</th>
  102. <th scope="col">Total</th>
  103. </tr>
  104. </thead>
  105. <tbody>
  106. <tr>
  107. <td className="product-name">
  108. <span href="#">Catania {data.namaKamar}</span>
  109. </td>
  110. <td className="product-total">
  111. <span className="subtotal-amount"><NumberFormat value={data.hargaKamar * days} displayType={'text'} thousandSeparator={true} prefix={'Rp.'} /></span>
  112. </td>
  113. </tr>
  114. <tr>
  115. <td className="product-name">
  116. <span href="#">Pajak 10%</span>
  117. </td>
  118. <td className="product-total">
  119. <span type="disable" className="subtotal-amount"><NumberFormat value={data.hargaKamar * days * 0.1} displayType={'text'} thousandSeparator={true} prefix={'Rp.'} /></span>
  120. </td>
  121. </tr>
  122. <tr>
  123. <td className="product-name">
  124. <span href="#">Total</span>
  125. </td>
  126. <td className="product-total">
  127. <span type="disable" className="subtotal-amount"><NumberFormat value={data.hargaKamar * days + data.hargaKamar * days * 0.1} displayType={'text'} thousandSeparator={true} prefix={'Rp.'} /></span>
  128. </td>
  129. </tr>
  130. </tbody>
  131. </table>
  132. </div>
  133. <button
  134. onClick={(e) => { snap.pay(transactionToken); }}
  135. className="btn btn-primary order-btn"
  136. >
  137. Bayar Pesanan
  138. </button>
  139. </div>
  140. </div>
  141. </div>
  142. );
  143. })
  144. return (
  145. <>
  146. <script type="text/javascript"
  147. src="https://app.sandbox.midtrans.com/snap/snap.js"
  148. data-client-key="SB-Mid-client-srx674LjNbEybd4-">
  149. </script>
  150. <div className="checkout-area ptb-80">
  151. <div className="container">
  152. <div className="row">
  153. <div className="col-lg-12 col-md-12">
  154. <div className="user-actions">
  155. <h4><Icon.Edit width="50px" /> Mohon Periksa Ulang Pesanan Anda</h4><br />
  156. </div>
  157. </div>
  158. </div>
  159. {ReviewContens}
  160. </div>
  161. </div>
  162. </>
  163. )
  164. }
  165. export default Checkout;