MaintenanceMode.js 55.3 KB
Newer Older
Riri Novita's avatar
Riri Novita committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
import React, { Component, useRef } from 'react';
import { Typography, Paper, TextField, Snackbar, withStyles, Switch, FormControlLabel } from '@material-ui/core';
import Images from '../../assets/Images';
import Constant from '../../library/Constant';
import api from '../../api';
import { PropagateLoader } from 'react-spinners';
import { format } from 'date-fns';
import Autocomplete from '@material-ui/lab/Autocomplete';
import { Alert } from '@material-ui/lab';
import ReactTooltip from "react-tooltip";
import SunEditor, { buttonList } from "suneditor-react";
import 'suneditor/dist/css/suneditor.min.css'; // Import Sun Editor's CSS File


const IOSSwitch = withStyles((theme) => ({
    root: {
        width: 55,
        height: 31,
        padding: 0,
        margin: theme.spacing(1),
    },
    switchBase: {
        padding: 3,
        marginLeft: 1,
        '&$checked': {
            transform: 'translateX(16px)',
            color: theme.palette.common.white,
            paddingLeft: 11,
            '& + $track': {
                backgroundColor: '#52d869',
                opacity: 1,
                border: 'none',
            },
        },
        '&$focusVisible $thumb': {
            color: '#52d869',
            border: '6px solid #fff',
        },
    },
    thumb: {
        width: 25,
        height: 25,
    },
    track: {
        borderRadius: 30 / 2,
        border: `1px solid ${theme.palette.grey[400]}`,
        backgroundColor: 'red',
        opacity: 1,
        transition: theme.transitions.create(['background-color', 'border']),
    },
    checked: {},
    focusVisible: {},
}))(({ classes, ...props }) => {
    return (
        <Switch
            focusVisibleClassName={classes.focusVisible}
            disableRipple
            classes={{
                root: classes.root,
                switchBase: classes.switchBase,
                thumb: classes.thumb,
                track: classes.track,
                checked: classes.checked,
            }}
            {...props}
        />
    );
});


class MaintenanceMode extends Component {
    constructor(props) {
        super(props)
        this.editorRef = React.createRef();
        this.editorRefEmail = React.createRef();
Riri Novita's avatar
Riri Novita committed
76
        this.editorRefContent = React.createRef();
Riri Novita's avatar
Riri Novita committed
77 78
        // this.handleChange = this.handleChange.bind(this)
        this.state = {
Riri Novita's avatar
Riri Novita committed
79 80 81 82 83 84
            load: false,
            loading: false,
            mailcontentModeActive: "",
            mailcontentModeNonActive: "",
            checkedB: true,
            headline: '',
Riri Novita's avatar
Riri Novita committed
85
            maintenanceContent: "",
Riri Novita's avatar
Riri Novita committed
86 87 88 89 90 91
            subjectMailActive: '',
            subjectMailNonActive: '',
            maintenanceID: null,
            maintenanceStatus: 0,
            mailStatusActive: 0,
            mailStatusNonActive: 0,
Riri Novita's avatar
Riri Novita committed
92
            visibleAlertSave: false
Riri Novita's avatar
Riri Novita committed
93 94


Riri Novita's avatar
Riri Novita committed
95 96 97 98 99
        }
    }


    componentDidMount() {
Riri Novita's avatar
Riri Novita committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
        this.getDetailMaintenanceMode()
    }

