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,
|
||||
Tag,
|
||||
Divider,
|
||||
Image,
|
||||
} from "antd";
|
||||
import { BreadcumbComponent } from "../../component/BreadcumbComponent";
|
||||
import { LINKS } from "../../routes/app";
|
||||
|
@ -20,6 +21,7 @@ import { observer } from "mobx-react-lite";
|
|||
import { format, parseISO } from "date-fns";
|
||||
import { ModalLoaderContext } from "../../utils/modal";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { appConfig } from "../../config/app";
|
||||
import { MembershipModal } from "./MembershipModal";
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
|
@ -219,13 +221,18 @@ export const DetailUser = observer(() => {
|
|||
key: "partner_transaction_code",
|
||||
},
|
||||
{
|
||||
title: "Transaction Date",
|
||||
title: "Tanggal Transaksi",
|
||||
dataIndex: "created_at",
|
||||
key: "created_at",
|
||||
render: (text, record) => {
|
||||
return <Text>{format(parseISO(record.created_at), "dd-MM-yyyy")}</Text>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Alasan Gagal",
|
||||
dataIndex: "failed_reason",
|
||||
key: "failed_reason",
|
||||
},
|
||||
];
|
||||
|
||||
const routeData = [
|
||||
|
@ -327,11 +334,7 @@ export const DetailUser = observer(() => {
|
|||
? "danger"
|
||||
: "primary"
|
||||
}
|
||||
onClick={() =>
|
||||
withdrawProfit(
|
||||
store.membership.dataDetail.id,
|
||||
)
|
||||
}
|
||||
onClick={() => withdrawProfit(store.membership.dataDetail.id)}
|
||||
>
|
||||
Withdraw Profit
|
||||
</Button>
|
||||
|
@ -343,42 +346,70 @@ export const DetailUser = observer(() => {
|
|||
<Row style={{ marginBottom: 20 }}>
|
||||
<Col lg={12} xs={24}>
|
||||
<Row>
|
||||
<Col span={12}>
|
||||
<Col span={10}>
|
||||
<Text strong>Name</Text>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col span={10}>
|
||||
<Text>{store.authentication.dataProfit.userDetail?.name}</Text>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col span={10}>
|
||||
<Text strong>Username</Text>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col span={10}>
|
||||
<Text>{store.authentication.dataProfit.username}</Text>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col span={10}>
|
||||
<Text strong>Role</Text>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col span={10}>
|
||||
<Text>{store.authentication.dataProfit.roles?.name}</Text>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col span={10}>
|
||||
<Text strong>Phone Number</Text>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col span={10}>
|
||||
<Text>
|
||||
{store.authentication.dataProfit.userDetail?.phone_number}
|
||||
</Text>
|
||||
</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>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col span={10}>
|
||||
<Text>
|
||||
{store.authentication.dataProfit.isActive === true
|
||||
? "Aktif"
|
||||
: "Inaktif"}
|
||||
</Text>
|
||||
</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>
|
||||
</Col>
|
||||
<Col lg={12} xs={24}>
|
||||
|
|
|
@ -252,8 +252,7 @@ export const Membership = observer(() => {
|
|||
name: <span style={{ fontWeight: "bold" }}>Keanggotaan</span>,
|
||||
},
|
||||
];
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
const onSubmit = async (data, image, imageStore) => {
|
||||
data.superior = true;
|
||||
|
||||
if (initialData.id) {
|
||||
|
@ -283,14 +282,17 @@ export const Membership = observer(() => {
|
|||
modalLoader.setLoading(true);
|
||||
try {
|
||||
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
|
||||
? message.success(
|
||||
response?.body?.message || "Berhasil Tambah Member Baru"
|
||||
)
|
||||
: message.error(
|
||||
response?.body?.error || "Gagal Tambah Member Baru"
|
||||
);
|
||||
: message.error(response?.body?.error || "Gagal Tambah Member Baru");
|
||||
await getData();
|
||||
} catch (e) {
|
||||
console.log(e, "apa errornya");
|
||||
|
@ -302,7 +304,6 @@ export const Membership = observer(() => {
|
|||
setInitialData({});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={["ppob-container"].join(" ")}>
|
||||
<BreadcumbComponent data={routeData} />
|
||||
|
@ -519,8 +520,8 @@ export const Membership = observer(() => {
|
|||
visible={visibleModal}
|
||||
confirmLoading={confirmLoading}
|
||||
initialData={initialData}
|
||||
onCreate={async (data) => {
|
||||
onSubmit(data);
|
||||
onCreate={async (data,image,imageStore) => {
|
||||
onSubmit(data,image,imageStore);
|
||||
}}
|
||||
onCancel={async () => {
|
||||
setInitialData({});
|
||||
|
|
|
@ -157,7 +157,7 @@ export const MembershipModal = ({
|
|||
form
|
||||
.validateFields()
|
||||
.then((values) => {
|
||||
onCreate(values);
|
||||
onCreate(values,responseFilename,responseFilenameStore);
|
||||
form.resetFields();
|
||||
})
|
||||
.catch((info) => {
|
||||
|
@ -231,6 +231,57 @@ export const MembershipModal = ({
|
|||
{((initialData.id && !initialData.isChangePassword) ||
|
||||
!initialData.id) &&
|
||||
store.authentication.userData.role === "Admin" && (
|
||||
<div>
|
||||
<Form.Item
|
||||
name="identity_number"
|
||||
label="Identity Number"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "Please input identity number!",
|
||||
},
|
||||
{
|
||||
pattern: /^(?:\d*)$/,
|
||||
message: "Phone number should contain just number",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<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"
|
||||
|
@ -244,6 +295,7 @@ export const MembershipModal = ({
|
|||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</div>
|
||||
)}
|
||||
{((initialData.id && !initialData.isChangePassword) ||
|
||||
!initialData.id) &&
|
||||
|
@ -269,10 +321,7 @@ export const MembershipModal = ({
|
|||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="Upload Identity Image"
|
||||
name="image_identity"
|
||||
>
|
||||
<Form.Item label="Upload Identity Image" name="image_identity">
|
||||
<div>
|
||||
<Upload
|
||||
listType="picture-card"
|
||||
|
@ -344,10 +393,7 @@ export const MembershipModal = ({
|
|||
</Form.Item>
|
||||
{/* <Row>
|
||||
<Col> */}
|
||||
<Form.Item
|
||||
label="Upload Identity Image"
|
||||
name="image_identity"
|
||||
>
|
||||
<Form.Item label="Upload Identity Image" name="image_identity">
|
||||
<div>
|
||||
<Upload
|
||||
listType="picture-card"
|
||||
|
|
|
@ -177,13 +177,18 @@ export const Profile = observer(() => {
|
|||
key: "partner_transaction_code",
|
||||
},
|
||||
{
|
||||
title: "Transaction Date",
|
||||
title: "Tanggal Transaksi",
|
||||
dataIndex: "created_at",
|
||||
key: "created_at",
|
||||
render: (text, record) => {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user