- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
755 lines
28 KiB
PHP
755 lines
28 KiB
PHP
<?php
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/load_GoogleDrive.php'; // 세션 등 여러가지 포함됨 파일 포함
|
|
|
|
if (!isset($_SESSION["level"]) || $_SESSION["level"] > 8) {
|
|
sleep(1);
|
|
header("Location:" . $WebSite . "login/login_form.php");
|
|
exit;
|
|
}
|
|
|
|
ini_set('display_errors', 1);
|
|
ini_set('display_startup_errors', 1);
|
|
error_reporting(E_ALL);
|
|
|
|
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
|
|
|
|
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : '';
|
|
$num = isset($_REQUEST["num"]) ? $_REQUEST["num"] : "";
|
|
$tablename = isset($_REQUEST["tablename"]) ? $_REQUEST["tablename"] : "output";
|
|
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/load_GoogleDriveSecond.php'; // attached, image에 대한 정보 불러오기
|
|
|
|
$title_message = "철재(스라트) 작업 ";
|
|
|
|
include $_SERVER['DOCUMENT_ROOT'] . '/mymodal.php';
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
|
$pdo = db_connect();
|
|
|
|
$today = date("Y-m-d"); // 현재일자 변수지정
|
|
|
|
try {
|
|
$sql = "select * from $DB.$tablename where num = ? ";
|
|
$stmh = $pdo->prepare($sql);
|
|
|
|
$stmh->bindValue(1, $num, PDO::PARAM_STR);
|
|
$stmh->execute();
|
|
$count = $stmh->rowCount();
|
|
$row = $stmh->fetch(PDO::FETCH_ASSOC); // $row 배열로 DB 정보를 불러온다.
|
|
if ($count < 1) {
|
|
print "검색결과가 없습니다.<br>";
|
|
} else {
|
|
include $_SERVER['DOCUMENT_ROOT'] . "/output/_row.php";
|
|
|
|
if ($indate != "0000-00-00") $indate = date("Y-m-d", strtotime($indate));
|
|
else $indate = "";
|
|
if ($outdate != "0000-00-00") $outdate = date("Y-m-d", strtotime($outdate));
|
|
else $outdate = "";
|
|
}
|
|
} catch (PDOException $Exception) {
|
|
print "오류: ".$Exception->getMessage();
|
|
}
|
|
?>
|
|
|
|
<title><?=$title_message?></title>
|
|
<style>
|
|
textarea {
|
|
overflow: hidden;
|
|
resize: none; /* 사용자 크기 조절을 방지 */
|
|
}
|
|
/* 기본 스타일 설정 */
|
|
input[type="checkbox"],
|
|
input[type="radio"] {
|
|
transform: scale(1.2); /* 크기 확대 */
|
|
margin: 3px; /* 여백 추가 */
|
|
}
|
|
|
|
/* "readonly" 상태일 때 스타일 설정 */
|
|
.readonly-checkbox,
|
|
.readonly-radio {
|
|
pointer-events: none; /* 사용자 상호작용 비활성화 */
|
|
opacity: 1; /* 불투명도 설정 */
|
|
color: red;
|
|
}
|
|
|
|
|
|
label {
|
|
font-size: 1.5em; /* 글꼴 크기 확대 */
|
|
display: inline-block;
|
|
margin: 5px 0;
|
|
}
|
|
|
|
.w-40{
|
|
width: 40%!important;
|
|
}
|
|
.w-60{
|
|
width: 60%!important;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<form id="board_form" name="board_form" method="post" enctype="multipart/form-data">
|
|
<input type="hidden" id="mode" name="mode" value="<?= isset($mode) ? $mode : '' ?>">
|
|
<input type="hidden" id="num" name="num" value="<?= isset($num) ? $num : '' ?>">
|
|
<input type="hidden" id="user_name" name="user_name" value="<?= isset($user_name) ? $user_name : '' ?>">
|
|
<input type="hidden" id="update_log" name="update_log" value="<?= isset($update_log) ? $update_log : NULL ?>">
|
|
<input type="hidden" id="tablename" name="tablename" value="<?= isset($tablename) ? $tablename : '' ?>">
|
|
<input type="hidden" id="is_deleted" name="is_deleted" value="<?= isset($is_deleted) ? $is_deleted : '0' ?>">
|
|
<input type="hidden" id="slat_su" name="slat_su" value="<?= isset($slat_su) ? $slat_su : '' ?>">
|
|
<input type="hidden" id="slat_m2" name="slat_m2" value="<?= isset($slat_m2) ? $slat_m2 : '' ?>">
|
|
|
|
<div class="container">
|
|
<div class="row justify-content-center align-items-center ">
|
|
<div class="card align-middle " style="width: 55rem;">
|
|
<div class="card-body text-center">
|
|
<div class="row d-flex justify-content-center align-items-center mb-2" >
|
|
<div class="col-sm-10" >
|
|
<div class="d-flex p-1 mb-1 justify-content-center align-items-center ">
|
|
<h3><?=$title_message?></h3>
|
|
<?php if($mode!=='view') { ?>
|
|
<button id="saveBtn" class="btn btn-dark btn-sm me-1" type="button">
|
|
<? if((int)$num>0) print ' <i class="bi bi-hdd-fill"></i> 저장'; else print ' <i class="bi bi-hdd-fill"></i> 저장'; ?></button>
|
|
<? } ?>
|
|
<button type="button" class="btn btn-outline-dark btn-sm me-2" id="showlogBtn">H</button>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-2" >
|
|
<button type="button" class="btn btn-outline-dark btn-sm" onclick="self.close();" > <i class="bi bi-box-arrow-left"></i> 창닫기 </button>
|
|
</div>
|
|
</div>
|
|
<div class="row text-center justify-content-center">
|
|
<span class="text-primary fs-6">
|
|
관리자가 아래의 라디오버튼을 클릭하면 상태가 변경됩니다.
|
|
</span>
|
|
</div>
|
|
<div class="row text-center justify-content-center">
|
|
<div class="d-flex justify-content-center align-items-center w-75">
|
|
<table class="table table-bordered">
|
|
<tbody>
|
|
<tr class="text-center">
|
|
<td class="text-center" style="width:120px;">
|
|
<span class="badge bg-dark fs-6">진행상태</span>
|
|
</td>
|
|
<td colspan="2" style="width:350px;">
|
|
<?php
|
|
$states = ["등록", "접수", "제작중", "완료"];
|
|
$is_admin = ($user_name === '김동실' || $user_name === '개발자' || $user_name === '이세희' || $user_name === '김진호');
|
|
?>
|
|
<?php foreach ($states as $state): ?>
|
|
<?= $state ?>
|
|
<input type="radio" class="readonly-radio" name="slat_state" value="<?= $state ?>" <?= ($slat_state === $state) ? "checked" : "" ?> <?= $is_admin ? "" : "readonly" ?> style="pointer-events: <?= $is_admin ? 'auto' : 'none' ?>;">
|
|
<?php endforeach; ?>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<button id="saveBtn" type="button" style="display:none;"></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/output/common/output_write_form.php'; // 공통으로 들어가는 부분 ?>
|
|
<div class="container-fluid">
|
|
<div class="row justify-content-center align-items-center p-1 mt-1 mb-1">
|
|
<h4 class="text-center">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<span class="badge bg-info"> 철재(스라트) </span> 작업 지시서
|
|
<button type='button' id="loadSlatWorkBtn" class='btn btn-info-emphasis bg-info-subtle border border-info-subtle rounded-pill btn-sm fw-bold me-2' ><i class="bi bi-card-text"></i> 철재스라트 작업일지 </button>
|
|
<button type='button' id="loadmidInspectSlatBtn" class='btn btn-danger-emphasis bg-danger-subtle border border-danger-subtle rounded-pill btn-sm fw-bold me-2' ><i class="bi bi-card-text"></i> 철재스라트-중간검사 </button>
|
|
<button type='button' id="loadmidInspectJointbarBtn" class='btn btn-danger-emphasis bg-danger-subtle border border-danger-subtle rounded-pill btn-sm fw-bold me-2' ><i class="bi bi-card-text"></i> 조인트바-중간검사 </button>
|
|
|
|
<span id="total_slat" class="badge bg-secondary me-2"></span>
|
|
<span id="make_slat" class="badge bg-dark me-2"></span>
|
|
<span id="total_slat_m2" class="badge bg-dark"></span>
|
|
</div>
|
|
</h4>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12 col-sm-12">
|
|
<div class="card">
|
|
<div class="card-body text-center">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<table id="slatTable" class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th class="text-dark fs-6 w50px" >번호</th>
|
|
<th class="text-dark fs-6 w100px">층</th>
|
|
<th class="text-dark fs-6 w200px">부호</th>
|
|
<th class="text-dark fs-6">철재(스라트)(제작) 너비(W)x높이(H), 수량(EA)</th>
|
|
<th class="text-dark fs-6">전체 공정</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$counter = 0;
|
|
$sum = 0;
|
|
$slatlist = isset($row['slatlist']) ? json_decode($row['slatlist'], true) : [];
|
|
|
|
foreach ($slatlist as $slatlist_item) {
|
|
$counter++;
|
|
$slatlist_item['num'] = $counter;
|
|
|
|
$text1 = isset($slatlist_item['text1']) ? trim($slatlist_item['text1']) : '';
|
|
$floors = isset($slatlist_item['floors']) ? trim($slatlist_item['floors']) : '';
|
|
$cutwidth = isset($slatlist_item['cutwidth']) ? trim($slatlist_item['cutwidth']) : '';
|
|
$cutheight = isset($slatlist_item['cutheight']) ? trim($slatlist_item['cutheight']) : '';
|
|
$number = isset($slatlist_item['number']) ? trim($slatlist_item['number']) : '';
|
|
$exititem = isset($slatlist_item['exititem']) ? trim($slatlist_item['exititem']) : '';
|
|
$hinge = isset($slatlist_item['hinge']) ? trim($slatlist_item['hinge']) : '';
|
|
$hingenum = isset($slatlist_item['hingenum']) ? trim($slatlist_item['hingenum']) : '';
|
|
$intervalnum = isset($slatlist_item['intervalnum']) ? trim($slatlist_item['intervalnum']) : '';
|
|
$memo = isset($slatlist_item['memo']) ? trim($slatlist_item['memo']) : ''; // EGI 1.6, EGI 1.2
|
|
$text2 = isset($slatlist_item['text2']) ? trim($slatlist_item['text2']) : '';
|
|
$done_check = isset($slatlist_item['done_check']) ? trim($slatlist_item['done_check']) : '';
|
|
|
|
$sum += (int)$number;
|
|
$readonly = ($user_name !== '김동실' && $user_name !== '개발자') ? "readonly" : "";
|
|
?>
|
|
<tr>
|
|
<td ><?= $counter ?></td>
|
|
<td class="text-center">
|
|
<div class="d-flex justify-content-center fs-5">
|
|
<span class="text-dark fs-6"><?= $floors ?></span>
|
|
</div>
|
|
</td>
|
|
<td class="text-center">
|
|
<div class="d-flex justify-content-center fs-5">
|
|
<span class="text-dark fs-6"><?= $text1 ?></span>
|
|
<span class="badge bg-success fs-6"><?= $memo ?></span>
|
|
</div>
|
|
</td>
|
|
<td class="text-start">
|
|
<div class="d-flex justify-content-start fs-5">
|
|
<?= $text2 ?>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
$checked = $done_check == '1' ? "checked" : "";
|
|
echo '<div><input type="checkbox" name="done_check[]" id="done_check' . $counter . '" class="workcheckbox" ' . $checked . ' value="1" ' . $readonly . '> <label for="done_check' . $counter . '">작업완료</label></div>';
|
|
?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script>
|
|
function captureReturnKey(e) {
|
|
if (e.keyCode == 13 && e.srcElement.type != 'textarea')
|
|
return false;
|
|
}
|
|
|
|
function recaptureReturnKey(e) {
|
|
if (e.keyCode == 13)
|
|
exe_search();
|
|
}
|
|
|
|
function Enter_Check() {
|
|
if (event.keyCode == 13) {
|
|
exe_search();
|
|
}
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
var loader = document.getElementById('loadingOverlay');
|
|
if(loader)
|
|
loader.style.display = 'none';
|
|
});
|
|
|
|
var mode = '<?php echo $mode; ?>';
|
|
var ajaxRequest_write = null;
|
|
|
|
$(document).ready(function() {
|
|
$("input[name='slat_state']").change(function() {
|
|
if ($(this).is(":checked")) {
|
|
$("#saveBtn").click();
|
|
}
|
|
});
|
|
|
|
$("#saveBtn").click(function() {
|
|
var form = $('#board_form')[0];
|
|
var data = new FormData(form);
|
|
savedata();
|
|
});
|
|
|
|
hideOverlay();
|
|
});
|
|
|
|
function savedata() {
|
|
var form = $('#board_form')[0];
|
|
var data = new FormData(form);
|
|
|
|
$("#overlay").show();
|
|
$("button").prop("disabled", true);
|
|
|
|
|
|
|
|
if ((typeof ajaxRequest_write !== 'undefined' && ajaxRequest_write) || ajaxRequest_write !== null) {
|
|
ajaxRequest_write.abort();
|
|
}
|
|
|
|
showMsgModal(2); // 파일저장중
|
|
|
|
ajaxRequest_write = $.ajax({
|
|
enctype: 'multipart/form-data',
|
|
processData: false,
|
|
contentType: false,
|
|
cache: false,
|
|
timeout: 600000,
|
|
url: "insert.php",
|
|
type: "post",
|
|
data: data,
|
|
dataType: "json",
|
|
success: function(data) {
|
|
// console.log(data.num);
|
|
|
|
setTimeout(function() {
|
|
if (window.opener && !window.opener.closed) {
|
|
if (typeof window.opener.restorePageNumber === 'function') {
|
|
window.opener.restorePageNumber();
|
|
}
|
|
}
|
|
setTimeout(function() {
|
|
if (data && data.num)
|
|
window.location.href = 'write_form.php?mode=view&tablename=' + $('#tablename').val() + '&num=' + data.num;
|
|
}, 1000);
|
|
}, 1500);
|
|
|
|
hideMsgModal();
|
|
},
|
|
error: function(jqxhr, status, error) {
|
|
console.log(jqxhr, status, error);
|
|
hideMsgModal();
|
|
}
|
|
});
|
|
}
|
|
|
|
function onlysave() {
|
|
var form = $('#board_form')[0];
|
|
var data = new FormData(form);
|
|
|
|
$("button").prop("disabled", true);
|
|
|
|
showMsgModal(2); // 파일저장중
|
|
|
|
if ((typeof ajaxRequest_write !== 'undefined' && ajaxRequest_write) || ajaxRequest_write !== null) {
|
|
ajaxRequest_write.abort();
|
|
}
|
|
|
|
ajaxRequest_write = $.ajax({
|
|
enctype: 'multipart/form-data',
|
|
processData: false,
|
|
contentType: false,
|
|
cache: false,
|
|
timeout: 600000,
|
|
url: "insert.php",
|
|
type: "post",
|
|
data: data,
|
|
dataType: "json",
|
|
success: function(data) {
|
|
if (window.opener && !window.opener.closed) {
|
|
// 부모창 새로고침
|
|
window.opener.location.reload();
|
|
|
|
// 1초 대기 (예: 이후 작업이 있다면 여기서 처리 가능)
|
|
setTimeout(function() {
|
|
hideMsgModal();
|
|
console.log('부모창 리로드 후 1초 경과');
|
|
// 여기에 추가 작업이 있다면 넣으세요.
|
|
}, 1000);
|
|
}
|
|
},
|
|
error: function(jqxhr, status, error) {
|
|
console.log(jqxhr, status, error);
|
|
hideMsgModal();
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
var mode = '<?php echo $mode; ?>';
|
|
|
|
if (mode === 'view') {
|
|
|
|
$('input, textarea').prop('readonly', true); // Disable all input, textarea, and select elements
|
|
$('input[type=hidden]').prop('readonly', false);
|
|
|
|
$('.viewon').prop('readonly', true);
|
|
$('.viewNoBtn').prop('readonly', true);
|
|
$('input[type=hidden]').prop('readonly', false);
|
|
|
|
$('.viewon').each(function() {
|
|
$(this).addClass('readonly-checkbox readonly-radio');
|
|
});
|
|
|
|
$('input[type=file]').prop('disabled', true);
|
|
$('label').css('font-size', '1.2em');
|
|
|
|
// select 속성 readonly 효과 내기
|
|
$('select[data-readonly="true"]').on('mousedown', function(event) {
|
|
event.preventDefault();
|
|
});
|
|
|
|
// checkbox 속성 readonly 효과 내기
|
|
$('input[type="checkbox"][data-readonly="true"]').on('click', function(event) {
|
|
event.preventDefault();
|
|
});
|
|
}
|
|
});
|
|
|
|
function adjustTextareaHeight(textarea) {
|
|
textarea.style.height = 'auto';
|
|
textarea.style.height = (textarea.scrollHeight) + 'px';
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
var $comment = $('#comment');
|
|
if ($comment.length) {
|
|
adjustTextareaHeight($comment[0]); // 초기 높이 조정
|
|
$comment.on('input', function() {
|
|
adjustTextareaHeight(this);
|
|
});
|
|
}
|
|
|
|
var $updatecomment = $('#updatecomment');
|
|
if ($updatecomment.length) {
|
|
adjustTextareaHeight($updatecomment[0]); // 초기 높이 조정
|
|
$updatecomment.on('input', function() {
|
|
adjustTextareaHeight(this);
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
$("#showlogBtn").click(function() {
|
|
var num = '<?php echo $num; ?>';
|
|
var workitem = 'output';
|
|
var btn = $(this);
|
|
popupCenter("../Showlog.php?num=" + num + "&workitem=" + workitem, '로그기록', 500, 500);
|
|
btn.prop('disabled', false);
|
|
});
|
|
$(document).on('click', '.Modalclose', function(e) {
|
|
$("#telModal").modal("hide");
|
|
});
|
|
});
|
|
|
|
var ajaxRequest = null;
|
|
|
|
$(document).ready(function() {
|
|
let fullslatlist = [];
|
|
|
|
function fetchslatlistAndUpdateCheckboxes() {
|
|
if (ajaxRequest !== null) {
|
|
ajaxRequest.abort();
|
|
}
|
|
|
|
ajaxRequest = $.ajax({
|
|
url: 'get_slatlist.php',
|
|
method: 'GET',
|
|
data: {
|
|
num: <?= $row['num'] ?>
|
|
},
|
|
success: function(response) {
|
|
if (response.success) {
|
|
fullslatlist = response.slatlist || [];
|
|
if (Array.isArray(fullslatlist)) {
|
|
updateCheckboxes(fullslatlist);
|
|
updateTotals();
|
|
} else {
|
|
console.error('Invalid slatlist format', fullslatlist);
|
|
}
|
|
} else {
|
|
console.error('Failed to fetch slatlist:', response.message);
|
|
}
|
|
},
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
console.error('AJAX request failed: ', textStatus, errorThrown);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function updateCheckboxes(slatlist) {
|
|
$('#slatTable tbody').children('tr').each(function(index, tr) {
|
|
const row = $(tr);
|
|
const item = slatlist[index]; // 직접 인덱스를 사용하여 각 행에 대응하는 항목을 참조
|
|
|
|
if (item) {
|
|
for (const key in item) {
|
|
if (item.hasOwnProperty(key) && key.endsWith('_check')) {
|
|
row.find(`input[name="${key}[]"]`).prop('checked', item[key] === "1");
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function updateTotals() {
|
|
if (ajaxRequest !== null) {
|
|
ajaxRequest.abort();
|
|
}
|
|
|
|
ajaxRequest = $.ajax({
|
|
url: 'get_check_done.php',
|
|
method: 'GET',
|
|
data: { num: <?= $row['num'] ?> },
|
|
success: function(response) {
|
|
if (response.success) {
|
|
// console.log('response ', response);
|
|
// Corrected property names according to the JSON response from the server
|
|
var completedQuantity = response['totalCompleted']; // Corrected from response['total']
|
|
var totalQuantity = response['totalItems']; // Corrected from response.totalQuantity
|
|
|
|
console.log('completedQuantity ', completedQuantity); // Should log 4
|
|
console.log('totalQuantity ', totalQuantity); // Should log 6
|
|
|
|
var newState = "";
|
|
if (completedQuantity === 0) {
|
|
newState = "접수";
|
|
} else if (completedQuantity < totalQuantity) {
|
|
newState = "제작중";
|
|
} else if (completedQuantity === totalQuantity) {
|
|
newState = "완료";
|
|
}
|
|
|
|
// Update the radio buttons for slat_state
|
|
$('input[name="slat_state"]').each(function() {
|
|
if ($(this).val() === newState) {
|
|
$(this).prop('checked', true);
|
|
}
|
|
});
|
|
|
|
// 진행상태 저장
|
|
onlysave();
|
|
|
|
// Update the UI elements with the fetched data
|
|
$('#total_slat').text(`총 수량: ${totalQuantity}`);
|
|
$('#make_slat').text(`완료: ${completedQuantity}`);
|
|
$('#total_slat_m2').text(`총 면적: ${parseFloat($("#slat_m2").val()).toFixed(1)} m²`);
|
|
} else {
|
|
console.error('Failed to fetch total:', response.message);
|
|
}
|
|
},
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
console.error('AJAX call failed: ', textStatus, errorThrown);
|
|
}
|
|
});
|
|
}
|
|
|
|
$('.workcheckbox').change(function() {
|
|
var slatlist = [];
|
|
|
|
// Loop through each row and create a corresponding entry in slatlist
|
|
$('#slatTable tbody').children('tr').each(function(index, tr) {
|
|
const row = $(tr);
|
|
const rowData = {};
|
|
|
|
// For each checkbox in the row, update rowData with its state
|
|
row.find('.workcheckbox').each(function() {
|
|
const checkbox = $(this);
|
|
const name = checkbox.attr('name').replace('[]', ''); // Remove the brackets for correct indexing
|
|
rowData[name] = checkbox.is(':checked') ? "1" : "0"; // Store "1" for checked and "0" for unchecked
|
|
});
|
|
|
|
slatlist.push(rowData); // Push the rowData object to slatlist
|
|
});
|
|
|
|
// Console output for debugging purposes (optional)
|
|
console.log('Updated slatlist before sending to server:', slatlist);
|
|
|
|
// Ensure no existing AJAX request is ongoing
|
|
if (ajaxRequest !== null) {
|
|
ajaxRequest.abort();
|
|
}
|
|
|
|
// Send the updated slatlist to the server using AJAX
|
|
ajaxRequest = $.ajax({
|
|
url: 'update_checkbox.php',
|
|
method: 'POST',
|
|
data: {
|
|
num: <?= $row['num'] ?>, // Ensure PHP variable $row['num'] is correctly defined in the scope
|
|
slatlist: JSON.stringify(slatlist),
|
|
slat_state: $('input[name="slat_state"]').val()
|
|
},
|
|
success: function(response) {
|
|
console.log('update_checkbox.php', response); // Debugging output
|
|
|
|
// Optional: Update UI totals or states based on the response
|
|
updateTotals();
|
|
|
|
// Display a toast notification based on the response success or failure
|
|
if (response.success) {
|
|
Toastify({
|
|
text: "설정 저장중...",
|
|
duration: 1000,
|
|
close: true,
|
|
gravity: "top",
|
|
position: "center",
|
|
style: {
|
|
background: "linear-gradient(to right, #000000, #96c93d)",
|
|
marginTop: "0px"
|
|
},
|
|
}).showToast();
|
|
} else {
|
|
Toastify({
|
|
text: "저장실패...",
|
|
duration: 1000,
|
|
close: true,
|
|
gravity: "top",
|
|
position: "center",
|
|
style: {
|
|
background: "linear-gradient(to right, #000000, #96c93d)"
|
|
},
|
|
}).showToast();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
// fetchslatlistAndUpdateCheckboxes();
|
|
});
|
|
|
|
$(document).ready(function () {
|
|
displayFileLoad(); // 기존파일 업로드 보이기
|
|
});
|
|
|
|
// 기존 파일 불러오기 (Google Drive에서 가져오기)
|
|
function displayFileLoad() {
|
|
$('#displayFile').show();
|
|
var data = <?php echo json_encode($savefilename_arr); ?>;
|
|
|
|
$("#displayFile").html(''); // 기존 내용 초기화
|
|
|
|
if (Array.isArray(data) && data.length > 0) {
|
|
data.forEach(function (fileData, i) {
|
|
const realName = fileData.realname || '다운로드 파일';
|
|
const link = fileData.link || '#';
|
|
const fileId = fileData.fileId || null;
|
|
|
|
if (!fileId) {
|
|
console.error("fileId가 누락되었습니다. index: " + i, fileData);
|
|
return;
|
|
}
|
|
|
|
$("#displayFile").append(
|
|
"<div class='row mb-3'>" +
|
|
"<div class='d-flex mb-3 align-items-center justify-content-start'>" +
|
|
"<span id='file" + i + "'>" +
|
|
"<a href='#' onclick=\"downloadFile('" + fileId + "', '" + realName + "'); return false;\">" +
|
|
"<span class='fw-bold text-primary'>" + realName + "</span>" +
|
|
"</a>" +
|
|
"</span> " +
|
|
"</div>" +
|
|
"</div>"
|
|
);
|
|
|
|
});
|
|
} else {
|
|
$("#displayFile").append(
|
|
"<div class='text-center text-muted'>No files</div>"
|
|
);
|
|
}
|
|
}
|
|
|
|
// 철재스라트작업일지 버튼 클릭 시
|
|
$(document).on('click', '#loadSlatWorkBtn', function() {
|
|
var num = $("#num").val();
|
|
var outDate = $("#outdate").val(); // 출고일
|
|
var orderDate = $("#orderdate").val(); // orderdate 값
|
|
var prodCode = $("#prodCode").val(); // prodCode 값
|
|
var warrantyNum = $("#warrantyNum").val();// warrantyNum 값
|
|
var delivery = $("input[name='delivery']:checked").val(); // 선택된 배송옵션 값
|
|
var outworkplace = $("#outworkplace").val(); // outworkplace 값
|
|
var outputplace = $("#outputplace").val(); // 수신처주소
|
|
var lotNum = $("#lotNum").val(); // 로트번호
|
|
|
|
// URL에 변수를 추가
|
|
var url = '/output/viewSlatWork.php?num=' + num
|
|
+ '&outdate=' + encodeURIComponent(outDate)
|
|
+ '&orderdate=' + encodeURIComponent(orderDate)
|
|
+ '&prodCode=' + encodeURIComponent(prodCode)
|
|
+ '&warrantyNum=' + encodeURIComponent(warrantyNum)
|
|
+ '&delivery=' + encodeURIComponent(delivery)
|
|
+ '&outputplace=' + encodeURIComponent(outputplace)
|
|
+ '&outworkplace=' + encodeURIComponent(outworkplace)
|
|
+ '&lotNum=' + encodeURIComponent(lotNum);
|
|
// 팝업 호출
|
|
customPopup(url, '철재스라트 작업일지', 800, 900);
|
|
});
|
|
|
|
// 철재스라트-중간검사 버튼 클릭 시
|
|
$(document).on('click', '#loadmidInspectSlatBtn', function() {
|
|
var num = $("#num").val();
|
|
var outDate = $("#outdate").val(); // 출고일
|
|
var orderDate = $("#orderdate").val(); // orderdate 값
|
|
var prodCode = $("#prodCode").val(); // prodCode 값
|
|
var warrantyNum = $("#warrantyNum").val();// warrantyNum 값
|
|
var delivery = $("input[name='delivery']:checked").val(); // 선택된 배송옵션 값
|
|
var outworkplace = $("#outworkplace").val(); // outworkplace 값
|
|
var outputplace = $("#outputplace").val(); // 수신처주소
|
|
var lotNum = $("#lotNum").val(); // 로트번호
|
|
|
|
// URL에 변수를 추가
|
|
var url = '/output/viewMidInspectSlat.php?num=' + num
|
|
+ '&outdate=' + encodeURIComponent(outDate)
|
|
+ '&orderdate=' + encodeURIComponent(orderDate)
|
|
+ '&prodCode=' + encodeURIComponent(prodCode)
|
|
+ '&warrantyNum=' + encodeURIComponent(warrantyNum)
|
|
+ '&delivery=' + encodeURIComponent(delivery)
|
|
+ '&outputplace=' + encodeURIComponent(outputplace)
|
|
+ '&outworkplace=' + encodeURIComponent(outworkplace)
|
|
+ '&lotNum=' + encodeURIComponent(lotNum);
|
|
|
|
// 팝업 호출
|
|
customPopup(url, '철재스라트-중간검사', 800, 900);
|
|
});
|
|
|
|
// 조인트바-중간검사 버튼 클릭 시
|
|
$(document).on('click', '#loadmidInspectJointbarBtn', function() {
|
|
var num = $("#num").val();
|
|
var outDate = $("#outdate").val(); // 출고일
|
|
var orderDate = $("#orderdate").val(); // orderdate 값
|
|
var prodCode = $("#prodCode").val(); // prodCode 값
|
|
var warrantyNum = $("#warrantyNum").val();// warrantyNum 값
|
|
var delivery = $("input[name='delivery']:checked").val(); // 선택된 배송옵션 값
|
|
var outworkplace = $("#outworkplace").val(); // outworkplace 값
|
|
var outputplace = $("#outputplace").val(); // 수신처주소
|
|
var lotNum = $("#lotNum").val(); // 로트번호
|
|
|
|
// URL에 변수를 추가
|
|
var url = '/output/viewinspectionJointbar.php?num=' + num
|
|
+ '&outdate=' + encodeURIComponent(outDate)
|
|
+ '&orderdate=' + encodeURIComponent(orderDate)
|
|
+ '&prodCode=' + encodeURIComponent(prodCode)
|
|
+ '&warrantyNum=' + encodeURIComponent(warrantyNum)
|
|
+ '&delivery=' + encodeURIComponent(delivery)
|
|
+ '&outputplace=' + encodeURIComponent(outputplace)
|
|
+ '&outworkplace=' + encodeURIComponent(outworkplace)
|
|
+ '&lotNum=' + encodeURIComponent(lotNum);
|
|
|
|
// 팝업 호출
|
|
customPopup(url, '조인트바-중간검사', 800, 900);
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|