    getDetailMaintenanceMode() {
        this.setState({ loading: true })
        api.create().getDetailMaintenanceMode().then((response) => {
            console.log(response);
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === 'success') {
                        let data = response.data.data
                        console.log(data.maintenance_mail.length);
                        let dataModeActive = data.maintenance_mail.length > 0 ? data.maintenance_mail.[0].[0] : null
                        let dataModeNonActive = data.maintenance_mail.length > 0 ? data.maintenance_mail.[0].[1] : null
                        this.setState({
                            maintenanceID: data.maintenance_id,
                            headline: data.maintenance_headline,
                            maintenanceContent: data.maintenance_content,
                            maintenanceStatus: data.maintenance_status === null ? 0 : data.maintenance_status,
                            mailStatusActive: dataModeActive === null ? 0 : dataModeActive.status,
                            subjectMailActive: dataModeActive === null ? null : dataModeActive.mailSubject,
                            mailcontentModeActive: dataModeActive === null ? null : dataModeActive.mailBody,
                            mailStatusNonActive: dataModeNonActive === null ? 0 : dataModeNonActive.status,
                            subjectMailNonActive: dataModeNonActive === null ? null : dataModeNonActive.mailSubject,
                            mailcontentModeNonActive: dataModeNonActive === null ? null : dataModeNonActive.mailBody,

                        }, () => {
                            setTimeout(() => {
                                this.setState({ loading: false })
                            }, 2000);
                        })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
            }
        })
    }

    handleChange(e, type) {
        let data = this.state
        let isDate = type !== '' ? true : false
        if (isDate && type === 'start_date') {
            this.setState({
                ...data, startDate: format(e, 'yyyy-MM-dd'), endDate: null
            })
        } else if (isDate && type === 'end_date') {
            this.setState({
                ...data, endDate: format(e, 'yyyy-MM-dd')
            })
        } else {
            this.setState({
                ...data, [e.target.name]: e.target.value
            })
        }

    }

    handleCreate() {
Riri Novita's avatar
Riri Novita committed
170 171 172
        let bodyInactive = '<p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Hi,</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">We’re happy to let you know that TIA 4.0 is back online!</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">We appreciate your patience and kind understanding.</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Thank you!</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Regards,</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong><span style="font-size: 13px"><span style="color: rgb(0, 32, 96)">Triputra Group</span></span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>&nbsp;</strong></span></span></p><div class="se-component se-image-container __se__float-" contenteditable="false"><figure style="margin: 0px; width: 288px;"><img alt="" src="https://ci3.googleusercontent.com/proxy/pZlDMYsSIvwgrUzQ7hPn1nrk26YNIJbCPH_G8X56UqyPfO3tJ2BX1RFFZ7tTlXkJa7ccfzn7CVm6zWmbgFyhVkvTBjAAHzaAo3sllX9kkd9aQnnk=s0-d-e1-ft#https://www.triputra-group.com/mt-content/uploads/images/logo.png" data-origin="288,64" data-proportion="true" data-size="288px,64px" data-align="" data-file-name="logo.png" data-file-size="0" origin-size="288,64" style="width: 288px; height: 64px;" data-index="0"></figure></div><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Menara Kadin Indonesia, 23<sup>rd</sup>&nbsp;Floor</strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Jl. HR Rasuna Said Blok X-5, Kav 2-3, Kuningan, Jakarta Selatan 12950</strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Ph&nbsp;<a href="callto:+62%2021%205274323" target="_blank">+62 21 5274323</a>;&nbsp;<a href="http://www.triputra-group.com/" target="_blank" class="on">www.triputra-group.com</a></strong></span></span></p>'
        let bodyActive = '<p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Hi,</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><span style="font-size: 29px">TIA 4.0 is down for maintenance!</span></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Thank you for your patience, we expect to be back shortly.</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">We apologize for any inconvenience.</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">For more information, please contact our email:&nbsp;<span style="color: rgb(0, 90, 149)"><a href="mailto:tia4.0@triputra-group.com" target="_blank">tia4.0@triputra-group.com</a></span>.</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Regards,</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong><span style="font-size: 13px"><span style="color: rgb(0, 32, 96)">Triputra Group</span></span></strong></span></span></p><div class="se-component se-image-container __se__float-" contenteditable="false"><figure style="margin: 0px; width: 288px;"><img alt="" src="https://www.triputra-group.com/mt-content/uploads/images/logo.png" data-origin="288,64" data-proportion="true" data-size="288px,64px" data-align="" data-file-name="logo.png" data-file-size="0" origin-size="288,64" style="width: 288px; height: 64px;" data-index="0"></figure></div><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Menara Kadin Indonesia, 23<sup>rd</sup>&nbsp;Floor</strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Jl. HR Rasuna Said Blok X-5, Kav 2-3, Kuningan, Jakarta Selatan 12950</strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Ph&nbsp;<a href="callto:+62 21 5274323">+62 21 5274323</a>;&nbsp;<a href="http://www.triputra-group.com/" target="_blank">www.triputra-group.com</a></strong></span></span></p>'

Riri Novita's avatar
Riri Novita committed
173 174 175 176
        let payload = {
            "maintenance_headline": this.state.headline,
            "maintenance_content": this.state.maintenanceContent,
            "maintenance_status": this.state.maintenanceStatus,
177 178 179
            "maintenance_mail": [
                {
                    "mail_type": "MAINTENANCE_MODE_ACTIVE",
Riri Novita's avatar
Riri Novita committed
180
                    "mail_subject": "TIA 4.0 Is Under Maintenance",
Riri Novita's avatar
Riri Novita committed
181
                    "mail_body": bodyActive,
Riri Novita's avatar
Riri Novita committed
182
                    "mail_status": 0
183 184 185
                },
                {
                    "mail_type": "MAINTENANCE_MODE_INACTIVE",
Riri Novita's avatar
Riri Novita committed
186
                    "mail_subject": "TIA 4.0 is Back",
Riri Novita's avatar
Riri Novita committed
187
                    "mail_body": bodyInactive,
Riri Novita's avatar
Riri Novita committed
188
                    "mail_status": 1
189 190
                }
            ]
Riri Novita's avatar
Riri Novita committed
191 192 193 194 195 196 197 198 199 200 201 202 203 204
            // "maintenance_mail": [
            //     {
            //         "mail_type": "MAINTENANCE_MODE_ACTIVE",
            //         "mail_subject": this.state.subjectMailActive,
            //         "mail_body": this.state.mailcontentModeActive,
            //         "mail_status": this.state.mailStatusActive
            //     },
            //     {
            //         "mail_type": "MAINTENANCE_MODE_INACTIVE",
            //         "mail_subject": this.state.subjectMailNonActive,
            //         "mail_body": this.state.mailcontentModeNonActive,
            //         "mail_status": this.state.mailStatusNonActive
            //     }
            // ]
Riri Novita's avatar
Riri Novita committed
205 206
        }
        console.log(payload);
Riri Novita's avatar
Riri Novita committed
207
        this.setState({ visibleAlertSave: true })
Riri Novita's avatar
Riri Novita committed
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
        api.create().createMaintenanceMode(payload).then((response) => {
            console.log(response)
            this.setState({ loading: true })
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === 'success') {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', loading: false }, () => this.getDetailMaintenanceMode())
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
                }
            } else {
                // this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
                alert(response.problem)
                this.setState({ loading: false })
            }
        })

    }

    handleEdit() {
Riri Novita's avatar
Riri Novita committed
238 239 240
        let bodyInactive = '<p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Hi,</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">We’re happy to let you know that TIA 4.0 is back online!</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">We appreciate your patience and kind understanding.</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Thank you!</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Regards,</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong><span style="font-size: 13px"><span style="color: rgb(0, 32, 96)">Triputra Group</span></span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>&nbsp;</strong></span></span></p><div class="se-component se-image-container __se__float-" contenteditable="false"><figure style="margin: 0px; width: 288px;"><img alt="" src="https://ci3.googleusercontent.com/proxy/pZlDMYsSIvwgrUzQ7hPn1nrk26YNIJbCPH_G8X56UqyPfO3tJ2BX1RFFZ7tTlXkJa7ccfzn7CVm6zWmbgFyhVkvTBjAAHzaAo3sllX9kkd9aQnnk=s0-d-e1-ft#https://www.triputra-group.com/mt-content/uploads/images/logo.png" data-origin="288,64" data-proportion="true" data-size="288px,64px" data-align="" data-file-name="logo.png" data-file-size="0" origin-size="288,64" style="width: 288px; height: 64px;" data-index="0"></figure></div><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Menara Kadin Indonesia, 23<sup>rd</sup>&nbsp;Floor</strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Jl. HR Rasuna Said Blok X-5, Kav 2-3, Kuningan, Jakarta Selatan 12950</strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Ph&nbsp;<a href="callto:+62%2021%205274323" target="_blank">+62 21 5274323</a>;&nbsp;<a href="http://www.triputra-group.com/" target="_blank" class="on">www.triputra-group.com</a></strong></span></span></p>'
        let bodyActive = '<p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Hi,</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><span style="font-size: 29px">TIA 4.0 is down for maintenance!</span></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Thank you for your patience, we expect to be back shortly.</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">We apologize for any inconvenience.</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">For more information, please contact our email:&nbsp;<span style="color: rgb(0, 90, 149)"><a href="mailto:tia4.0@triputra-group.com" target="_blank">tia4.0@triputra-group.com</a></span>.</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">Regards,</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong><span style="font-size: 13px"><span style="color: rgb(0, 32, 96)">Triputra Group</span></span></strong></span></span></p><div class="se-component se-image-container __se__float-" contenteditable="false"><figure style="margin: 0px; width: 288px;"><img alt="" src="https://www.triputra-group.com/mt-content/uploads/images/logo.png" data-origin="288,64" data-proportion="true" data-size="288px,64px" data-align="" data-file-name="logo.png" data-file-size="0" origin-size="288,64" style="width: 288px; height: 64px;" data-index="0"></figure></div><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)">&nbsp;</span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Menara Kadin Indonesia, 23<sup>rd</sup>&nbsp;Floor</strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Jl. HR Rasuna Said Blok X-5, Kav 2-3, Kuningan, Jakarta Selatan 12950</strong></span></span></p><p><span style="font-size: 15px"><span style="color: rgb(0, 0, 0)"><strong>Ph&nbsp;<a href="callto:+62 21 5274323">+62 21 5274323</a>;&nbsp;<a href="http://www.triputra-group.com/" target="_blank">www.triputra-group.com</a></strong></span></span></p>'

Riri Novita's avatar
Riri Novita committed
241 242 243 244 245
        let payload = {
            "maintenance_id": this.state.maintenanceID,
            "maintenance_headline": this.state.headline,
            "maintenance_content": this.state.maintenanceContent,
            "maintenance_status": this.state.maintenanceStatus,
246 247 248
            "maintenance_mail": [
                {
                    "mail_type": "MAINTENANCE_MODE_ACTIVE",
Riri Novita's avatar
Riri Novita committed
249 250
                    "mail_subject": "TIA 4.0 Is Under Maintenance",
                    "mail_body": bodyActive,
Riri Novita's avatar
Riri Novita committed
251
                    "mail_status": 0
252 253 254
                },
                {
                    "mail_type": "MAINTENANCE_MODE_INACTIVE",
Riri Novita's avatar
Riri Novita committed
255 256
                    "mail_subject": "TIA 4.0 is Back",
                    "mail_body": bodyInactive,
Riri Novita's avatar
Riri Novita committed
257
                    "mail_status": 1
258 259
                }
            ]
Riri Novita's avatar
Riri Novita committed
260 261 262 263 264 265 266 267 268 269 270 271 272 273
            // "maintenance_mail": [
            //     {
            //         "mail_type": "MAINTENANCE_MODE_ACTIVE",
            //         "mail_subject": this.state.subjectMailActive,
            //         "mail_body": this.state.mailcontentModeActive,
            //         "mail_status": this.state.mailStatusActive
            //     },
            //     {
            //         "mail_type": "MAINTENANCE_MODE_INACTIVE",
            //         "mail_subject": this.state.subjectMailNonActive,
            //         "mail_body": this.state.mailcontentModeNonActive,
            //         "mail_status": this.state.mailStatusNonActive
            //     }
            // ]
Riri Novita's avatar
Riri Novita committed
274 275
        }
        console.log(payload);
Riri Novita's avatar
Riri Novita committed
276
        this.setState({ visibleAlertSave: true })
Riri Novita's avatar
Riri Novita committed
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
        api.create().updateMaintenanceMode(payload).then((response) => {
            console.log(response)
            this.setState({ loading: true })
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === 'success') {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', loading: false }, () => this.getDetailMaintenanceMode())
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
                }
            } else {
                // this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
                alert(response.problem)
                this.setState({ loading: false })
            }
        })
