초기 커밋: 5130 레거시 시스템

- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경
- DB 연결 하드코딩 → .env 기반으로 변경
- MySQL strict mode DATE 오류 수정
This commit is contained in:
2025-12-10 20:14:31 +09:00
commit aca1767eb9
6728 changed files with 1863265 additions and 0 deletions

58
common/enlargeImage.php Normal file
View File

@@ -0,0 +1,58 @@
<script>
/* 다음은 테이블 내의 이미지에 마우스 hover시 해당 이미지가 마우스 위치 근처에 3배 확대되어 나타나도록 하는 jQuery 코드 예제입니다.
```html
동작 방식:
페이지 로드 시 body에 #zoomContainer라는 절대 위치의 div를 생성합니다.
#myTable 내부의 이미지에 마우스가 올라가면, 해당 이미지의 src와 크기를 가져와 3배 확대된 크기로 #zoomContainer에 이미지 태그를 생성하여 표시합니다.
마우스가 움직일 때마다 컨테이너의 위치를 마우스 포인터 근처로 업데이트합니다.
이미지에서 마우스가 벗어나면 확대된 이미지를 숨깁니다.
이 코드를 페이지 하단에 추가하면 원하는 기능을 구현할 수 있습니다.
*/
$(document).ready(function(){
// 확대 이미지를 표시할 컨테이너가 없다면 body에 추가
if($("#zoomContainer").length === 0) {
$("body").append("<div id='zoomContainer' style='position: absolute; display: none; pointer-events: none; z-index: 9999;'></div>");
}
// #myTable 내부의 모든 이미지에 대해 이벤트 바인딩
$("#myTable").on("mouseenter", "img", function(e){
var imgSrc = $(this).attr("src");
// 원본 이미지의 크기를 가져와서 3배로 확대
var origWidth = $(this).width();
var origHeight = $(this).height();
var zoomWidth = origWidth * 4;
var zoomHeight = origHeight * 4;
// 확대 이미지 컨테이너에 이미지 삽입 (원하는 스타일로 꾸밀 수 있음)
$("#zoomContainer").html("<img src='" + imgSrc + "' style='width:" + zoomWidth + "px; height:" + zoomHeight + "px; border: 1px solid #ccc; background: #fff;'>");
// 마우스 위치 근처에 컨테이너 표시 (약간의 오프셋 추가)
$("#zoomContainer").css({
top: (e.pageY + 15) + "px",
left: (e.pageX + 15) + "px",
display: "block"
});
});
// 마우스 이동에 따라 확대 이미지 컨테이너 위치 업데이트
$("#myTable").on("mousemove", "img", function(e){
$("#zoomContainer").css({
top: (e.pageY + 15) + "px",
left: (e.pageX + 15) + "px"
});
});
// 마우스가 이미지 영역을 벗어나면 확대 이미지 숨김
$("#myTable").on("mouseleave", "img", function(){
$("#zoomContainer").hide();
});
});
</script>

569
common/fileImage.php Normal file
View File

