-
- {store.authentication.userData.role === "Admin" ?
- `
+
+
+
+ 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"}
- {" "}
-
-
-
-
- }
- />
- {/*
+ {" "}
+
+
+ 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"}
+ {" "}
+
+
+
+
+ }
+ />
+ {/* */}
-
-
-
- );
- }}
- />
- )}
-
-
-
-
-
-
+
+
+
+ );
+ }}
+ />
+ )}
+
+
+
+
+
+
);
});
diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js
index 916877a..62b46e8 100644
--- a/src/pages/Profile/Profile.js
+++ b/src/pages/Profile/Profile.js
@@ -34,16 +34,12 @@ const { RangePicker } = DatePicker;
export const Profile = observer(() => {
const store = useStore();
const [form] = Form.useForm();
- const [formFilterByTrxCode] = Form.useForm();
const [formExport] = Form.useForm();
const { id } = useParams();
const modalLoader = useContext(ModalLoaderContext);
const [filterStart, setFilterStart] = useState([]);
const [filterEnd, setFilterEnd] = useState([]);
- const [filterTrxId, setFilterTrxId] = useState([]);
- const [filterPartnerTrxId, setFilterPartnerTrxId] = useState([]);
const [actionFilter, setAction] = useState(false);
- const [actionFilterByCode, setActionFilterByCode] = useState(false);
const [visible, setVisible] = useState(false);
const [modalExport, setModalExport] = useState(false);
@@ -97,21 +93,6 @@ export const Profile = observer(() => {
setAction(false);
};
- const handleRemoveFilterByTrxId = async () => {
- store.transaction.filterStart = null;
- store.transaction.filterEnd = null;
- store.transaction.filterTrxId = null;
- store.transaction.filterPartnerTrxId = null;
- formFilterByTrxCode.resetFields();
- setFilterStart([]);
- setFilterEnd([]);
- setFilterTrxId([]);
- setFilterPartnerTrxId([]);
- store.transaction.visibleModalFilterTransactionByCode = false;
- setActionFilterByCode(false);
- await store.transaction.getDataHistoryTransaction();
- };
-
const handleCancelFilter = async () => {
store.transaction.filterStart = null;
//form.resetFields();
@@ -126,16 +107,6 @@ export const Profile = observer(() => {
//await store.transaction.getDataHistoryTransaction();
};
- const handleCancelFilterByTrxId = async () => {
- store.transaction.filterStart = null;
- store.transaction.filterEnd = null;
- store.transaction.filterTrxId = null;
- store.transaction.filterPartnerTrxId = null;
- store.transaction.visibleModalFilterTransactionByCode = false;
-
- setActionFilterByCode(false);
- };
-
const handleSubmitFilter = async () => {
const data = form.getFieldsValue();
store.transaction.filterStart = moment(data.start_date).format(
@@ -158,19 +129,6 @@ export const Profile = observer(() => {
setAction(false);
};
- const handleSubmitFilterByTrxId = async (data) => {
- store.transaction.filterStart = null
- store.transaction.filterEnd = null
- store.transaction.filterTrxId = data.trx_id == undefined || data.trx_id == '' ? null : data.trx_id
- store.transaction.filterPartnerTrxId = data.partner_trx_id == undefined || data.partner_trx_id == '' ? null : data.partner_trx_id
- modalLoader.setLoading(true);
-
- modalLoader.setLoading(false);
- store.transaction.visibleModalFilterTransactionByCode = false;
- setActionFilterByCode(false);
- await store.transaction.getDataHistoryTransaction();
- };
-
const footerLayoutFilter = [
,
];
-
- const footerLayoutFilterByTrxId = [
- ,
- ,
- ,
- ];
-
const columns = [
{
title: "Nama Produk",
@@ -313,7 +238,7 @@ export const Profile = observer(() => {
render: (text, record) => {
return (
- {moment(new Date (record.created_at).toISOString().slice(0, -1)).format("MM-DD-YYYY HH:mm:ss")}
+ {moment(new Date (record.created_at).toISOString().replace('Z', ' ').replace('T', ' ')).format("MM-DD-YYYY HH:mm:ss")}
);
},
@@ -348,7 +273,7 @@ export const Profile = observer(() => {
render: (text, record) => {
return (
- {moment(new Date (record.transaction_date).toISOString().slice(0, -1)).format("DD MMMM YYYY HH:mm:ss")}
+ {format(parseISO(record.transaction_date), "dd MMMM yyyy HH:mm:ss")}
);
},
@@ -464,8 +389,7 @@ export const Profile = observer(() => {
const handleSubmitExport = async () => {
const date = formExport.getFieldsValue();
const dataDate ={
- dateStart: moment(date.start_date).format("YYYY-MM-DD"),
- dateEnd: moment(date.end_date).format("YYYY-MM-DD")
+ dateStart: moment(date.tanggal_export).format("YYYY-MM-DD")
}
modalLoader.setLoading(true);
try {
@@ -676,16 +600,16 @@ export const Profile = observer(() => {
dataSource={store.transaction.dataHistoryTopUpProfile}
bordered
pagination={{
- pageSize: store.transaction.pageSizeHistoryTopUpProfile,
+ pageSize: store.transaction.pageSize,
total: store.transaction.total_dataHistoryTopUpProfile,
- current: store.transaction.pageHistoryTopUpProfile + 1,
+ current: store.transaction.page + 1,
showSizeChanger: true,
simple: false,
}}
onChange={async (page) => {
let pageNumber = page.current;
- store.transaction.pageSizeHistoryTopUpProfile = page.pageSize;
- store.transaction.pageHistoryTopUpProfile = pageNumber - 1;
+ store.transaction.pageSize = page.pageSize;
+ store.transaction.page = pageNumber - 1;
modalLoader.setLoading(true);
await store.transaction.getDataHistoryTopUpProfile(
store.authentication.profileData?.id
@@ -704,17 +628,17 @@ export const Profile = observer(() => {
onChange: async (page, pageSize) => {
console.log(page, "Page");
console.log(pageSize, "Page size");
- store.transaction.pageSizeHistoryTopUpProfile = pageSize;
- store.transaction.pageHistoryTopUpProfile = page - 1;
+ store.transaction.pageSize = pageSize;
+ store.transaction.page = page - 1;
modalLoader.setLoading(true);
await store.transaction.getDataHistoryTopUpProfile(
store.authentication.profileData?.id
);
modalLoader.setLoading(false);
},
- pageSize: store.transaction.pageSizeHistoryTopUpProfile,
+ pageSize: store.transaction.pageSize,
total: store.transaction.total_dataHistoryTopUpProfile,
- current: store.transaction.pageHistoryTopUpProfile + 1,
+ current: store.transaction.page + 1,
style: { marginBottom: "1rem", marginRight: "1rem" },
}}
style={{ padding: 0 }}
@@ -753,7 +677,10 @@ export const Profile = observer(() => {
Transaction Date :{" "}
- {moment(new Date (item.transaction_date).toISOString().slice(0, -1)).format("DD MMMM YYYY")}
+ {format(
+ parseISO(item.transaction_date),
+ "dd-MM-yyyy"
+ )}
{" "}
@@ -780,18 +707,6 @@ export const Profile = observer(() => {
Filter
-
-
{store.ui.mediaQuery.isDesktop && (
{
Transaction Date :{" "}
- {moment(new Date (item.created_at).toISOString().slice(0, -1)).format("MM-DD-YYYY HH:mm:ss")}
+ {format(
+ parseISO(item.created_at),
+ "dd-MM-yyyy"
+ )}
{" "}
@@ -938,16 +856,16 @@ export const Profile = observer(() => {
dataSource={store.transaction.dataHistorybillProfile}
bordered
pagination={{
- pageSize: store.transaction.pageSizeHistorybillProfile,
+ pageSize: store.transaction.pageSize,
total: store.transaction.total_dataHistorybillProfile,
- current: store.transaction.pageHistorybillProfile + 1,
+ current: store.transaction.page + 1,
showSizeChanger: true,
simple: false,
}}
onChange={async (page) => {
let pageNumber = page.current;
- store.transaction.pageSizeHistorybillProfile = page.pageSize;
- store.transaction.pageHistorybillProfile = pageNumber - 1;
+ store.transaction.pageSize = page.pageSize;
+ store.transaction.page = pageNumber - 1;
modalLoader.setLoading(true);
await store.transaction.getDataHistoryCheckBill();
modalLoader.setLoading(false);
@@ -964,15 +882,15 @@ export const Profile = observer(() => {
onChange: async (page, pageSize) => {
console.log(page, "Page");
console.log(pageSize, "Page size");
- store.transaction.pageSizeHistorybillProfile = pageSize;
- store.transaction.pageHistorybillProfile = page - 1;
+ store.transaction.pageSize = pageSize;
+ store.transaction.page = page - 1;
modalLoader.setLoading(true);
await store.transaction.getDataHistoryCheckBill();
modalLoader.setLoading(false);
},
- pageSize: store.transaction.pageSizeHistorybillProfile,
+ pageSize: store.transaction.pageSize,
total: store.transaction.total_dataHistorybillProfile,
- current: store.transaction.pageHistorybillProfile + 1,
+ current: store.transaction.page + 1,
style: { marginBottom: "1rem", marginRight: "1rem" },
}}
style={{ padding: 0 }}
@@ -1011,7 +929,10 @@ export const Profile = observer(() => {
Transaction Date :{" "}
- { moment(new Date (item.created_at).toISOString().slice(0, -1)).format("MM-DD-YYYY dd-MM-yyyy") }
+ {format(
+ parseISO(item.transaction_date),
+ "dd-MM-yyyy"
+ )}
{" "}
@@ -1069,44 +990,6 @@ export const Profile = observer(() => {
- {
- //form.resetFields();
- store.transaction.filterStart = null;
- store.transaction.filterEnd = null;
- store.transaction.filterTrxId = null;
- store.transaction.filterPartnerTrxId = null;
- store.transaction.visibleModalFilterTransactionByCode = false;
- actionFilterByCode === true
- ? await store.transaction.getDataHistoryTopUpProfile(
- store.authentication.profileData?.id
- )
- : await store.transaction.getDataHistoryTransaction();
- }}
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
{
-
-
-
-
diff --git a/src/store/membership.js b/src/store/membership.js
index 03ed3e7..fda2a67 100644
--- a/src/store/membership.js
+++ b/src/store/membership.js
@@ -5,7 +5,6 @@ export class Membership {
page = 0;
pageSize = 10
data = [];
- dataFilterMembership = [];
total_data = 0;
dataTotal=0;
@@ -45,26 +44,6 @@ export class Membership {
}
}
- async getDataFilter() {
- try {
- const response = await http.get(`/users?page=${this.page}&pageSize=1000&superior=${this.filterMembership}&type=${this.filterPartner}`);
- this.dataFilterMembership = response.body.data ?? []
- this.dataFilterMembership = response.body.data.map((item, idx) => {
- item.key = idx;
- item.name = item?.user_detail?.name;
- item.username = item?.username
- item.phone_number = item?.user_detail?.phone_number;
- item.roleId = item?.roles.id;
- item.roleName = item?.roles.name;
- return item
- }) ?? []
-
- console.log(this.dataTotal)
- } catch (e) {
- console.error(e);
- }
- }
-
async getDetail(id) {
try {
const response = await http.get(`/users/`+id);
@@ -74,7 +53,7 @@ export class Membership {
console.error(e);
}
}
-
+
async getDataBySuperior() {
try {
const response = await http.get(`/users/find-by-supperior?page=${this.page}&pageSize=${this.pageSize}`);
diff --git a/src/store/transaction.js b/src/store/transaction.js
index 1e4cce5..1ac8c0a 100644
--- a/src/store/transaction.js
+++ b/src/store/transaction.js
@@ -46,13 +46,9 @@ export class Transaction {
dataHistoryTopUp = [];
total_dataHistoryTopUp = 0;
- pageHistorybillProfile = 0;
- pageSizeHistorybillProfile = 10;
dataHistorybillProfile = [];
total_dataHistorybillProfile = 0;
- pageHistoryTopUpProfile = 0;
- pageSizeHistoryTopUpProfile = 10;
dataHistoryTopUpProfile = [];
total_dataHistoryTopUpProfile = 0;
@@ -64,11 +60,8 @@ export class Transaction {
//filter
visibleModalFilterTransaction = false;
- visibleModalFilterTransactionByCode = false;
filterStart = null;
filterEnd = null;
- filterTrxId = null;
- filterPartnerTrxId = null;
filterStartDetailUser = null;
filterEndDetailUser = null;
constructor(ctx) {
@@ -148,12 +141,12 @@ 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.pageHistorybillProfile}&pageSize=${this.pageSizeHistorybillProfile}`
+ `/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;
@@ -166,7 +159,7 @@ export class Transaction {
async getDataHistoryTransaction() {
try {
const response = await http.get(
- `/transaction/history?page=${this.page}&pageSize=${this.pageSize}&start=${this.filterStart}&end=${this.filterEnd}&trxId=${this.filterTrxId}&partnerTrxId=${this.filterPartnerTrxId}`
+ `/transaction/history?page=${this.page}&pageSize=${this.pageSize}&start=${this.filterStart}&end=${this.filterEnd}`
);
console.log(response);
this.dataHistoryTransaction = response.body.data ?? [];
@@ -178,7 +171,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}&trxId=${this.filterTrxId}&partnerTrxId=${this.filterPartnerTrxId}`);
+ 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');
this.dataDetailHistoryTransactionDetailUser = response.body.data ?? [];
this.total_data = response?.body?.count ?? 0;
@@ -190,7 +183,7 @@ export class Transaction {
async getDataHistoryTopUp(id) {
try {
const response = await http.get(
- `/transaction/history-deposit?page=${this.pageHistoryTopUp}&pageSize=${this.pageSizeHistoryTopUp}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}`
+ `/transaction/history-deposit?page=${this.page}&pageSize=${this.pageSize}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}`
);
console.log(response, 'get data history')
this.dataHistoryTopUp = response.body.data ?? [];
@@ -203,7 +196,7 @@ export class Transaction {
async getDataHistoryTopUpProfile(id) {
try {
const response = await http.get(
- `/transaction/history-deposit-profile?page=${this.pageHistoryTopUpProfile}&pageSize=${this.pageSizeHistoryTopUpProfile}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}`
+ `/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')
this.dataHistoryTopUpProfile = response.body.data ?? [];
@@ -292,7 +285,7 @@ export class Transaction {
}).then((response) => {
var fileDownload = require('react-file-download');
message.success("Success export");
- fileDownload(response.data, `Mutasi Transaki ${data.userDetail.name} ${date.dateStart} - ${date.dateEnd}.xlsx`);
+ fileDownload(response.data, `Mutasi Transaki ${data.userDetail.name} ${date.dateStart}.xlsx`);
return fileDownload;
}).catch(function (error) {
message.error("No data to export");
@@ -303,27 +296,4 @@ export class Transaction {
console.error(e,':)')
}
}
-
- exportTransactionAll(data) {
- try {
- axios({
- url: appConfig.apiUrl + `/excel/history-user/export-all`,
- headers: {"Authorization" : `Bearer ${TokenUtil.accessToken}`},
- method: 'POST',
- data: data,
- responseType: 'blob'
- }).then((response) => {
- var fileDownload = require('react-file-download');
- message.success("Success export");
- fileDownload(response.data, `Mutasi Transaksi ${data.dateStart} - ${data.dateEnd}.xlsx`);
- return fileDownload;
- }).catch(function (error) {
- message.error("No data to export");
- return error;
- });
-
- } catch (e) {
- console.error(e,':)')
- }
- }
}