/* Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de) Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah) */ import React from 'react'; import { Space, Tag } from 'antd'; import { CopyOutlined, DeleteOutlined, EditOutlined, MonitorOutlined, } from '@ant-design/icons'; import ReactLogViewAdapter from './ReactLogViewAdapter'; class ReactApproveModuleAdapter extends ReactLogViewAdapter { cancelRequest(id) { const object = {}; object.id = id; const reqJson = JSON.stringify(object); const callBackData = []; callBackData.callBackData = []; callBackData.callBackSuccess = 'cancelSuccessCallBack'; callBackData.callBackFail = 'cancelFailCallBack'; this.customAction('cancel', `modules=${this.modulePathName}`, reqJson, callBackData); } // eslint-disable-next-line no-unused-vars cancelSuccessCallBack(callBackData) { this.showMessage('Successful', `${this.itemName} cancellation request sent`); this.get([]); } cancelFailCallBack(callBackData) { this.showMessage(`Error Occurred while cancelling ${this.itemName}`, callBackData); } getTableActionButtonJsx(adapter) { return (text, record) => ( {adapter.hasAccess('save') && adapter.showEdit && ( modJs.edit(record.id)} style={{ cursor: 'pointer' }}> {` ${adapter.gt('Edit')}`} )} {adapter.hasAccess('delete') && adapter.showDelete && record.status === 'Approved' && ( modJs.cancelRequest(record.id)} style={{ cursor: 'pointer' }}> {` ${adapter.gt('Cancel')}`} )} {adapter.hasAccess('delete') && adapter.showDelete && record.status === 'Pending' && this.user.user_level === 'Admin' && ( modJs.deleteRow(record.id)} style={{ cursor: 'pointer' }}> {` ${adapter.gt('Delete')}`} )} modJs.getLogs(record.id)} style={{ cursor: 'pointer' }}> {` ${adapter.gt('View Logs')}`} ); } } export default ReactApproveModuleAdapter;