From d683951c4947d8b361bc3fa7eaad86e0663842e2 Mon Sep 17 00:00:00 2001 From: "ajat91.sudrajat" Date: Fri, 4 Feb 2022 19:26:02 +0700 Subject: [PATCH 01/36] Bug Fixing --- src/component/ProductComponent.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index 4a37738..3a3cc7c 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -228,9 +228,13 @@ export const ProductComponent = observer((props) => { store.product.filterSupplier = filterSupplier; store.product.filterSubCategory = filterSubCategories; modalLoader.setLoading(true); + store.authentication.userData.role === "Admin Partner" + ? await store.product.getData() + : await store.product.getData() await store.product.getData(); modalLoader.setLoading(false); store.product.visibleModalFilterProduct = false; + //store.product.page=1 }; const footerLayoutFilter = [ @@ -478,6 +482,7 @@ export const ProductComponent = observer((props) => { visible={store.product.visibleModalFilterProduct} title={"Filter"} footer={footerLayoutFilter} + onClick={store.product.page + 1} onCancel={async () => { // setFilterSupplier([]); // setFilterSubCategories([]); From 8ec940d618c317dcc34a3610c619e0d2677c589f Mon Sep 17 00:00:00 2001 From: "ajat91.sudrajat" Date: Fri, 4 Feb 2022 19:51:51 +0700 Subject: [PATCH 02/36] Bug Fixing --- src/component/ProductComponent.js | 8 +++--- src/pages/Product/Product.js | 1 + src/pages/Transaction/Product.js | 37 ++++++++++++++-------------- src/pages/Transaction/Transaction.js | 37 ++++++++++++++-------------- 4 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index 3a3cc7c..b01aca2 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -228,9 +228,9 @@ export const ProductComponent = observer((props) => { store.product.filterSupplier = filterSupplier; store.product.filterSubCategory = filterSubCategories; modalLoader.setLoading(true); - store.authentication.userData.role === "Admin Partner" - ? await store.product.getData() - : await store.product.getData() + // store.authentication.userData.role === "Admin Partner" + // ? await store.product.getData() + // : await store.product.getData() await store.product.getData(); modalLoader.setLoading(false); store.product.visibleModalFilterProduct = false; @@ -482,7 +482,7 @@ export const ProductComponent = observer((props) => { visible={store.product.visibleModalFilterProduct} title={"Filter"} footer={footerLayoutFilter} - onClick={store.product.page + 1} + onCancel={async () => { // setFilterSupplier([]); // setFilterSubCategories([]); diff --git a/src/pages/Product/Product.js b/src/pages/Product/Product.js index 3cadd9c..1ff75cf 100644 --- a/src/pages/Product/Product.js +++ b/src/pages/Product/Product.js @@ -195,6 +195,7 @@ export const Product = observer(() => { { store.product.visibleModalFilterProduct = true; + store.product.page=0 }} > diff --git a/src/pages/Transaction/Product.js b/src/pages/Transaction/Product.js index ff73f3c..2d89bca 100644 --- a/src/pages/Transaction/Product.js +++ b/src/pages/Transaction/Product.js @@ -215,6 +215,7 @@ export const Product = observer(() => { style={{ backgroundColor: "#4e79e7", color: "#fff", + marginRight:10 }} onClick={() => { form @@ -231,24 +232,24 @@ export const Product = observer(() => { > Beli , - { - form - .validateFields() - .then((values) => { - console.log(values, "isi form"); - handleBuyStag(values, barang.product_code); - form.resetFields(); - }) - .catch((info) => { - console.error("Validate Failed:", info); - }); - }} - > - Beli Staging - , + // { + // form + // .validateFields() + // .then((values) => { + // console.log(values, "isi form"); + // handleBuyStag(values, barang.product_code); + // form.resetFields(); + // }) + // .catch((info) => { + // console.error("Validate Failed:", info); + // }); + // }} + // > + // Beli Staging + // , ]} > diff --git a/src/pages/Transaction/Transaction.js b/src/pages/Transaction/Transaction.js index 3a8ec96..69468dc 100644 --- a/src/pages/Transaction/Transaction.js +++ b/src/pages/Transaction/Transaction.js @@ -294,6 +294,7 @@ export const Transaction = observer(() => { style={{ backgroundColor: "#4e79e7", color: "#fff", + marginRight:10 }} onClick={() => { form @@ -310,24 +311,24 @@ export const Transaction = observer(() => { > Beli , - { - form - .validateFields() - .then((values) => { - console.log(values, "isi form"); - handleBuyStag(values, barang.product_code); - form.resetFields(); - }) - .catch((info) => { - console.error("Validate Failed:", info); - }); - }} - > - Beli Staging - , + // { + // form + // .validateFields() + // .then((values) => { + // console.log(values, "isi form"); + // handleBuyStag(values, barang.product_code); + // form.resetFields(); + // }) + // .catch((info) => { + // console.error("Validate Failed:", info); + // }); + // }} + // > + // Beli Staging + // , ]} > From a790a23c93e479479bb23b64f95c53e1b9d5ed7a Mon Sep 17 00:00:00 2001 From: "ajat91.sudrajat" Date: Fri, 4 Feb 2022 20:20:04 +0700 Subject: [PATCH 03/36] Bug Fixing --- src/component/ProductComponent.js | 4 ++-- src/pages/Membership/DetailUser.js | 4 ++-- src/pages/Membership/Membership.js | 22 ++++++++++++---------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index b01aca2..df8ddf6 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -128,7 +128,7 @@ export const ProductComponent = observer((props) => { ), }, ]; - if (store.authentication.userData.role !== "Admin") columns.pop(); + //if (store.authentication.userData.role !== "Admin") columns.pop(); //if (store.authentication.userData.role === "Admin Partner") delete columns[2]; if (store.authentication.userData.role === "Admin Partner") delete columns[3]; if (store.authentication.userData.role != "Admin Partner") delete columns[4]; @@ -136,7 +136,7 @@ export const ProductComponent = observer((props) => { if (store.authentication.userData.role !== "Admin") delete columns[2]; if (store.authentication.userData.role !== "Admin") delete columns[5]; if (store.authentication.userData.role === "Admin Partner") delete columns[7]; - if (store.authentication.userData.role !== "Admin") delete columns[8]; + //if (store.authentication.userData.role !== "Admin") delete columns[8]; //if (store.authentication.userData.role === "Admin Partner") delete columns[5]; const deleteData = async (id) => { diff --git a/src/pages/Membership/DetailUser.js b/src/pages/Membership/DetailUser.js index 7257b59..642ae26 100644 --- a/src/pages/Membership/DetailUser.js +++ b/src/pages/Membership/DetailUser.js @@ -412,8 +412,8 @@ export const DetailUser = observer(() => { Detail User { key: "action", render: (text, record) => ( - { - setDestination(record?.id); - console.log(record?.id); - setIsVisibleTopUpModal(true); - }} - > - Top Up Saldo - + {store.authentication.userData.role === "Admin" && ( + { + setDestination(record?.id); + console.log(record?.id); + setIsVisibleTopUpModal(true); + }} + > + Top Up Saldo + + )} { await store.transaction.getDataHistoryTopUp(record.id); @@ -226,7 +228,7 @@ export const Membership = observer(() => { }, ]; - if (store.authentication.userData.role === "Customer Service") columns.pop(); + //if (store.authentication.userData.role === "Customer Service") columns.pop(); const routeData = [ { route: LINKS.HOME, From 23f210ccd52fc1c238821a670e8423a86dd9bdbe Mon Sep 17 00:00:00 2001 From: "ajat91.sudrajat" Date: Fri, 4 Feb 2022 21:13:09 +0700 Subject: [PATCH 04/36] Bug Fixing --- src/component/CategoryComponent.js | 8 +- src/component/ProductComponent.js | 76 ++++++++---- src/component/SubcategoryComponent.js | 38 +++--- src/pages/Membership/DetailUser.js | 2 +- src/pages/Membership/Membership.js | 23 ++-- src/pages/Product/ProductDetail.js | 166 ++++++++++++++++++++++---- 6 files changed, 236 insertions(+), 77 deletions(-) diff --git a/src/component/CategoryComponent.js b/src/component/CategoryComponent.js index 70fc4f1..62ce17b 100644 --- a/src/component/CategoryComponent.js +++ b/src/component/CategoryComponent.js @@ -195,9 +195,11 @@ export const CategoryComponent = observer((props) => { margin: 0, }} > - handleEditButton(item)}> - Edit - + {store.authentication.userData.role === "Admin" && ( + handleEditButton(item)}> + Edit + + )}
+ + Markup Price :{" "} + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item.mark_up_price)} + {" "} + + + Price:{" "} + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item.price)} + {" "} + + + {" "} + Tanggal Berlaku : + {item.startDate + ? format( + parseISO(item.startDate), + "dd MMMM yyyy" + ) + : "-"} + {" "} + + + Tanggal Berakhir :{" "} + {item.endDate + ? format( + parseISO(item.endDate), + "dd MMMM yyyy" + ) + : "Sampai Sekarang"} + {" "} + +
+ + {item?.product_status === "ACTIVE" + ? " Tersedia" + : "Tidak"} + +
- {item.product_name} - {/* Harga Beli : {item.current_price_price} - */} - Harga Jual : {item.mark_up_price} - - { - history.push( - LINKS.PRODUCT_DETAIL.replace( - ":id", - item.product_id - ) - ); + + {store.ui.mediaQuery.isDesktop && ( + { + let pageNumber = page.current; + store.authentication.userData.role === "Admin" ? store.product.pageSize = page.pageSize : store.product.pageSizeProductPartner = page.pageSize; + store.authentication.userData.role === "Admin" ? store.product.page = pageNumber - 1 : store.product.pageProductPartner = pageNumber - 1 + store.product.filterSubCategory = filterSubCategories + modalLoader.setLoading(true); + store.authentication.userData.role === "Admin Partner" + ? await store.product.getProductPartner( + // store.authentication.profileData.id + ) + : await store.product.getData(); + modalLoader.setLoading(false); + }} + /> + )} + {store.ui.mediaQuery.isMobile && ( + { + store.authentication.userData.role === "Admin" ? store.product.pageSize = pageSize : store.product.pageSizeProductPartner = pageSize; + store.authentication.userData.role === "Admin" ? store.product.page = page - 1 : store.product.pageProductPartner = page - 1 + modalLoader.setLoading(true); + store.authentication.userData.role === "Admin Partner" + ? await store.product.getProductPartner( + // store.authentication.profileData.id + ) + : await store.product.getData(); + //await store.product.getData(); + modalLoader.setLoading(false); + }, + pageSize: store.authentication.userData.role === "Admin" ? store.product.pageSize : store.product.pageSizeProductPartner, + total: store.authentication.userData.role === "Admin Partner" + ? store.product.total_data_partner + : store.product.total_data, + current: store.authentication.userData.role === "Admin" ? store.product.page + 1 : store.product.pageProductPartner + 1, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + dataSource={ + store.authentication.userData.role === "Admin Partner" + ? store.product.dataProductPartner + : store.product.data + } + style={{ padding: 0 }} + renderItem={(item) => { + return ( + + - Detail - - - + > + + + {item.product_name} + {/* Harga Beli : {item.current_price_price} + */} + Harga Jual : {item.mark_up_price} + + { + history.push( + LINKS.PRODUCT_DETAIL.replace( + ":id", + item.product_id + ) + ); + }} + > + Detail + + + + + } + /> + + + + {item?.product_status === "ACTIVE" + ? " Tersedia" + : "Tidak"} + + + + + - } - /> - - - - {item?.product_status === "ACTIVE" - ? " Tersedia" - : "Tidak"} - - - - - - - ); - }} - /> - )} - { - form.resetFields(); - handleCancel(); - }} - onOk={() => { - form - .validateFields() - .then((values) => { - console.log(values, "isi form"); - handleSubmit(values); + ); + }} + /> + )} + { form.resetFields(); - }) - .catch((info) => { - console.error("Validate Failed:", info); - }); - }} - > - - - - - - - `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") - } - parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} - /> - - - - `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") - } - parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} - /> - - - - - - - AKTIF - INAKTIF - - - - - {store.category.dataSubCategories.map((item) => ( - - {item.name} - - ))} - - - - - { - // setFilterSupplier([]); - // setFilterSubCategories([]); - store.product.filterSupplier = null; - store.product.filterSubCategory = null; - store.product.visibleModalFilterProduct = false; - await store.product.getData(); - }} - > - - {store.authentication.userData.role === "Admin" && ( + handleCancel(); + }} + onOk={() => { + form + .validateFields() + .then((values) => { + console.log(values, "isi form"); + handleSubmit(values); + form.resetFields(); + }) + .catch((info) => { + console.error("Validate Failed:", info); + }); + }} + > + + + + + + + `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + } + parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} + /> + + + + `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + } + parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} + /> + + + + + + + AKTIF + INAKTIF + + + + + {store.category.dataSubCategories.map((item) => ( + + {item.name} + + ))} + + + + + { + // setFilterSupplier([]); + // setFilterSubCategories([]); + store.product.filterSupplier = null; + store.product.filterSubCategory = null; + store.product.visibleModalFilterProduct = false; + await store.product.getData(); + }} + > + + {store.authentication.userData.role === "Admin" && ( + + + Filter Supplier + + { + setFilterSupplier(val); + }} + style={{ marginBottom: "20px", width: "100%" }} + value={filterSupplier} + > + {store.supplier.data.map((item) => ( + + {item.name} + + ))} + + + )} - Filter Supplier + Filter Sub-Categories { - setFilterSupplier(val); - }} - style={{ marginBottom: "20px", width: "100%" }} - value={filterSupplier} + mode={"multiple"} + placeholder="Choose Sub-Category" + onChange={(val) => { + setFilterSubCategories(val); + }} + style={{ marginBottom: "20px", width: "100%" }} + value={filterSubCategories} > - {store.supplier.data.map((item) => ( - - {item.name} - + {store.product.dataSubCategories.map((item) => ( + + {item.name} + ))} - )} - - - Filter Sub-Categories - - { - setFilterSubCategories(val); - }} - style={{ marginBottom: "20px", width: "100%" }} - value={filterSubCategories} - > - {store.product.dataSubCategories.map((item) => ( - - {item.name} - - ))} - - - - - + + + ); }); diff --git a/src/pages/Product/ProductDetail.js b/src/pages/Product/ProductDetail.js index 6364f74..caa71a8 100644 --- a/src/pages/Product/ProductDetail.js +++ b/src/pages/Product/ProductDetail.js @@ -57,20 +57,30 @@ export const ProductDetail = observer(() => { dataIndex: "mark_up_price", key: "mark_up_price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Price", dataIndex: "price", key: "price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), + }, + { + title: "Biaya Admin", + dataIndex: "admin_price", + key: "admin_price", + render: (text) => + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Tanggal Berlaku", @@ -78,7 +88,7 @@ export const ProductDetail = observer(() => { key: "startDate", render: (text) => { return ( - {text ? format(parseISO(text), "dd MMMM yyyy") : "-"} + {text ? format(parseISO(text), "dd MMMM yyyy") : "-"} ); }, }, @@ -88,174 +98,174 @@ export const ProductDetail = observer(() => { key: "endDate", render: (text) => { return ( - - {text ? format(parseISO(text), "dd MMMM yyyy") : "Sampai Sekarang"} - + + {text ? format(parseISO(text), "dd MMMM yyyy") : "Sampai Sekarang"} + ); }, }, ]; const styleSaldoTitle = store.ui.mediaQuery.isDesktop - ? { + ? { display: "flex", justifyContent: "center", } - : { fontSize: "0.75rem" }; + : { fontSize: "0.75rem" }; const styleSaldoContent = store.ui.mediaQuery.isDesktop - ? { + ? { fontSize: "1.25rem", display: "flex", justifyContent: "center", } - : null; + : null; return ( - - - - Product Detail - - - - - Kode - - - {store.product?.dataDetailProduct?.code} - - - Nama Produk - - - {store.product?.dataDetailProduct?.name} - - - Supplier - - - {store.product?.dataDetailProduct?.supplier?.name} - - - Status - - - {store.product?.dataDetailProduct?.status} - - - - - - - - - Product Price History - - {store.ui.mediaQuery.isDesktop && ( - { - let pageNumber = page.current; - store.product.pageSizePriceHistory = page.pageSize; - store.product.pagePriceHistory = pageNumber - 1; - modalLoader.setLoading(true); - await store.product.getPriceHistoryByProduct(id); - modalLoader.setLoading(false); - }} - /> - )} - {store.ui.mediaQuery.isMobile && ( - { - store.product.pageSizePriceHistory = pageSize; - store.product.pagePriceHistory = page - 1; - modalLoader.setLoading(true); - await store.product.getPriceHistoryByProduct(id); - modalLoader.setLoading(false); - }, - pageSize: store.product.pageSizePriceHistory, - total: store.product.totalDataPriceHistory, - current: store.product.pagePriceHistory + 1, - style: { marginBottom: "1rem", marginRight: "1rem" }, - }} - dataSource={store.product.dataPriceHistory} - style={{ padding: 0 }} - renderItem={(item) => { - return ( - - - - - - Markup Price :{" "} - {new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(item.mark_up_price)} - {" "} - - - Price:{" "} - {new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(item.price)} - {" "} - - - {" "} - Tanggal Berlaku : - {item.startDate - ? format( - parseISO(item.startDate), - "dd MMMM yyyy" - ) - : "-"} - {" "} - - - Tanggal Berakhir :{" "} - {item.endDate - ? format( - parseISO(item.endDate), - "dd MMMM yyyy" - ) - : "Sampai Sekarang"} - {" "} - - - - - } - /> - {/* + + + + Product Detail + + + + + Kode + + + {store.product?.dataDetailProduct?.code} + + + Nama Produk + + + {store.product?.dataDetailProduct?.name} + + + Supplier + + + {store.product?.dataDetailProduct?.supplier?.name} + + + Status + + + {store.product?.dataDetailProduct?.status} + + + + + + + + + Product Price History + + {store.ui.mediaQuery.isDesktop && ( + { + let pageNumber = page.current; + store.product.pageSizePriceHistory = page.pageSize; + store.product.pagePriceHistory = pageNumber - 1; + modalLoader.setLoading(true); + await store.product.getPriceHistoryByProduct(id); + modalLoader.setLoading(false); + }} + /> + )} + {store.ui.mediaQuery.isMobile && ( + { + store.product.pageSizePriceHistory = pageSize; + store.product.pagePriceHistory = page - 1; + modalLoader.setLoading(true); + await store.product.getPriceHistoryByProduct(id); + modalLoader.setLoading(false); + }, + pageSize: store.product.pageSizePriceHistory, + total: store.product.totalDataPriceHistory, + current: store.product.pagePriceHistory + 1, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + dataSource={store.product.dataPriceHistory} + style={{ padding: 0 }} + renderItem={(item) => { + return ( + + + + + + Markup Price :{" "} + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item.mark_up_price)} + {" "} + + + Price:{" "} + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item.price)} + {" "} + + + {" "} + Tanggal Berlaku : + {item.startDate + ? format( + parseISO(item.startDate), + "dd MMMM yyyy" + ) + : "-"} + {" "} + + + Tanggal Berakhir :{" "} + {item.endDate + ? format( + parseISO(item.endDate), + "dd MMMM yyyy" + ) + : "Sampai Sekarang"} + {" "} + + + + + } + /> + {/* { */} - - - - ); - }} - /> - )} - - - - - - + + + + ); + }} + /> + )} + + + + + + ); }); From 6a26068339b72098484b05f7e0819298dfe6620c Mon Sep 17 00:00:00 2001 From: rahman Date: Wed, 11 May 2022 20:33:04 +0700 Subject: [PATCH 26/36] feat: revisi fixing filter admin partner and add column biaya admin --- src/component/ProductComponent.js | 661 +++++++++++++++--------------- src/store/product.js | 2 +- 2 files changed, 331 insertions(+), 332 deletions(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index c4d28b5..ccc771b 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -64,40 +64,40 @@ export const ProductComponent = observer((props) => { dataIndex: "current_price_price", key: "current_price_price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Harga Jual", dataIndex: "mark_up_price", key: "mark_up_price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Harga", dataIndex: "price", key: "price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Biaya Admin", dataIndex: "admin_price", key: "admin_price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Supplier", @@ -114,27 +114,27 @@ export const ProductComponent = observer((props) => { dataIndex: "tersedia", key: "tersedia", render: (text, record) => ( - - {record?.product_status === "ACTIVE" ? " Tersedia" : "Tidak"} - + + {record?.product_status === "ACTIVE" ? " Tersedia" : "Tidak"} + ), }, { title: "Tindakan", key: "action", render: (text, record) => ( - { - history.push( - LINKS.PRODUCT_DETAIL.replace(":id", record.product_id) - ); - }} - > - Detail - + { + history.push( + LINKS.PRODUCT_DETAIL.replace(":id", record.product_id) + ); + }} + > + Detail + ), }, ]; @@ -145,7 +145,6 @@ export const ProductComponent = observer((props) => { if (store.authentication.userData.role !== "Admin") delete columns[8]; if (store.authentication.userData.role !== "Admin") delete columns[6]; if (store.authentication.userData.role !== "Admin") delete columns[2]; - if (store.authentication.userData.role !== "Admin") delete columns[5]; if (store.authentication.userData.role === "Admin Partner") delete columns[7]; //if (store.authentication.userData.role !== "Admin") delete columns[8]; //if (store.authentication.userData.role === "Admin Partner") delete columns[5]; @@ -190,10 +189,10 @@ export const ProductComponent = observer((props) => { try { const response = await store.product.update(idData, data); response?.body?.statusCode === 201 || response?.body?.statusCode === 200 - ? message.success( - response?.body?.message || "Berhasil Ubah Data Produk" - ) - : message.error(response?.body?.message || "Gagal Ubah Data Produk"); + ? message.success( + response?.body?.message || "Berhasil Ubah Data Produk" + ) + : message.error(response?.body?.message || "Gagal Ubah Data Produk"); } catch (e) { message.error(e.response?.body?.message || "Gagal Ubah Data Produk"); } @@ -206,8 +205,8 @@ export const ProductComponent = observer((props) => { try { const response = await store.product.create(data); response?.body?.statusCode === 201 || response?.body?.statusCode === 200 - ? message.success(response?.body?.message || "Berhasil Tambah Produk") - : message.error(response?.body?.message || "Gagal Tambah Produk"); + ? message.success(response?.body?.message || "Berhasil Tambah Produk") + : message.error(response?.body?.message || "Gagal Tambah Produk"); } catch (e) { console.log(e, "apa errornya"); message.error(e.response?.body?.message || "Gagal Tambah Produk"); @@ -227,8 +226,8 @@ export const ProductComponent = observer((props) => { setFilterSupplier([]); setFilterSubCategories([]); store.authentication.userData.role === "Admin Partner" - ? await store.product.getProductPartner() - : await store.product.getData(); + ? await store.product.getProductPartner() + : await store.product.getData(); //await store.product.getData(); modalLoader.setLoading(false); }; @@ -245,8 +244,8 @@ export const ProductComponent = observer((props) => { store.product.filterSubCategory = filterSubCategories; modalLoader.setLoading(true); store.authentication.userData.role === "Admin Partner" - ? await store.product.getProductPartner(filterSubCategories) - : await store.product.getData(); + ? await store.product.getProductPartner(filterSubCategories) + : await store.product.getData(); //await store.product.getData(); modalLoader.setLoading(false); //store.product.page=1 @@ -254,12 +253,12 @@ export const ProductComponent = observer((props) => { const footerLayoutFilter = [ Hapus Filter , @@ -267,12 +266,12 @@ export const ProductComponent = observer((props) => { Batal , Terapkan , @@ -284,293 +283,293 @@ export const ProductComponent = observer((props) => { }, }); return ( - - {store.ui.mediaQuery.isDesktop && ( - { - let pageNumber = page.current; - store.authentication.userData.role === "Admin" ? store.product.pageSize = page.pageSize : store.product.pageSizeProductPartner = page.pageSize; - store.authentication.userData.role === "Admin" ? store.product.page = pageNumber - 1 : store.product.pageProductPartner = pageNumber - 1 - store.product.filterSubCategory = filterSubCategories - modalLoader.setLoading(true); - store.authentication.userData.role === "Admin Partner" - ? await store.product.getProductPartner( - // store.authentication.profileData.id - ) - : await store.product.getData(); - modalLoader.setLoading(false); - }} - /> - )} - {store.ui.mediaQuery.isMobile && ( - { - store.authentication.userData.role === "Admin" ? store.product.pageSize = pageSize : store.product.pageSizeProductPartner = pageSize; - store.authentication.userData.role === "Admin" ? store.product.page = page - 1 : store.product.pageProductPartner = page - 1 - modalLoader.setLoading(true); - store.authentication.userData.role === "Admin Partner" - ? await store.product.getProductPartner( - // store.authentication.profileData.id - ) - : await store.product.getData(); - //await store.product.getData(); - modalLoader.setLoading(false); - }, - pageSize: store.authentication.userData.role === "Admin" ? store.product.pageSize : store.product.pageSizeProductPartner, - total: store.authentication.userData.role === "Admin Partner" - ? store.product.total_data_partner - : store.product.total_data, - current: store.authentication.userData.role === "Admin" ? store.product.page + 1 : store.product.pageProductPartner + 1, - style: { marginBottom: "1rem", marginRight: "1rem" }, - }} - dataSource={ - store.authentication.userData.role === "Admin Partner" - ? store.product.dataProductPartner - : store.product.data - } - style={{ padding: 0 }} - renderItem={(item) => { - return ( - - - - - {item.product_name} - {/* Harga Beli : {item.current_price_price} + + {store.ui.mediaQuery.isDesktop && ( + { + let pageNumber = page.current; + store.authentication.userData.role === "Admin" ? store.product.pageSize = page.pageSize : store.product.pageSizeProductPartner = page.pageSize; + store.authentication.userData.role === "Admin" ? store.product.page = pageNumber - 1 : store.product.pageProductPartner = pageNumber - 1 + store.product.filterSubCategory = filterSubCategories + modalLoader.setLoading(true); + store.authentication.userData.role === "Admin Partner" + ? await store.product.getProductPartner( + filterSubCategories + ) + : await store.product.getData(); + modalLoader.setLoading(false); + }} + /> + )} + {store.ui.mediaQuery.isMobile && ( + { + store.authentication.userData.role === "Admin" ? store.product.pageSize = pageSize : store.product.pageSizeProductPartner = pageSize; + store.authentication.userData.role === "Admin" ? store.product.page = page - 1 : store.product.pageProductPartner = page - 1 + modalLoader.setLoading(true); + store.authentication.userData.role === "Admin Partner" + ? await store.product.getProductPartner( + filterSubCategories + ) + : await store.product.getData(); + //await store.product.getData(); + modalLoader.setLoading(false); + }, + pageSize: store.authentication.userData.role === "Admin" ? store.product.pageSize : store.product.pageSizeProductPartner, + total: store.authentication.userData.role === "Admin Partner" + ? store.product.total_data_partner + : store.product.total_data, + current: store.authentication.userData.role === "Admin" ? store.product.page + 1 : store.product.pageProductPartner + 1, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + dataSource={ + store.authentication.userData.role === "Admin Partner" + ? store.product.dataProductPartner + : store.product.data + } + style={{ padding: 0 }} + renderItem={(item) => { + return ( + + + + + {item.product_name} + {/* Harga Beli : {item.current_price_price} */} - Harga Jual : {item.mark_up_price} - - { - history.push( - LINKS.PRODUCT_DETAIL.replace( - ":id", - item.product_id - ) - ); - }} - > - Detail - - - - - } - /> - - - - {item?.product_status === "ACTIVE" - ? " Tersedia" - : "Tidak"} - - - - - + Harga Jual : {item.mark_up_price} + + { + history.push( + LINKS.PRODUCT_DETAIL.replace( + ":id", + item.product_id + ) + ); + }} + > + Detail + + + - ); - }} - /> - )} - { - form.resetFields(); - handleCancel(); - }} - onOk={() => { - form - .validateFields() - .then((values) => { - console.log(values, "isi form"); - handleSubmit(values); - form.resetFields(); - }) - .catch((info) => { - console.error("Validate Failed:", info); - }); - }} - > - - - - - - - `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") - } - parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} - /> - - - - `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") - } - parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} - /> - - - - - - - AKTIF - INAKTIF - - - - - {store.category.dataSubCategories.map((item) => ( - - {item.name} - - ))} - - - - - { - // setFilterSupplier([]); - // setFilterSubCategories([]); - store.product.filterSupplier = null; - store.product.filterSubCategory = null; - store.product.visibleModalFilterProduct = false; - await store.product.getData(); - }} - > - - {store.authentication.userData.role === "Admin" && ( - - - Filter Supplier - - { - setFilterSupplier(val); + } + /> + + - {store.supplier.data.map((item) => ( - - {item.name} - - ))} - - - )} + > + + {item?.product_status === "ACTIVE" + ? " Tersedia" + : "Tidak"} + + + + + + + ); + }} + /> + )} + { + form.resetFields(); + handleCancel(); + }} + onOk={() => { + form + .validateFields() + .then((values) => { + console.log(values, "isi form"); + handleSubmit(values); + form.resetFields(); + }) + .catch((info) => { + console.error("Validate Failed:", info); + }); + }} + > + + + + + + + `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + } + parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} + /> + + + + `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + } + parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} + /> + + + + + + + AKTIF + INAKTIF + + + + + {store.category.dataSubCategories.map((item) => ( + + {item.name} + + ))} + + + + + { + // setFilterSupplier([]); + // setFilterSubCategories([]); + store.product.filterSupplier = null; + store.product.filterSubCategory = null; + store.product.visibleModalFilterProduct = false; + await store.product.getData(); + }} + > + + {store.authentication.userData.role === "Admin" && ( - Filter Sub-Categories + Filter Supplier { - setFilterSubCategories(val); - }} - style={{ marginBottom: "20px", width: "100%" }} - value={filterSubCategories} + mode={"multiple"} + placeholder="Choose Supplier" + onChange={(val) => { + setFilterSupplier(val); + }} + style={{ marginBottom: "20px", width: "100%" }} + value={filterSupplier} > - {store.product.dataSubCategories.map((item) => ( - - {item.name} - + {store.supplier.data.map((item) => ( + + {item.name} + ))} - - - + )} + + + Filter Sub-Categories + + { + setFilterSubCategories(val); + }} + style={{ marginBottom: "20px", width: "100%" }} + value={filterSubCategories} + > + {store.product.dataSubCategories.map((item) => ( + + {item.name} + + ))} + + + + + ); }); diff --git a/src/store/product.js b/src/store/product.js index 057db3f..7beeed4 100644 --- a/src/store/product.js +++ b/src/store/product.js @@ -101,7 +101,7 @@ export class Product { } async getProductPartner(id) { - + console.log({ id }); if (id === undefined) { try { const response = await http.get(`/product/by-categories?page=${this.pageProductPartner}&pageSize=${this.pageSizeProductPartner}&sub-category=`); From e8830781039844085cb00a8d0aefef467e9dd7e6 Mon Sep 17 00:00:00 2001 From: rahman Date: Thu, 12 May 2022 17:00:53 +0700 Subject: [PATCH 27/36] feat: hide column tindakan admin partner --- src/component/ProductComponent.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index ccc771b..55ad0c9 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -140,6 +140,7 @@ export const ProductComponent = observer((props) => { ]; //if (store.authentication.userData.role !== "Admin") columns.pop(); //if (store.authentication.userData.role === "Admin Partner") delete columns[2]; + if (store.authentication.userData.role === "Admin Partner") delete columns[9]; if (store.authentication.userData.role === "Admin Partner") delete columns[3]; if (store.authentication.userData.role != "Admin Partner") delete columns[4]; if (store.authentication.userData.role !== "Admin") delete columns[8]; From 77513308a2942db36c9a1638ae66e9b3e308f7e2 Mon Sep 17 00:00:00 2001 From: rahman Date: Thu, 12 May 2022 17:10:28 +0700 Subject: [PATCH 28/36] feat: hide column tindakan admin partner --- src/component/ProductComponent.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index 55ad0c9..7145ab8 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -33,6 +33,7 @@ export const ProductComponent = observer((props) => { const [filterSupplier, setFilterSupplier] = useState([]); const [filterSubCategories, setFilterSubCategories] = useState([]); const modalLoader = useContext(ModalLoaderContext); + const role = store.authentication.userData.role const handleEditButton = (data) => { console.log(data, "isi data"); @@ -280,7 +281,7 @@ export const ProductComponent = observer((props) => { const handleClickRow = (record, index) => ({ onClick: (event) => { - history.push(LINKS.PRODUCT_DETAIL.replace(":id", record.product_id)); + role === "Admin Partner" ? history.push(LINKS.PRODUCT_DETAIL.replace(":id", record.product_id)) : '' }, }); return ( From e98914fb86a1de27f30bb22feec675ba31f1d443 Mon Sep 17 00:00:00 2001 From: rahman Date: Thu, 12 May 2022 17:19:57 +0700 Subject: [PATCH 29/36] feat: validasi detail product admin partner --- src/component/ProductComponent.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index 7145ab8..e39f214 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -139,7 +139,6 @@ export const ProductComponent = observer((props) => { ), }, ]; - //if (store.authentication.userData.role !== "Admin") columns.pop(); //if (store.authentication.userData.role === "Admin Partner") delete columns[2]; if (store.authentication.userData.role === "Admin Partner") delete columns[9]; if (store.authentication.userData.role === "Admin Partner") delete columns[3]; From 8737da9da4e87984fdcff7c4e2e360e45565d614 Mon Sep 17 00:00:00 2001 From: rahman Date: Thu, 12 May 2022 17:39:15 +0700 Subject: [PATCH 30/36] feat: validasi detail product admin partner --- src/component/ProductComponent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index e39f214..2309c9a 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -280,7 +280,7 @@ export const ProductComponent = observer((props) => { const handleClickRow = (record, index) => ({ onClick: (event) => { - role === "Admin Partner" ? history.push(LINKS.PRODUCT_DETAIL.replace(":id", record.product_id)) : '' + history.push(LINKS.PRODUCT_DETAIL.replace(":id", record.product_id)) }, }); return ( @@ -298,7 +298,7 @@ export const ProductComponent = observer((props) => { ? store.product.dataProductPartner : store.product.data } - onRow={handleClickRow} + onRow={role === "Admin Partner" ? false : handleClickRow} pagination={{ pageSize: store.authentication.userData.role === "Admin" ? store.product.pageSize : store.product.pageSizeProductPartner, total: From 6c4a78f87128ed7d6ac3e204a4e39e0e3a648b42 Mon Sep 17 00:00:00 2001 From: rahman Date: Mon, 23 May 2022 21:36:27 +0700 Subject: [PATCH 31/36] feat: add column partner fee in list product role admin --- src/component/ProductComponent.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index 2309c9a..a371bf5 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -62,8 +62,8 @@ export const ProductComponent = observer((props) => { }, { title: "Harga Beli", - dataIndex: "current_price_price", - key: "current_price_price", + dataIndex: "price", + key: "price", render: (text) => new Intl.NumberFormat("id-ID", { style: "currency", @@ -100,6 +100,16 @@ export const ProductComponent = observer((props) => { currency: "IDR", }).format(text), }, + { + title: "Partner fee", + dataIndex: "partner_fee", + key: "partner_fee", + render: (text) => + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), + }, { title: "Supplier", dataIndex: "supplier_name", @@ -140,13 +150,14 @@ export const ProductComponent = observer((props) => { }, ]; //if (store.authentication.userData.role === "Admin Partner") delete columns[2]; - if (store.authentication.userData.role === "Admin Partner") delete columns[9]; + if (store.authentication.userData.role === "Admin Partner") delete columns[10]; if (store.authentication.userData.role === "Admin Partner") delete columns[3]; - if (store.authentication.userData.role != "Admin Partner") delete columns[4]; - if (store.authentication.userData.role !== "Admin") delete columns[8]; + if (store.authentication.userData.role !== "Admin Partner") delete columns[4]; + if (store.authentication.userData.role !== "Admin") delete columns[9]; if (store.authentication.userData.role !== "Admin") delete columns[6]; + if (store.authentication.userData.role !== "Admin") delete columns[7]; if (store.authentication.userData.role !== "Admin") delete columns[2]; - if (store.authentication.userData.role === "Admin Partner") delete columns[7]; + if (store.authentication.userData.role === "Admin Partner") delete columns[8]; //if (store.authentication.userData.role !== "Admin") delete columns[8]; //if (store.authentication.userData.role === "Admin Partner") delete columns[5]; From cd3d61d5f5a61cb7fe9dc05f315f99d0a1c34828 Mon Sep 17 00:00:00 2001 From: rahman Date: Tue, 24 May 2022 00:59:01 +0700 Subject: [PATCH 32/36] feat: add column partner fee in detail product role admin --- src/component/ProductComponent.js | 2 + src/pages/Product/ProductDetail.js | 379 +++++++++++++++-------------- 2 files changed, 196 insertions(+), 185 deletions(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index a371bf5..550485b 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -136,6 +136,7 @@ export const ProductComponent = observer((props) => { { title: "Tindakan", key: "action", + fixed: 'right', render: (text, record) => ( { @@ -303,6 +304,7 @@ export const ProductComponent = observer((props) => { textAlign: "center", width: store.ui.mediaQuery.isMobile ? 250 : "", }} + scroll={role === "Admin Partner" ? false : { x: 1300 }} columns={columns} dataSource={ store.authentication.userData.role === "Admin Partner" diff --git a/src/pages/Product/ProductDetail.js b/src/pages/Product/ProductDetail.js index caa71a8..17fceea 100644 --- a/src/pages/Product/ProductDetail.js +++ b/src/pages/Product/ProductDetail.js @@ -57,30 +57,39 @@ export const ProductDetail = observer(() => { dataIndex: "mark_up_price", key: "mark_up_price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Price", dataIndex: "price", key: "price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Biaya Admin", dataIndex: "admin_price", key: "admin_price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), + }, { + title: "Partner fee", + dataIndex: "partner_fee", + key: "partner_fee", + render: (text) => + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Tanggal Berlaku", @@ -88,7 +97,7 @@ export const ProductDetail = observer(() => { key: "startDate", render: (text) => { return ( - {text ? format(parseISO(text), "dd MMMM yyyy") : "-"} + {text ? format(parseISO(text), "dd MMMM yyyy") : "-"} ); }, }, @@ -98,174 +107,174 @@ export const ProductDetail = observer(() => { key: "endDate", render: (text) => { return ( - - {text ? format(parseISO(text), "dd MMMM yyyy") : "Sampai Sekarang"} - + + {text ? format(parseISO(text), "dd MMMM yyyy") : "Sampai Sekarang"} + ); }, }, ]; const styleSaldoTitle = store.ui.mediaQuery.isDesktop - ? { - display: "flex", - justifyContent: "center", - } - : { fontSize: "0.75rem" }; + ? { + display: "flex", + justifyContent: "center", + } + : { fontSize: "0.75rem" }; const styleSaldoContent = store.ui.mediaQuery.isDesktop - ? { - fontSize: "1.25rem", - display: "flex", - justifyContent: "center", - } - : null; + ? { + fontSize: "1.25rem", + display: "flex", + justifyContent: "center", + } + : null; return ( - - - - Product Detail - - - - - Kode - - - {store.product?.dataDetailProduct?.code} - - - Nama Produk - - - {store.product?.dataDetailProduct?.name} - - - Supplier - - - {store.product?.dataDetailProduct?.supplier?.name} - - - Status - - - {store.product?.dataDetailProduct?.status} - - - - - - - - - Product Price History - - {store.ui.mediaQuery.isDesktop && ( - { - let pageNumber = page.current; - store.product.pageSizePriceHistory = page.pageSize; - store.product.pagePriceHistory = pageNumber - 1; - modalLoader.setLoading(true); - await store.product.getPriceHistoryByProduct(id); - modalLoader.setLoading(false); - }} - /> - )} - {store.ui.mediaQuery.isMobile && ( - { - store.product.pageSizePriceHistory = pageSize; - store.product.pagePriceHistory = page - 1; - modalLoader.setLoading(true); - await store.product.getPriceHistoryByProduct(id); - modalLoader.setLoading(false); - }, - pageSize: store.product.pageSizePriceHistory, - total: store.product.totalDataPriceHistory, - current: store.product.pagePriceHistory + 1, - style: { marginBottom: "1rem", marginRight: "1rem" }, - }} - dataSource={store.product.dataPriceHistory} - style={{ padding: 0 }} - renderItem={(item) => { - return ( - - - - - - Markup Price :{" "} - {new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(item.mark_up_price)} - {" "} - - - Price:{" "} - {new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(item.price)} - {" "} - - - {" "} - Tanggal Berlaku : - {item.startDate - ? format( - parseISO(item.startDate), - "dd MMMM yyyy" - ) - : "-"} - {" "} - - - Tanggal Berakhir :{" "} - {item.endDate - ? format( - parseISO(item.endDate), - "dd MMMM yyyy" - ) - : "Sampai Sekarang"} - {" "} - - - - - } - /> - {/* + + + + Product Detail + + + + + Kode + + + {store.product?.dataDetailProduct?.code} + + + Nama Produk + + + {store.product?.dataDetailProduct?.name} + + + Supplier + + + {store.product?.dataDetailProduct?.supplier?.name} + + + Status + + + {store.product?.dataDetailProduct?.status} + + + + + + + + + Product Price History + + {store.ui.mediaQuery.isDesktop && ( + { + let pageNumber = page.current; + store.product.pageSizePriceHistory = page.pageSize; + store.product.pagePriceHistory = pageNumber - 1; + modalLoader.setLoading(true); + await store.product.getPriceHistoryByProduct(id); + modalLoader.setLoading(false); + }} + /> + )} + {store.ui.mediaQuery.isMobile && ( + { + store.product.pageSizePriceHistory = pageSize; + store.product.pagePriceHistory = page - 1; + modalLoader.setLoading(true); + await store.product.getPriceHistoryByProduct(id); + modalLoader.setLoading(false); + }, + pageSize: store.product.pageSizePriceHistory, + total: store.product.totalDataPriceHistory, + current: store.product.pagePriceHistory + 1, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + dataSource={store.product.dataPriceHistory} + style={{ padding: 0 }} + renderItem={(item) => { + return ( + + + + + + Markup Price :{" "} + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item.mark_up_price)} + {" "} + + + Price:{" "} + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item.price)} + {" "} + + + {" "} + Tanggal Berlaku : + {item.startDate + ? format( + parseISO(item.startDate), + "dd MMMM yyyy" + ) + : "-"} + {" "} + + + Tanggal Berakhir :{" "} + {item.endDate + ? format( + parseISO(item.endDate), + "dd MMMM yyyy" + ) + : "Sampai Sekarang"} + {" "} + + + + + } + /> + {/* { */} - - - - ); - }} - /> - )} - - - - - - + + + + ); + }} + /> + )} + + + + + + ); }); From c330f65612935a9d1f74216e6977dbe1fae63869 Mon Sep 17 00:00:00 2001 From: rahman Date: Tue, 24 May 2022 16:39:54 +0700 Subject: [PATCH 33/36] feat: wording fee jual in product list --- src/component/ProductComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index 550485b..311d64a 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -101,7 +101,7 @@ export const ProductComponent = observer((props) => { }).format(text), }, { - title: "Partner fee", + title: "Fee Jual", dataIndex: "partner_fee", key: "partner_fee", render: (text) => From 5fea6f568d56c4ebb4ea550f21978605caad8d11 Mon Sep 17 00:00:00 2001 From: rahman Date: Tue, 24 May 2022 21:06:34 +0700 Subject: [PATCH 34/36] feat: create table in profile --- src/pages/Profile/Profile.js | 264 +++++++++++++++++++++++++++++------ src/store/transaction.js | 41 ++++-- 2 files changed, 255 insertions(+), 50 deletions(-) diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js index 2f860b3..4ff74d0 100644 --- a/src/pages/Profile/Profile.js +++ b/src/pages/Profile/Profile.js @@ -66,13 +66,14 @@ export const Profile = observer(() => { await Promise.allSettled([ store.authentication.getProfile(), store.transaction.getDataHistoryTransaction(), + store.transaction.getDataHistoryCheckBill(), ]); await store.transaction.getDataHistoryTopUpProfile( store.authentication.profileData?.id ); modalLoader.setLoading(false); })(); - }, []); + }, [store.transaction.filterStart, store.transaction.filterEnd]); const handleRemoveFilter = async () => { store.transaction.filterStart = null; @@ -81,11 +82,11 @@ export const Profile = observer(() => { setFilterStart([]); setFilterEnd([]); //await store.transaction.getDataHistoryTransaction(); - actionFilter === true - ? await store.transaction.getDataHistoryTopUpProfile( - store.authentication.profileData?.id - ) - : await store.transaction.getDataHistoryTransaction(); + // actionFilter === true + // ? await store.transaction.getDataHistoryTopUpProfile( + // store.authentication.profileData?.id + // ) + // : await store.transaction.getDataHistoryTransaction(); store.transaction.visibleModalFilterTransaction = false; setAction(false); }; @@ -95,11 +96,11 @@ export const Profile = observer(() => { //form.resetFields(); store.transaction.filterEnd = null; store.transaction.visibleModalFilterTransaction = false; - actionFilter === true - ? await store.transaction.getDataHistoryTopUpProfile( - store.authentication.profileData?.id - ) - : await store.transaction.getDataHistoryTransaction(); + // actionFilter === true + // ? await store.transaction.getDataHistoryTopUpProfile( + // store.authentication.profileData?.id + // ) + // : await store.transaction.getDataHistoryTransaction(); setAction(false); //await store.transaction.getDataHistoryTransaction(); }; @@ -113,14 +114,14 @@ export const Profile = observer(() => { "YYYY-MM-DD HH:mm:ss" ); modalLoader.setLoading(true); - actionFilter === true - ? await store.transaction.getDataHistoryTopUpProfile( - store.authentication.profileData?.id - ) - : await store.transaction.getDataHistoryTransaction(); + // actionFilter === true + // ? await store.transaction.getDataHistoryTopUpProfile( + // store.authentication.profileData?.id + // ) + // : await store.transaction.getDataHistoryTransaction(); modalLoader.setLoading(false); - store.transaction.filterStart = null; - store.transaction.filterEnd = null; + // store.transaction.filterStart = null; + // store.transaction.filterEnd = null; //form.resetFields(); store.transaction.visibleModalFilterTransaction = false; setAction(false); @@ -194,15 +195,15 @@ export const Profile = observer(() => { record.status === 1 ? "success" : record.status === 0 - ? "warning" - : "processing" + ? "warning" + : "processing" } > {record.status === 1 ? "Sukses" : record.status === 0 - ? "Dalam Proses" - : "Gagal"} + ? "Dalam Proses" + : "Gagal"} ); }, @@ -266,18 +267,93 @@ export const Profile = observer(() => { }, }, ]; + + const columnBill = [ + { + title: "Code Product", + dataIndex: "product_code", + key: "product_code", + }, + { + title: "Admin Price", + dataIndex: "admin_price", + key: "admin_price", + render: (text) => + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), + }, + { + title: "Tagihan BPJS", + dataIndex: "amount", + key: "amount", + }, + { + title: "Nomor tujuan", + dataIndex: "destination", + key: "destination", + }, + { + title: "Transaction Id", + dataIndex: "trx_id", + key: "trx_id", + }, + { + title: "Partner Transaction Id", + dataIndex: "partner_trx_id", + key: "partner_trx_id", + }, + { + title: "Tanggal Transaksi", + dataIndex: "createdAt", + key: "createdAt", + render: (text, record) => { + return ( + + {format(parseISO(record.createdAt), "dd MMMM yyyy HH:mm:ss")} + + ); + }, + }, + { + title: "Status", + dataIndex: "status", + key: "status", + render: (text, record) => { + console.log("status", record) + return ( + + {record.status === "SUCCESS" + ? "Sukses" + : record.status === 0 + ? "Dalam Proses" + : "Gagal"} + + ); + }, + }, + ]; const styleSaldoTitle = store.ui.mediaQuery.isDesktop ? { - display: "flex", - justifyContent: "center", - } + display: "flex", + justifyContent: "center", + } : { fontSize: "0.75rem" }; const styleSaldoContent = store.ui.mediaQuery.isDesktop ? { - fontSize: "1.25rem", - display: "flex", - justifyContent: "center", - } + fontSize: "1.25rem", + display: "flex", + justifyContent: "center", + } : null; const handleSubmit = async (id, data) => { @@ -301,8 +377,8 @@ export const Profile = observer(() => { { dataSource={store.transaction.dataHistoryTransaction} pagination={{ onChange: async (page, pageSize) => { - console.log(page, "Page"); - console.log(pageSize, "Page size"); store.transaction.page = pageSize; store.transaction.page = page - 1; modalLoader.setLoading(true); @@ -657,15 +731,15 @@ export const Profile = observer(() => { item.status === 1 ? "success" : item.status === 0 - ? "warning" - : "processing" + ? "warning" + : "processing" } > {item.status === 1 ? "Sukses" : item.status === 0 - ? "Dalam Proses" - : "Gagal"} + ? "Dalam Proses" + : "Gagal"} } {" "} @@ -704,6 +778,118 @@ export const Profile = observer(() => { )} + + { + store.transaction.visibleModalFilterTransaction = true; + store.transaction.page = 0; + setAction(true); + }} + > + + Filter + + {store.ui.mediaQuery.isDesktop && ( + { + let pageNumber = page.current; + store.transaction.pageSize = page.pageSize; + store.transaction.page = pageNumber - 1; + modalLoader.setLoading(true); + await store.transaction.getDataHistoryCheckBill(); + modalLoader.setLoading(false); + }} + /> + )} + {store.ui.mediaQuery.isMobile && ( + + { + console.log(page, "Page"); + console.log(pageSize, "Page size"); + store.transaction.pageSize = pageSize; + store.transaction.page = page - 1; + modalLoader.setLoading(true); + await store.transaction.getDataHistoryCheckBill(); + modalLoader.setLoading(false); + }, + pageSize: store.transaction.pageSize, + total: store.transaction.total_dataHistorybillProfile, + current: store.transaction.page + 1, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + style={{ padding: 0 }} + renderItem={(item) => { + return ( + + + + + + Pengirim : {item.sender_name} + {" "} + + + Amount :{" "} + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item.amount || 0)} + {" "} + + + Transaction Date :{" "} + {format( + parseISO(item.transaction_date), + "dd-MM-yyyy" + )} + {" "} + + + + } + /> + + + + ); + }} + /> + + )} + @@ -719,8 +905,8 @@ export const Profile = observer(() => { store.transaction.visibleModalFilterTransaction = false; actionFilter === true ? await store.transaction.getDataHistoryTopUpProfile( - store.authentication.profileData?.id - ) + store.authentication.profileData?.id + ) : await store.transaction.getDataHistoryTransaction(); }} > diff --git a/src/store/transaction.js b/src/store/transaction.js index da74f34..25f3910 100644 --- a/src/store/transaction.js +++ b/src/store/transaction.js @@ -11,8 +11,8 @@ export class Transaction { filterSubCategory = null; visibleModalProduct = false; visibleModalTransaction = false; - pageSizeDetail=10; - pageDetail=0 + pageSizeDetail = 10; + pageDetail = 0 pageCategories = 0; pageSizeCategories = 10; @@ -40,15 +40,18 @@ export class Transaction { dataHistoryTopUp = []; total_dataHistoryTopUp = 0; + dataHistorybillProfile = []; + total_dataHistorybillProfile = 0; + dataHistoryTopUpProfile = []; total_dataHistoryTopUpProfile = 0; dataTransaction = []; dataTransactionB2B = []; dataTransactionPartner = []; - total_dataDetailHistoryTransactionDetailUser=0; + total_dataDetailHistoryTransactionDetailUser = 0; + - //filter visibleModalFilterTransaction = false; filterStart = null; @@ -130,6 +133,23 @@ export class Transaction { } } + async getDataHistoryCheckBill() { + try { + const response = await http.get( + `/transaction/check-bill-history` + ); + // const response = await http.get( + // `/transaction/check-bill-history?page=${this.page}&pageSize=${this.pageSize}&start=${this.filterStart}&end=${this.filterEnd}` + // ); + console.log("bill", response); + this.dataHistorybillProfile = response.body.data ?? []; + this.total_dataHistorybillProfile = response?.body?.count ?? 0; + console.log(this.total_dataHistorybillProfile) + } catch (e) { + console.error(e); + } + } + async getDataHistoryTransaction() { try { const response = await http.get( @@ -138,7 +158,6 @@ export class Transaction { console.log(response); this.dataHistoryTransaction = response.body.data ?? []; this.total_dataHistoryTransaction = response?.body?.count ?? 0; - console.log(this.total_dataHistoryTransaction) } catch (e) { console.error(e); } @@ -147,7 +166,7 @@ export class Transaction { async getDetailHistoryTransaction(id) { try { const response = await http.get(`/transaction/history-user/${id}?page=${this.page}&pageSize=${this.pageSize}&start=${this.filterStart}&end=${this.filterEnd}`); - console.log(response,'Data Trans'); + console.log(response, 'Data Trans'); this.dataDetailHistoryTransactionDetailUser = response.body.data ?? []; this.total_data = response?.body?.count ?? 0; } catch (e) { @@ -160,7 +179,7 @@ export class Transaction { const response = await http.get( `/transaction/history-deposit?page=${this.page}&pageSize=${this.pageSize}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}` ); - console.log(response,'get data history') + console.log(response, 'get data history') this.dataHistoryTopUp = response.body.data ?? []; this.total_dataHistoryTopUp = response?.body?.count ?? 0; } catch (e) { @@ -173,7 +192,7 @@ export class Transaction { const response = await http.get( `/transaction/history-deposit-profile?page=${this.page}&pageSize=${this.pageSize}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}` ); - console.log(response,'get data history Profile') + console.log(response, 'get data history Profile') this.dataHistoryTopUpProfile = response.body.data ?? []; this.total_dataHistoryTopUpProfile = response?.body?.count ?? 0; } catch (e) { @@ -192,9 +211,9 @@ export class Transaction { } async buyProduct(data) { - const response = await http.post("/transaction/order").send(data); - console.log(response,'dari store') - return response; + const response = await http.post("/transaction/order").send(data); + console.log(response, 'dari store') + return response; } async buyProd(data) { From 166e8ecde5f00107391dacbcef64606ca1ec775f Mon Sep 17 00:00:00 2001 From: rahman Date: Wed, 25 May 2022 01:24:18 +0700 Subject: [PATCH 35/36] fixing wording --- src/pages/Profile/Profile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js index 4ff74d0..28614d4 100644 --- a/src/pages/Profile/Profile.js +++ b/src/pages/Profile/Profile.js @@ -285,7 +285,7 @@ export const Profile = observer(() => { }).format(text), }, { - title: "Tagihan BPJS", + title: "Tagihan Postpaid", dataIndex: "amount", key: "amount", }, From e12b530e7dba7dd9a1dcd0edeeab0460f7c592c2 Mon Sep 17 00:00:00 2001 From: Fadli Date: Mon, 20 Jun 2022 13:53:14 +0700 Subject: [PATCH 36/36] - add code in detail user in role admin --- src/pages/Membership/DetailUser.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/Membership/DetailUser.js b/src/pages/Membership/DetailUser.js index cb08660..98ff298 100644 --- a/src/pages/Membership/DetailUser.js +++ b/src/pages/Membership/DetailUser.js @@ -445,6 +445,7 @@ export const DetailUser = observer(() => { onClick={() => { setInitialData({ id: store.membership.dataDetail.id, + code: store.membership.dataDetail.partner.code, name: store.membership.dataDetail.userDetail.name, username: store.membership.dataDetail.username, identity_number: @@ -558,6 +559,14 @@ export const DetailUser = observer(() => { {store.authentication.dataProfit.userDetail?.identity_number} + + Code + + + + {store.authentication.dataProfit.partner?.code} + + Status
+ {item.product_name} + {/* Harga Beli : {item.current_price_price} + */} + Harga Jual : {item.mark_up_price} + + { + history.push( + LINKS.PRODUCT_DETAIL.replace( + ":id", + item.product_id + ) + ); + }} + > + Detail + +
- - {item?.product_status === "ACTIVE" - ? " Tersedia" - : "Tidak"} - -
- - Markup Price :{" "} - {new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(item.mark_up_price)} - {" "} - - - Price:{" "} - {new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(item.price)} - {" "} - - - {" "} - Tanggal Berlaku : - {item.startDate - ? format( - parseISO(item.startDate), - "dd MMMM yyyy" - ) - : "-"} - {" "} - - - Tanggal Berakhir :{" "} - {item.endDate - ? format( - parseISO(item.endDate), - "dd MMMM yyyy" - ) - : "Sampai Sekarang"} - {" "} - -
{
- {item.product_name} - {/* Harga Beli : {item.current_price_price} +
+ {item.product_name} + {/* Harga Beli : {item.current_price_price} */} - Harga Jual : {item.mark_up_price} - - { - history.push( - LINKS.PRODUCT_DETAIL.replace( - ":id", - item.product_id - ) - ); - }} - > - Detail - -
- {store.supplier.data.map((item) => ( - - {item.name} - - ))} - - - )} + > + + {item?.product_status === "ACTIVE" + ? " Tersedia" + : "Tidak"} + +
+ + Pengirim : {item.sender_name} + {" "} + + + Amount :{" "} + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item.amount || 0)} + {" "} + + + Transaction Date :{" "} + {format( + parseISO(item.transaction_date), + "dd-MM-yyyy" + )} + {" "} + +