-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpanel_setup.php
More file actions
162 lines (133 loc) · 6.55 KB
/
panel_setup.php
File metadata and controls
162 lines (133 loc) · 6.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
session_start();
if (isset($_SESSION["product"]) && isset($_SESSION["line"]) && isset($_SESSION["point"])) {
header("location: tracking_panel.php");
}
if (!isset($_SESSION["login_user"])) {
header("location: index.php");
} else {
require "backend/db_conn.php";
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST["product"])) {
$_SESSION["product"] = $_POST["product"];
$_SESSION["line"] = $_POST["line"];
$_SESSION["point"] = $_POST["point"];
header("location: tracking_panel.php");
} else {
session_destroy();
header("location: index.php");
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css" />
<title>Image Tracking System</title>
</head>
<body>
<?php require "layouts/navbar_sidebar.php"; ?>
<main class="mt-5 pt-3">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="text-center mb-2">Panel Setup</h1>
<hr>
<div class="row">
<div class="col-3">
</div>
<div class="col-6">
<div class="card p-3">
<form action="panel_setup.php" method="post">
<div class="row g-3 align-items-center">
<div class="col-3">
<label for="" class="col-form-label">Product</label>
</div>
<div class="col">
<select class="form-select mb-1" aria-label="Default select example" name="product" id="category-dropdown" required>
<option value="">Select One</option>
<?php
$user_id = $_SESSION["login_user"];
$sql = "SELECT * FROM user_prod WHERE user_id='$user_id' AND is_active=1";
$query = mysqli_query($conn, $sql);
var_dump($query);
while ($row = mysqli_fetch_array($query)) {
?>
<option value="<?php echo $row['short_code']; ?>">
<?php echo $row['product']; ?>
</option>
<?php
}
?>
</select>
</div>
</div>
<div class="row g-3 align-items-center">
<div class="col-3">
<label for="" class="col-form-label">Line</label>
</div>
<div class="col">
<select class="form-select mb-1" aria-label="Default select example" name="line" id="sub-category-dropdown" required>
</select>
</div>
</div>
<div class="row g-3 align-items-center">
<div class="col-3">
<label for="" class="col-form-label">Point</label>
</div>
<div class="col">
<select class="form-select mb-1" aria-label="Default select example" name="point" required>
<option value="">Select One</option>
<option value="packaging_point">Packaging Point</option>
</select>
</div>
</div>
<div class="row g-3 align-items-center">
<div class="col-3">
</div>
<div class="col-3">
<input type="submit" class="btn btn-primary" value="Save">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#category-dropdown').on('change', function() {
var short_code = this.value;
console.log(short_code);
$.ajax({
url: "backend/fetch_line.php",
type: "POST",
data: {
short_code: short_code
},
cache: false,
success: function(result) {
$("#sub-category-dropdown").html(result);
console.log(result);
}
});
});
});
</script>
<?php
require "backend/footer.php";
?>
</body>
</html>