36670-vm/request_form.php
Flatlogic Bot 7c1bf16409 PDA
2025-12-05 05:31:29 +00:00

155 lines
7.7 KiB
PHP

<?php
require_once __DIR__ . '/auth_check.php';
$pageTitle = "Program Change Request Form";
$username = $_SESSION['username'] ?? 'User';
$full_name = $_SESSION['full_name'] ?? '';
$department = $_SESSION['department'] ?? '';
// Autogenerate Related Change Request No.
require_once __DIR__ . '/db/config.php';
$pdo = db();
$year = date('Y');
$month = date('m');
$prefix = "$department/$year/$month/";
$stmt = $pdo->prepare("SELECT related_request_no FROM change_requests WHERE related_request_no LIKE ? ORDER BY related_request_no DESC LIMIT 1");
$stmt->execute([$prefix . '%']);
$lastRequest = $stmt->fetch();
$running_no = 1;
if ($lastRequest) {
$last_no = (int)substr($lastRequest['related_request_no'], strlen($prefix));
$running_no = $last_no + 1;
}
$related_request_no = $prefix . str_pad($running_no, 3, '0', STR_PAD_LEFT);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= htmlspecialchars($pageTitle) ?></title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/custom.css">
</head>
<body>
<?php include 'header.php'; ?>
<div class="container mt-3">
<?php if (isset($_SESSION['success_message'])): ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<?= htmlspecialchars($_SESSION['success_message']); ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php unset($_SESSION['success_message']); ?>
<?php endif; ?>
<?php if (isset($_SESSION['error_message'])): ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<?= htmlspecialchars($_SESSION['error_message']); ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php unset($_SESSION['error_message']); ?>
<?php endif; ?>
</div>
<div class="container form-container">
<div class="text-center mb-4">
<h1 class="section-title">Program Change Request / プログラム作成・変更依頼書</h1>
</div>
<form action="submit_request.php" method="POST">
<!-- Requester Info -->
<div class="form-section">
<div class="row mb-3">
<div class="col-md-6">
<label for="requestDate" class="form-label">Request Date / 依頼日</label>
<input type="date" class="form-control" id="requestDate" name="request_date" value="<?= date('Y-m-d'); ?>">
</div>
<div class="col-md-6">
<label for="relatedRequestNo" class="form-label">Related Change Request No. / 関連依頼No.</label>
<input type="text" class="form-control" id="relatedRequestNo" name="related_request_no" value="<?= htmlspecialchars($related_request_no); ?>" readonly>
</div>
</div>
<div class="row mb-3">
<div class="col-md-4">
<label for="requesterDept" class="form-label">Department / 所属</label>
<input type="text" class="form-control" id="requesterDept" name="requester_dept" value="<?= htmlspecialchars($department); ?>" readonly>
</div>
<div class="col-md-4">
<label for="requesterName" class="form-label">Requester Name / 依頼者氏名</label>
<input type="text" class="form-control" id="requesterName" name="requester_name" value="<?= htmlspecialchars($full_name); ?>" readonly>
</div>
<div class="col-md-4">
<label for="requesterTel" class="form-label">TEL</label>
<input type="text" class="form-control" id="requesterTel" name="requester_ext">
</div>
</div>
</div>
<!-- Change Details -->
<div class="form-section">
<h2 class="section-title">Change Details / 変更内容</h2>
<div class="row mb-3">
<div class="col-md-6">
<label for="systemName" class="form-label">System Name / システム名</label>
<input type="text" class="form-control" id="systemName" name="system_name">
</div>
<div class="col-md-6">
<label for="programName" class="form-label">Program Name / プログラム名</label>
<input type="text" class="form-control" id="programName" name="program_name">
</div>
</div>
<div class="row mb-3">
<div class="col-md-12">
<label for="changeTitle" class="form-label">Change Title / 変更の件名</label>
<input type="text" class="form-control" id="changeTitle" name="change_title">
</div>
</div>
<div class="mb-3">
<label class="form-label">Change Category / 作成・変更区分</label>
<div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="change_category" id="newProgram" value="New" checked>
<label class="form-check-label" for="newProgram">New / 新規</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="change_category" id="modifyProgram" value="Modification">
<label class="form-check-label" for="modifyProgram">Modification / 変更</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="change_category" id="bugFix" value="Bug Fix">
<label class="form-check-label" for="bugFix">Bug Fix / 不具合</label>
</div>
</div>
</div>
<div class="mb-3">
<label for="reasonForChange" class="form-label">Reason for Change / 理由</label>
<textarea class="form-control" id="reasonForChange" name="reason_for_change" rows="4"></textarea>
</div>
<div class="mb-3">
<label for="descriptionOfChange" class="form-label">Description of Change / 内容</label>
<textarea class="form-control" id="descriptionOfChange" name="description_of_change" rows="6"></textarea>
</div>
</div>
<div class="text-center">
<button type="submit" name="submit_action" value="Submit" class="btn btn-primary">Submit / 提出</button>
<button type="submit" name="submit_action" value="Draft" class="btn btn-secondary">Save as Draft / 下書き保存</button>
</div>
</form>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.2/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>