-
Notifications
You must be signed in to change notification settings - Fork 0
/
employee-index.php
125 lines (117 loc) · 5.1 KB
/
employee-index.php
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
<?php
$commonNameTitle = parse_ini_file("./common.ini");
require 'db/DB.php';
require 'model/Employee.php';
require 'model/Enum.php';
require 'model/BookCategory.php';
require 'model/Book.php';
require 'model/Publisher.php';
require 'model/BookInventory.php';
require 'model/BookstoreOrder.php';
require 'controller/EmployeeController.php';
require 'controller/BookController.php';
require 'controller/BookInventoryController.php';
require 'controller/PublisherController.php';
require 'controller/BookstoreOrderController.php';
ob_start();
session_start();
$employee = new Employee();
if (isset($_SESSION["employee"])) {
$employee = $_SESSION["employee"];
} else {
header("Location: index.php");
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Home</title>
<link href="css/bootstrap-pulse.css" rel="stylesheet">
<link href="css/navbar.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/select/1.2.5/css/select.dataTables.min.css">
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body>
<div class="container">
<div class="d-none"><input type="hidden" id="employee-input" value="<?php echo $employee->getEmpId(); ?>"></div>
<nav class="navbar navbar-expand-lg navbar-light bg-light rounded">
<a class="navbar-brand" href="#"><?php echo $commonNameTitle['siteName']; ?></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExample09"
aria-controls="navbarsExample09" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExample09">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="employee-index.php">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="employee-book-function.php">Book</a>
</li>
</ul>
<!-- employee nav -->
<?php include 'view/employee/nav.php'; ?>
</div>
</nav>
<!-- Receive Shipment Success Alert -->
<div class="alert alert-success d-none" role="alert">
These books are now in the inventory. This page will reload in <span class="badge badge-primary" id="receiveRefreshSeconds"></span> seconds.
</div>
<?php include 'view/employee/home-tab-list.php' ?>
<div class="tab-content pt-2" id="homeTabContent">
<?php include 'view/employee/home/receive-orders.php' ?>
<?php include 'view/employee/home/books-ordered.php' ?>
</div>
<script>
feather.replace();
</script>
<!-- Order: jQuery, popper, bootstrap -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/select/1.2.5/js/dataTables.select.min.js"></script>
<script src="js/util.js"></script>
<script src="js/employee-index.js"></script>
<script>
$(document).ready(function () {
$('#booksOrderedTable').DataTable({
'pageLength': 10
});
});
</script>
<script>
$("#bookReceiveTable tr").click(function () {
// cannot received a shipment that is not shipped
if ($(this).find('td.receiveStatus').html() === "PROCESSING") {
alert('This shipment has pending status.\nPlease wait until publisher shipped this order.');
return;
}
let dataToPassToServer = {
orderId: $(this).find('td.receiveBookstoreOrderId').html(),
bookId: $(this).find('td.receiveBookId').html(),
qtyToBeAdded: $(this).find('td.receiveQtyOrdered').html(),
};
let retVal = confirm("The shipment to receive is ORDER ID#: " + dataToPassToServer.orderId + "\nDo you want to continue?");
if (retVal === true) {
$.post("api/process.php", {updateReceiveItems: dataToPassToServer}, (response) => {
console.log(response);
if (parseInt(response) === 2) {
console.log('success');
location.reload();
} else {
alert('something went wrong');
}
});
return true;
} else {
return false;
}
});
</script>
</body>
</html>