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 />
|
||||
</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 && (
|
||||
<>
|
||||
<Form.Item
|
||||
|
|
|
@ -66,10 +66,12 @@ export const SupplierComponent = observer((props) => {
|
|||
key: ["coa", "amount"],
|
||||
width: "20%",
|
||||
render: (text, record) =>
|
||||
new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
}).format(text),
|
||||
text
|
||||
? new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
}).format(text)
|
||||
: "-",
|
||||
},
|
||||
{
|
||||
title: "Status",
|
||||
|
|
|
@ -44,10 +44,11 @@ export const Membership = observer(() => {
|
|||
const init = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const isAdmin = store.authentication.userData.role === "Admin";
|
||||
|
||||
await getData();
|
||||
store.role.getData();
|
||||
if (store.authentication.userData.role === "Admin")
|
||||
await store.supplier.getData();
|
||||
await store.role.getData(isAdmin);
|
||||
if (isAdmin) await store.supplier.getData();
|
||||
setIsLoading(false);
|
||||
} catch (e) {
|
||||
setIsLoading(false);
|
||||
|
|
|
@ -1,50 +1,52 @@
|
|||
import {makeAutoObservable} from "mobx";
|
||||
import {http} from "../utils/http";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import { http } from "../utils/http";
|
||||
|
||||
export class Role {
|
||||
page = null;
|
||||
pageSize = null;
|
||||
data = [];
|
||||
total_data = 0
|
||||
page = null;
|
||||
pageSize = null;
|
||||
data = [];
|
||||
total_data = 0;
|
||||
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
async getData() {
|
||||
try {
|
||||
const response = await http.get(`/config/roles?page=${this.page}&pageSize=${this.pageSize}`);
|
||||
this.data = response.body.data ?? []
|
||||
this.total_data = response.body.total_data ?? 0
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
async getData(isForMembership = false) {
|
||||
try {
|
||||
const response = await http.get(
|
||||
`/config/roles${isForMembership ? "/for-membership" : ""}?page=${
|
||||
this.page
|
||||
}&pageSize=${this.pageSize}`
|
||||
);
|
||||
this.data = response.body.data ?? [];
|
||||
this.total_data = response.body.total_data ?? 0;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async create(data) {
|
||||
try {
|
||||
return await http.post('/users').send(data)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
async create(data) {
|
||||
try {
|
||||
return await http.post("/users").send(data);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async update(id, data) {
|
||||
try {
|
||||
return await http.put('/users/' + id).send(data);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
async update(id, data) {
|
||||
try {
|
||||
return await http.put("/users/" + id).send(data);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async delete(id) {
|
||||
try {
|
||||
return await http.del('/users/' + id);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
async delete(id) {
|
||||
try {
|
||||
return await http.del("/users/" + id);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user