@@ -0,0 +1,569 @@
<script>
var ajaxRequest11 = null;
$(document).ready(function () {
displayFileLoad(); // 기존파일 업로드 보이기
displayImageLoad(); // 기존이미지 업로드 보이기
// displayImageLoad(); // 기존 이미지 로드
var tablename = $("#tablename").val();
const uploadedFiles = new Set(); // 업로드된 파일 이름을 저장하는 Set
// 드롭 영역 설정
const dropArea = $("#dropArea");
dropArea.on("dragover", function (e) {
e.preventDefault();
dropArea.css("border-color", "blue"); // 드래그 중 표시
});
dropArea.on("dragleave", function (e) {
e.preventDefault();
dropArea.css("border-color", "#ccc"); // 드래그 해제 시 원래대로
});
dropArea.on("drop", function (e) {
e.preventDefault();
dropArea.css("border-color", "#ccc"); // 드롭 시 원래대로
const files = e.originalEvent.dataTransfer.files;
if (files.length > 0) {
processFiles(files, tablename, "attached", "upfile");
}
});
// 파일 선택 이벤트 처리
$("#upfile").off("change").on("change", function (e) {
e.preventDefault();
const files = this.files;
console.log('upfile ', files);
if (files.length > 0) {
filterAndProcessFiles(files, tablename, "attached", "upfile");
}
});
// 중복 파일 필터링 및 처리 함수
function filterAndProcessFiles(files, tablename, type, inputId) {
const newFiles = [];
for (let i = 0; i < files.length; i++) {
if (!uploadedFiles.has(files[i].name)) { // 중복 파일 확인
uploadedFiles.add(files[i].name); // Set에 파일 이름 추가
newFiles.push(files[i]); // 처리할 파일 배열에 추가
}
}
console.log('newFiles',newFiles);
if (newFiles.length > 0) {
processFiles(newFiles, tablename, type, inputId); // 중복되지 않은 파일만 처리
}
}
// 파일 업로드 및 처리 함수
function processFiles(files, tablename, item, upfilename) {
if (!files || files.length === 0) {
console.warn("파일이 선택되지 않았습니다.");
return;
}
console.log("processFiles 호출됨"); // 함수 호출 확인
console.log("업로드 파일 수:", files.length); // 파일 개수 확인
showMsgModal(3); // 파일처리중
const form = $('#board_form')[0];
const formData = new FormData(form);
for (const file of files) {
if (!uploadedFiles.has(file.name)) {
formData.append(upfilename + "[]", file);
uploadedFiles.add(file.name); // 중복 방지
console.log("추가된 파일:", file.name);
} else {
console.warn("중복 파일 무시됨:", file.name);
}
}
// 추가 데이터 설정
formData.append("tablename", tablename);
formData.append("item", item);
formData.append("upfilename", upfilename);
formData.append("folderPath", "경동기업/uploads");
formData.append("DBtable", "picuploads");
showMsgModal(2); // 파일저장중
// AJAX 요청을 통해 데이터 가져오기
if (ajaxRequest11 !== null) {
ajaxRequest11.abort();
}
ajaxRequest11 = $.ajax({
enctype: 'multipart/form-data',
processData: false,
contentType: false,
url: "/filedrive/fileprocess.php",
type: "POST",
data: formData,
success: function (response) {
console.log("응답 데이터:", response);
let successCount = 0;
let errorCount = 0;
let errorMessages = [];
response.forEach((item) => {
if (item.status === "success") {
successCount++;
} else if (item.status === "error") {
errorCount++;
errorMessages.push(`파일: ${item.file}, 메시지: ${item.message}`);
}
});
if (successCount > 0) {
Toastify({
text: `${successCount}개의 파일이 성공적으로 업로드되었습니다.`,
duration: 2000,
close: true,
gravity: "top",
position: "center",
backgroundColor: "#4fbe87",
}).showToast();
}
if (errorCount > 0) {
Toastify({
text: `오류 발생: ${errorCount}개의 파일 업로드 실패\n상세 오류: ${errorMessages.join("\n")}`,
duration: 5000,
close: true,
gravity: "top",
position: "center",
backgroundColor: "#f44336",
}).showToast();
}
setTimeout(function () {
displayFile();
hideMsgModal();
}, 1000);
ajaxRequest11 = null;
},
error: function (jqxhr, status, error) {
console.error("업로드 실패:", jqxhr, status, error);
ajaxRequest11 = null;
},
});
}
// 첨부 이미지 업로드 처리
$("#upfileimage").change(function (e) {
if (this.files.length === 0) {
// 파일이 선택되지 않았을 때
console.warn("파일이 선택되지 않았습니다.");
return;
}
const form = $('#board_form')[0];
const data = new FormData(form);
// 추가 데이터 설정
data.append("tablename", $("#tablename").val() );
data.append("item", "image");
data.append("upfilename", "upfileimage"); // upfile 파일 name
data.append("folderPath", "경동기업/uploads");
data.append("DBtable", "picuploads");
showMsgModal(1); // 이미지저장중
// AJAX 요청 (Google Drive API)
$.ajax({
enctype: 'multipart/form-data',
processData: false,
contentType: false,
url: "/filedrive/fileprocess.php",
type: "POST",
data: data,
success: function (response) {
console.log("응답 데이터:", response);
let successCount = 0;
let errorCount = 0;
let errorMessages = [];
response.forEach((item) => {
if (item.status === "success") {
successCount++;
} else if (item.status === "error") {
errorCount++;
errorMessages.push(`파일: ${item.file}, 메시지: ${item.message}`);
}
});
if (successCount > 0) {
Toastify({
text: `${successCount}개의 파일이 성공적으로 업로드되었습니다.`,
duration: 2000,
close: true,
gravity: "top",
position: "center",
backgroundColor: "#4fbe87",
}).showToast();
}
if (errorCount > 0) {
Toastify({
text: `오류 발생: ${errorCount}개의 파일 업로드 실패\n상세 오류: ${errorMessages.join("\n")}`,
duration: 5000,
close: true,
gravity: "top",
position: "center",
backgroundColor: "#f44336",
}).showToast();
}
setTimeout(function () {
displayImage();
hideMsgModal();
}, 1000);
},
error: function (jqxhr, status, error) {
console.error("업로드 실패:", jqxhr, status, error);
},
});
});
});
// 화면에서 저장한 첨부된 파일 불러오기
function displayFile() {
$('#displayFile').show();
const params = $("#timekey").val() ? $("#timekey").val() : $("#num").val();
if (!params) {
console.error("ID 값이 없습니다. 파일을 불러올 수 없습니다.");
alert("ID 값이 유효하지 않습니다. 다시 시도해주세요.");
return;
}
console.log("요청 ID:", params); // 요청 전 ID 확인
$.ajax({
url: '/filedrive/fileprocess.php',
type: 'GET',
data: {
num: params,
tablename: $("#tablename").val(),
item: 'attached',
folderPath: '경동기업/uploads',
},
dataType: 'json',
}).done(function (data) {
console.log("파일 데이터:", data);
$("#displayFile").html(''); // 기존 내용 초기화
if (Array.isArray(data) && data.length > 0) {
data.forEach(function (fileData, index) {
const realName = fileData.realname || '다운로드 파일';
const link = fileData.link || '#';
const fileId = fileData.fileId || null;
if (!fileId) {
console.error("fileId가 누락되었습니다. index: " + index, fileData);
$("#displayFile").append(
"<div class='text-danger'>파일 ID가 누락되었습니다.</div>"
);
return;
}
$("#displayFile").append(
"<div class='row mb-3'>" +
"<div class='d-flex mb-3 align-items-center justify-content-center'>" +
"<span id='file" + index + "'>" +
"<a href='#' onclick=\"downloadFile('" + fileId + "', '" + realName + "'); return false;\">" +
"<span class='fw-bold text-primary'>" + realName + "</span>" +
"</a>" +
"</span> &nbsp;&nbsp;" +
"<button type='button' class='btn btn-danger btn-sm' id='delFile" + index + "' onclick=\"delFileFn('" + index + "', '" + fileId + "')\">" +
"<i class='bi bi-trash'></i>" +
"</button>" +
"</div>" +
"</div>"
);
});
} else {
$("#displayFile").append(
"<div class='text-center text-muted'>No files</div>"
);
}
}).fail(function (error) {
console.error("파일 불러오기 오류:", error);
Swal.fire({
title: "파일 불러오기 실패",
text: "파일을 불러오는 중 문제가 발생했습니다.",
icon: "error",
confirmButtonText: "확인",
});
});
}
// 기존 파일 불러오기 (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-center'>" +
"<span id='file" + i + "'>" +
"<a href='#' onclick=\"downloadFile('" + fileId + "', '" + realName + "'); return false;\">" +
"<span class='fw-bold text-primary'>" + realName + "</span>" +
"</a>" +
"</span> &nbsp;&nbsp;" +
"<button type='button' class='btn btn-danger btn-sm' id='delFile" + i + "' onclick=\"delFileFn('" + i + "', '" + fileId + "')\">" +
"<i class='bi bi-trash'></i>" +
"</button>" +
"</div>" +
"</div>"
);
});
} else {
$("#displayFile").append(
"<div class='text-center text-muted'>No files</div>"
);
}
}
// 파일 삭제 처리 함수
function delFileFn(divID, fileId) {
Swal.fire({
title: "파일 삭제 확인",
text: "정말 삭제하시겠습니까?",
icon: "warning",
showCancelButton: true,
confirmButtonText: "삭제",
cancelButtonText: "취소",
reverseButtons: true,
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/filedrive/fileprocess.php',
type: 'DELETE',
data: JSON.stringify({
fileId: fileId,
tablename: $("#tablename").val(),
item: "attached",
folderPath: "경동기업/uploads",
DBtable: "picuploads",
}),
contentType: "application/json",
dataType: 'json',
}).done(function (response) {
if (response.status === 'success') {
console.log("삭제 완료:", response);
$("#file" + divID).remove();
$("#delFile" + divID).remove();
Swal.fire({
title: "삭제 완료",
text: "파일이 성공적으로 삭제되었습니다.",
icon: "success",
confirmButtonText: "확인",
});
} else {
console.log(response.message);
}
}).fail(function (error) {
console.error("삭제 중 오류:", error);
Swal.fire({
title: "삭제 실패",
text: "파일 삭제 중 문제가 발생했습니다.",
icon: "error",
confirmButtonText: "확인",
});
});
}
});
}
// 첨부된 이미지 불러오기
function displayImage() {
$('#displayImage').show();
const params = $("#timekey").val() ? $("#timekey").val() : $("#num").val();
if (!params) {
console.error("ID 값이 없습니다. 파일을 불러올 수 없습니다.");
alert("ID 값이 유효하지 않습니다. 다시 시도해주세요.");
return;
}
console.log("요청 ID:", params); // 요청 전 ID 확인
$.ajax({
url: '/filedrive/fileprocess.php',
type: 'GET',
data: {
num: params,
tablename: $("#tablename").val(),
item: 'image',
folderPath: '경동기업/uploads',
},
dataType: 'json',
}).done(function (data) {
console.log("파일 데이터:", data);
$("#displayImage").html(''); // 기존 내용 초기화
if (Array.isArray(data) && data.length > 0) {
data.forEach(function (fileData, index) {
const realName = fileData.realname || '다운로드 파일';
const thumbnail = fileData.thumbnail || '/assets/default-thumbnail.png';
const link = fileData.link || '#';
const fileId = fileData.fileId || null;
if (!fileId) {
console.error("fileId가 누락되었습니다. index: " + index, fileData);
$("#displayImage").append(
"<div class='text-danger'>파일 ID가 누락되었습니다.</div>"
);
return;
}
$("#displayImage").append(
"<div class='row mb-3'>" +
"<div class='col d-flex align-items-center justify-content-center'>" +
"<a href='#' onclick=\"popupCenter('" + link + "', 'imagePopup', 800, 600); return false;\">" +
"<img id='image" + index + "' src='" + thumbnail + "' style='width:150px; height:auto;'>" +
"</a> &nbsp;&nbsp;" +
"<button type='button' class='btn btn-danger btn-sm' id='delImage" + index + "' onclick=\"delImageFn('" + index + "', '" + fileId + "')\">" +
"<i class='bi bi-trash'></i>" +
"</button>" +
"</div>" +
"</div>"
);
});
} else {
$("#displayImage").append(
"<div class='text-center text-muted'>No files</div>"
);
}
}).fail(function (error) {
console.error("파일 불러오기 오류:", error);
Swal.fire({
title: "파일 불러오기 실패",
text: "파일을 불러오는 중 문제가 발생했습니다.",
icon: "error",
confirmButtonText: "확인",
});
});
}
// 기존 이미지 불러오기 (Google Drive에서 가져오기)
function displayImageLoad() {
$('#displayImage').show();
var data = <?php echo json_encode($saveimagename_arr); ?>;
$("#displayImage").html(''); // 기존 내용 초기화
if (Array.isArray(data) && data.length > 0) {
data.forEach(function (fileData, i) {
const realName = fileData.realname || '다운로드 파일';
const thumbnail = fileData.thumbnail || '/assets/default-thumbnail.png';
const link = fileData.link || '#';
const fileId = fileData.fileId || null;
if (!fileId) {
console.error("fileId가 누락되었습니다. index: " + i, fileData);
return;
}
$("#displayImage").append(
"<div class='row mb-3'>" +
"<div class='col d-flex align-items-center justify-content-center'>" +
"<a href='#' onclick=\"popupCenter('" + link + "', 'imagePopup', 800, 600); return false;\">" +
"<img id='image" + i + "' src='" + thumbnail + "' style='width:150px; height:auto;'>" +
"</a> &nbsp;&nbsp;" +
"<button type='button' class='btn btn-danger btn-sm' id='delImage" + i + "' onclick=\"delImageFn('" + i + "', '" + fileId + "')\">" +
"<i class='bi bi-trash'></i>" +
"</button>" +
"</div>" +
"</div>"
);
});
} else {
$("#displayImage").append(
"<div class='text-center text-muted'>No files</div>"
);
}
}
// 이미지 삭제 처리 함수
function delImageFn(divID, fileId) {
Swal.fire({
title: "이미지 삭제 확인",
text: "정말 삭제하시겠습니까?",
icon: "warning",
showCancelButton: true,
confirmButtonText: "삭제",
cancelButtonText: "취소",
reverseButtons: true,
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/filedrive/fileprocess.php',
type: 'DELETE',
data: JSON.stringify({
fileId: fileId,
tablename: $("#tablename").val(),
item: "image",
folderPath: "경동기업/uploads",
DBtable: "picuploads",
}),
contentType: "application/json",
dataType: 'json',
}).done(function (response) {
if (response.status === 'success') {
console.log("삭제 완료:", response);
$("#image" + divID).remove();
$("#delImage" + divID).remove();
Swal.fire({
title: "삭제 완료",
text: "파일이 성공적으로 삭제되었습니다.",
icon: "success",
confirmButtonText: "확인",
});
} else {
console.log(response.message);
}
}).fail(function (error) {
console.error("삭제 중 오류:", error);
Swal.fire({
title: "삭제 실패",
text: "파일 삭제 중 문제가 발생했습니다.",
icon: "error",
confirmButtonText: "확인",
});
});
}
});
}
</script>

