diff --git a/components/Yamaha/Shop/Checkout.js b/components/Yamaha/Shop/Checkout.js index d71eb82..172934e 100644 --- a/components/Yamaha/Shop/Checkout.js +++ b/components/Yamaha/Shop/Checkout.js @@ -1,10 +1,20 @@ import React from 'react'; import * as Icon from 'react-feather'; +import { + Accordion, + AccordionItem, + AccordionItemHeading, + AccordionItemPanel, + AccordionItemButton +} from 'react-accessible-accordion'; + //library yarn import NumberFormat from 'react-number-format'; -const CheckoutContent = function ({ backend, checkout_product, ...props }) { +const CheckoutContent = function ({ backend, checkout_product, user, ...props }) { + + console.log(user); // const Checkout = checkout_product.map((data) => { // return ( @@ -29,90 +39,92 @@ const CheckoutContent = function ({ backend, checkout_product, ...props }) {
-

Billing Details

+

Alamat Pengiriman

-
+
- - -
- -
+ +
- +
- - + +
-
+
- - + + +
+ +
-
+
- - + +
-
+
- +
- +
- +
+
- - + + +
+ +
- +
-
+ {/*
@@ -124,7 +136,7 @@ const CheckoutContent = function ({ backend, checkout_product, ...props }) {
-
+
*/}
@@ -135,24 +147,103 @@ const CheckoutContent = function ({ backend, checkout_product, ...props }) {
-
+
+
+

Metode Pengiriman

+ +
+
+
+
+ + + + + JNE
+

+ Akan diterima pada tanggal 13 - 16 Nov
+

+
+
+ +

Pilih Waktu Pengiriman

+ + Pengiriman Setiap Saat
+ Disarankan untuk alamat rumah

+ + Pengiriman Pada Jam Kantor
+ Disarankan untuk alamat rumah

+
+
+ + + + + Kargo - JNE Trucking (JTR)
+

+ Akan diterima pada tanggal 14 - 17 Nov
+

+
+
+ +

Pilih Waktu Pengiriman

+ + Pengiriman Setiap Saat
+ Disarankan untuk alamat rumah

+ + Pengiriman Pada Jam Kantor
+ Disarankan untuk alamat rumah

+
+
+ + + + + Next Day
+

+ Akan diterima pada tanggal 13 - 14 Nov

+
+
+ +

Pilih Waktu Pengiriman

+ + Pengiriman Setiap Saat
+ Disarankan untuk alamat rumah

+ + Pengiriman Pada Jam Kantor
+ Disarankan untuk alamat rumah

+
+
+
+
+
+
+
+
+ +
-

Your Order

+

Pesanan Anda

- + - + + - + {checkout_product.length ? checkout_product.map(data => ( + + - - + + + + @@ -189,6 +284,10 @@ const CheckoutContent = function ({ backend, checkout_product, ...props }) { + + @@ -197,6 +296,10 @@ const CheckoutContent = function ({ backend, checkout_product, ...props }) { Order Total + + diff --git a/components/_App/NavbarYamaha.js b/components/_App/NavbarYamaha.js index a0dac49..d993026 100644 --- a/components/_App/NavbarYamaha.js +++ b/components/_App/NavbarYamaha.js @@ -146,12 +146,18 @@ export default function NavbarYamaha({ username, ...props }) {
  • - + Profile
  • + + Checkout + +
  • + +
  • Pesanan Saya diff --git a/package.json b/package.json index 0a614ac..322cec4 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "react-toast-notifications": "^2.4.3", "redux": "^3.6.0", "redux-devtools-extension": "^2.13.2", + "request-promise": "^4.2.6", "sass": "^1.32.7", "sweetalert": "^2.1.2", "sweetalert2": "^10.15.5", diff --git a/pages/yamaha/Shop/Checkout.js b/pages/yamaha/Shop/Checkout.js index ea91b5e..75b3260 100644 --- a/pages/yamaha/Shop/Checkout.js +++ b/pages/yamaha/Shop/Checkout.js @@ -1,23 +1,23 @@ import React from 'react'; import Navbar from "@/components/_App/NavbarYamaha"; import Footer from "@/components/_App/FooterYamaha"; -import PageBanner from '@/components/Common/PageBanner'; +import PageBanner from '@/components/Common/PageBanner'; import CheckoutContent from '@/components/Yamaha/Shop/Checkout'; import * as Icon from 'react-feather'; import CheckoutProduct from "api/shop/checkout"; - + import Cookies from "cookies"; -const Checkout = function ({ backend, checkout_product, user, ...props }) { +const Checkout = function ({ backend, checkout_product, user, ...props }) { return ( <> - - + +
    ) @@ -45,11 +45,25 @@ export async function getServerSideProps(context) { } var res = await CheckoutProduct.GetCheckoutproduct(); - if (res["STATUS"] === 1) { - checkout_product = res["DATA"]["checkouts"]; - } + if (res["STATUS"] === 1) { + checkout_product = res["DATA"]["checkouts"]; + } + + var provinces = []; + const request = require('request'); + let options = { + method: 'GET', + url: 'https://api.rajaongkir.com/starter/province', + headers: { key: 'f4ac703bb25ada32478d52ef2e1cab7a' } + }; + + // var res = request(options, function (error, response, body) { + // provinces = body; + // console.log(body); + // }); + + console.log("tes :", provinces); - console.log(checkout_product); return { props: { checkout_product, backend, user }, // will be passed to the page component as props }; diff --git a/pages/yamaha/index.js b/pages/yamaha/index.js index f1680fc..1d217bd 100644 --- a/pages/yamaha/index.js +++ b/pages/yamaha/index.js @@ -10,6 +10,7 @@ import Testimoni from '@/components/Yamaha/Home/Testimoni'; import Footer from "@/components/_App/FooterYamaha"; import Getdealer from "api/dealer/dealer.js"; +import GetUser from "api/profile/profile"; import Cookies from "cookies"; @@ -57,6 +58,7 @@ export async function getServerSideProps(context) { if (res["STATUS"] === 1) { dealers = res["DATA"]["dealers"]; } + console.log(userObj); return { props: { dealers, backend, user }, // will be passed to the page component as props diff --git a/yarn.lock b/yarn.lock index 8a29a6f..9e30251 100644 --- a/yarn.lock +++ b/yarn.lock @@ -581,6 +581,11 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== +bluebird@^3.5.0: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== + bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" @@ -2198,7 +2203,7 @@ lodash.throttle@^4.1.1: resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" integrity sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y= -lodash@^4.1.0, lodash@^4.15.0, lodash@^4.17.13, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.2.1: +lodash@^4.1.0, lodash@^4.15.0, lodash@^4.17.13, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.2.1: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -3009,6 +3014,23 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" +request-promise-core@1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f" + integrity sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw== + dependencies: + lodash "^4.17.19" + +request-promise@^4.2.6: + version "4.2.6" + resolved "https://registry.yarnpkg.com/request-promise/-/request-promise-4.2.6.tgz#7e7e5b9578630e6f598e3813c0f8eb342a27f0a2" + integrity sha512-HCHI3DJJUakkOr8fNoCc73E5nU5bqITjOYFMDrKHYOXWXrgD/SBaC7LjwuPymUprRyuF06UK7hd/lMHkmUXglQ== + dependencies: + bluebird "^3.5.0" + request-promise-core "1.1.4" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" + request@^2.55.0, request@^2.60.0: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" @@ -3202,6 +3224,11 @@ stacktrace-parser@0.1.10: resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= +stealthy-require@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= + stream-browserify@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f" @@ -3427,7 +3454,7 @@ toidentifier@1.0.0: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== -tough-cookie@^2.2.0, tough-cookie@~2.5.0: +tough-cookie@^2.2.0, tough-cookie@^2.3.3, tough-cookie@~2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==
Product NameNama ProdukJumlah Total
- {data.product_name} + {data.product_name} + + {data.product_quantity} Unit @@ -173,12 +264,16 @@ const CheckoutContent = function ({ backend, checkout_product, ...props }) { )}
Cart Subtotal + + $210.00 + + $5.00
+ + $215.00