5) {
sleep(1);
header("Location:" . $WebSite . "login/login_form.php");
exit;
}
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
$title_message = '경동기업 수주 List';
?>
=$title_message?>
document.addEventListener('DOMContentLoaded', function() {
var columnDefs = [
{ headerName: "번호", field: "num", width: 80 },
{ headerName: "출고일자", field: "outdate", width: 120 },
{ headerName: "접수일", field: "indate", width: 120 },
{ headerName: "진행", field: "regist_state", width: 100, cellRenderer: function(params) {
if (params.value == "1") {
return '등록';
} else if (params.value == "2") {
return '접수';
} else if (params.value == "3") {
return '완료';
}
}},
{ headerName: "구분", field: "root", width: 100, cellClass: function(params) {
return params.value == "주일" ? "text-dark" : "text-primary";
}},
{ headerName: "절곡", field: "steel", width: 100 },
{ headerName: "모터", field: "motor", width: 100 },
{ headerName: "현장명", field: "outworkplace", width: 180 },
{ headerName: "수신자", field: "receiver", width: 100 },
{ headerName: "수신 주소", field: "outputplace", width: 200 },
{ headerName: "수신 연락처", field: "phone", width: 120 },
{ headerName: "운송방식", field: "delivery", width: 120 },
{ headerName: "담당", field: "orderman", width: 100 },
{ headerName: "틀수", field: "number", width: 80 },
{ headerName: "면적", field: "area", width: 100 },
{ headerName: "비고", field: "comment", width: 200 }
];
var gridOptions = {
columnDefs: columnDefs,
rowModelType: 'infinite',
paginationPageSize: 50,
cacheBlockSize: 50,
datasource: {
getRows: function(params) {
console.log('Requesting rows: ', params.startRow, ' to ', params.endRow);
$.ajax({
url: 'loadpage.php',
type: 'GET',
data: {
startRow: params.startRow,
endRow: params.endRow,
fromdate: $('#fromdate').val(),
todate: $('#todate').val(),
SettingDate: $("input[name='separate_date']:checked").val(),
setRange: $('#setRange').is(':checked'),
search: $('#search').val()
},
success: function(data) {
console.log(data);
if (data.error) {
alert('Error: ' + data.error);
} else {
params.successCallback(data.rowsThisPage, data.lastRow);
}
},
error: function() {
params.failCallback();
}
});
}
}
};
var eGridDiv = document.querySelector('#myGrid');
const gridApi = agGrid.createGrid(eGridDiv, gridOptions);
$('#searchBtn').on('click', function() {
gridApi.setDatasource(gridOptions.datasource);
});
$('#fromdate, #todate, #setRange, input[name="separate_date"]').on('change', function() {
gridApi.setDatasource(gridOptions.datasource);
});
$('#premonth').on('click', function() {
$('#fromdate').val(new Date(new Date().setDate(new Date().getDate() - 1)).toISOString().split('T')[0]);
gridApi.setDatasource(gridOptions.datasource);
});
$('#this_today').on('click', function() {
$('#fromdate').val(new Date().toISOString().split('T')[0]);
gridApi.setDatasource(gridOptions.datasource);
});
$('#this_tomorrow').on('click', function() {
$('#fromdate').val(new Date(new Date().setDate(new Date().getDate() + 1)).toISOString().split('T')[0]);
gridApi.setDatasource(gridOptions.datasource);
});
$("input:radio[name=separate_date]").click(function() {
gridApi.setDatasource(gridOptions.datasource);
});
});