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 />
</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) && (
<Form.Item
name="password_account"
@ -289,7 +302,7 @@ export const PartnerComponent = observer((props) => {
</Form.Item>
<Form.Item
name="address"
label="address"
label="Address"
rules={[
idData
? { required: false }

View File

@ -1,11 +1,11 @@
import React, {useState} from "react";
import {Button, Form, Input, message, Modal, Space, Table, Tag} from "antd";
import {observer} from "mobx-react-lite";
import {ExclamationCircleOutlined} from "@ant-design/icons";
import {useHistory} from "react-router-dom";
import {useStore} from "../utils/useStore";
import {LINKS} from "../routes/app";
import {TopupsaldoModal} from "./TopupsaldoModal";
import React, { useState } from "react";
import { Button, Form, Input, message, Modal, Space, Table, Tag } from "antd";
import { observer } from "mobx-react-lite";
import { ExclamationCircleOutlined } from "@ant-design/icons";
import { useHistory } from "react-router-dom";
import { useStore } from "../utils/useStore";
import { LINKS } from "../routes/app";
import { TopupsaldoModal } from "./TopupsaldoModal";
export const SupplierComponent = observer((props) => {
const store = useStore();
@ -65,6 +65,11 @@ export const SupplierComponent = observer((props) => {
dataIndex: ["coa", "amount"],
key: ["coa", "amount"],
width: "20%",
render: (text, record) =>
new Intl.NumberFormat("id-ID", {
style: "currency",
currency: "IDR",
}).format(text),
},
{
title: "Status",
@ -74,7 +79,7 @@ export const SupplierComponent = observer((props) => {
render: (text, record) => (
<Tag
color={record?.status === true ? "processing" : "#E3E8EE"}
style={{color: "#4F566B"}}
style={{ color: "#4F566B" }}
>
{record?.status === true ? " ACTIVE" : "INACTIVE"}
</Tag>
@ -212,18 +217,18 @@ export const SupplierComponent = observer((props) => {
>
<Input />
</Form.Item>
{!idData &&
{!idData && (
<Form.Item
name="code"
label="Kode"
rules={[{required: true, message: "Please input kode!"}]}
rules={[{ required: true, message: "Please input kode!" }]}
>
<Input/>
<Input />
</Form.Item>
}
)}
</Form>
</Modal>
<TopupsaldoModal code={store.supplier.code}/>
<TopupsaldoModal code={store.supplier.code} />
</div>
);
});

View File

@ -209,7 +209,6 @@ export const Membership = observer(() => {
data.superior = true;
if (initialData.id) {
setInitialData({});
setConfirmLoading(true);
try {
await store.membership.update(initialData.id, data);
@ -229,7 +228,6 @@ export const Membership = observer(() => {
setConfirmLoading(false);
setVisibleModal(false);
} else {
setInitialData({});
setConfirmLoading(true);
try {
await store.membership.create(data);
@ -241,6 +239,7 @@ export const Membership = observer(() => {
}
setConfirmLoading(false);
setVisibleModal(false);
setInitialData({});
}
};

View File

@ -1,11 +1,11 @@
import React, {useEffect, useState} from "react";
import {useStore} from "../../utils/useStore";
import {Button, Card, Col, Input, Row, Select} from "antd";
import {observer} from "mobx-react-lite";
import {BuyProductModal} from "../../component/BuyProductModal";
import React, { useEffect, useState } from "react";
import { useStore } from "../../utils/useStore";
import { Button, Card, Col, Input, Row, Select } from "antd";
import { observer } from "mobx-react-lite";
import { BuyProductModal } from "../../component/BuyProductModal";
const {Search} = Input;
const {Option} = Select;
const { Search } = Input;
const { Option } = Select;
export const Product = observer(() => {
const store = useStore();
@ -31,31 +31,33 @@ export const Product = observer(() => {
// data
useEffect(() => {
console.log('⚡ transaction data store', store.transaction.data)
setProductData(store.transaction.data)
}, [store.transaction.data])
console.log("⚡ transaction data store", store.transaction.data);
setProductData(store.transaction.data);
}, [store.transaction.data]);
// Subcategory
useEffect(() => {
console.log('⚡ transaction subcategory store', store.transaction.dataSubCategories)
}, [store.transaction.dataSubCategories])
console.log(
"⚡ transaction subcategory store",
store.transaction.dataSubCategories
);
}, [store.transaction.dataSubCategories]);
const handleChangeSubcategory = async (item) => {
console.log('item', 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"}}>
<span style={{ fontWeight: "bold", marginBottom: "10px" }}>
Sub Category
</span>
</Row>
@ -66,10 +68,11 @@ export const Product = observer(() => {
allowClear={true}
onChange={(val) => {
if (val) {
handleChangeSubcategory(val)
handleChangeSubcategory(val);
}
}}
style={{marginBottom: "10px", width: "100%"}}>
style={{ marginBottom: "10px", width: "100%" }}
>
{store.transaction.dataSubCategories.map((item, index) => (
<Option key={item.id} value={item.id}>
{item.name}
@ -78,34 +81,49 @@ export const Product = observer(() => {
</Select>
</Col>
</Row>
<Row justify={"center"} align={"center"} style={{marginBottom: "1rem"}}>
<Col span={12} style={{fontWeight: "bold", display: "flex", alignItems: "center"}}>
<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"}}>
<Col span={12} style={{ textAlign: "right" }}>
<Search
placeholder="input search text"
style={{width: 200, marginRight: 10}}
style={{ width: 200, marginRight: 10 }}
/>
</Col>
</Row>
{productData.length != 0 && <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
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"}}>
</Row>
)}
{productData.length !== 0 && (
<Col style={{ textAlign: "right" }}>
<Button style={{ backgroundColor: "#2D9CDB", color: "white" }}>
Beli Sekarang
</Button>
</Col>}
<BuyProductModal initialData={data}/>
</Col>
)}
<BuyProductModal initialData={data} />
</div>
);
});

View File

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