|
|
|
@ -4,10 +4,17 @@ import moment from 'moment';
|
|
|
|
|
import { Button, Table, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; |
|
|
|
|
import Select from 'react-select'; |
|
|
|
|
import axios from 'axios'; |
|
|
|
|
import { BASE_URL_GEOHR_API } from '../../../const/ApiConst'; |
|
|
|
|
import { BASE_SIMPRO_LUMEN, BASE_URL_GEOHR_API } from '../../../const/ApiConst'; |
|
|
|
|
import { Transfer } from 'antd'; |
|
|
|
|
import { withTranslation } from 'react-i18next'; |
|
|
|
|
|
|
|
|
|
const token = window.localStorage.getItem('token'); |
|
|
|
|
const config = { |
|
|
|
|
headers: |
|
|
|
|
{ |
|
|
|
|
Authorization: `Bearer ${token}`, |
|
|
|
|
"Content-type": `application/json` |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
const ERROR_TITLE = "judul is required!" |
|
|
|
|
const ERROR_MESSAGE = "message is required!" |
|
|
|
|
const BASE_URL = "https://oslog.id/geohr-api/"; |
|
|
|
@ -42,26 +49,23 @@ class DialogDetail extends Component {
|
|
|
|
|
|
|
|
|
|
getDataDetail = async () => { |
|
|
|
|
countError++; |
|
|
|
|
let url = BASE_URL_GEOHR_API + `/broadcast-detail/search?broadcastId=${this.state.id}`; |
|
|
|
|
let url = BASE_SIMPRO_LUMEN + `/broadcast/search`; |
|
|
|
|
const payload = { |
|
|
|
|
"paging": { "start": 0, "length": 25 }, |
|
|
|
|
"orders": { "columns": ["id"], "ascending": true }, |
|
|
|
|
"columns": [ |
|
|
|
|
{ "name": "status_send", "logic_operator": "ilike", "value": "", "operator": "AND" } |
|
|
|
|
], |
|
|
|
|
"joins": [ |
|
|
|
|
{ "name": "m_broadcast", "column_results": ["title_notif", "message_notif", "description", "status_send"], "column_join": "broadcast_id" } |
|
|
|
|
{ "name": "id", "logic_operator": "=", "value": this.state.id, "operator": "AND" } |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
const result = await axios |
|
|
|
|
.post(url, payload) |
|
|
|
|
.post(url, payload, config) |
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
console.log('cek data detail', result.data) |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
|
if (result.data.data && result.data.data.broadcast_details) { |
|
|
|
|
this.setState({ dataListDetail: result.data.data.broadcast_details }) |
|
|
|
|
if (result.data.data && result.data.data) { |
|
|
|
|
this.setState({ dataListDetail: result.data.data }) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (countError < 6) { |
|
|
|
@ -97,11 +101,11 @@ class DialogDetail extends Component {
|
|
|
|
|
{this.state.dataListDetail.map((val, index) => { |
|
|
|
|
return ( |
|
|
|
|
<tr key={index}> |
|
|
|
|
<td>{val.join.status_send === "" ? "-" : val.status_send}</td> |
|
|
|
|
<td>{val.join.created_date === "" ? "-" : moment(val.created_date).format("YYYY-MM-DD HH:mm:ss")}</td> |
|
|
|
|
<td>{val.join.broadcast_description === "" ? "-" : val.join.broadcast_description}</td> |
|
|
|
|
<td>{val.join.broadcast_title_notif === "" ? "-" : val.join.broadcast_title_notif}</td> |
|
|
|
|
<td>{val.join.broadcast_message_notif === "" ? "-" : val.join.broadcast_message_notif}</td> |
|
|
|
|
<td>{val.status_send === "" ? "-" : val.status_send}</td> |
|
|
|
|
<td>{val.created_at === "" ? "-" : moment(val.created_date).format("DD-MM-YYYY HH:mm:ss")}</td> |
|
|
|
|
<td>{val.description === "" ? "-" : val.description}</td> |
|
|
|
|
<td>{val.title_notif === "" ? "-" : val.title_notif}</td> |
|
|
|
|
<td>{val.message_notif === "" ? "-" : val.message_notif}</td> |
|
|
|
|
</tr> |
|
|
|
|
) |
|
|
|
|
})} |
|
|
|
|