Untitled

 avatar
user_4058768
plain_text
6 months ago
4.6 kB
2
Indexable
import React from 'react';
import { Link } from 'react-router-dom';
import { connect } from 'react-redux';
import { AdminPage, FormCheckbox, FormSelect, FormTabs, FormDatePicker, renderDataTable, TableCell, TableHead } from 'view/component/AdminPage';
import { SelectAdapter_DmHocSdh } from 'modules/mdSauDaiHoc/dmHocSdh/redux';
import { SelectAdapter_SemesterData } from 'modules/mdSauDaiHoc/sdhSemester/redux';
import { SelectAdapter_SchoolYear } from 'modules/mdDaoTao/dtSemester/redux';
import { getSdhSemesterCurrent } from 'modules/mdSauDaiHoc/sdhSemester/redux';
import TraCuuThoiKhoaBieu from './section/tra-cuu-thoi-khoa-bieu';
import QuanLyBu from './section/quan-ly-bu';
import DangKyBu from './section/dang-ky-bu';
class SdhQuanLyNghiBuHP extends AdminPage {

    componentDidMount() {
        T.ready('user/sau-dai-hoc', () => {
            this.showAdvanceSearch();
            T.showSearchBox(() => {
                this.showAdvanceSearch();
            });
            this.props.getSdhSemesterCurrent(data => {
                const { namHoc } = data;
                this.namHoc.value(namHoc);
                this.setState({ filter: { ...this.state.filter, namHoc } }, () => {
                    T.alert('Load thành công', 'success', false, 500);
                });
            });
        });
    }

    handleSearch = () => {
        if (!this.fromTime.value()) {
            T.notify('Vui lòng nhập thời điểm bắt đầu!', 'danger');
        } else if (!this.toTime.value()) {
            T.notify('Vui lòng nhập thời điểm kết thúc!', 'danger');
        } else {
            let filter = {
                fromTime: this.fromTime.value().setHours(0, 0, 0, 0),
                toTime: this.toTime.value().setHours(23, 59, 59, 999),
                loaiHinhDaoTao: this.loaiHinhDaoTao.value(),
                namHoc: this.namHoc.value(),
                hocKy: this.hocKy.value(),
            };
            this.setState({ filter, isSearch: 1 }, () => {
                this.dkBu.getData();
                this.quanLyBu.getData();
            });
        }
    }

    render() {
        const dangKyBuHP = {
            key: 'dangKyBuHP', title: 'Đăng ký bù', component: <DangKyBu ref={e => this.dkBu = e} filter={this.state.filter} />
        };
        const quanLyLichBu = {
            key: 'quanLyLichBu', title: 'Quản lý lịch bù', component: <QuanLyBu ref={e => this.quanLyBu = e} filter={this.state.filter} />
        }
        const tabs = [dangKyBuHP, quanLyLichBu];
        return this.renderPage({
            icon: 'fa fa-calendar',
            title: 'Điều chỉnh học phần',
            breadcrumb: [
                <Link key={0} to='/user/sau-dai-hoc'>Sau đại học</Link>,
                <Link key={1} to='/user/sau-dai-hoc/thoi-khoa-bieu'>Thời khóa biểu</Link>,
                'Điều chỉnh học phần'
            ],
            content: <>
                <div className='tile'>
                    <FormTabs tabs={tabs} />
                </div>
            </>,
            advanceSearchTitle: '',
            advanceSearch: <div className='row'>
                <FormDatePicker type='date' ref={e => this.fromTime = e} label='Từ thời điểm' className='col-md-2' required />
                <FormDatePicker type='date' ref={e => this.toTime = e} label='Đến thời điểm' className='col-md-2' required />
                <FormSelect ref={e => this.namHoc = e} className='col-md-2' label='Năm học' data={SelectAdapter_SchoolYear} />
                <FormSelect ref={e => this.hocKy = e} className='col-md-2' label='Học kỳ' data={SelectAdapter_SemesterData} />
                <FormSelect ref={(e) => this.loaiHinhDaoTao = e} className='col-md-2' label='Bậc đào tạo' data={SelectAdapter_DmHocSdh} />
                <div className='col-md-2' style={{ textAlign: 'left', margin: 'auto' }}>
                    <button className='btn btn-success' type='button' onClick={e => e && e.preventDefault() || this.handleSearch()}>
                        <i className='fa fa-fw fa-lg fa-search' />Tìm kiếm
                    </button>
                </div>
            </div>,
            backRoute: '/user/sau-dai-hoc/thoi-khoa-bieu',

        });
    }
}

const mapStateToProps = state => ({ system: state.system, sdhQuanLyNghiBuHP: state.sdh.sdhQuanLyNghiBuHP });
const mapActionsToProps = { getSdhSemesterCurrent };
export default connect(mapStateToProps, mapActionsToProps)(SdhQuanLyNghiBuHP);
Editor is loading...
Leave a Comment