29
common/listTopCard.php Normal file
View File

@@ -0,0 +1,29 @@
<div class="card mb-2 mt-2">
<div class="card-body">
<div class="row">
<div class="col-sm-12">
<div class="d-flex p-1 m-1 mt-1 justify-content-center align-items-center ">
<h5> <?=$title_message?> </h5> &nbsp;&nbsp;&nbsp;&nbsp;
<button type="button" class="btn btn-dark btn-sm mx-3" onclick='location.reload();' title="새로고침"> <i class="bi bi-arrow-clockwise"></i> </button>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="d-flex p-1 m-1 mt-1 mb-1 justify-content-center align-items-center">
▷ <?= $total_row ?> &nbsp;
<input type="date" id="fromdate" name="fromdate" class="form-control" style="width:100px;" value="<?=$fromdate?>"> &nbsp; ~ &nbsp;
<input type="date" id="todate" name="todate" class="form-control me-1" style="width:100px;" value="<?=$todate?>"> &nbsp;
<div class="inputWrap">
<input type="text" id="search" name="search" value="<?=$search?>" onkeydown="JavaScript:SearchEnter();" autocomplete="off" class="form-control" style="width:150px;" > &nbsp;
<button class="btnClear"></button>
</div>
&nbsp;
<button id="searchBtn" type="button" class="btn btn-dark btn-sm" > <i class="bi bi-search"></i> 검색 </button>
&nbsp;&nbsp;&nbsp;
<button type="button" class="btn btn-dark btn-sm me-1" id="writeBtn"> <i class="bi bi-pencil-fill"></i> 신규 </button>
</div>
</div>
</div>
</div> <!--card-body-->
</div> <!--card -->