Riri Novita's avatar
Riri Novita committed
303 304 305 306 307 308
    }

    closeAlert() {
        this.setState({ alert: false })
    }

Riri Novita's avatar
Riri Novita committed
309 310 311
    // handleChange(event) {
    //     this.setState({ ...this.state.checkedB, [event.target.name]: event.target.checked });
    // };
Riri Novita's avatar
Riri Novita committed
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330

    handleImageUploadBefore(files, info, uploadHandler) {
        // uploadHandler is a function
        console.log(files, info, uploadHandler)
        try {
            this.ResizeImage(files, uploadHandler)
        } catch (err) {
            uploadHandler(err.toString())
        }
    }
    handleImageUpload(targetImgElement, index, state, imageInfo, remainingFilesCount) {
        console.log(targetImgElement, index, state, imageInfo, remainingFilesCount)
    }

    handleImageUploadError(errorMessage, result) {
        console.log(errorMessage, result)
    }

    handleEditorChange(value) {
Riri Novita's avatar
Riri Novita committed
331 332
        // console.log(value);
        this.setState({ mailcontentModeActive: value })
Riri Novita's avatar
Riri Novita committed
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412

        // setContent(value)
    }

    handleDrop(event) {
        console.log(event); //Get the drop event
    }

    handleBlur(event, editorContents) {
        console.log(event, editorContents); //Get the blur event
    }

    imageUploadHandler(xmlHttpRequest, info, core) {
        console.log(xmlHttpRequest, info, core)
    }

    ResizeImage(files, uploadHandler) {
        const uploadFile = files[0];
        const img = document.createElement('img');
        const canvas = document.createElement('canvas');
        const reader = new FileReader();

        console.log(uploadFile);

        reader.onload = function (e) {
            img.src = e.target.result
            img.onload = function () {
                let ctx = canvas.getContext("2d");
                ctx.drawImage(img, 0, 0);

                const MAX_WIDTH = 200;
                const MAX_HEIGHT = 100;
                let width = img.width;
                let height = img.height;

                if (width > height) {
                    if (width > MAX_WIDTH) {
                        height *= MAX_WIDTH / width;
                        width = MAX_WIDTH;
                    }
                } else {
                    if (height > MAX_HEIGHT) {
                        width *= MAX_HEIGHT / height;
                        height = MAX_HEIGHT;
                    }
                }

                canvas.width = width;
                canvas.height = height;

                ctx = canvas.getContext("2d");
                ctx.drawImage(img, 0, 0, width, height);

                canvas.toBlob(function (blob) {
                    uploadHandler([new File([blob], uploadFile.name)])
                }, uploadFile.type, 1);
            }
        }

        reader.readAsDataURL(uploadFile);
    }

    handleImageUploadBeforeEmail(files, info, uploadHandler) {
        // uploadHandler is a function
        console.log(files, info, uploadHandler)
        try {
            this.ResizeImageEmail(files, uploadHandler)
        } catch (err) {
            uploadHandler(err.toString())
        }
    }
    handleImageUploadEmail(targetImgElement, index, state, imageInfo, remainingFilesCount) {
        console.log(targetImgElement, index, state, imageInfo, remainingFilesCount)
    }

    handleImageUploadErrorEmail(errorMessage, result) {
        console.log(errorMessage, result)
    }

    handleEditorChangeEmail(value) {
Riri Novita's avatar
Riri Novita committed
413 414
        // console.log(value);
        this.setState({ mailcontentModeNonActive: value })
Riri Novita's avatar
Riri Novita committed
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476

        // setContent(value)
    }

    handleDropEmail(event) {
        console.log(event); //Get the drop event
    }

    handleBlurEmail(event, editorContents) {
        console.log(event, editorContents); //Get the blur event
    }

    imageUploadHandlerEmail(xmlHttpRequest, info, core) {
        console.log(xmlHttpRequest, info, core)
    }

    ResizeImageEmail(files, uploadHandler) {
        const uploadFile = files[0];
        const img = document.createElement('img');
        const canvas = document.createElement('canvas');
        const reader = new FileReader();

        console.log(uploadFile);

        reader.onload = function (e) {
            img.src = e.target.result
            img.onload = function () {
                let ctx = canvas.getContext("2d");
                ctx.drawImage(img, 0, 0);

                const MAX_WIDTH = 200;
                const MAX_HEIGHT = 100;
                let width = img.width;
                let height = img.height;

                if (width > height) {
                    if (width > MAX_WIDTH) {
                        height *= MAX_WIDTH / width;
                        width = MAX_WIDTH;
                    }
                } else {
                    if (height > MAX_HEIGHT) {
                        width *= MAX_HEIGHT / height;
                        height = MAX_HEIGHT;
                    }
                }

                canvas.width = width;
                canvas.height = height;

                ctx = canvas.getContext("2d");
                ctx.drawImage(img, 0, 0, width, height);

                canvas.toBlob(function (blob) {
                    uploadHandler([new File([blob], uploadFile.name)])
                }, uploadFile.type, 1);
            }
        }

        reader.readAsDataURL(uploadFile);
    }

