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

@ -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",
@ -74,7 +79,7 @@ export const SupplierComponent = observer((props) => {
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>
@ -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>
); );
}); });

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

@ -1,11 +1,11 @@
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();
@ -31,31 +31,33 @@ 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>
<Row> <Row>
<span style={{fontWeight: "bold", marginBottom: "10px"}}> <span style={{ fontWeight: "bold", marginBottom: "10px" }}>
Sub Category Sub Category
</span> </span>
</Row> </Row>
@ -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}
@ -78,34 +81,49 @@ export const Product = observer(() => {
</Select> </Select>
</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" }}>
<Search <Search
placeholder="input search text" placeholder="input search text"
style={{width: 200, marginRight: 10}} style={{ width: 200, marginRight: 10 }}
/> />
</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
<span style={{color: "black"}}>{item.name}</span> onClick={() => handleBuyProduct(item)}
<br/> style={{ cursor: "pointer" }}
<span style={{color: "grey", fontSize: 10}}>{item?.currentPrice?.mark_up_price}</span> >
<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> </Card>
</Col> </Col>
))} ))}
</Row>} </Row>
{productData.length != 0 && <Col style={{textAlign: "right"}}> )}
<Button style={{backgroundColor: "#2D9CDB", color: "white"}}> {productData.length !== 0 && (
<Col style={{ textAlign: "right" }}>
<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) {