24
common/modal.php Normal file
View File

@@ -0,0 +1,24 @@
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-lg modal-center" >
<!-- Modal content-->
<div class="modal-content modal-lg">
<div class="modal-header">
<h5 class="modal-title">알림</h5>
</div>
<div class="modal-body">
<div id="alertmsg" class="fs-4 mb-5 justify-content-center" >
결재가 진행중입니다.
<br> <br>
수정사항이 있으면 결재권자에게 말씀해 주세요.
</div>
</div>
<div class="modal-footer">
<button type="button" id="closeModalBtn" class="btn btn-default" data-dismiss="modal">닫기</button>
</div>
</div>
</div>
</div>

352
common/output.php Normal file
View File

@@ -0,0 +1,352 @@
<script>
// 수주내역의 후반부 자바스크립트
$(document).ready(function() {
// 서버에서 전달된 estimateList 데이터
var mode = '<?php echo $mode; ?>' ;
let estimateList = <?php echo json_encode($estimateList ?? []); ?>;
let estimateList_auto = <?php echo json_encode($estimateList_auto ?? []); ?>;
let estimateSlatList = <?php echo json_encode($estimateSlatList ?? []); ?>;
let estimateSlatList_auto = <?php echo json_encode($estimateSlatList_auto ?? []); ?>;
var etcList = <?php echo json_encode($etcList ?? []); ?>;
let screen_unapprovedList = <?php echo json_encode($screen_unapprovedList ?? []); ?>;
let slat_unapprovedList = <?php echo json_encode($slat_unapprovedList ?? []); ?>;
let motorList = <?php echo json_encode($motorList ?? []); ?>;
let bendList = <?php echo json_encode($bendList ?? []); ?>;
/**
* 입력값(raw)을 안전하게 배열로 변환합니다.
* - raw가 문자열이면 JSON.parse
* - raw가 객체/배열이면 JSON.stringify → JSON.parse
* - 파싱 실패하거나 최종 결과가 배열이 아니면 빈 배열 반환
*/
function parseJsonList(raw) {
let str;
// 1) raw를 JSON 문자열로 확보
if (typeof raw === 'string') {
str = raw;
} else {
try {
str = JSON.stringify(raw);
} catch (e) {
console.error('parseJsonList: 데이터를 문자열로 변환 실패', e);
return [];
}
}
// 2) 문자열을 JSON으로 파싱
try {
const parsed = JSON.parse(str);
if (!Array.isArray(parsed)) {
console.warn('parseJsonList: 파싱 결과가 배열이 아님, 빈 배열로 초기화');
return [];
}
return parsed;
} catch (e) {
console.error('parseJsonList: JSON 파싱 오류', e);
return [];
}
}
// 각각 리스트 파싱
screen_unapprovedList = parseJsonList(screen_unapprovedList);
slat_unapprovedList = parseJsonList(slat_unapprovedList);
motorList = parseJsonList(motorList);
bendList = parseJsonList(bendList);
// 화면 로딩 시 데이터가 있을 경우 해당 테이블에 행을 추가
screen_unapprovedList.forEach(rowData => {
addRowUA_screen($('#screen_unapprovedListBody'), rowData);
});
slat_unapprovedList.forEach(rowData => {
addRowUA_slat($('#slat_unapprovedListBody'), rowData);
});
motorList.forEach(rowData => {
addRowUA_motor($('#motor_listBody'), rowData);
});
bendList.forEach(rowData => {
addRowUA_bend($('#bend_listBody'), rowData);
});
// 장비리스트에 대한 JSON이 배열인지 아닌지 여부를 확인하는 방법
if (typeof etcList === 'string') {
try {
etcList = JSON.parse(etcList);
} catch (e) {
console.error('JSON 파싱 오류:', e);
etcList = [];
}
}
if (Array.isArray(etcList)) {
console.log('etcList is an array:', etcList);
} else {
console.log('etcList is not an array, resetting to empty array');
etcList = [];
}
etcList.forEach(function(rowData, index) {
$.ajax({
url: 'fetch_etc.php', // PHP 파일 경로 수정 필요
type: 'POST',
dataType: 'json',
success: function(response) {
itemData = response;
addRow_etc($('#etcListBody'), rowData);
},
error: function() {
alert('데이터를 불러오는데 실패했습니다.');
}
});
});
// estimateList이 객체나 배열 형태라면 바로 사용
if (typeof estimateList === 'object' && estimateList !== null) {
console.log('estimateList 객체로 전달됨');
} else if (typeof estimateList === 'string') {
// 문자열로 전달된 경우만 JSON.parse로 파싱
try {
estimateList = JSON.parse(estimateList);
document.getElementById('estimateList').value = JSON.stringify(estimateList);
} catch (e) {
console.error('JSON 파싱 오류:', e);
estimateList = [];
}
}
// estimateList이 객체나 배열 형태라면 바로 사용
if (typeof estimateList_auto === 'object' && estimateList_auto !== null) {
console.log('estimateList_auto 객체로 전달됨');
} else if (typeof estimateList_auto === 'string') {
// 문자열로 전달된 경우만 JSON.parse로 파싱
try {
estimateList_auto = JSON.parse(estimateList_auto);
document.getElementById('estimateList_auto').value = JSON.stringify(estimateList_auto);
} catch (e) {
console.error('JSON 파싱 오류:', e);
estimateList_auto = [];
}
}
// 데이터가 배열이 아니거나 비어있을 경우를 처리
if (!Array.isArray(estimateList) || estimateList.length === 0) {
console.log('estimateList 유효한 데이터가 없습니다.');
if (mode === 'view')
$("#screenWindow").hide(); // 스크린 견적서 불러오기 등 작업일지 등등 감추기
} else {
// 데이터가 있을 경우 테이블을 생성하여 표시
renderEstimateData({ estimateList: JSON.stringify(estimateList) });
}
// estimateSlatList이 객체나 배열 형태라면 바로 사용
if (typeof estimateSlatList === 'object' && estimateSlatList !== null) {
console.log('estimateSlatList 객체로 전달됨');
} else if (typeof estimateSlatList === 'string') {
// 문자열로 전달된 경우만 JSON.parse로 파싱
try {
estimateSlatList = JSON.parse(estimateSlatList);
document.getElementById('estimateSlatList').value = JSON.stringify(estimateSlatList);
} catch (e) {
console.error('JSON 파싱 오류:', e);
estimateSlatList = [];
}
}
// estimateSlatList이 객체나 배열 형태라면 바로 사용
if (typeof estimateSlatList_auto === 'object' && estimateSlatList_auto !== null) {
console.log('estimateSlatList_auto 객체로 전달됨');
} else if (typeof estimateSlatList_auto === 'string') {
// 문자열로 전달된 경우만 JSON.parse로 파싱
try {
estimateSlatList_auto = JSON.parse(estimateSlatList_auto);
document.getElementById('estimateSlatList_auto').value = JSON.stringify(estimateSlatList_auto);
} catch (e) {
console.error('JSON 파싱 오류:', e);
estimateSlatList_auto = [];
}
}
// 데이터가 배열이 아니거나 비어있을 경우를 처리
if (!Array.isArray(estimateSlatList) || estimateSlatList.length === 0) {
console.log('estimateSlatList 유효한 데이터가 없습니다.');
if (mode === 'view')
$("#slatWindow").hide(); // 스라트 견적서 불러오기 등 작업일지 등등 감추기
} else {
// 데이터가 있을 경우 테이블을 생성하여 표시
renderEstimateData_slat({ estimateSlatList: JSON.stringify(estimateSlatList) });
}
});
// 쿠키 값 가져오는 함수
function getCookie(name) {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i].trim();
if (cookie.startsWith(name + '=')) {
return cookie.substring(name.length + 1);
}
}
return null;
}
// 쿠키 저장 함수
function setCookie(name, value, days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "expires=" + date.toUTCString();
document.cookie = name + "=" + value + ";" + expires + ";path=/";
}
function toggleView(viewId, cookieName, iconId = null) {
const view = getCookie(cookieName);
const listContainer = $("#" + viewId);
const icon = iconId ? $(iconId) : null;
if (view === "show") {
listContainer.hide();
setCookie(cookieName, "hide", 10);
if (icon) icon.removeClass("bi-chevron-down").addClass("bi-chevron-right");
} else {
listContainer.show();
setCookie(cookieName, "show", 10);
if (icon) icon.removeClass("bi-chevron-right").addClass("bi-chevron-down");
}
}
function initializeView(viewId, cookieName, iconId = null) {
const view = getCookie(cookieName);
const listContainer = $("#" + viewId);
const icon = iconId ? $(iconId) : null;
if (view === "show") {
listContainer.show();
if (icon) icon.removeClass("bi-chevron-right").addClass("bi-chevron-down");
} else {
listContainer.hide();
if (icon) icon.removeClass("bi-chevron-down").addClass("bi-chevron-right");
}
}
// searchWarrantyNumber 함수 정의
function searchWarrantyNumber(searchCode) {
// 제품명과 인정번호 데이터를 객체로 정의합니다.
const productData = {
"KD-SL60": "NVS22-0902-1",
"KTE01": "FDS-NVS23-0117-1",
"KSS01": "FDS-OTS23-0117-2",
"KSS02": "FDS-OTS25-0318-2",
"KSE01": "FDS-OTS23-0117-3",
"KWE01": "FDS-OTS23-0117-4",
"KQTS01": "FDS-NVS23-1226-3",
"KDSS01": "FDS-OTS25-0318-1"
};
// 입력된 제품명에 해당하는 인정번호를 반환
return productData[searchCode] || "해당 제품명이 없습니다.";
}
$(document).ready(function() {
// 뷰 ID와 쿠키 이름 매핑 (output-list 제거)
var views = [
{ id: "estimate_screenDiv", cookie: "showEsimateView", button: "#estimate_view" , iconId: "#estimate_viewIcon" },
{ id: "estimate_slatDiv", cookie: "showEsimateView_slat", button: "#estimate_slat_view" , iconId: "#estimate_slat_viewIcon" },
{ id: "showGroupViewDiv", cookie: "showGroupView", button: "#showGroupViewBtn" , iconId: "#showGroupViewIcon" }
];
views.forEach(function (view) {
$(view.button).on("click", function () {
toggleView(view.id, view.cookie, view.iconId);
});
initializeView(view.id, view.cookie, view.iconId);
});
// output-list는 항상 보이게 설정
$("#output-list").css("display", "block");
});
$(document).ready(function(){
$('#prodCode').on('change', function() {
var prodCode = $(this).val(); // 선택된 제품코드
var pairCode = $(this).find(':selected').data('pair'); // 대응하는 인정제품 코드
if (prodCode && pairCode) {
// 로트번호 자동생성 체크박스가 체크되어 있는지 확인
var lotNum = 'KD-' + pairCode ;
$('#lotNum').val(lotNum); // lotNum 필드 업데이트
} else {
$('#lotNum').val(''); // 제품코드가 선택되지 않은 경우 필드 초기화
}
// console.log('호출 prodCode' + $("#prodCode").val());
});
});
$(document).ready(function() {
// 견적선택에서 전체 선택 또는 해제 동작 구현
$('#selectAllEstimates').on('change', function() {
var isChecked = $(this).is(':checked');
// 전체 체크박스 선택 또는 해제
$('.estimate-checkbox').prop('checked', isChecked);
});
// 모달창이 열릴 때 이미 선택된 상태 유지
$('#selectEstimateModal').on('show.bs.modal', function() {
$('#selectAllEstimates').prop('checked', false); // 모달이 열릴 때 전체 선택을 초기화
});
// 다른 필요한 초기화 코드
});
<!-- mode == 'view' 조회 화면일때 사용금지 시키는 구문 -->
$(document).ready(function() {
var mode = '<?php echo $mode; ?>' ;
// 마지막에 넣어줘야 전체를 적용할 수 있다.
if (mode === 'view')
disableView();
});
function disableView() {
$('input, textarea ').prop('readonly', true); // Disable all input, textarea, and select elements
$('input[type=hidden]').prop('readonly', false);
// checkbox와 radio는 클릭 불가능하게 하고 시각적 강조
$('input[type="checkbox"], input[type="radio"]').each(function() {
$(this).addClass('readonly-checkbox readonly-radio');
});
// 파일 입력 비활성화
$('input[type=file]').prop('disabled', true);
$('.fetch_receiverBtn').prop('disabled', true); // 수신자 버튼 비활성화
$('.viewNoBtn').prop('disabled', true); //버튼 비활성화
$('.searchplace').prop('disabled', true); // 수신자 버튼 비활성화
$('.searchsecondord').prop('disabled', true); // 수신자 버튼 비활성화
$('.fetch_loadgroupBtn').prop('disabled', true); // 품질인증 그룹명 버튼 비활성화
// 레이블 텍스트 크게 설정
$('label').css('font-size', '1.5em');
// 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();
});
}
</script>

