Merge branch 'develop' into 'devops-staging'
Develop See merge request empatnusabangsa/ppob/ppob-frontend!57
This commit is contained in:
commit
ad60f5f1bb
|
@ -12,6 +12,7 @@ import {
|
||||||
List,
|
List,
|
||||||
Tag,
|
Tag,
|
||||||
Divider,
|
Divider,
|
||||||
|
Image,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import { BreadcumbComponent } from "../../component/BreadcumbComponent";
|
import { BreadcumbComponent } from "../../component/BreadcumbComponent";
|
||||||
import { LINKS } from "../../routes/app";
|
import { LINKS } from "../../routes/app";
|
||||||
|
@ -20,6 +21,7 @@ import { observer } from "mobx-react-lite";
|
||||||
import { format, parseISO } from "date-fns";
|
import { format, parseISO } from "date-fns";
|
||||||
import { ModalLoaderContext } from "../../utils/modal";
|
import { ModalLoaderContext } from "../../utils/modal";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { appConfig } from "../../config/app";
|
||||||
import { MembershipModal } from "./MembershipModal";
|
import { MembershipModal } from "./MembershipModal";
|
||||||
|
|
||||||
const { Title, Text } = Typography;
|
const { Title, Text } = Typography;
|
||||||
|
@ -83,8 +85,8 @@ export const DetailUser = observer(() => {
|
||||||
modalLoader.setLoading(false);
|
modalLoader.setLoading(false);
|
||||||
|
|
||||||
response?.body?.statusCode === 201 || response?.body?.statusCode === 200
|
response?.body?.statusCode === 201 || response?.body?.statusCode === 200
|
||||||
? message.success(`Success Withdraw Profit`)
|
? message.success(`Success Withdraw Profit`)
|
||||||
: message.error(`Failed Withdraw Profit`);
|
: message.error(`Failed Withdraw Profit`);
|
||||||
await getData();
|
await getData();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
modalLoader.setLoading(false);
|
modalLoader.setLoading(false);
|
||||||
|
@ -219,13 +221,18 @@ export const DetailUser = observer(() => {
|
||||||
key: "partner_transaction_code",
|
key: "partner_transaction_code",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Transaction Date",
|
title: "Tanggal Transaksi",
|
||||||
dataIndex: "created_at",
|
dataIndex: "created_at",
|
||||||
key: "created_at",
|
key: "created_at",
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return <Text>{format(parseISO(record.created_at), "dd-MM-yyyy")}</Text>;
|
return <Text>{format(parseISO(record.created_at), "dd-MM-yyyy")}</Text>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Alasan Gagal",
|
||||||
|
dataIndex: "failed_reason",
|
||||||
|
key: "failed_reason",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const routeData = [
|
const routeData = [
|
||||||
|
@ -327,11 +334,7 @@ export const DetailUser = observer(() => {
|
||||||
? "danger"
|
? "danger"
|
||||||
: "primary"
|
: "primary"
|
||||||
}
|
}
|
||||||
onClick={() =>
|
onClick={() => withdrawProfit(store.membership.dataDetail.id)}
|
||||||
withdrawProfit(
|
|
||||||
store.membership.dataDetail.id,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
Withdraw Profit
|
Withdraw Profit
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -343,42 +346,70 @@ export const DetailUser = observer(() => {
|
||||||
<Row style={{ marginBottom: 20 }}>
|
<Row style={{ marginBottom: 20 }}>
|
||||||
<Col lg={12} xs={24}>
|
<Col lg={12} xs={24}>
|
||||||
<Row>
|
<Row>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
<Text strong>Name</Text>
|
<Text strong>Name</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
<Text>{store.authentication.dataProfit.userDetail?.name}</Text>
|
<Text>{store.authentication.dataProfit.userDetail?.name}</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
<Text strong>Username</Text>
|
<Text strong>Username</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
<Text>{store.authentication.dataProfit.username}</Text>
|
<Text>{store.authentication.dataProfit.username}</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
<Text strong>Role</Text>
|
<Text strong>Role</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
<Text>{store.authentication.dataProfit.roles?.name}</Text>
|
<Text>{store.authentication.dataProfit.roles?.name}</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
<Text strong>Phone Number</Text>
|
<Text strong>Phone Number</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
<Text>
|
<Text>
|
||||||
{store.authentication.dataProfit.userDetail?.phone_number}
|
{store.authentication.dataProfit.userDetail?.phone_number}
|
||||||
</Text>
|
</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
|
<Text strong>Id Number</Text>
|
||||||
|
</Col>
|
||||||
|
<Col span={10}>
|
||||||
|
<Text>
|
||||||
|
{store.authentication.dataProfit.userDetail?.identity_number}
|
||||||
|
</Text>
|
||||||
|
</Col>
|
||||||
|
<Col span={10}>
|
||||||
<Text strong>Status</Text>
|
<Text strong>Status</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={10}>
|
||||||
<Text>
|
<Text>
|
||||||
{store.authentication.dataProfit.isActive === true
|
{store.authentication.dataProfit.isActive === true
|
||||||
? "Aktif"
|
? "Aktif"
|
||||||
: "Inaktif"}
|
: "Inaktif"}
|
||||||
</Text>
|
</Text>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col span={10}>
|
||||||
|
<Text strong>Image identity</Text>
|
||||||
|
</Col>
|
||||||
|
<Col span={10}>
|
||||||
|
<Text strong>Image Store</Text>
|
||||||
|
</Col>
|
||||||
|
<Col span={10}>
|
||||||
|
<Image
|
||||||
|
src={`${appConfig.apiUrl}/config/image/${store.authentication.dataProfit.userDetail?.image_identity}`}
|
||||||
|
style={{ width: "5vw" }}
|
||||||
|
alt={store.authentication.dataProfit.userDetail?.name}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={10}>
|
||||||
|
<Image
|
||||||
|
src={`${appConfig.apiUrl}/config/image/${store.authentication.dataProfit.userDetail?.image_store}`}
|
||||||
|
style={{ width: "5vw" }}
|
||||||
|
alt={store.authentication.dataProfit.userDetail?.name}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
<Col lg={12} xs={24}>
|
<Col lg={12} xs={24}>
|
||||||
|
@ -418,7 +449,7 @@ export const DetailUser = observer(() => {
|
||||||
style: "currency",
|
style: "currency",
|
||||||
currency: "IDR",
|
currency: "IDR",
|
||||||
}).format(
|
}).format(
|
||||||
store.authentication.dataProfit?.profit || 0
|
store.authentication.dataProfit?.profit || 0
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
|
@ -252,8 +252,7 @@ export const Membership = observer(() => {
|
||||||
name: <span style={{ fontWeight: "bold" }}>Keanggotaan</span>,
|
name: <span style={{ fontWeight: "bold" }}>Keanggotaan</span>,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const onSubmit = async (data, image, imageStore) => {
|
||||||
const onSubmit = async (data) => {
|
|
||||||
data.superior = true;
|
data.superior = true;
|
||||||
|
|
||||||
if (initialData.id) {
|
if (initialData.id) {
|
||||||
|
@ -283,14 +282,17 @@ export const Membership = observer(() => {
|
||||||
modalLoader.setLoading(true);
|
modalLoader.setLoading(true);
|
||||||
try {
|
try {
|
||||||
console.log(data, "data member");
|
console.log(data, "data member");
|
||||||
const response = await store.membership.create(data);
|
const request = {
|
||||||
|
...data,
|
||||||
|
image_identity: image,
|
||||||
|
image_store: imageStore,
|
||||||
|
};
|
||||||
|
const response = await store.membership.create(request);
|
||||||
response?.body?.statusCode === 201 || response?.body?.statusCode === 200
|
response?.body?.statusCode === 201 || response?.body?.statusCode === 200
|
||||||
? message.success(
|
? message.success(
|
||||||
response?.body?.message || "Berhasil Tambah Member Baru"
|
response?.body?.message || "Berhasil Tambah Member Baru"
|
||||||
)
|
)
|
||||||
: message.error(
|
: message.error(response?.body?.error || "Gagal Tambah Member Baru");
|
||||||
response?.body?.error || "Gagal Tambah Member Baru"
|
|
||||||
);
|
|
||||||
await getData();
|
await getData();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e, "apa errornya");
|
console.log(e, "apa errornya");
|
||||||
|
@ -302,7 +304,6 @@ export const Membership = observer(() => {
|
||||||
setInitialData({});
|
setInitialData({});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={["ppob-container"].join(" ")}>
|
<div className={["ppob-container"].join(" ")}>
|
||||||
<BreadcumbComponent data={routeData} />
|
<BreadcumbComponent data={routeData} />
|
||||||
|
@ -519,8 +520,8 @@ export const Membership = observer(() => {
|
||||||
visible={visibleModal}
|
visible={visibleModal}
|
||||||
confirmLoading={confirmLoading}
|
confirmLoading={confirmLoading}
|
||||||
initialData={initialData}
|
initialData={initialData}
|
||||||
onCreate={async (data) => {
|
onCreate={async (data,image,imageStore) => {
|
||||||
onSubmit(data);
|
onSubmit(data,image,imageStore);
|
||||||
}}
|
}}
|
||||||
onCancel={async () => {
|
onCancel={async () => {
|
||||||
setInitialData({});
|
setInitialData({});
|
||||||
|
|
|
@ -157,7 +157,7 @@ export const MembershipModal = ({
|
||||||
form
|
form
|
||||||
.validateFields()
|
.validateFields()
|
||||||
.then((values) => {
|
.then((values) => {
|
||||||
onCreate(values);
|
onCreate(values,responseFilename,responseFilenameStore);
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
})
|
})
|
||||||
.catch((info) => {
|
.catch((info) => {
|
||||||
|
@ -231,19 +231,71 @@ export const MembershipModal = ({
|
||||||
{((initialData.id && !initialData.isChangePassword) ||
|
{((initialData.id && !initialData.isChangePassword) ||
|
||||||
!initialData.id) &&
|
!initialData.id) &&
|
||||||
store.authentication.userData.role === "Admin" && (
|
store.authentication.userData.role === "Admin" && (
|
||||||
<Form.Item
|
<div>
|
||||||
name="roleId"
|
<Form.Item
|
||||||
label="Role"
|
name="identity_number"
|
||||||
rules={[{ required: true, message: "Please input role id!" }]}
|
label="Identity Number"
|
||||||
>
|
rules={[
|
||||||
<Select>
|
{
|
||||||
{store.role.data.map((item) => (
|
required: true,
|
||||||
<Option key={item.id} value={item.id}>
|
message: "Please input identity number!",
|
||||||
{item.name}
|
},
|
||||||
</Option>
|
{
|
||||||
))}
|
pattern: /^(?:\d*)$/,
|
||||||
</Select>
|
message: "Phone number should contain just number",
|
||||||
</Form.Item>
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
onChange={(value) => {
|
||||||
|
setValue(value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="Upload Identity Image" name="image_identity">
|
||||||
|
<div>
|
||||||
|
<Upload
|
||||||
|
listType="picture-card"
|
||||||
|
fileList={fileList}
|
||||||
|
onPreview={(file) => {
|
||||||
|
setPreviewImage(file.url || file.filename);
|
||||||
|
}}
|
||||||
|
showUploadList={true}
|
||||||
|
onChange={handleChange}
|
||||||
|
beforeUpload={(file) => beforeUpload(file)}
|
||||||
|
customRequest={(args) => uploadHandler(args)}
|
||||||
|
onRemove={(file) => {
|
||||||
|
setImage("");
|
||||||
|
setLoading(false);
|
||||||
|
setFileList([]);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{image === "" ? uploadButton : null}
|
||||||
|
</Upload>
|
||||||
|
<h5
|
||||||
|
style={{
|
||||||
|
marginTop: 12,
|
||||||
|
color: "rgba(0, 0, 0, 0.45)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Max size of file 2 MB
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name="roleId"
|
||||||
|
label="Role"
|
||||||
|
rules={[{ required: true, message: "Please input role id!" }]}
|
||||||
|
>
|
||||||
|
<Select>
|
||||||
|
{store.role.data.map((item) => (
|
||||||
|
<Option key={item.id} value={item.id}>
|
||||||
|
{item.name}
|
||||||
|
</Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
{((initialData.id && !initialData.isChangePassword) ||
|
{((initialData.id && !initialData.isChangePassword) ||
|
||||||
!initialData.id) &&
|
!initialData.id) &&
|
||||||
|
@ -269,10 +321,7 @@ export const MembershipModal = ({
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item label="Upload Identity Image" name="image_identity">
|
||||||
label="Upload Identity Image"
|
|
||||||
name="image_identity"
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<Upload
|
<Upload
|
||||||
listType="picture-card"
|
listType="picture-card"
|
||||||
|
@ -344,10 +393,7 @@ export const MembershipModal = ({
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{/* <Row>
|
{/* <Row>
|
||||||
<Col> */}
|
<Col> */}
|
||||||
<Form.Item
|
<Form.Item label="Upload Identity Image" name="image_identity">
|
||||||
label="Upload Identity Image"
|
|
||||||
name="image_identity"
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<Upload
|
<Upload
|
||||||
listType="picture-card"
|
listType="picture-card"
|
||||||
|
|
|
@ -177,13 +177,18 @@ export const Profile = observer(() => {
|
||||||
key: "partner_transaction_code",
|
key: "partner_transaction_code",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Transaction Date",
|
title: "Tanggal Transaksi",
|
||||||
dataIndex: "created_at",
|
dataIndex: "created_at",
|
||||||
key: "created_at",
|
key: "created_at",
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return <Text>{format(parseISO(record.created_at), "dd-MM-yyyy")}</Text>;
|
return <Text>{format(parseISO(record.created_at), "dd-MM-yyyy")}</Text>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Alasan Gagal",
|
||||||
|
dataIndex: "failed_reason",
|
||||||
|
key: "failed_reason",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const styleSaldoTitle = store.ui.mediaQuery.isDesktop
|
const styleSaldoTitle = store.ui.mediaQuery.isDesktop
|
||||||
|
|
Loading…
Reference in New Issue
Block a user