Riri Novita's avatar
Riri Novita committed
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
    handleImageUploadBeforeContent(files, info, uploadHandler) {
        // uploadHandler is a function
        console.log(files, info, uploadHandler)
        try {
            this.ResizeImage(files, uploadHandler)
        } catch (err) {
            uploadHandler(err.toString())
        }
    }
    handleImageUploadContent(targetImgElement, index, state, imageInfo, remainingFilesCount) {
        console.log(targetImgElement, index, state, imageInfo, remainingFilesCount)
    }

    handleImageUploadErrorContent(errorMessage, result) {
        console.log(errorMessage, result)
    }

    handleEditorChangeContent(value) {
        // console.log(value);
        this.setState({ maintenanceContent: value })

        // setContent(value)
    }

    handleDropContent(event) {
        console.log(event); //Get the drop event
    }

    handleBlurContent(event, editorContents) {
        console.log(event, editorContents); //Get the blur event
    }

    imageUploadHandlerContent(xmlHttpRequest, info, core) {
        console.log(xmlHttpRequest, info, core)
    }

    ResizeImageContent(files, uploadHandler) {
        const uploadFile = files[0];
        const img = document.createElement('img');
        const canvas = document.createElement('canvas');
        const reader = new FileReader();

        console.log(uploadFile);

        reader.onload = function (e) {
            img.src = e.target.result
            img.onload = function () {
                let ctx = canvas.getContext("2d");
                ctx.drawImage(img, 0, 0);

                const MAX_WIDTH = 200;
                const MAX_HEIGHT = 100;
                let width = img.width;
                let height = img.height;

                if (width > height) {
                    if (width > MAX_WIDTH) {
                        height *= MAX_WIDTH / width;
                        width = MAX_WIDTH;
                    }
                } else {
                    if (height > MAX_HEIGHT) {
                        width *= MAX_HEIGHT / height;
                        height = MAX_HEIGHT;
                    }
                }

                canvas.width = width;
                canvas.height = height;

                ctx = canvas.getContext("2d");
                ctx.drawImage(img, 0, 0, width, height);

                canvas.toBlob(function (blob) {
                    uploadHandler([new File([blob], uploadFile.name)])
                }, uploadFile.type, 1);
            }
        }

        reader.readAsDataURL(uploadFile);
    }