20
common/workingon.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
// HTML 헤더 로드
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
?>
<script>
var loader = document.getElementById('loadingOverlay');
if(loader) loader.style.display = 'none';
$(document).ready(function () {
// showShiningText('프로그램 개발 중입니다...', '80px');
showShiningText();
});
</script>
</body>
</html>

View File

@@ -0,0 +1,33 @@
<div class="container">
<div class="row justify-content-center align-items-center" style="padding : 4px;">
<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-3">
<div class="col-sm-1">
<div class="d-flex p-1 mb-1 justify-content-start align-items-center">
<?=$mode?>
</div>
</div>
<div class="col-sm-9">
<div class="d-flex p-1 mb-1 justify-content-center align-items-center">
<h3> <?=$title_message?> </h3> &nbsp; &nbsp; &nbsp; &nbsp;
<?php if ($mode == 'view') { ?>
<button type="button" class="btn btn-dark btn-sm me-1" onclick="location.href='write_form.php?mode=modify&num=<?=$num?>&tablename=<?=$tablename?>';"> <i class="bi bi-pencil-square"></i> 수정 </button>
<button id="copyBtn" class="btn btn-primary btn-sm me-1" type="button"> <i class="bi bi-copy"></i> 복사 </button>
<button id="deleteBtn" class="btn btn-danger btn-sm me-1" type="button"> <i class="bi bi-trash"></i> 삭제 </button>
<?php } ?>
<?php if ($mode !== 'view') { ?>
<button id="saveBtn" class="btn btn-dark btn-sm me-1" type="button"> <i class="bi bi-floppy-fill"></i>
<?php if ((int)$num > 0) print ' 저장'; else print ' 저장'; ?></button>
<?php } ?>
<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();"> &times; 닫기 </button> &nbsp;
</div>
</div>
</div>
</div>
</div>
</div>