퍼스트가든에서 사용하는 사용자 함수 및 관련파일 추가
This commit is contained in:
155
manager/bakery/bakery_product_list.php
Normal file
155
manager/bakery/bakery_product_list.php
Normal file
@ -0,0 +1,155 @@
|
||||
<?php
|
||||
// 베이커리 제품목록록
|
||||
include_once "_common.php";
|
||||
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
|
||||
include_once FG_MANAGER_PATH."/head.php";
|
||||
|
||||
// 검색 변수 초기화
|
||||
!isset($search) ?? "";
|
||||
!isset($where) ?? "";
|
||||
!isset($search_count) ?? "";
|
||||
|
||||
$is_debug = false; // 디버깅 시 true로 변경
|
||||
|
||||
// ord_by 로 넘어온 값이 있으면 반영
|
||||
$ord_by = isset($_REQUEST["ord_by"]) ? $_REQUEST["ord_by"] : "ASC";
|
||||
|
||||
// 제품 목록 불러오기
|
||||
$productList = getBakeryProductList($ord_by);
|
||||
|
||||
$totalCountQuery = "SELECT COUNT(*) as cnt FROM {$fg['bakery_product_table']}";
|
||||
$totalCountResult = sql_query($totalCountQuery);
|
||||
$totalCount = sql_fetch_array($totalCountResult)['cnt'];
|
||||
|
||||
$usedCountQuery = "SELECT COUNT(*) as cnt FROM {$fg['bakery_product_table']} WHERE used = 1";
|
||||
$usedCountResult = sql_query($usedCountQuery);
|
||||
$usedCount = sql_fetch_array($usedCountResult)['cnt'];
|
||||
?>
|
||||
|
||||
<style>
|
||||
.bakery tfoot {
|
||||
font-weight: 600;
|
||||
}
|
||||
.sort-icon {
|
||||
margin-left: 5px;
|
||||
font-size: 12px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h2 class="mb-3">베이커리 제품목록</h2>
|
||||
<div class="d-flex justify-content-between my-1 mb-3">
|
||||
<div>
|
||||
<p>전체 품목 수 : <?=$totalCount?> | 활성 품목 수 : <?=$usedCount?></p>
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#add_modal">추가</button>
|
||||
<!-- 추가 버튼을 누르면 출력한다. -->
|
||||
<div id="add_modal" class="modal fade">
|
||||
<div class="modal-dialog modal-dialog-centered" style="width:800px;">
|
||||
<div class="modal-content">
|
||||
<?php //class="signup" ?>
|
||||
<form class="add" action="bakery_product_list.add.php" method="POST" enctype="multipart/form-data" > <!-- 폼 이름을 알려줌 -->
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">추가</h4>
|
||||
</div>
|
||||
<div class="modal-body text-start">
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="product_name">품명</span>
|
||||
<input type="text" class="form-control" id="product_name" name="product_name" value="">
|
||||
<input type="radio" class="btn-check" name="used" id="used_1" value="1" checked required>
|
||||
<label class="btn btn-outline-primary" for="used_1">사용</label>
|
||||
<input type="radio" class="btn-check" name="used" id="used_0" value="0" required>
|
||||
<label class="btn btn-outline-primary" for="used_0">미사용</label>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="barcode">바코드</span>
|
||||
<input type="text" class="form-control" id="barcode" name="barcode" value="" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" id="add_submit" class="btn btn-primary">추가</button>
|
||||
<button type="button" class="btn btn-default" data-bs-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-striped align-middle table-hover bakery" id="bakeryTable">
|
||||
<colgroup>
|
||||
<col width="30px">
|
||||
<col width="150px">
|
||||
<col width="70px">
|
||||
<col width="70px">
|
||||
<col width="50px">
|
||||
</colgroup>
|
||||
<!-- 테이블 제목 -->
|
||||
<thead class="table-light">
|
||||
<tr class="align-middle">
|
||||
<th class="text-center no-click">No.</th>
|
||||
<th class="text-center" data-column="product_name" data-order="asc">품목 <span class="sort-icon" data-column="product_name"></span></th>
|
||||
<th class="text-center" data-column="barcode" data-order="asc">바코드 <span class="sort-icon" data-column="barcode"></span></th>
|
||||
<th class="text-center" data-column="current_stock" data-order="asc">사용 <span class="sort-icon" data-column="current_stock"></span></th>
|
||||
<th class="text-center no-click">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- 테이블 데이터 -->
|
||||
<tbody class="table-group-divider" id="bakeryTableBody">
|
||||
<?php
|
||||
// 제품목록 반복문
|
||||
$i = 1;
|
||||
foreach ($productList as $row) {
|
||||
|
||||
?>
|
||||
<tr id="row-<?=$row['barcode']?>">
|
||||
<td class="text-center"><?=$i?></td>
|
||||
<td class="text-center"><?=$row['product_name']?></td>
|
||||
<td class="text-center"><?=$row['barcode']?></td>
|
||||
<td class="text-center"><?=($row['used'] == 1) ? '활성' : '비활성' ?></td>
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$row['idx']?>"><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
<a class="btn btn-danger" href="javascript:void(0);" role="button" onclick="confirmDelete('<?=$row['idx']?>')"><i class="fa-solid fa-trash-can"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 수정 모달 -->
|
||||
<div id="modify_modal_<?=$row['idx']?>" class="modal fade" tabindex="-1" aria-labelledby="modify_modal_<?=$row['idx']?>" aria-hidden="true">
|
||||
<div class="modal-dialog modal modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<form class="modify" id="modify_<?=$row['idx']?>" name="modify_<?=$row['idx']?>">
|
||||
<input type="hidden" name="idx" id="idx_<?=$row['idx']?>" value="<?=$row['idx']?>">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">정보 보기/수정</h5>
|
||||
</div>
|
||||
<div class="modal-body text-start">
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="product_name_<?=$row['idx']?>">품명</span>
|
||||
<input type="text" class="form-control" id="product_name_<?=$row['idx']?>" name="product_name" value="<?=$row['product_name'] ?>">
|
||||
<input type="radio" class="btn-check" name="used" id="used_<?=$row['idx']?>_1" value="1" <?=$row['used'] == "1" ? "checked": "" ?> required>
|
||||
<label class="btn btn-outline-primary" for="used_<?=$row['idx']?>_1">사용</label>
|
||||
<input type="radio" class="btn-check" name="used" id="used_<?=$row['idx']?>_0" value="0" <?=$row['used'] =="0" ? "checked" : "" ?> required>
|
||||
<label class="btn btn-outline-primary" for="used_<?=$row['idx']?>_0">미사용</label>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="barcode_<?=$row['idx']?>">바코드</span>
|
||||
<input type="text" class="form-control" id="barcode_<?=$row['idx']?>" name="barcode" value="<?=$row['barcode']?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary" >수정</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Close" data-bs-target="#modify_modal_<?=$row['idx']?>">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
<!-- 수정 모달 끝 -->
|
||||
|
||||
|
||||
<?php $i++; } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
include_once "tail.sub.php";
|
||||
include_once FG_MANAGER_PATH."/tail.php";
|
||||
Reference in New Issue
Block a user