fix: add membership owner

This commit is contained in:
rarsyansyahr 2021-12-17 06:01:12 +07:00
parent 068444fb07
commit 4f82f9d978
5 changed files with 173 additions and 138 deletions

View File

@ -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 }

View File

@ -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",
@ -212,7 +217,7 @@ 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"
@ -220,7 +225,7 @@ export const SupplierComponent = observer((props) => {
> >
<Input /> <Input />
</Form.Item> </Form.Item>
} )}
</Form> </Form>
</Modal> </Modal>
<TopupsaldoModal code={store.supplier.code} /> <TopupsaldoModal code={store.supplier.code} />

View File

@ -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({});
} }
}; };

View File

@ -31,26 +31,28 @@ export const Product = observer(() => {
// 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
);
}, [store.transaction.dataSubCategories]);
const handleChangeSubcategory = async (item) => { const handleChangeSubcategory = async (item) => {
console.log('item', item); console.log("item", item);
store.transaction.filterSubCategory = item; store.transaction.filterSubCategory = item;
await store.transaction.getData(); await store.transaction.getData();
} };
const handleBuyProduct = (data) => { const handleBuyProduct = (data) => {
setData(data); setData(data);
store.transaction.visibleModalTransaction = true; store.transaction.visibleModalTransaction = true;
} };
return ( return (
<div> <div>
@ -66,10 +68,11 @@ export const Product = observer(() => {
allowClear={true} allowClear={true}
onChange={(val) => { onChange={(val) => {
if (val) { if (val) {
handleChangeSubcategory(val) handleChangeSubcategory(val);
} }
}} }}
style={{marginBottom: "10px", width: "100%"}}> style={{ marginBottom: "10px", width: "100%" }}
>
{store.transaction.dataSubCategories.map((item, index) => ( {store.transaction.dataSubCategories.map((item, index) => (
<Option key={item.id} value={item.id}> <Option key={item.id} value={item.id}>
{item.name} {item.name}
@ -79,7 +82,10 @@ export const Product = observer(() => {
</Col> </Col>
</Row> </Row>
<Row justify={"center"} align={"center"} style={{ marginBottom: "1rem" }}> <Row justify={"center"} align={"center"} style={{ marginBottom: "1rem" }}>
<Col span={12} style={{fontWeight: "bold", display: "flex", alignItems: "center"}}> <Col
span={12}
style={{ fontWeight: "bold", display: "flex", alignItems: "center" }}
>
Produk & Nominal Produk & Nominal
</Col> </Col>
<Col span={12} style={{ textAlign: "right" }}> <Col span={12} style={{ textAlign: "right" }}>
@ -89,22 +95,34 @@ export const Product = observer(() => {
/> />
</Col> </Col>
</Row> </Row>
{productData.length != 0 && <Row> {productData.length != 0 && (
<Row>
{productData.map((item, index) => ( {productData.map((item, index) => (
<Col key={index} xs={24} md={16} lg={8}> <Col key={index} xs={24} md={16} lg={8}>
<Card onClick={() => handleBuyProduct(item)} style={{cursor: "pointer"}}> <Card
onClick={() => handleBuyProduct(item)}
style={{ cursor: "pointer" }}
>
<span style={{ color: "black" }}>{item.name}</span> <span style={{ color: "black" }}>{item.name}</span>
<br /> <br />
<span style={{color: "grey", fontSize: 10}}>{item?.currentPrice?.mark_up_price}</span> <span style={{ color: "grey", fontSize: 10 }}>
{new Intl.NumberFormat("id-ID", {
style: "currency",
currency: "IDR",
}).format(item?.currentPrice?.mark_up_price)}
</span>
</Card> </Card>
</Col> </Col>
))} ))}
</Row>} </Row>
{productData.length != 0 && <Col style={{textAlign: "right"}}> )}
{productData.length !== 0 && (
<Col style={{ textAlign: "right" }}>
<Button style={{ backgroundColor: "#2D9CDB", color: "white" }}> <Button style={{ backgroundColor: "#2D9CDB", color: "white" }}>
Beli Sekarang Beli Sekarang
</Button> </Button>
</Col>} </Col>
)}
<BuyProductModal initialData={data} /> <BuyProductModal initialData={data} />
</div> </div>
); );

View File

@ -13,7 +13,7 @@ export class UI {
} }
setTestValue() { setTestValue() {
this.testValue = "yo dayo"; this.testValue = "yoshahhh #!";
} }
setMediaQuery(data) { setMediaQuery(data) {