Merge branch 'develop' of https://gitlab.com/empatnusabangsa/ppob/ppob-frontend into develop
This commit is contained in:
commit
551c8ba17e
|
@ -286,7 +286,19 @@ export const PartnerComponent = observer((props) => {
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
{!idData && (
|
||||||
|
<Form.Item
|
||||||
|
name="phone_number"
|
||||||
|
label="Phone Number"
|
||||||
|
rules={[
|
||||||
|
idData
|
||||||
|
? { required: false }
|
||||||
|
: { required: true, message: "Please input password phone number!" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
{!isChangePassword && (
|
{!isChangePassword && (
|
||||||
<>
|
<>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|
|
@ -66,10 +66,12 @@ export const SupplierComponent = observer((props) => {
|
||||||
key: ["coa", "amount"],
|
key: ["coa", "amount"],
|
||||||
width: "20%",
|
width: "20%",
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
new Intl.NumberFormat("id-ID", {
|
text
|
||||||
|
? new Intl.NumberFormat("id-ID", {
|
||||||
style: "currency",
|
style: "currency",
|
||||||
currency: "IDR",
|
currency: "IDR",
|
||||||
}).format(text),
|
}).format(text)
|
||||||
|
: "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Status",
|
title: "Status",
|
||||||
|
|
|
@ -44,10 +44,11 @@ export const Membership = observer(() => {
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
const isAdmin = store.authentication.userData.role === "Admin";
|
||||||
|
|
||||||
await getData();
|
await getData();
|
||||||
store.role.getData();
|
await store.role.getData(isAdmin);
|
||||||
if (store.authentication.userData.role === "Admin")
|
if (isAdmin) await store.supplier.getData();
|
||||||
await store.supplier.getData();
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
|
@ -5,18 +5,22 @@ export class Role {
|
||||||
page = null;
|
page = null;
|
||||||
pageSize = null;
|
pageSize = null;
|
||||||
data = [];
|
data = [];
|
||||||
total_data = 0
|
total_data = 0;
|
||||||
|
|
||||||
constructor(ctx) {
|
constructor(ctx) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
makeAutoObservable(this);
|
makeAutoObservable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getData() {
|
async getData(isForMembership = false) {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(`/config/roles?page=${this.page}&pageSize=${this.pageSize}`);
|
const response = await http.get(
|
||||||
this.data = response.body.data ?? []
|
`/config/roles${isForMembership ? "/for-membership" : ""}?page=${
|
||||||
this.total_data = response.body.total_data ?? 0
|
this.page
|
||||||
|
}&pageSize=${this.pageSize}`
|
||||||
|
);
|
||||||
|
this.data = response.body.data ?? [];
|
||||||
|
this.total_data = response.body.total_data ?? 0;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +28,7 @@ export class Role {
|
||||||
|
|
||||||
async create(data) {
|
async create(data) {
|
||||||
try {
|
try {
|
||||||
return await http.post('/users').send(data)
|
return await http.post("/users").send(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +36,7 @@ export class Role {
|
||||||
|
|
||||||
async update(id, data) {
|
async update(id, data) {
|
||||||
try {
|
try {
|
||||||
return await http.put('/users/' + id).send(data);
|
return await http.put("/users/" + id).send(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -40,11 +44,9 @@ export class Role {
|
||||||
|
|
||||||
async delete(id) {
|
async delete(id) {
|
||||||
try {
|
try {
|
||||||
return await http.del('/users/' + id);
|
return await http.del("/users/" + id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user