Merge branch 'develop' of https://gitlab.com/empatnusabangsa/ppob/ppob-frontend into develop
This commit is contained in:
		| @@ -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", { | ||||
|         text | ||||
|           ? new Intl.NumberFormat("id-ID", { | ||||
|               style: "currency", | ||||
|               currency: "IDR", | ||||
|         }).format(text), | ||||
|             }).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,22 +1,26 @@ | ||||
| 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 | ||||
|   total_data = 0; | ||||
|  | ||||
|   constructor(ctx) { | ||||
|     this.ctx = ctx; | ||||
|     makeAutoObservable(this); | ||||
|   } | ||||
|  | ||||
|     async getData() { | ||||
|   async getData(isForMembership = false) { | ||||
|     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 | ||||
|       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); | ||||
|     } | ||||
| @@ -24,7 +28,7 @@ export class Role { | ||||
|  | ||||
|   async create(data) { | ||||
|     try { | ||||
|             return await http.post('/users').send(data) | ||||
|       return await http.post("/users").send(data); | ||||
|     } catch (e) { | ||||
|       console.error(e); | ||||
|     } | ||||
| @@ -32,7 +36,7 @@ export class Role { | ||||
|  | ||||
|   async update(id, data) { | ||||
|     try { | ||||
|             return await http.put('/users/' + id).send(data); | ||||
|       return await http.put("/users/" + id).send(data); | ||||
|     } catch (e) { | ||||
|       console.error(e); | ||||
|     } | ||||
| @@ -40,11 +44,9 @@ export class Role { | ||||
|  | ||||
|   async delete(id) { | ||||
|     try { | ||||
|             return await http.del('/users/' + id); | ||||
|       return await http.del("/users/" + id); | ||||
|     } catch (e) { | ||||
|       console.error(e); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user