Browse Source

Add column in page presensi and Icon Action

pull/2/head
farhan048 2 years ago
parent
commit
643f6258b3
  1. 100
      src/views/Master/MasterRoles/index.js
  2. 4
      src/views/Master/RoleProject/index.js
  3. 8
      src/views/SimproV2/Divisi/index.js
  4. 210
      src/views/SimproV2/Presence/index.js
  5. 8
      src/views/SimproV2/Satuan/index.js

100
src/views/Master/MasterRoles/index.js

@ -17,8 +17,8 @@ const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/";
const config = {
headers:
{
Authorization : `Bearer ${token}`,
"Content-type" : `application/json`
Authorization: `Bearer ${token}`,
"Content-type": `application/json`
}
};
@ -34,24 +34,24 @@ export default class index extends Component {
alertNotDelete: false,
currentPage: 1,
dataEdit: null,
dataExport:[],
dataExport: [],
dataGs: [],
dataIdHo: [],
dataTable: [],
dialogMenuForm: false,
idDelete: 0,
idRoles:0,
menuRoles:[],
idRoles: 0,
menuRoles: [],
openDialog: false,
page: 0,
rowsPerPage: LENGTH_DATA,
search: "",
tooltipDelete: false,
tooltipEdit: false,
tooltipExport:false,
tooltipImport:false,
tooltipExport: false,
tooltipImport: false,
tooltipMenu: false,
tooltipTambah:false,
tooltipTambah: false,
totalPage: 0,
typeDialog: 'Save',
}
@ -61,22 +61,22 @@ export default class index extends Component {
title: 'Action',
dataIndex: '',
key: 'x',
className:'nowrap',
className: 'nowrap',
render: (text, record) => <>
<Tooltip title="Roles Menu">
<i className="cil-menu fa-lg" style={{ color: 'green', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleMenuRoles(text.id)}></i>
<i className="cil-menu" style={{ color: 'green', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleMenuRoles(text.id)}></i>
</Tooltip>
<Tooltip title="Hapus">
<i className="cil-trash fa-lg" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i>
<i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i>
</Tooltip>
<Tooltip title="Edit">
<i className="fa fa-edit fa-lg" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i>
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i>
</Tooltip>
</>,
},
{ title: 'Nama Role', dataIndex: 'name', key: 'name', className:"nowrap" },
{ title: 'Nama Role', dataIndex: 'name', key: 'name', className: "nowrap" },
{ title: 'Description', dataIndex: 'description', key: 'description' },
]
}
@ -102,12 +102,12 @@ export default class index extends Component {
}
const formData = {
"paging": {"start": start, "length": this.state.rowsPerPage},
"paging": { "start": start, "length": this.state.rowsPerPage },
"columns": [
{"name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND"}
{ "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND" }
],
"joins": [],
"orders": {"columns": ["id"], "ascending": false}
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
@ -115,9 +115,9 @@ export default class index extends Component {
.then(res => res)
.catch((error) => error.response);
if(result && result.data && result.data.code == 200){
if (result && result.data && result.data.code == 200) {
this.setState({ dataTable: result.data.data, totalPage: result.data.totalRecord });
}else{
} else {
NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
}
}
@ -142,7 +142,7 @@ export default class index extends Component {
}
handleCloseDialogMr = (type, data) => {
if(type==="save"){
if (type === "save") {
this.saveMenuRoles(data)
}
this.setState({ dialogMenuForm: false })
@ -174,15 +174,15 @@ export default class index extends Component {
saveRole = async (data) => {
const formData = {
name:data.name,
description:data.description
name: data.name,
description: data.description
}
const result = await axios.post(ROLE_ADD, formData, config)
.then(res => res)
.catch((error) => error.response);
if(result && result.data && result.data.code===200){
if (result && result.data && result.data.code === 200) {
this.getDataRoles();
NotificationManager.success(`Data role berhasil ditambah`, 'Success!!');
} else {
@ -193,15 +193,15 @@ export default class index extends Component {
editRole = async (data) => {
const formData = {
name:data.name,
description:data.description
name: data.name,
description: data.description
}
const url = ROLE_EDIT(data.id)
const result = await axios.put(url, formData, config)
.then(res => res)
.catch((error) => error.response);
if(result && result.data && result.data.code===200){
if (result && result.data && result.data.code === 200) {
this.getDataRoles();
NotificationManager.success(`Data role berhasil diedit`, 'Success!!');
} else {
@ -236,17 +236,17 @@ export default class index extends Component {
this.setState(prevState => ({ tooltipEdit: !prevState.tooltipEdit }))
} else if (param === "delete") {
this.setState(prevState => ({ tooltipDelete: !prevState.tooltipDelete }))
} else if(param === "menu"){
} else if (param === "menu") {
this.setState(prevState => ({ tooltipMenu: !prevState.tooltipMenu }))
} else if (param === "tambah") {
this.setState(prevState => ({ tooltipTambah: !prevState.tooltipTambah }))
} else if (param === "export") {
} else if (param === "export") {
this.setState(prevState => ({ tooltipExport: !prevState.tooltipExport }))
}
}
dataNotAvailable = () => {
if(this.state.dataTable.length===0){
if (this.state.dataTable.length === 0) {
return (
<tr>
<td align="center" colSpan="3">Not Data Available</td>
@ -257,12 +257,12 @@ export default class index extends Component {
handleMenuRoles = async (id) => {
const formData = {
"paging": {"start": 0, "length": -1},
"paging": { "start": 0, "length": -1 },
"columns": [
{"name": "role_id", "logic_operator": "=", "value": `${id}`, "operator": "AND"}
{ "name": "role_id", "logic_operator": "=", "value": `${id}`, "operator": "AND" }
],
"joins": [],
"orders": {"columns": ["id"], "ascending": false}
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
@ -270,7 +270,7 @@ export default class index extends Component {
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ menuRoles:result.data.data,idRoles:id },() => {
this.setState({ menuRoles: result.data.data, idRoles: id }, () => {
this.handleOpenDialogMr();
});
} else {
@ -279,16 +279,16 @@ export default class index extends Component {
saveMenuRoles = async (dataArray) => {
let payloadArray = dataArray || []
if(payloadArray.length > 0){
if (payloadArray.length > 0) {
await this.deleteCurrentRoleMenu(payloadArray[0].roles_id)
}
let promises = []
let result = []
dataArray.map((val, index)=> {
if(val.checked===true){
dataArray.map((val, index) => {
if (val.checked === true) {
const formData = {
menu_id:val.menu_id,
role_id:val.roles_id
menu_id: val.menu_id,
role_id: val.roles_id
}
promises.push(axios.post(ROLEMENU_ADD, formData, config)
.then(res => result.push(res)))
@ -296,8 +296,8 @@ export default class index extends Component {
})
await Promise.all(promises);
if(result){
if(result.length > 0){
if (result) {
if (result.length > 0) {
if (result[0].data.code === 200) {
this.getDataRoles();
NotificationManager.success('Data roles berhasil ditambahkan!!', 'Success!!');
@ -326,24 +326,24 @@ export default class index extends Component {
let url = BASE_URL + "roles.php?act=get_data";
const formData = new FormData();
formData.append('field', 'name');
if(this.state.search !== ""){
if (this.state.search !== "") {
formData.append('value', this.state.search);
}
const result = await axios
.post(url,formData)
.post(url, formData)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.statusText == "OK") {
const dataRes = result.data.data|| [];
const dataRes = result.data.data || [];
const dataExport = [];
dataRes.map((val,index)=> {
dataRes.map((val, index) => {
let row = {
Nama:val.name,
Deskripsi:val.description
Nama: val.name,
Deskripsi: val.description
}
dataExport.push(row);
})
this.setState({ dataExport:dataExport },()=> {
this.setState({ dataExport: dataExport }, () => {
this.exportExcel();
});
} else {
@ -361,7 +361,7 @@ export default class index extends Component {
}
render() {
const { tooltipTambah,tooltipExport,dialogMenuForm, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete,tooltipMenu } = this.state
const { tooltipTambah, tooltipExport, dialogMenuForm, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete, tooltipMenu } = this.state
let noSeq = 0;
return (
<div>
@ -385,7 +385,7 @@ export default class index extends Component {
confirmBtnText="Can't Delete"
confirmBtnBsStyle="danger"
title="Data can't be delete!"
onConfirm={() => this.setState({ alertNotDelete: false})}
onConfirm={() => this.setState({ alertNotDelete: false })}
>
Data tipe roles tidak dapat di hapus!!
</SweetAlert>
@ -417,7 +417,7 @@ export default class index extends Component {
<Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button>
</Tooltip>
<Tooltip title="Export Excel">
<Button style={{marginLeft:"5px"}} id="TooltipExport" color="primary" onClick={()=> this.handleExportExcel()}><i className="fa fa-print"></i></Button>
<Button style={{ marginLeft: "5px" }} id="TooltipExport" color="primary" onClick={() => this.handleExportExcel()}><i className="fa fa-print"></i></Button>
</Tooltip>
</Col>
</Row>
@ -432,7 +432,7 @@ export default class index extends Component {
bordered={false}
/>
<Pagination
style={{marginTop:"25px"}}
style={{ marginTop: "25px" }}
showSizeChanger
onShowSizeChange={this.onShowSizeChange}
onChange={this.onPagination}

4
src/views/Master/RoleProject/index.js

@ -69,12 +69,12 @@ export default class index extends Component {
className: 'nowrap',
render: (text, record) => <>
<Tooltip title="Hapus">
<i className="cil-trash fa-lg" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i>
<i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i>
</Tooltip>
<Tooltip title="Edit">
<i className="fa fa-edit fa-lg" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i>
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i>
</Tooltip>
</>,
},

8
src/views/SimproV2/Divisi/index.js

@ -5,7 +5,7 @@ import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi"
import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
import { DIVISI_LIST, DIVISI_ADD, DIVISI_EDIT, DIVISI_DELETE, DIVISI_SEARCH} from '../../../const/ApiConst';
import { DIVISI_LIST, DIVISI_ADD, DIVISI_EDIT, DIVISI_DELETE, DIVISI_SEARCH } from '../../../const/ApiConst';
import { DownloadOutlined } from '@ant-design/icons';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Button, Tooltip } from 'antd';
@ -67,7 +67,7 @@ const ProjectType = ({ params }) => {
.then(res => res)
.catch((error) => error.response);
if (listDivions&& listDivions.data && listDivions.data.code == 200) {
if (listDivions && listDivions.data && listDivions.data.code == 200) {
let arr = []
for (const v in listDivions.data.data) {
arr.push(listDivions.data.data[v])
@ -274,10 +274,10 @@ const ProjectType = ({ params }) => {
<tr key={n.id}>
<td className='nowrap'>
<Tooltip title="Hapus">
<i id="TooltipDelete" className="cil-trash fa-lg" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(n.id)}></i>
<i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(n.id)}></i>
</Tooltip>
<Tooltip title="Edit">
<i id="TooltipEdit" className="cil-pencil fa-lg" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i>
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i>
</Tooltip>
</td>
<td>{n.displayName}</td>

210
src/views/SimproV2/Presence/index.js

@ -12,7 +12,7 @@ const { RangePicker } = DatePicker;
const token = window.localStorage.getItem('token');
const Index = ({params}) => {
const Index = ({ params }) => {
const [dataTable, setDatatable] = useState([])
const [search, setSearch] = useState('')
const [currentPage, setCurrentPage] = useState(1)
@ -29,21 +29,21 @@ const Index = ({params}) => {
const config = {
headers:
{
Authorization : `Bearer ${token}`,
"Content-type" : `application/json`
Authorization: `Bearer ${token}`,
"Content-type": `application/json`
}
};
useEffect(()=> {
getDataPresence();
},[search,currentPage,rowsPerPage, startDate, endDate])
useEffect(() => {
getDataPresence();
}, [search, currentPage, rowsPerPage, startDate, endDate])
useEffect(()=> {
useEffect(() => {
const cekData = dataExport || []
if(cekData.length > 0){
if (cekData.length > 0) {
exportExcel()
}
},[dataExport])
}, [dataExport])
const handleSearch = e => {
const value = e.target.value
@ -64,20 +64,20 @@ const Index = ({params}) => {
let dateEnd = moment(endDate).format("YYYY-MM-DD 23:59:59");
const payload = {
"paging": {"start": start, "length": rowsPerPage},
"paging": { "start": start, "length": rowsPerPage },
"columns": [
{"name": "name", "logic_operator": "ilike", "value": search, "table_name": "m_users"},
{"name": "clock_in", "logic_operator": "range", "value": dateStart, "value1": dateEnd},
{ "name": "name", "logic_operator": "ilike", "value": search, "table_name": "m_users" },
{ "name": "clock_in", "logic_operator": "range", "value": dateStart, "value1": dateEnd },
],
"joins": [{
"name":"m_users",
"column_join":"user_id",
"column_results":[
"name",
"ktp_number"
]
}],
"orders": {"columns": ["id"], "ascending": false}
"name": "m_users",
"column_join": "user_id",
"column_results": [
"name",
"ktp_number"
]
}],
"orders": { "columns": ["id"], "ascending": false }
}
@ -88,11 +88,11 @@ const Index = ({params}) => {
.catch((error) => error.response);
if(result && result.data && result.data.code == 200){
if (result && result.data && result.data.code == 200) {
setDatatable(result.data.data);
console.log("resdata", result.data.data)
setTotalPage(result.data.totalRecord);
}else{
} else {
NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
}
}
@ -105,17 +105,17 @@ const Index = ({params}) => {
.get(url, config)
.then(res => res)
.catch((error) => error.response);
if(result && result.data.code==200){
let dataRes = result.data.data
let dataImage = {
name,
url:dataRes.image
}
console.log("dataImage", dataImage)
await setDataImage(dataImage)
setOpenImage(true)
}else{
NotificationManager.error('Data image tidak ditemukan!', 'Failed');
if (result && result.data.code == 200) {
let dataRes = result.data.data
let dataImage = {
name,
url: dataRes.image
}
console.log("dataImage", dataImage)
await setDataImage(dataImage)
setOpenImage(true)
} else {
NotificationManager.error('Data image tidak ditemukan!', 'Failed');
}
}
@ -125,8 +125,8 @@ const Index = ({params}) => {
}
const toggleDialogImage = () => {
if(openImage){
setDataImage(null)
if (openImage) {
setDataImage(null)
}
setOpenImage(!openImage)
}
@ -140,20 +140,20 @@ const Index = ({params}) => {
}
const renderDurasiKerja = (jamMasuk, jamKeluar) => {
if(jamMasuk && jamKeluar){
if (jamMasuk && jamKeluar) {
let start = moment(jamMasuk),
end = moment(jamKeluar);
let diff = end.diff(start);
let result = moment.utc(diff).format('HH:mm:ss');
if(result){
if (result) {
return result;
}else{
} else {
return "-"
}
}else{
} else {
return "-"
}
}
@ -164,20 +164,20 @@ const Index = ({params}) => {
let dateEnd = moment(endDate).format("YYYY-MM-DD 23:59:59");
const payload = {
"paging": {"start": 0, "length": -1},
"paging": { "start": 0, "length": -1 },
"columns": [
{"name": "name", "logic_operator": "ilike", "value": search, "table_name": "m_users"},
{"name": "clock_in", "logic_operator": "range", "value": dateStart, "value1": dateEnd},
{ "name": "name", "logic_operator": "ilike", "value": search, "table_name": "m_users" },
{ "name": "clock_in", "logic_operator": "range", "value": dateStart, "value1": dateEnd },
],
"joins": [{
"name":"m_users",
"column_join":"user_id",
"column_results":[
"name",
"ktp_number"
]
}],
"orders": {"columns": ["id"], "ascending": false}
"name": "m_users",
"column_join": "user_id",
"column_results": [
"name",
"ktp_number"
]
}],
"orders": { "columns": ["id"], "ascending": false }
}
@ -188,25 +188,25 @@ const Index = ({params}) => {
.catch((error) => error.response);
if(result && result.data && result.data.code == 200){
if (result && result.data && result.data.code == 200) {
let resData = result.data.data;
console.log("resdata", resData)
const excelData = [];
resData.map((val, index) => {
let dataRow = {
"NIK/ID Card": val.join_first_ktp_number ? val.join_first_ktp_number : '-',
"Nama Human Resource": val.join_first_name ? val.join_first_name : '',
"Tanggal Kehadiran" : val.date_presence ? moment(val.date_presence).format("D-M-YYYY") : '-',
"Jam Masuk" : val.clock_in ? moment(val.clock_in).format("D-M-YYYY HH:mm:ss") : '-',
"Jam Keluar": val.clock_out ? moment(val.clock_out).format("D-M-YYYY HH:mm:ss") : '-',
"Durasi Kerja" : renderDurasiKerja(val.clock_in, val.clock_out),
"Clock-in Location": val.clock_in_loc && val.clock_in_loc !== '' ? val.clock_in_loc : '-',
"Clock-out Location": val.clock_out_loc && val.clock_out_loc !== '' ? val.clock_out_loc : '-'
"NIK/ID Card": val.join_first_ktp_number ? val.join_first_ktp_number : '-',
"Nama Human Resource": val.join_first_name ? val.join_first_name : '',
"Tanggal Kehadiran": val.date_presence ? moment(val.date_presence).format("D-M-YYYY") : '-',
"Jam Masuk": val.clock_in ? moment(val.clock_in).format("D-M-YYYY HH:mm:ss") : '-',
"Jam Keluar": val.clock_out ? moment(val.clock_out).format("D-M-YYYY HH:mm:ss") : '-',
"Durasi Kerja": renderDurasiKerja(val.clock_in, val.clock_out),
"Clock-in Location": val.clock_in_loc && val.clock_in_loc !== '' ? val.clock_in_loc : '-',
"Clock-out Location": val.clock_out_loc && val.clock_out_loc !== '' ? val.clock_out_loc : '-'
}
excelData.push(dataRow)
})
await setDataExport(excelData);
}else{
} else {
NotificationManager.error('Gagal Export Data!!', 'Failed');
}
}
@ -216,10 +216,10 @@ const Index = ({params}) => {
const dataExcel = dataExport || [];
const fileName = `Data ${pageName}.xlsx`;
const ws = XLSX.utils.json_to_sheet(dataExcel);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`);
XLSX.writeFile(wb, fileName);
XLSX.writeFile(wb, fileName);
setDataExport([])
}
const renderTable = useMemo(() => {
@ -241,13 +241,15 @@ const Index = ({params}) => {
</>,
},
{ title: 'NIK/ID Card', dataIndex: 'join_first_ktp_number', key: 'join_first_ktp_number' },
{ title: 'Nama Human Resource', dataIndex: 'join_first_name', key: 'join_first_name' },
{ title: 'Tanggal Kehadiran', dataIndex: 'date_presence', key: 'date_presence', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) },
{ title: 'Nama HR', dataIndex: 'join_first_name', key: 'join_first_name' },
{ title: 'Tanggal', dataIndex: 'date_presence', key: 'date_presence', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY") : "-"}</div>) },
{ title: 'Jam Masuk', dataIndex: 'clock_in', key: 'clock_in', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY HH:mm:ss") : "-"}</div>) },
{ title: 'Jam Keluar', dataIndex: 'clock_out', key: 'clock_out', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY HH:mm:ss") : "-"}</div>) },
{ title: 'Durasi Kerja', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{renderDurasiKerja(record.clock_in, record.clock_out)}</div>) },
{ title: 'Clock-in Location', dataIndex: 'clock_in_loc', key: 'clock_in_loc', render: (text, record) => <>{text && text !== '' ? text : '-'}</> },
{ title: 'Clock-out Location', dataIndex: 'clock_out_loc', key: 'clock_out_loc', render: (text, record) => <>{text && text !== '' ? text : '-'}</> },
{ title: 'Lokasi Masuk', dataIndex: 'clock_in_loc', key: 'clock_in_loc', render: (text, record) => <>{text && text !== '' ? text : '-'}</> },
{ title: 'Lokasi Pulang', dataIndex: 'clock_out_loc', key: 'clock_out_loc', render: (text, record) => <>{text && text !== '' ? text : '-'}</> },
{ title: 'Area Kerja In', dataIndex: 'clock_out_loc', key: 'clock_out_loc', render: (text, record) => <>{text && text !== '' ? text : '-'}</> },
{ title: 'Area Kerja Out', dataIndex: 'clock_out_loc', key: 'clock_out_loc', render: (text, record) => <>{text && text !== '' ? text : '-'}</> },
];
return (
<Table
@ -261,29 +263,29 @@ const Index = ({params}) => {
}, [dataTable])
const handleDatePicker = (date, dateString) => {
setStartDate(date[0])
setEndDate(date[1])
setStartDate(date[0])
setEndDate(date[1])
}
const handleChangeDay = (e) => {
const val = e.target.value;
setCurrentDay(val)
if(val==="today"){
if (val === "today") {
setStartDate(moment(moment().format("YYYY-M-D")))
setEndDate(moment(moment().format("YYYY-M-D")))
setCurrentPage(1)
} else if (val === "3 day") {
setStartDate(moment(moment().subtract(3, "days").format("YYYY-M-D")))
setEndDate(moment(moment().format("YYYY-M-D")))
setCurrentPage(1)
} else if (val === "7 day") {
setStartDate(moment(moment().subtract(7, "days").format("YYYY-M-D")))
setEndDate(moment(moment().format("YYYY-M-D")))
setCurrentPage(1)
} else {
setStartDate(moment(moment().format("YYYY-M-D")))
setEndDate(moment(moment().format("YYYY-M-D")))
setCurrentPage(1)
}else if(val==="3 day"){
setStartDate(moment(moment().subtract(3, "days").format("YYYY-M-D")))
setEndDate(moment(moment().format("YYYY-M-D")))
setCurrentPage(1)
}else if(val==="7 day"){
setStartDate(moment(moment().subtract(7, "days").format("YYYY-M-D")))
setEndDate(moment(moment().format("YYYY-M-D")))
setCurrentPage(1)
}else{
setStartDate(moment(moment().format("YYYY-M-D")))
setEndDate(moment(moment().format("YYYY-M-D")))
setCurrentPage(1)
}
}
@ -291,42 +293,42 @@ const Index = ({params}) => {
<div>
<NotificationContainer />
<DialogFoto
openDialog={openImage}
closeDialog={closeDialogImage}
toggleDialog={toggleDialogImage}
dataImage={dataImage}
/>
openDialog={openImage}
closeDialog={closeDialogImage}
toggleDialog={toggleDialogImage}
dataImage={dataImage}
/>
<Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}>
<h4 className="capitalize">{pageName}</h4>
<Row>
<Col>
<Tooltip title="Export Excel">
<Button style={{marginLeft:"5px"}} id="TooltipExport" color="primary" onClick={()=> handleExportExcel()}><i className="fa fa-print"></i></Button>
<Button style={{ marginLeft: "5px" }} id="TooltipExport" color="primary" onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button>
</Tooltip>
</Col>
</Row>
</CardHeader>
<CardBody>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<div style={{ width:"100%",display:"flex",alignItems:"center" }}>
<div style={{ width:"100%",marginRight:"10px",maxWidth:"200px" }}>
<Input type="select" onChange={(e) => handleChangeDay(e)} defaultValue={currentDay}>
<option value="today">Hari Ini</option>
<option value="3 day">3 Hari yang lalu</option>
<option value="7 day">7 Hari yang lalu</option>
</Input>
</div>
<div style={{ width:"50%",marginTop:"3px" }}>
<RangePicker size="default" allowClear={false} value={[startDate, endDate]} onChange={handleDatePicker}/>{' '}
<Button color="primary" onClick={() => getDataPresence()}>Cari</Button>
</div>
</div>
<Input onChange={handleSearch} value={search} type="text" name="search" id="search" placeholder="Cari nama human resource" style={{ maxWidth: "200px", marginBottom: "20px" }} />
<div style={{ display: "flex", justifyContent: "space-between" }}>
<div style={{ width: "100%", display: "flex", alignItems: "center" }}>
<div style={{ width: "100%", marginRight: "10px", maxWidth: "200px" }}>
<Input type="select" onChange={(e) => handleChangeDay(e)} defaultValue={currentDay}>
<option value="today">Hari Ini</option>
<option value="3 day">3 Hari yang lalu</option>
<option value="7 day">7 Hari yang lalu</option>
</Input>
</div>
<div style={{ width: "50%", marginTop: "3px" }}>
<RangePicker size="default" allowClear={false} value={[startDate, endDate]} onChange={handleDatePicker} />{' '}
<Button color="primary" onClick={() => getDataPresence()}>Cari</Button>
</div>
</div>
<Input onChange={handleSearch} value={search} type="text" name="search" id="search" placeholder="Cari nama human resource" style={{ maxWidth: "200px", marginBottom: "20px" }} />
</div>
{renderTable}
<Pagination
style={{marginTop:"25px"}}
style={{ marginTop: "25px" }}
showSizeChanger
onShowSizeChange={onShowSizeChange}
onChange={onPagination}

8
src/views/SimproV2/Satuan/index.js

@ -6,7 +6,7 @@ import axios from "../../../const/interceptorApi"
import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Button, Tooltip } from 'antd';
import { SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE,SATUAN_SEARCH} from '../../../const/ApiConst';
import { SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE, SATUAN_SEARCH } from '../../../const/ApiConst';
const token = window.localStorage.getItem('token');
const config = {
@ -286,7 +286,7 @@ const Satuan = ({ params }) => {
<Button style={{ background: "#4caf50", color: "#fff" }} onClick={() => handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button>
</Tooltip>
<Tooltip title="Export Excel">
<Button style={{marginLeft:"5px"}} color="primary" onClick={()=> handleExportExcel()}><i className="fa fa-print"></i></Button>
<Button style={{ marginLeft: "5px" }} color="primary" onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button>
</Tooltip>
</Col>
</Row>
@ -311,11 +311,11 @@ const Satuan = ({ params }) => {
<td className='nowrap'>
<Tooltip title="Hapus">
<i id="TooltipDelete" className="cil-trash fa-lg" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(n.id)}></i>
<i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(n.id)}></i>
</Tooltip>
<Tooltip title="Edit">
<i id="TooltipEdit" className="cil-pencil fa-lg" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i>
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i>
</Tooltip>
</td>
<td>{n.name}</td>

Loading…
Cancel
Save