Riri Novita's avatar
Riri Novita committed
559 560 561
    render() {

        const loadingComponent = (
Riri Novita's avatar
Riri Novita committed
562
            <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
Riri Novita's avatar
Riri Novita committed
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
                <PropagateLoader
                    // css={override}
                    size={20}
                    color={"#274B80"}
                    loading={this.state.loading}
                />
            </div>
        );

        return (
            <div style={{ flex: 1, backgroundColor: '#f8f8f8', minHeight: this.props.height }}>
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
                <div>
Riri Novita's avatar
Riri Novita committed
580
                    {this.state.loading && loadingComponent}
Riri Novita's avatar
Riri Novita committed
581 582 583 584
                    <div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
                        <Typography style={{ fontSize: '16px', color: 'white' }}>Maintenance Mode</Typography>
                    </div>
                    <div style={{ padding: 20, width: '100%' }}>
Riri Novita's avatar
Riri Novita committed
585
                        <Paper style={{ paddingTop: 10, paddingBottom: 50 }}>
Riri Novita's avatar
Riri Novita committed
586
                            <div style={{ display: 'flex', justifyContent: 'space-between', margin: 10, borderBottom: 'solid 2px #00000057', height: '100%' }}>
Riri Novita's avatar
Riri Novita committed
587 588 589 590
                                <div >
                                    <Typography style={{ fontSize: '17px', color: '#4b4b4b', margin: 10 }}>General Setting - Maintenance Mode</Typography>
                                </div>
                                <div style={{ marginTop: 5, marginRight: 30 }}>
Riri Novita's avatar
Riri Novita committed
591
                                    {/* <button
Riri Novita's avatar
Riri Novita committed
592 593
                                        type="button"
                                        style={{ background: 'white' }}
Riri Novita's avatar
Riri Novita committed
594
                                        onClick={() => Alert('Coming Soon !')}
Riri Novita's avatar
Riri Novita committed
595 596 597 598
                                    >
                                        <div style={{ width: 102, height: 30, backgroundColor: '#fff', border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', marginRight: 15 }}>
                                            <span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
                                        </div>
Riri Novita's avatar
Riri Novita committed
599
                                    </button> */}
Riri Novita's avatar
Riri Novita committed
600 601
                                    <button
                                        type="button"
Riri Novita's avatar
Riri Novita committed
602
                                        onClick={() => this.state.maintenanceID === null ? this.handleCreate() : this.handleEdit()}
Riri Novita's avatar
Riri Novita committed
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
                                    >
                                        <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                            <span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
                                        </div>
                                    </button>
                                </div>
                            </div>
                            <div style={{ margin: 20 }}>
                                <div style={{ display: 'flex', marginTop: 20, width: '100%', justifyContent: 'space-between' }}>
                                    <Typography style={{ marginTop: 13, width: '20%', color: '#656565', fontSize: 14 }}>Maintenance Mode</Typography>
                                    <div style={{ width: '80%', paddingTop: 10 }}>
                                        <div>
                                            {/* <FormControlLabel
                                                control={<IOSSwitch checked={this.state.checkedB} onChange={this.handleChange.bind(this)} name="checkedB" />} /> */}
                                            <button
                                                type="button"
                                                style={{ background: '#fff', marginRight: 15 }}
Riri Novita's avatar
Riri Novita committed
620
                                                onClick={() => this.setState({ maintenanceStatus: 0 })}
Riri Novita's avatar
Riri Novita committed
621
                                            >
Riri Novita's avatar
Riri Novita committed
622 623
                                                <div style={{ width: 102, height: 30, backgroundColor: this.state.maintenanceStatus === 0 ? 'green' : '#fff', border: this.state.maintenanceStatus === 0 ? 'none' : 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                                    <span style={{ color: this.state.maintenanceStatus === 0 ? 'white' : '#354960', fontSize: 11, fontWeight: 'bold' }}>Non Active</span>
Riri Novita's avatar
Riri Novita committed
624 625 626 627
                                                </div>
                                            </button>
                                            <button
                                                type="button"
Riri Novita's avatar
Riri Novita committed
628
                                                onClick={() => this.setState({ maintenanceStatus: 1 })}
Riri Novita's avatar
Riri Novita committed
629
                                            >
Riri Novita's avatar
Riri Novita committed
630 631
                                                <div style={{ width: 102, height: 30, backgroundColor: this.state.maintenanceStatus === 1 ? 'red' : '#fff', border: this.state.maintenanceStatus === 1 ? null : 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                                    <span style={{ color: this.state.maintenanceStatus === 1 ? 'white' : '#354960', fontSize: 11, fontWeight: 'bold' }}>Active</span>
Riri Novita's avatar
Riri Novita committed
632 633 634 635 636 637 638 639 640 641 642 643 644
                                                </div>
                                            </button>
                                        </div>
                                        <Typography style={{ alignSelf: 'center', width: '80%', marginTop: 11, color: '#656565', fontSize: 14 }}>Dengan mengaktifkan, maka user selain admin tidak dapat melakukan akses ke dalam sistem. (Halaman maintenance terbuka)</Typography>
                                    </div>
                                </div>
                                <Typography style={{ marginTop: 20, width: '80%', color: '#656565', fontSize: 15, fontWeight: 'bold' }}>Setting Halaman Maintenance</Typography>
                                <div style={{ display: 'flex', marginTop: 15, width: '100%', justifyContent: 'space-between' }}>
                                    <Typography style={{ marginTop: 13, width: '20%', color: '#656565', fontSize: 14 }}>Headline</Typography>
                                    <div style={{ width: '80%', margin: 0, marginTop: 10 }}>
                                        <div>
                                            <TextField
                                                variant="outlined"
Riri Novita's avatar
Riri Novita committed
645 646 647 648
                                                id="headline"
                                                name="headline"
                                                value={this.state.headline}
                                                onChange={(e) => this.handleChange(e, '')}
Riri Novita's avatar
Riri Novita committed
649 650 651 652 653 654
                                                style={{ width: '80%' }}
                                                inputProps={{ style: { color: '#656565', height: 0 } }}
                                            />
                                        </div>
                                    </div>
                                </div>
Riri Novita's avatar
Riri Novita committed
655
                                <div style={{ display: 'flex', marginTop: 15, width: '100%', justifyContent: 'space-between' }}>
Riri Novita's avatar
Riri Novita committed
656 657
                                    <Typography style={{ marginTop: 13, width: '20%', color: '#656565', fontSize: 14 }}>Content</Typography>
                                    <div style={{ width: '80%', margin: 0, marginTop: 10 }}>
Riri Novita's avatar
Riri Novita committed
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687
                                        <div style={{ marginTop: 20 }}>
                                            <SunEditor
                                                showToolbar={true}
                                                enableToolbar={true}
                                                ref={this.editorRefContent}
                                                width={"100%"}
                                                setOptions={{
                                                    width: '80%',
                                                    height: 300,
                                                    buttonList: [
                                                        // default
                                                        ['undo', 'redo'],
                                                        ['font', 'fontSize', 'formatBlock'],
                                                        ['paragraphStyle', 'blockquote'],
                                                        ['fontColor', 'hiliteColor', 'textStyle'],
                                                        ['bold', 'underline', 'italic', 'list', 'align'],
                                                        ['table', 'link', 'image'],
                                                        ['fullScreen']
                                                    ]
                                                    // buttonList: buttonList.formatting // Or Array of button list, eg. [['font', 'align'], ['image']]
                                                    // Other option
                                                }}
                                                onChange={this.handleEditorChangeContent.bind(this)}
                                                setContents={this.state.maintenanceContent}
                                                onDrop={this.handleDropContent.bind(this)}
                                                imageUploadHandler={this.imageUploadHandlerContent.bind(this)}
                                                onBlur={this.handleBlurContent.bind(this)}
                                                onImageUploadBefore={this.handleImageUploadBeforeContent.bind(this)}
                                                onImageUpload={this.handleImageUploadContent.bind(this)}
                                                onImageUploadError={this.handleImageUploadErrorContent.bind(this)}
Riri Novita's avatar
Riri Novita committed
688 689 690 691
                                            />
                                        </div>
                                    </div>
                                </div>
Riri Novita's avatar
Riri Novita committed
692
                                {/* <Typography style={{ marginTop: 30, width: '80%', color: '#656565', fontSize: 15, fontWeight: 'bold' }}>Setting Notifikasi Email Saat Maintenance Mode Aktif</Typography>
Riri Novita's avatar
Riri Novita committed
693 694 695 696 697 698 699
                                <div style={{ display: 'flex', marginTop: 20, width: '100%', justifyContent: 'space-between' }}>
                                    <Typography style={{ marginTop: 13, width: '20%', color: '#656565', fontSize: 14 }}>Kirim Email Notif</Typography>
                                    <div style={{ width: '80%', margin: 0, marginTop: 10 }}>
                                        <div>
                                            <button
                                                type="button"
                                                style={{ background: '#fff', marginRight: 15 }}
Riri Novita's avatar
Riri Novita committed
700
                                                onClick={() => this.setState({ mailStatusActive: 0 })}
Riri Novita's avatar
Riri Novita committed
701
                                            >
Riri Novita's avatar
Riri Novita committed
702 703
                                                <div style={{ width: 102, height: 30, backgroundColor: this.state.mailStatusActive === 0 ? 'red' : '#fff', border: this.state.mailStatusActive === 0 ? 'none' : 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                                    <span style={{ color: this.state.mailStatusActive === 0 ? 'white' : '#354960', fontSize: 11, fontWeight: 'bold' }}>Tidak</span>
Riri Novita's avatar
Riri Novita committed
704 705 706 707
                                                </div>
                                            </button>
                                            <button
                                                type="button"
Riri Novita's avatar
Riri Novita committed
708
                                                onClick={() => this.setState({ mailStatusActive: 1 })}
Riri Novita's avatar
Riri Novita committed
709
                                            >
Riri Novita's avatar
Riri Novita committed
710 711
                                                <div style={{ width: 102, height: 30, backgroundColor: this.state.mailStatusActive === 1 ? 'green' : '#fff', border: this.state.mailStatusActive === 1 ? null : 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                                    <span style={{ color: this.state.mailStatusActive === 1 ? 'white' : '#354960', fontSize: 11, fontWeight: 'bold' }}>Ya</span>
Riri Novita's avatar
Riri Novita committed
712 713 714 715 716 717 718 719 720 721 722
                                                </div>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div style={{ display: 'flex', marginTop: 15, width: '100%', justifyContent: 'space-between' }}>
                                    <Typography style={{ marginTop: 13, width: '20%', color: '#656565', fontSize: 14 }}>Subject Email</Typography>
                                    <div style={{ width: '80%', margin: 0, marginTop: 10 }}>
                                        <div>
                                            <TextField
                                                variant="outlined"
Riri Novita's avatar
Riri Novita committed
723 724 725 726
                                                id="subjectMailActive"
                                                name="subjectMailActive"
                                                onChange={(e) => this.handleChange(e, '')}
                                                value={this.state.subjectMailActive}
Riri Novita's avatar
Riri Novita committed
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
                                                style={{ width: '80%' }}
                                                inputProps={{ style: { color: '#656565', height: 0 } }}
                                            />
                                        </div>
                                    </div>
                                </div>
                                <div style={{ display: 'flex', marginTop: 15, width: '100%', justifyContent: 'space-between' }}>
                                    <Typography style={{ marginTop: 13, width: '20%', color: '#656565', fontSize: 14 }}>Content Email</Typography>
                                    <div style={{ width: '80%', margin: 0, marginTop: 10 }}>
                                        <div style={{ marginTop: 20 }}>
                                            <SunEditor
                                                showToolbar={true}
                                                enableToolbar={true}
                                                ref={this.editorRef}
                                                width={"100%"}
                                                setOptions={{
                                                    width: '80%',
                                                    height: 300,
                                                    buttonList: [
                                                        // default
                                                        ['undo', 'redo'],
                                                        ['font', 'fontSize', 'formatBlock'],
                                                        ['paragraphStyle', 'blockquote'],
                                                        ['fontColor', 'hiliteColor', 'textStyle'],
                                                        ['bold', 'underline', 'italic', 'list', 'align'],
                                                        ['table', 'link', 'image'],
                                                        ['fullScreen']
                                                    ]
                                                    // buttonList: buttonList.formatting // Or Array of button list, eg. [['font', 'align'], ['image']]
                                                    // Other option
                                                }}
                                                onChange={this.handleEditorChange.bind(this)}
Riri Novita's avatar
Riri Novita committed
759
                                                setContents={this.state.mailcontentModeActive}
Riri Novita's avatar
Riri Novita committed
760 761 762 763 764 765 766 767 768
                                                onDrop={this.handleDrop.bind(this)}
                                                imageUploadHandler={this.imageUploadHandler.bind(this)}
                                                onBlur={this.handleBlur.bind(this)}
                                                onImageUploadBefore={this.handleImageUploadBefore.bind(this)}
                                                onImageUpload={this.handleImageUpload.bind(this)}
                                                onImageUploadError={this.handleImageUploadError.bind(this)}
                                            />
                                        </div>
                                    </div>
Riri Novita's avatar
Riri Novita committed
769 770
                                </div> */}
                                {/* <Typography style={{ marginTop: 30, width: '80%', color: '#656565', fontSize: 15, fontWeight: 'bold' }}>Setting Notifikasi Email Saat Maintenance Mode Non Aktif</Typography>
Riri Novita's avatar
Riri Novita committed
771 772 773 774 775 776 777
                                <div style={{ display: 'flex', marginTop: 20, width: '100%', justifyContent: 'space-between' }}>
                                    <Typography style={{ marginTop: 13, width: '20%', color: '#656565', fontSize: 14 }}>Kirim Email Notif</Typography>
                                    <div style={{ width: '80%', margin: 0, marginTop: 10 }}>
                                        <div>
                                            <button
                                                type="button"
                                                style={{ background: '#fff', marginRight: 15 }}
Riri Novita's avatar
Riri Novita committed
778
                                                onClick={() => this.setState({ mailStatusNonActive: 0 })}
Riri Novita's avatar
Riri Novita committed
779
                                            >
Riri Novita's avatar
Riri Novita committed
780 781
                                                <div style={{ width: 102, height: 30, backgroundColor: this.state.mailStatusNonActive === 0 ? 'red' : '#fff', border: this.state.mailStatusNonActive === 0 ? 'none' : 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                                    <span style={{ color: this.state.mailStatusNonActive === 0 ? 'white' : '#354960', fontSize: 11, fontWeight: 'bold' }}>Tidak</span>
Riri Novita's avatar
Riri Novita committed
782 783 784 785
                                                </div>
                                            </button>
                                            <button
                                                type="button"
Riri Novita's avatar
Riri Novita committed
786
                                                onClick={() => this.setState({ mailStatusNonActive: 1 })}
Riri Novita's avatar
Riri Novita committed
787
                                            >
Riri Novita's avatar
Riri Novita committed
788 789
                                                <div style={{ width: 102, height: 30, backgroundColor: this.state.mailStatusNonActive === 1 ? 'green' : '#fff', border: this.state.mailStatusNonActive === 1 ? null : 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                                    <span style={{ color: this.state.mailStatusNonActive === 1 ? 'white' : '#354960', fontSize: 11, fontWeight: 'bold' }}>Ya</span>
Riri Novita's avatar
Riri Novita committed
790 791 792 793 794 795 796 797 798 799 800
                                                </div>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div style={{ display: 'flex', marginTop: 15, width: '100%', justifyContent: 'space-between' }}>
                                    <Typography style={{ marginTop: 13, width: '20%', color: '#656565', fontSize: 14 }}>Subject Email</Typography>
                                    <div style={{ width: '80%', margin: 0, marginTop: 10 }}>
                                        <div>
                                            <TextField
                                                variant="outlined"
Riri Novita's avatar
Riri Novita committed
801 802 803 804
                                                id="subjectMailNonActive"
                                                name="subjectMailNonActive"
                                                onChange={(e) => this.handleChange(e, '')}
                                                value={this.state.subjectMailNonActive}
Riri Novita's avatar
Riri Novita committed
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836
                                                style={{ width: '80%' }}
                                                inputProps={{ style: { color: '#656565', height: 0 } }}
                                            />
                                        </div>
                                    </div>
                                </div>
                                <div style={{ display: 'flex', marginTop: 15, width: '100%', justifyContent: 'space-between' }}>
                                    <Typography style={{ marginTop: 13, width: '20%', color: '#656565', fontSize: 14 }}>Content Email</Typography>
                                    <div style={{ width: '80%', margin: 0, marginTop: 10 }}>
                                        <div style={{ marginTop: 20 }}>
                                            <SunEditor
                                                showToolbar={true}
                                                enableToolbar={true}
                                                ref={this.editorRefEmail}
                                                width={"100%"}
                                                setOptions={{
                                                    width: '80%',
                                                    height: 300,
                                                    buttonList: [
                                                        // default
                                                        ['undo', 'redo'],
                                                        ['font', 'fontSize', 'formatBlock'],
                                                        ['paragraphStyle', 'blockquote'],
                                                        ['fontColor', 'hiliteColor', 'textStyle'],
                                                        ['bold', 'underline', 'italic', 'list', 'align'],
                                                        ['table', 'link', 'image'],
                                                        ['fullScreen']
                                                    ]
                                                    // buttonList: buttonList.formatting // Or Array of button list, eg. [['font', 'align'], ['image']]
                                                    // Other option
                                                }}
                                                onChange={this.handleEditorChangeEmail.bind(this)}
Riri Novita's avatar
Riri Novita committed
837
                                                setContents={this.state.mailcontentModeNonActive}
Riri Novita's avatar
Riri Novita committed
838 839 840 841 842 843 844 845 846
                                                onDrop={this.handleDropEmail.bind(this)}
                                                imageUploadHandler={this.imageUploadHandlerEmail.bind(this)}
                                                onBlur={this.handleBlurEmail.bind(this)}
                                                onImageUploadBefore={this.handleImageUploadBeforeEmail.bind(this)}
                                                onImageUpload={this.handleImageUploadEmail.bind(this)}
                                                onImageUploadError={this.handleImageUploadErrorEmail.bind(this)}
                                            />
                                        </div>
                                    </div>
Riri Novita's avatar
Riri Novita committed
847
                                </div> */}
Riri Novita's avatar
Riri Novita committed
848 849 850 851
                            </div>
                        </Paper>
                    </div>
                </div>
Riri Novita's avatar
Riri Novita committed
852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888

                {this.state.visibleAlertSave && (
                    <div className="test app-popup-show">
                        <div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 561, height: 233 }}>
                            <div style={{ margin: 25 }}>
                                <div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
                                    <div style={{ alignSelf: 'center', marginRight: 25 }}>
                                        <img src={Images.berhasil} />
                                    </div>
                                    <div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
                                        Maintenance mode deactivated successfully!
                                    </div>
                                </div>
                                <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            background: '#F6F7F9',
                                            cursor: 'pointer',
                                            border: '1px solid #3549609e',
                                            outline: 'none',
                                            marginRight: 20,
                                            borderRadius: 9
                                        }}
                                        onClick={() => this.setState({ visibleAlertSave: false })}
                                    >
                                        <div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
                                            <Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
                                        </div>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                )
                }
Riri Novita's avatar
Riri Novita committed
889 890 891 892 893 894
            </div>
        );

    }
}

Riri Novita's avatar
Riri Novita committed
895
export default MaintenanceMode;