|
|
|
@ -5,7 +5,7 @@ import SweetAlert from 'react-bootstrap-sweetalert';
|
|
|
|
|
import axios from 'axios'; |
|
|
|
|
import { Button } from 'reactstrap'; |
|
|
|
|
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap'; |
|
|
|
|
import { MENU_ADD, MENU_SEARCH, MENU_EDIT, MENU_DELETE } from '../../../const/ApiConst.js'; |
|
|
|
|
import { MENU_ADD, MENU_SEARCH, MENU_EDIT, MENU_DELETE, MENU_LIST } from '../../../const/ApiConst.js'; |
|
|
|
|
import { NotificationContainer, NotificationManager } from 'react-notifications'; |
|
|
|
|
import { Pagination, Tooltip, Table } from 'antd'; |
|
|
|
|
import { useTranslation } from 'react-i18next'; |
|
|
|
@ -67,23 +67,21 @@ const Index = ({ params }) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getDataAllMenu = async () => { |
|
|
|
|
const payload = { |
|
|
|
|
"paging": { "start": 0, "length": -1 }, |
|
|
|
|
"columns": [ |
|
|
|
|
{ "name": "name", "logic_operator": "ilike", "value": "", "operator": "AND" } |
|
|
|
|
], |
|
|
|
|
"joins": [], |
|
|
|
|
"orders": { "columns": ["id"], "ascending": false } |
|
|
|
|
} |
|
|
|
|
const result = await axios |
|
|
|
|
.post(MENU_SEARCH, payload, config) |
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
.get(MENU_LIST, config) |
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
setAllDataMenu(result.data.data); |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
let arr = [] |
|
|
|
|
let dataRes = result.data.data; |
|
|
|
|
for (const v in dataRes) { |
|
|
|
|
arr.push(dataRes[v]) |
|
|
|
|
} |
|
|
|
|
setAllDataMenu(arr); |
|
|
|
|
}else { |
|
|
|
|
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const getDataMenu = async () => { |
|
|
|
@ -123,6 +121,7 @@ const Index = ({ params }) => {
|
|
|
|
|
|
|
|
|
|
const handleOpenDialog = async (type) => { |
|
|
|
|
await setTypeDialog(type) |
|
|
|
|
getDataAllMenu(); |
|
|
|
|
setOpenDialog(true) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|