Fixing Menu
This commit is contained in:
parent
ee6a227352
commit
ba5eef89fb
|
@ -85,7 +85,7 @@ export const SubcategoryComponent = observer((props) => {
|
||||||
: message.error(
|
: message.error(
|
||||||
response?.body?.message || "Gagal Ubah Data Sub Kategori"
|
response?.body?.message || "Gagal Ubah Data Sub Kategori"
|
||||||
);
|
);
|
||||||
//await getData();
|
await getData();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
message.error(
|
message.error(
|
||||||
e.response?.body?.message || "Gagal Ubah Data Sub Kategori"
|
e.response?.body?.message || "Gagal Ubah Data Sub Kategori"
|
||||||
|
@ -106,6 +106,7 @@ export const SubcategoryComponent = observer((props) => {
|
||||||
: message.error(
|
: message.error(
|
||||||
response?.body?.message || "Gagal Tambah Sub Kategori"
|
response?.body?.message || "Gagal Tambah Sub Kategori"
|
||||||
);
|
);
|
||||||
|
await getData();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e, "apa errornya");
|
console.log(e, "apa errornya");
|
||||||
message.error(e.response?.body?.message || "Gagal Tambah Sub Kategori");
|
message.error(e.response?.body?.message || "Gagal Tambah Sub Kategori");
|
||||||
|
|
|
@ -140,6 +140,14 @@ export const DesktopLayout = observer(() => {
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
|
{store.authentication.userData.role === "Sales" && (
|
||||||
|
<Menu.Item key="membership">
|
||||||
|
<Link to={LINKS.MEMBERSHIP}>
|
||||||
|
<IdcardOutlined />
|
||||||
|
<span>Keanggotaan</span>
|
||||||
|
</Link>
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
{store.authentication.userData.role === "Supervisor" && (
|
{store.authentication.userData.role === "Supervisor" && (
|
||||||
<Menu.Item key="membership">
|
<Menu.Item key="membership">
|
||||||
<Link to={LINKS.MEMBERSHIP}>
|
<Link to={LINKS.MEMBERSHIP}>
|
||||||
|
@ -221,6 +229,14 @@ export const DesktopLayout = observer(() => {
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
|
{store.authentication.userData.role === "Sales" && (
|
||||||
|
<Menu.Item key="product">
|
||||||
|
<Link to={LINKS.PRODUCT}>
|
||||||
|
<AppstoreAddOutlined />
|
||||||
|
<span>Produk</span>
|
||||||
|
</Link>
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
{store.authentication.userData.role === "Admin Partner" && (
|
{store.authentication.userData.role === "Admin Partner" && (
|
||||||
<Menu.Item key="transaction">
|
<Menu.Item key="transaction">
|
||||||
<Link to={LINKS.TRANSACTION}>
|
<Link to={LINKS.TRANSACTION}>
|
||||||
|
@ -237,8 +253,7 @@ export const DesktopLayout = observer(() => {
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
{store.authentication.userData.role !== "Admin Partner" &&
|
{store.authentication.userData.role !== "Admin Partner" && (
|
||||||
store.authentication.userData.role !== "Retail" && (
|
|
||||||
<SubMenu
|
<SubMenu
|
||||||
key="payback-main"
|
key="payback-main"
|
||||||
icon={<ProfileOutlined />}
|
icon={<ProfileOutlined />}
|
||||||
|
|
|
@ -51,14 +51,14 @@ export const MenuList = observer((props) => {
|
||||||
overflowedIndicator={0}
|
overflowedIndicator={0}
|
||||||
forceSubMenuRender={true}
|
forceSubMenuRender={true}
|
||||||
>
|
>
|
||||||
{/* {store.authentication.userData.role === "Admin" && ( */}
|
{store.authentication.userData.role !== "Retail" && (
|
||||||
<Menu.Item key="home">
|
<Menu.Item key="home">
|
||||||
<Link to={LINKS.HOME}>
|
<Link to={LINKS.HOME}>
|
||||||
<HomeOutlined />
|
<HomeOutlined />
|
||||||
<span>Beranda</span>
|
<span>Beranda</span>
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
{/* )} */}
|
)}
|
||||||
{store.authentication.userData.role === "Admin" && (
|
{store.authentication.userData.role === "Admin" && (
|
||||||
<Menu.Item key="membership">
|
<Menu.Item key="membership">
|
||||||
<Link to={LINKS.MEMBERSHIP}>
|
<Link to={LINKS.MEMBERSHIP}>
|
||||||
|
@ -75,6 +75,14 @@ export const MenuList = observer((props) => {
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
|
{store.authentication.userData.role === "Sales" && (
|
||||||
|
<Menu.Item key="membership">
|
||||||
|
<Link to={LINKS.MEMBERSHIP}>
|
||||||
|
<IdcardOutlined />
|
||||||
|
<span>Keanggotaan</span>
|
||||||
|
</Link>
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
{store.authentication.userData.role === "Admin" && (
|
{store.authentication.userData.role === "Admin" && (
|
||||||
<SubMenu key="config" icon={<SettingOutlined />} title="Config">
|
<SubMenu key="config" icon={<SettingOutlined />} title="Config">
|
||||||
<Menu.Item key="partner">
|
<Menu.Item key="partner">
|
||||||
|
@ -135,6 +143,14 @@ export const MenuList = observer((props) => {
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
|
{store.authentication.userData.role === "Sales" && (
|
||||||
|
<Menu.Item key="retail">
|
||||||
|
<Link to={LINKS.PRODUCT}>
|
||||||
|
<AppstoreAddOutlined />
|
||||||
|
<span>Produk</span>
|
||||||
|
</Link>
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
{store.authentication.userData.role === "Supervisor" && (
|
{store.authentication.userData.role === "Supervisor" && (
|
||||||
<Menu.Item key="retail">
|
<Menu.Item key="retail">
|
||||||
<Link to={LINKS.PRODUCT}>
|
<Link to={LINKS.PRODUCT}>
|
||||||
|
@ -151,8 +167,7 @@ export const MenuList = observer((props) => {
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
{store.authentication.userData.role !== "Retail" &&
|
{store.authentication.userData.role !== "Admin Partner" && (
|
||||||
store.authentication.userData.role !== "Admin Partner" && (
|
|
||||||
<SubMenu
|
<SubMenu
|
||||||
key="payback-main"
|
key="payback-main"
|
||||||
icon={<CodepenOutlined />}
|
icon={<CodepenOutlined />}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {observer} from 'mobx-react-lite';
|
import { observer } from "mobx-react-lite";
|
||||||
import { useStore } from "../../utils/useStore";
|
import { useStore } from "../../utils/useStore";
|
||||||
import {Button, Card, Col, Form, Input, message, Row, Typography} from 'antd';
|
import { Button, Card, Col, Form, Input, message, Row, Typography } from "antd";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import { LINKS } from "../../routes/app";
|
import { LINKS } from "../../routes/app";
|
||||||
|
|
||||||
|
@ -23,21 +23,31 @@ export const Login = observer(() => {
|
||||||
}
|
}
|
||||||
message.error(e.message);
|
message.error(e.message);
|
||||||
}
|
}
|
||||||
history.push(LINKS.HOME);
|
store.authentication.userData.role === "Retail"
|
||||||
}
|
? history.push(LINKS.TRANSACTION)
|
||||||
|
: history.push(LINKS.HOME);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{width: '100vw', display: 'flex', justifyContent: 'center'}}>
|
<div style={{ width: "100vw", display: "flex", justifyContent: "center" }}>
|
||||||
<Row justify={'center'}>
|
<Row justify={"center"}>
|
||||||
<Col>
|
<Col>
|
||||||
<div style={{
|
<div
|
||||||
display: 'flex',
|
style={{
|
||||||
justifyContent: 'flex-start',
|
display: "flex",
|
||||||
marginTop: '5vh',
|
justifyContent: "flex-start",
|
||||||
flexDirection: 'column',
|
marginTop: "5vh",
|
||||||
alignItems: 'center',
|
flexDirection: "column",
|
||||||
}}>
|
alignItems: "center",
|
||||||
<div style={{display: 'flex', flexDirection: 'column', alignItems: 'stretch'}}>
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "stretch",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Typography.Paragraph
|
<Typography.Paragraph
|
||||||
style={{
|
style={{
|
||||||
margin: 0,
|
margin: 0,
|
||||||
|
@ -52,11 +62,11 @@ export const Login = observer(() => {
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
</div>
|
</div>
|
||||||
<Card
|
<Card
|
||||||
style={{width: 320, textAlign: 'center'}}
|
style={{ width: 320, textAlign: "center" }}
|
||||||
headStyle={{ fontSize: 13, fontWeight: 200 }}
|
headStyle={{ fontSize: 13, fontWeight: 200 }}
|
||||||
className={"shadow"}
|
className={"shadow"}
|
||||||
bordered={true}
|
bordered={true}
|
||||||
title={'Sign in to your account'}
|
title={"Sign in to your account"}
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
layout={"vertical"}
|
layout={"vertical"}
|
||||||
|
@ -64,17 +74,32 @@ export const Login = observer(() => {
|
||||||
onFinish={handleLogin}
|
onFinish={handleLogin}
|
||||||
className={"w-9/12"}
|
className={"w-9/12"}
|
||||||
>
|
>
|
||||||
<Form.Item label="Username" name="username"
|
<Form.Item
|
||||||
rules={[{required: true, message: 'Please input your username!'}]}>
|
label="Username"
|
||||||
|
name="username"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: "Please input your username!" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="Password" name="password"
|
<Form.Item
|
||||||
rules={[{required: true, message: 'Please input your password!'}]}>
|
label="Password"
|
||||||
|
name="password"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: "Please input your password!" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
<Input.Password />
|
<Input.Password />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div className={"flex flex-row justify-between content-center"}>
|
<div className={"flex flex-row justify-between content-center"}>
|
||||||
<Button type="primary" htmlType="submit"
|
<Button
|
||||||
loading={store.authentication.isLoginLoading}>Submit</Button>
|
type="primary"
|
||||||
|
htmlType="submit"
|
||||||
|
loading={store.authentication.isLoginLoading}
|
||||||
|
>
|
||||||
|
Submit
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
|
@ -327,13 +327,10 @@ export const Membership = observer(() => {
|
||||||
description={
|
description={
|
||||||
<div style={{}}>
|
<div style={{}}>
|
||||||
<p>
|
<p>
|
||||||
|
<small>Saldo System : {item.name}</small> <br />
|
||||||
<small>Role : {item.roleName}</small> <br />
|
<small>Role : {item.roleName}</small> <br />
|
||||||
<small>
|
<small>
|
||||||
Saldo Supplier : {item.coa.amount}
|
Saldo Supplier : {item.coa?.amount}
|
||||||
</small>{" "}
|
|
||||||
<br />
|
|
||||||
<small>
|
|
||||||
Saldo System : {item.coa.amount}
|
|
||||||
</small>{" "}
|
</small>{" "}
|
||||||
<br />
|
<br />
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class Category {
|
||||||
async getData() {
|
async getData() {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(`/product/categories?page=${this.page}&pageSize=${this.pageSize}`);
|
const response = await http.get(`/product/categories?page=${this.page}&pageSize=${this.pageSize}`);
|
||||||
console.log(response)
|
//console.log(response)
|
||||||
this.data = response.body.data.map((item, idx) => {
|
this.data = response.body.data.map((item, idx) => {
|
||||||
item.key = idx;
|
item.key = idx;
|
||||||
return item
|
return item
|
||||||
|
|
|
@ -17,6 +17,7 @@ export class Membership {
|
||||||
async getData() {
|
async getData() {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(`/users?page=${this.page}&pageSize=${this.pageSize}`);
|
const response = await http.get(`/users?page=${this.page}&pageSize=${this.pageSize}`);
|
||||||
|
//console.log(response)
|
||||||
this.data = response.body.data.map((item, idx) => {
|
this.data = response.body.data.map((item, idx) => {
|
||||||
item.key = idx;
|
item.key = idx;
|
||||||
item.name = item?.user_detail?.name;
|
item.name = item?.user_detail?.name;
|
||||||
|
@ -35,7 +36,7 @@ export class Membership {
|
||||||
async getDetail(id) {
|
async getDetail(id) {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(`/users/`+id);
|
const response = await http.get(`/users/`+id);
|
||||||
console.log(response,'Data Detail')
|
//console.log(response,'Data Detail')
|
||||||
this.dataDetail = response.body.data
|
this.dataDetail = response.body.data
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
|
@ -27,6 +27,7 @@ export class Subcategory {
|
||||||
async getData() {
|
async getData() {
|
||||||
try {
|
try {
|
||||||
const response = await http.get(`/product/sub-categories?page=${this.page}&pageSize=${this.pageSize}`);
|
const response = await http.get(`/product/sub-categories?page=${this.page}&pageSize=${this.pageSize}`);
|
||||||
|
console.log(response)
|
||||||
this.data = response.body.data.map((item, idx) => {
|
this.data = response.body.data.map((item, idx) => {
|
||||||
item.key = idx;
|
item.key = idx;
|
||||||
item.categoryName = item.category.name;
|
item.categoryName = item.category.name;
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class UI {
|
||||||
};
|
};
|
||||||
|
|
||||||
toggleLeftDrawerIsShown() {
|
toggleLeftDrawerIsShown() {
|
||||||
console.log('what')
|
//console.log('what')
|
||||||
this.leftDrawerIsShown = !this.leftDrawerIsShown;
|
this.leftDrawerIsShown = !this.leftDrawerIsShown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user