Merge branch 'develop' of https://gitlab.com/empatnusabangsa/ppob/ppob-frontend
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import {makeAutoObservable} from "mobx";
|
||||
import {http} from "../utils/http";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import { http } from "../utils/http";
|
||||
|
||||
export class Product {
|
||||
page = 0;
|
||||
pageSize = 10
|
||||
data = [];
|
||||
total_data = 0;
|
||||
total_data_partner=0;
|
||||
total_data_partner = 0;
|
||||
filterSupplier = null;
|
||||
filterSubCategory = null;
|
||||
visibleModalProduct = false;
|
||||
@@ -28,10 +28,11 @@ export class Product {
|
||||
totalDataPriceHistory = 0;
|
||||
pagePriceHistory = 0;
|
||||
pageProductPartner = 0;
|
||||
pageSizeProductPartner = 10
|
||||
pageSizePriceHistory = 10
|
||||
|
||||
dataDetailProduct = {};
|
||||
dataProductPartner=[]
|
||||
dataProductPartner = []
|
||||
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
@@ -54,6 +55,7 @@ export class Product {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async getDataSubCategories() {
|
||||
try {
|
||||
const response = await http.get(`/product/sub-categories?category=${this.filterCategory}&page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`);
|
||||
@@ -99,14 +101,27 @@ export class Product {
|
||||
}
|
||||
|
||||
async getProductPartner(id) {
|
||||
try {
|
||||
const response = await http.get(`/product/by-categories?page=${this.pageProductPartner}&pageSize=10&sub-category=${id}`);
|
||||
console.log(response)
|
||||
this.dataProductPartner = response.body.data
|
||||
this.total_data_partner= response?.body?.count ?? 0
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.log({ id });
|
||||
if (id === undefined) {
|
||||
try {
|
||||
const response = await http.get(`/product/by-categories?page=${this.pageProductPartner}&pageSize=${this.pageSizeProductPartner}&sub-category=`);
|
||||
console.log(response)
|
||||
this.dataProductPartner = response.body.data
|
||||
this.total_data_partner = response?.body?.count ?? 0
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
const response = await http.get(`/product/by-categories?page=${this.pageProductPartner}&pageSize=${this.pageSizeProductPartner}&sub-category=${id}`);
|
||||
console.log(response)
|
||||
this.dataProductPartner = response.body.data
|
||||
this.total_data_partner = response?.body?.count ?? 0
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async create(data) {
|
||||
|
||||
@@ -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,15 +133,31 @@ 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(
|
||||
`/transaction/history?page=${this.pageHistoryTransaction}&pageSize=${this.pageSizeHistoryTransaction}&start=${this.filterStart}&end=${this.filterEnd}`
|
||||
`/transaction/history?page=${this.page}&pageSize=${this.pageSize}&start=${this.filterStart}&end=${this.filterEnd}`
|
||||
);
|
||||
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) {
|
||||
@@ -158,9 +177,9 @@ 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')
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user