fix: add membership owner
This commit is contained in:
parent
068444fb07
commit
4f82f9d978
|
@ -257,6 +257,19 @@ export const PartnerComponent = observer((props) => {
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
{!idData && (
|
||||||
|
<Form.Item
|
||||||
|
name="owner"
|
||||||
|
label="Owner"
|
||||||
|
rules={[
|
||||||
|
idData
|
||||||
|
? { required: false }
|
||||||
|
: { required: true, message: "Please input password owner!" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
{((idData && isChangePassword) || !idData) && (
|
{((idData && isChangePassword) || !idData) && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="password_account"
|
name="password_account"
|
||||||
|
@ -289,7 +302,7 @@ export const PartnerComponent = observer((props) => {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="address"
|
name="address"
|
||||||
label="address"
|
label="Address"
|
||||||
rules={[
|
rules={[
|
||||||
idData
|
idData
|
||||||
? { required: false }
|
? { required: false }
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import React, {useState} from "react";
|
import React, { useState } from "react";
|
||||||
import {Button, Form, Input, message, Modal, Space, Table, Tag} from "antd";
|
import { Button, Form, Input, message, Modal, Space, Table, Tag } from "antd";
|
||||||
import {observer} from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import {ExclamationCircleOutlined} from "@ant-design/icons";
|
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
||||||
import {useHistory} from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import {useStore} from "../utils/useStore";
|
import { useStore } from "../utils/useStore";
|
||||||
import {LINKS} from "../routes/app";
|
import { LINKS } from "../routes/app";
|
||||||
import {TopupsaldoModal} from "./TopupsaldoModal";
|
import { TopupsaldoModal } from "./TopupsaldoModal";
|
||||||
|
|
||||||
export const SupplierComponent = observer((props) => {
|
export const SupplierComponent = observer((props) => {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
@ -65,6 +65,11 @@ export const SupplierComponent = observer((props) => {
|
||||||
dataIndex: ["coa", "amount"],
|
dataIndex: ["coa", "amount"],
|
||||||
key: ["coa", "amount"],
|
key: ["coa", "amount"],
|
||||||
width: "20%",
|
width: "20%",
|
||||||
|
render: (text, record) =>
|
||||||
|
new Intl.NumberFormat("id-ID", {
|
||||||
|
style: "currency",
|
||||||
|
currency: "IDR",
|
||||||
|
}).format(text),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Status",
|
title: "Status",
|
||||||
|
@ -72,12 +77,12 @@ export const SupplierComponent = observer((props) => {
|
||||||
key: "status",
|
key: "status",
|
||||||
width: "5%",
|
width: "5%",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Tag
|
<Tag
|
||||||
color={record?.status === true ? "processing" : "#E3E8EE"}
|
color={record?.status === true ? "processing" : "#E3E8EE"}
|
||||||
style={{color: "#4F566B"}}
|
style={{ color: "#4F566B" }}
|
||||||
>
|
>
|
||||||
{record?.status === true ? " ACTIVE" : "INACTIVE"}
|
{record?.status === true ? " ACTIVE" : "INACTIVE"}
|
||||||
</Tag>
|
</Tag>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -85,15 +90,15 @@ export const SupplierComponent = observer((props) => {
|
||||||
key: "action",
|
key: "action",
|
||||||
width: "20%",
|
width: "20%",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Space size="middle">
|
<Space size="middle">
|
||||||
<Button
|
<Button
|
||||||
type={record?.status === true ? "danger" : "primary"}
|
type={record?.status === true ? "danger" : "primary"}
|
||||||
onClick={() => changeStatus(record?.id, record?.status)}
|
onClick={() => changeStatus(record?.id, record?.status)}
|
||||||
>
|
>
|
||||||
{record?.status === true ? "INACTIVE" : "ACTIVE"}
|
{record?.status === true ? "INACTIVE" : "ACTIVE"}
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={() => handleTopup(record)}> Top Up Saldo</Button>
|
<Button onClick={() => handleTopup(record)}> Top Up Saldo</Button>
|
||||||
<Button onClick={() => handleEditButton(record)}>Edit</Button>
|
<Button onClick={() => handleEditButton(record)}>Edit</Button>
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
@ -212,18 +217,18 @@ export const SupplierComponent = observer((props) => {
|
||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{!idData &&
|
{!idData && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="code"
|
name="code"
|
||||||
label="Kode"
|
label="Kode"
|
||||||
rules={[{required: true, message: "Please input kode!"}]}
|
rules={[{ required: true, message: "Please input kode!" }]}
|
||||||
>
|
>
|
||||||
<Input/>
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
}
|
)}
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
<TopupsaldoModal code={store.supplier.code}/>
|
<TopupsaldoModal code={store.supplier.code} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -209,7 +209,6 @@ export const Membership = observer(() => {
|
||||||
data.superior = true;
|
data.superior = true;
|
||||||
|
|
||||||
if (initialData.id) {
|
if (initialData.id) {
|
||||||
setInitialData({});
|
|
||||||
setConfirmLoading(true);
|
setConfirmLoading(true);
|
||||||
try {
|
try {
|
||||||
await store.membership.update(initialData.id, data);
|
await store.membership.update(initialData.id, data);
|
||||||
|
@ -229,7 +228,6 @@ export const Membership = observer(() => {
|
||||||
setConfirmLoading(false);
|
setConfirmLoading(false);
|
||||||
setVisibleModal(false);
|
setVisibleModal(false);
|
||||||
} else {
|
} else {
|
||||||
setInitialData({});
|
|
||||||
setConfirmLoading(true);
|
setConfirmLoading(true);
|
||||||
try {
|
try {
|
||||||
await store.membership.create(data);
|
await store.membership.create(data);
|
||||||
|
@ -241,6 +239,7 @@ export const Membership = observer(() => {
|
||||||
}
|
}
|
||||||
setConfirmLoading(false);
|
setConfirmLoading(false);
|
||||||
setVisibleModal(false);
|
setVisibleModal(false);
|
||||||
|
setInitialData({});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,111 +1,129 @@
|
||||||
import React, {useEffect, useState} from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import {useStore} from "../../utils/useStore";
|
import { useStore } from "../../utils/useStore";
|
||||||
import {Button, Card, Col, Input, Row, Select} from "antd";
|
import { Button, Card, Col, Input, Row, Select } from "antd";
|
||||||
import {observer} from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import {BuyProductModal} from "../../component/BuyProductModal";
|
import { BuyProductModal } from "../../component/BuyProductModal";
|
||||||
|
|
||||||
const {Search} = Input;
|
const { Search } = Input;
|
||||||
const {Option} = Select;
|
const { Option } = Select;
|
||||||
|
|
||||||
export const Product = observer(() => {
|
export const Product = observer(() => {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [productData, setProductData] = useState([]);
|
const [productData, setProductData] = useState([]);
|
||||||
const [data, setData] = useState({});
|
const [data, setData] = useState({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
await store.transaction.getDataSubCategories();
|
await store.transaction.getDataSubCategories();
|
||||||
await store.transaction.getDataCategories();
|
await store.transaction.getDataCategories();
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// data
|
// data
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('⚡ transaction data store', store.transaction.data)
|
console.log("⚡ transaction data store", store.transaction.data);
|
||||||
setProductData(store.transaction.data)
|
setProductData(store.transaction.data);
|
||||||
}, [store.transaction.data])
|
}, [store.transaction.data]);
|
||||||
|
|
||||||
// Subcategory
|
// Subcategory
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('⚡ transaction subcategory store', store.transaction.dataSubCategories)
|
console.log(
|
||||||
}, [store.transaction.dataSubCategories])
|
"⚡ transaction subcategory store",
|
||||||
|
store.transaction.dataSubCategories
|
||||||
|
|
||||||
const handleChangeSubcategory = async (item) => {
|
|
||||||
console.log('item', item);
|
|
||||||
store.transaction.filterSubCategory = item;
|
|
||||||
await store.transaction.getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleBuyProduct = (data) => {
|
|
||||||
setData(data);
|
|
||||||
store.transaction.visibleModalTransaction = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<Row>
|
|
||||||
<span style={{fontWeight: "bold", marginBottom: "10px"}}>
|
|
||||||
Sub Category
|
|
||||||
</span>
|
|
||||||
</Row>
|
|
||||||
<Row>
|
|
||||||
<Col span={24}>
|
|
||||||
<Select
|
|
||||||
placeholder={"Select Sub Category"}
|
|
||||||
allowClear={true}
|
|
||||||
onChange={(val) => {
|
|
||||||
if (val) {
|
|
||||||
handleChangeSubcategory(val)
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
style={{marginBottom: "10px", width: "100%"}}>
|
|
||||||
{store.transaction.dataSubCategories.map((item, index) => (
|
|
||||||
<Option key={item.id} value={item.id}>
|
|
||||||
{item.name}
|
|
||||||
</Option>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
<Row justify={"center"} align={"center"} style={{marginBottom: "1rem"}}>
|
|
||||||
<Col span={12} style={{fontWeight: "bold", display: "flex", alignItems: "center"}}>
|
|
||||||
Produk & Nominal
|
|
||||||
</Col>
|
|
||||||
<Col span={12} style={{textAlign: "right"}}>
|
|
||||||
<Search
|
|
||||||
placeholder="input search text"
|
|
||||||
style={{width: 200, marginRight: 10}}
|
|
||||||
/>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
{productData.length != 0 && <Row>
|
|
||||||
{productData.map((item, index) => (
|
|
||||||
<Col key={index} xs={24} md={16} lg={8}>
|
|
||||||
<Card onClick={() => handleBuyProduct(item)} style={{cursor: "pointer"}}>
|
|
||||||
<span style={{color: "black"}}>{item.name}</span>
|
|
||||||
<br/>
|
|
||||||
<span style={{color: "grey", fontSize: 10}}>{item?.currentPrice?.mark_up_price}</span>
|
|
||||||
</Card>
|
|
||||||
</Col>
|
|
||||||
))}
|
|
||||||
</Row>}
|
|
||||||
{productData.length != 0 && <Col style={{textAlign: "right"}}>
|
|
||||||
<Button style={{backgroundColor: "#2D9CDB", color: "white"}}>
|
|
||||||
Beli Sekarang
|
|
||||||
</Button>
|
|
||||||
</Col>}
|
|
||||||
<BuyProductModal initialData={data}/>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
|
}, [store.transaction.dataSubCategories]);
|
||||||
|
|
||||||
|
const handleChangeSubcategory = async (item) => {
|
||||||
|
console.log("item", item);
|
||||||
|
store.transaction.filterSubCategory = item;
|
||||||
|
await store.transaction.getData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleBuyProduct = (data) => {
|
||||||
|
setData(data);
|
||||||
|
store.transaction.visibleModalTransaction = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Row>
|
||||||
|
<span style={{ fontWeight: "bold", marginBottom: "10px" }}>
|
||||||
|
Sub Category
|
||||||
|
</span>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col span={24}>
|
||||||
|
<Select
|
||||||
|
placeholder={"Select Sub Category"}
|
||||||
|
allowClear={true}
|
||||||
|
onChange={(val) => {
|
||||||
|
if (val) {
|
||||||
|
handleChangeSubcategory(val);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
style={{ marginBottom: "10px", width: "100%" }}
|
||||||
|
>
|
||||||
|
{store.transaction.dataSubCategories.map((item, index) => (
|
||||||
|
<Option key={item.id} value={item.id}>
|
||||||
|
{item.name}
|
||||||
|
</Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row justify={"center"} align={"center"} style={{ marginBottom: "1rem" }}>
|
||||||
|
<Col
|
||||||
|
span={12}
|
||||||
|
style={{ fontWeight: "bold", display: "flex", alignItems: "center" }}
|
||||||
|
>
|
||||||
|
Produk & Nominal
|
||||||
|
</Col>
|
||||||
|
<Col span={12} style={{ textAlign: "right" }}>
|
||||||
|
<Search
|
||||||
|
placeholder="input search text"
|
||||||
|
style={{ width: 200, marginRight: 10 }}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
{productData.length != 0 && (
|
||||||
|
<Row>
|
||||||
|
{productData.map((item, index) => (
|
||||||
|
<Col key={index} xs={24} md={16} lg={8}>
|
||||||
|
<Card
|
||||||
|
onClick={() => handleBuyProduct(item)}
|
||||||
|
style={{ cursor: "pointer" }}
|
||||||
|
>
|
||||||
|
<span style={{ color: "black" }}>{item.name}</span>
|
||||||
|
<br />
|
||||||
|
<span style={{ color: "grey", fontSize: 10 }}>
|
||||||
|
{new Intl.NumberFormat("id-ID", {
|
||||||
|
style: "currency",
|
||||||
|
currency: "IDR",
|
||||||
|
}).format(item?.currentPrice?.mark_up_price)}
|
||||||
|
</span>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
))}
|
||||||
|
</Row>
|
||||||
|
)}
|
||||||
|
{productData.length !== 0 && (
|
||||||
|
<Col style={{ textAlign: "right" }}>
|
||||||
|
<Button style={{ backgroundColor: "#2D9CDB", color: "white" }}>
|
||||||
|
Beli Sekarang
|
||||||
|
</Button>
|
||||||
|
</Col>
|
||||||
|
)}
|
||||||
|
<BuyProductModal initialData={data} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@ export class UI {
|
||||||
}
|
}
|
||||||
|
|
||||||
setTestValue() {
|
setTestValue() {
|
||||||
this.testValue = "yo dayo";
|
this.testValue = "yoshahhh #!";
|
||||||
}
|
}
|
||||||
|
|
||||||
setMediaQuery(data) {
|
setMediaQuery(data) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user