Browse Source

Upload files to 'public_html'

david.ortiz11 5 years ago
parent
commit
0293eb490a
4 changed files with 882 additions and 0 deletions
  1. 115
    0
      public_html/index.php
  2. 211
    0
      public_html/inventory.php
  3. 316
    0
      public_html/laboratory.php
  4. 240
    0
      public_html/manage-laboratories.php

+ 115
- 0
public_html/index.php View File

@@ -0,0 +1,115 @@
1
+<!--    Authors         :   Carlos C. Corrada-Bravo
2
+                            David J. Ortiz-Rivera
3
+
4
+        Organization    :   Centro de Desarrollo y Consultoria Computacional
5
+        Project         :   OPASO Material Registry  
6
+        File            :   index
7
+        Description     :   Authenticate user -->
8
+
9
+<!-- verify session -->
10
+<?php       
11
+    /* start user session */
12
+    if(!isset($_SESSION)){
13
+        session_start();
14
+    }
15
+    
16
+    /* check for expired session */
17
+    if(isset($_SESSION["last_activity"]) and (time() - $_SESSION["last_activity"]) <= 1800){
18
+        header("Location: /menu");
19
+        die();
20
+    }
21
+
22
+    /* initialize google client */
23
+    require_once "vendor/autoload.php";
24
+    $config = "config/o_auth.json";
25
+    $client = new Google_Client();
26
+    $client->setAuthConfig($config);
27
+    
28
+    /* set redirect uri */
29
+    $redirect_uri = "http://".$_SERVER["HTTP_HOST"]."/session.php";
30
+    $client->setRedirectUri($redirect_uri);
31
+    $client->addScope("email");
32
+    $client->addScope("profile");
33
+?>
34
+
35
+<!doctype html>
36
+<html lang="en">
37
+    <!-- encoding/imports/styling -->
38
+    <head>
39
+        <meta charset="utf-8">
40
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
41
+        <title class="title">OPASO - Log In</title>
42
+        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
43
+        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
44
+        <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
45
+        <link rel="stylesheet" href='https://fonts.googleapis.com/css?family=Noto+Sans'>
46
+        <link rel="stylesheet" href="./style/main.css">
47
+        <link rel="stylesheet" href="/style/login.css">
48
+    </head>
49
+
50
+    <!-- content -->
51
+    <body>
52
+        <div class="content">
53
+            <!-- alerts -->
54
+            <div class="alerts">
55
+                <div class="alert">
56
+                    <div class="message-icon-wrapper">
57
+                        <i class="message-icon success-icon material-icons">done</i>
58
+                        <i class="message-icon error-icon failed-icon warning-icon material-icons">close</i>
59
+                    </div>
60
+                    <p class="alert-status"></p>
61
+                    <p class="alert-message"></p>
62
+                </div>
63
+            </div>
64
+
65
+            <!-- login -->
66
+            <div class="login">
67
+                <div class="form-wrapper">
68
+                    <div class="form">
69
+                        <div class="form-header-wrapper">
70
+                            <!-- <img class="form-logo" src="https://cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_large.png?v=1530129081"> -->
71
+                            <h4 class="form-header">OPASO</h4>
72
+                            <!-- <small class="form-header-subtitle">Material registry</small> -->
73
+                        </div>
74
+                        <div class="form-body">
75
+                            <div class="form-input-wrapper">
76
+                                <h5 class="form-body-header">Log In</h5>
77
+
78
+                                <div class="input-wrapper">
79
+                                    <span class="placeholder email">Email <i class="fas fa-circle placeholder-icon email-circle"></i></span>
80
+                                    <input class="login-field" id="email" type="text" autocomplete="off">
81
+                                </div>
82
+
83
+                                <div class="input-wrapper">
84
+                                    <span class="placeholder password">Password <i class="fas fa-circle placeholder-icon password-circle"></i></span>
85
+                                    <input class="login-field" id="password" type="password" autocomplete="off">
86
+                                    <i class="view-password far fa-eye-slash" value="password"></i>
87
+                                </div>
88
+
89
+                                <button class="btn btn-primary submit-login" type="button">Log In</button>
90
+                            </div>
91
+
92
+                            <!-- google sign in -->
93
+                            <div class="google-sign-in-wrapper">
94
+                                <h6 class="form-body-header or">Or</h6>
95
+                                <h6 class="google-sign-in-header">Log In using institutional account</h6>
96
+                                <a class="btn-light google-sign-in" href='<?php print $client->createAuthUrl();?>'><img class="google-logo" src="https://www.freepnglogos.com/uploads/google-logo-png/google-logo-png-suite-everything-you-need-know-about-google-newest-0.png"><div class="google-sign-in-text">Log In using Google</div></a>
97
+                            </div>
98
+                        </div>
99
+                    </div>
100
+                    <div class="form-subtitle">
101
+                        <a class="form-link" href="#">Forgot password?</a><br>
102
+                        <a class="form-link" href="#">Request an account</a>
103
+                    </div>
104
+                </div>
105
+            </div>
106
+        </div>
107
+
108
+        <!-- scripts -->
109
+        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
110
+        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
111
+        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
112
+        <script type="text/javascript" src="/scripts/main.js"></script>
113
+        <script type="text/javascript" src="/scripts/login.js"></script>
114
+    </body>
115
+</html>

+ 211
- 0
public_html/inventory.php View File

@@ -0,0 +1,211 @@
1
+<!--    Authors         :   Carlos C. Corrada-Bravo
2
+                            David J. Ortiz-Rivera
3
+
4
+        Organization    :   Centro de Desarrollo y Consultoria Computacional
5
+        Project         :   OPASO Material Registry  
6
+        File            :   inventory
7
+        Description     :   Edit laboratory inventory -->
8
+
9
+<!-- Verify Session -->
10
+<?php require_once("header.php");
11
+
12
+    /* start user session */
13
+    if(!isset($_SESSION)){
14
+        session_start();
15
+    }
16
+
17
+    /* verify lab id */
18
+    if(!isset($_GET["lab_id"])){
19
+        header("Location: /menu");
20
+        die();
21
+    }
22
+
23
+    else{
24
+        if(!($_SESSION["authorized"][$_GET["lab_id"]]["access_level"] === "admin") and !($_SESSION["authorized"][$_GET["lab_id"]]["access_level"] === "investigator") and !(array_key_exists($_GET["lab_id"],$_SESSION["authorized"]))){
25
+            header("Location: /menu");
26
+            die();
27
+        }
28
+    }
29
+?>
30
+
31
+<!doctype html>
32
+<html lang="en">
33
+    <!-- encoding/imports/styling -->
34
+    <head>
35
+        <meta charset="utf-8">
36
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
37
+        <title class="title"><?php echo $_SESSION["authorized"][$_GET["lab_id"]]["lab_room"]; ?></title>
38
+        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
39
+        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
40
+        <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
41
+        <link rel="stylesheet" href="/style/main.css">
42
+        <link rel="stylesheet" href="/style/laboratory.css">
43
+    </head>
44
+
45
+    <!-- content -->
46
+    <body>
47
+        <div class="form-shader close-form">
48
+            <div class="edit-form close-form">
49
+                <div class="edit-form-wrapper">
50
+                    <div class="edit-form-header-wrapper">
51
+                        <h4 class="form-header">Edit Material</h4>
52
+                        <div class="close-icon"><i class="material-icons close-form">close</i></div>
53
+                    </div>
54
+                    <div class="edit-form-body-wrapper">
55
+                        <div class="edit-form-body">
56
+                            <div class="details material">
57
+                                <h5 class="details-header">Material Details</h5>
58
+                                <div class="edit-li-wrapper large-field">
59
+                                    <label for="mat_name">Material</label>
60
+                                    <input class="material-input" type="text" placeholder="Material" name="mat_name">
61
+                                </div>
62
+                                <div class="edit-li-wrapper medium-field">
63
+                                    <label for="cas-number">CAS Num.</label>
64
+                                    <input class="material-input" type="text" placeholder="Cas Num." name="cas">
65
+                                </div>
66
+                                <div class="edit-li-wrapper medium-field">
67
+                                    <label for="man_name">Manufacturer</label>
68
+                                    <input class="material-input" type="text" placeholder="Manufacturer" name="man_name">
69
+                                </div>
70
+                                <div class="edit-li-wrapper large-field">
71
+                                    <label for="sds-link">SDS Link</label>
72
+                                    <input class="material-input" type="text" placeholder="SDS Link" name="sds">
73
+                                </div>
74
+                                <div class="edit-li-wrapper extra-small-field">
75
+                                    <label for="state">State</label>
76
+                                    <input class="material-input" type="text" placeholder="State" name="state">
77
+                                </div>
78
+                            </div>
79
+                            <div class="details hazard">
80
+                                <h5 class="details-header">Hazard Details</h5>
81
+                                <div class="edit-li-wrapper medium-field">
82
+                                    <label for="ghs">GHS</label>
83
+                                    <input class="material-input" type="text" placeholder="GHS" name="ghs">
84
+                                </div>
85
+                            </div>
86
+                            <div class="details container">
87
+                                <h5 class="details-header">Container Details</h5>
88
+                                <div class="edit-li-wrapper extra-small-field">
89
+                                    <label for="type">Type</label>
90
+                                    <input class="material-input" type="text" placeholder="Type" name="type">
91
+                                </div>
92
+                                <div class="edit-li-wrapper small-field">
93
+                                    <label for="capacity">Capacity</label>
94
+                                    <input class="material-input" type="text" name="capacity" placeholder="Capacity" oninput="this.value = this.value.replace(/[^0-9.]/g,'').replace(/(\..*)\./g, '$1');">
95
+                                </div>
96
+                                <div class="edit-li-wrapper small-field quantity">
97
+                                    <label for="quantity">Quantity</label>
98
+                                    <input class="material-input" type="text" name="quantity" placeholder="Quantity" oninput="this.value = this.value.replace(/[^0-9.]/g,'').replace(/(\..*)\./g, '$1');">
99
+                                </div>
100
+                                <div class="edit-li-wrapper small-field uom">
101
+                                    <label for="uom">UOM</label>
102
+                                    <input class="material-input" type="text" placeholder="UOM" name="uom">
103
+                                </div>
104
+                                <div class="edit-li-wrapper medium-field">
105
+                                    <label for="location">Location</label>
106
+                                    <input class="material-input" type="text" placeholder="Location" name="location">
107
+                                </div> 
108
+                            </div>
109
+                        </div>
110
+                        <div class="edit-form-actions">
111
+                            <button class="btn btn-primary action-btn submit" id="edit-submit">Submit</button>
112
+                        </div>
113
+                    </div>
114
+                </div>
115
+            </div> 
116
+        </div>
117
+
118
+        <!-- alerts -->
119
+        <div class="alerts">
120
+            <div class="alert">
121
+                <div class="message-icon-wrapper">
122
+                    <i class="message-icon success-icon material-icons">done</i>
123
+                    <i class="message-icon error-icon failed-icon warning-icon material-icons">close</i>
124
+                </div>
125
+                <p class="alert-status"></p>
126
+                <p class="alert-message"></p>
127
+            </div>
128
+        </div>
129
+
130
+        <!-- confirm alert -->
131
+        <div class="alert-wrapper hide-confirm">
132
+            <div class="confirm-alert">
133
+                <h5 class="header confirm-header">Confirm</h5>
134
+                <div class="mi-wrapper">
135
+                    <div class="confirm-message"></div>
136
+                    <div class="query-actions">
137
+                        <button class="btn query-btn" id="yes">Yes</button>
138
+                        <button class="btn query-btn hide-confirm">No</button>
139
+                    </div>                                       
140
+                </div>
141
+            </div> 
142
+        </div>
143
+
144
+        <div class="content">
145
+           <!-- navbar -->
146
+            <?php require_once("navbar.php")?>
147
+
148
+            <div class="main">
149
+                <div class="header-wrapper">
150
+                    <h5 class="header lab-header"><?php echo $_SESSION["authorized"][$_GET["lab_id"]]["lab_room"]; ?></h5>
151
+                    <!-- processing -->
152
+                    <div class="processing">
153
+                        <p class="processing-text">Fetching inventory...</p>
154
+                        <div class="loader"></div>
155
+                    </div>
156
+                </div>
157
+
158
+                <div class="main-wrapper">
159
+                    <!-- search form -->
160
+                    <div class="float-right">
161
+                        <div class="search-form-wrapper">
162
+                            <input class="search-form" type="text" placeholder="Search for materials" name="search-form">
163
+                            <button class="clear-btn search-form-submit">
164
+                                <i class="material-icons clear-icon">close</i>
165
+                            </button>
166
+                        </div>
167
+                    </div>
168
+
169
+                    <!-- inventory -->
170
+                    <h6 class="header sub-header">Edit Inventory</h6>
171
+                    <div class="table-wrapper inventory">
172
+                        <table class="table">
173
+                            <thead>
174
+                                <tr>
175
+                                    <th class="sort" value="mat_name" >Material
176
+                                        <i class="sort-icon sort-material fas fa-caret-down"></i>
177
+                                    </th>
178
+                                    <th >Manufacturer</th>
179
+                                    <th >CAS Num.</th>
180
+                                    <th >SDS</th>
181
+                                    <th >GHS</th>
182
+                                    <th >State</th>
183
+                                    <th >Type</th>
184
+                                    <th value="capacity">Capacity</th>
185
+                                    <th value="quantity">Quantity</th>
186
+                                    <th value="total">Total</th>
187
+                                    <th value="uom">UOM</th>
188
+                                    <th >Location</th>
189
+                                    <th >Options</th>
190
+                                </tr>
191
+                            </thead>
192
+                            <tbody></tbody>
193
+                        </table>
194
+                    </div>
195
+
196
+                    <h6 class="header table-total"></h6>
197
+                </div>
198
+             </div>
199
+
200
+            <!-- footer -->
201
+            <?php require_once("footer.php")?>
202
+        </div>  
203
+
204
+        <!-- scripts -->
205
+        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
206
+        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
207
+        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
208
+        <script type="text/javascript" src="/scripts/main.js"></script>
209
+        <script type="text/javascript" src="/scripts/inventory.js"></script>
210
+    </body>
211
+</html>

+ 316
- 0
public_html/laboratory.php View File

@@ -0,0 +1,316 @@
1
+<!--    Authors         :   Carlos C. Corrada-Bravo
2
+                            David J. Ortiz-Rivera
3
+
4
+        Organization    :   Centro de Desarrollo y Consultoria Computacional
5
+        Project         :   OPASO Material Registry  
6
+        File            :   laboratory
7
+        Description     :   Display laboratory inventory -->
8
+
9
+<!-- verify session -->
10
+<?php require_once("header.php");
11
+
12
+    /* start user session */
13
+    if(!isset($_SESSION)){
14
+        session_start();
15
+    }
16
+
17
+    /* verify lab id */
18
+    if(!isset($_GET["lab_id"])){
19
+        header("Location: /menu");
20
+        die();
21
+    }
22
+
23
+    else{
24
+        if(!(array_key_exists($_GET["lab_id"],$_SESSION["authorized"]))){
25
+            header("Location: /menu");
26
+            die();
27
+        }
28
+    }
29
+?>
30
+
31
+<!doctype html>
32
+<html lang="en">
33
+    <!-- encoding/imports/styling -->
34
+    <head>
35
+        <meta charset="utf-8">
36
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
37
+        <title class="title"><?php echo $_SESSION["authorized"][$_GET["lab_id"]]["lab_room"]; ?></title>
38
+        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
39
+        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
40
+        <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
41
+        <link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
42
+        <link rel="stylesheet" href="/style/main.css">
43
+        <link rel="stylesheet" href="/style/laboratory.css">
44
+    </head>
45
+    
46
+    <!-- content -->
47
+    <body>
48
+        <!-- transaction forms -->
49
+        <div class="form-shader close-form">
50
+            <!-- main transactions -->
51
+            <div class="main-form close-form">
52
+                <div class="form-wrapper">
53
+                    <div class="form-header-wrapper">
54
+                        <h4 class="form-header main-header">Material Use</h4>
55
+                        <div class="close-icon"><i class="material-icons close-form">close</i></div>
56
+                    </div>
57
+                    <div class="form">
58
+                        <div class="form-body">
59
+                            <div class="li-wrapper total">
60
+                                <label class="label" for="total">Limit</label>
61
+                                <input class="text-field" id="total" type="text" name="total" disabled>
62
+                            </div>
63
+                            <div class="li-wrapper">
64
+                                <label class="label transaction-label" for="transaction"></label>
65
+                                <div class="control-wrapper">
66
+                                    <input class="text-field" id="transaction" type="text" name="transaction">
67
+                <!--                     <i class="control control-plus fas fa-plus" id="plus"></i><br>
68
+                                    <i class="control control-minus fas fa-minus" id="minus"></i> -->
69
+                                </div>
70
+                            </div>
71
+                        </div>
72
+                        <div class="form-actions">
73
+                            <button class="btn btn-primary action-btn submit" id="main-submit">Submit</button>
74
+                        </div>
75
+                    </div>
76
+                </div>
77
+            </div>
78
+            
79
+            <!-- add material -->
80
+            <div class="add-form close-form">
81
+                <div class="add-form-wrapper">
82
+                    <div class="add-form-header-wrapper">
83
+                        <h4 class="form-header">Add Material</h4>
84
+                        <div class="close-icon"><i class="material-icons close-form">close</i></div>
85
+                    </div>
86
+                    <div class="add-form-body-wrapper">
87
+                        <div class="add-form-body">
88
+                            <div class="details material">
89
+                                <h5 class="details-header">Material Details</h5>
90
+                                <div class="add-li-wrapper large-field">
91
+                                    <label for="mat_name">Material</label>
92
+                                    <input class="material-input" type="text" placeholder="Material name" name="mat_name">
93
+                                </div>
94
+                                <div class="add-li-wrapper medium-field">
95
+                                    <label for="cas-number">CAS Number</label>
96
+                                    <input class="material-input" type="text" placeholder="CAS Num." name="cas">
97
+                                </div>
98
+                                <div class="add-li-wrapper medium-field">
99
+                                    <label for="man_name">Manufacturer</label>
100
+                                    <input class="material-input" type="text" placeholder="Manufacturer name" name="man_name">
101
+                                </div>
102
+                                <div class="add-li-wrapper large-field">
103
+                                    <label for="sds-link">SDS Link</label>
104
+                                    <input class="material-input" type="text" placeholder="SDS Link" name="sds">
105
+                                </div>
106
+                                <div class="add-li-wrapper extra-small-field">
107
+                                    <label for="state">State</label>
108
+                                    <input class="material-input" type="text" placeholder="State" name="state">
109
+                                </div>
110
+                            </div>
111
+                            <div class="details hazard">
112
+                                <h5 class="details-header">Hazard Details</h5>
113
+                                <div class="add-li-wrapper small-field">
114
+                                    <label for="ghs">GHS</label>
115
+                                    <input class="material-input" type="text" placeholder="GHS" name="ghs">
116
+                                </div>
117
+                                <div class="add-li-wrapper medium-field">
118
+                                    <label for="hazard">Hazard</label>
119
+                                    <input class="material-input" type="text" placeholder="Hazard" name="hazard">
120
+                                </div>
121
+                            </div>
122
+                            <div class="details container-details">
123
+                                <h5 class="details-header">Container Details</h5>
124
+                                <div class="add-li-wrapper extra-small-field">
125
+                                    <label for="type">Type</label>
126
+                                    <input class="material-input" type="text" placeholder="Type" name="type">
127
+                                </div>
128
+                                <div class="add-li-wrapper small-field">
129
+                                    <label for="capacity">Capacity</label>
130
+                                    <input class="material-input" type="text" name="capacity" placeholder="Capacity" oninput="this.value = this.value.replace(/[^0-9.]/g,'').replace(/(\..*)\./g, '$1');">
131
+                                </div>
132
+                                <div class="add-li-wrapper small-field quantity">
133
+                                    <label for="quantity">Quantity</label>
134
+                                    <input class="material-input" type="text" name="quantity" placeholder="Quantity" oninput="this.value = this.value.replace(/[^0-9.]/g,'').replace(/(\..*)\./g, '$1');">
135
+                                </div>
136
+                                <div class="add-li-wrapper small-field uom">
137
+                                    <label for="uom">UOM</label>
138
+                                    <input class="material-input" type="text" placeholder="UOM" name="uom">
139
+                                </div>
140
+                                <div class="add-li-wrapper medium-field">
141
+                                    <label for="location">Location</label>
142
+                                    <input class="material-input" type="text" placeholder="Location" name="location">
143
+                                </div> 
144
+                            </div>
145
+                        </div>
146
+                        <div class="add-form-actions">
147
+                            <button class="btn btn-primary action-btn submit" id="add-submit">Submit</button>
148
+                        </div>
149
+                    </div>
150
+                </div>
151
+            </div> 
152
+        </div>
153
+
154
+        <!-- alerts -->
155
+        <div class="alerts">
156
+            <div class="alert">
157
+                <div class="message-icon-wrapper">
158
+                    <i class="message-icon success-icon material-icons">done</i>
159
+                    <i class="message-icon error-icon failed-icon warning-icon material-icons">close</i>
160
+                </div>
161
+                <p class="alert-status"></p>
162
+                <p class="alert-message"></p>
163
+            </div>
164
+        </div>
165
+
166
+        <!-- confirm alert -->
167
+        <div class="alert-wrapper hide-confirm">
168
+            <div class="confirm-alert">
169
+                <h5 class="header confirm-header">Confirm</h5>
170
+                <div class="mi-wrapper">
171
+                    <div class="confirm-message"></div>
172
+                    <div class="query-actions">
173
+                        <button class="btn query-btn" id="yes">Yes</button>
174
+                        <button class="btn query-btn hide-confirm">No</button>
175
+                    </div>                                       
176
+                </div>
177
+            </div> 
178
+        </div>
179
+
180
+        <!-- material data -->
181
+        <div class="material-data-shader hide-material-data">
182
+            <div class="material-data-wrapper">
183
+                <div class="material-data-icon-wrapper">
184
+                    <i class="hide-material-data-icon hide-material-data material-icons">close</i>
185
+                </div>
186
+                <div class="material-data">
187
+                    <div class="material-name-wrapper">
188
+                        <h5 class="header material-data-header material-name" value="mat_name"></h6>
189
+                        <a class="material-link" target="_blank" rel="noopener noreferrer" title="material"><i class="fas fa-external-link-alt"></i></a>
190
+                    </div>
191
+                    <div class="material-data-row">
192
+                        <h6 class="header material-data-header">CAS Num.</h6>
193
+                        <span class="material-data-text" value="cas"></span>
194
+                    </div>
195
+                    <div class="material-data-row">
196
+                        <h6 class="header material-data-header">State</h6>
197
+                        <span class="material-data-text" value="state"></span>
198
+                    </div>
199
+                    <div class="material-data-row">
200
+                        <h6 class="header material-data-header">Type</h6>
201
+                        <span class="material-data-text" value="type"></span>
202
+                    </div>
203
+                    <div class="material-data-row">
204
+                        <h6 class="header material-data-header">SDS Link</h6>
205
+                        <span class="material-data-text" value="sds"></span>
206
+                    </div>
207
+                    <div class="material-data-row">
208
+                        <h6 class="header material-data-header">GHS</h6>
209
+                        <span class="material-data-text" value="ghs"></span>
210
+                    </div>
211
+                </div> 
212
+            </div>
213
+        </div>
214
+
215
+        <div class="content">
216
+            <!-- navbar -->
217
+            <?php require_once("navbar.php")?>
218
+            <div class="main">
219
+                <div class="header-wrapper">
220
+                    <h5 class="header lab-header"><?php echo $_SESSION["authorized"][$_GET["lab_id"]]["lab_room"]; ?></h5>
221
+                    
222
+                    <!-- processing -->
223
+                    <div class="processing">
224
+                        <p class="processing-text">Fetching inventory...</p>
225
+                        <div class="loader"></div>
226
+                    </div>
227
+                </div>
228
+
229
+                <div class="main-wrapper">
230
+
231
+                    <!-- inventory -->
232
+                    <div class="personnel-wrapper">
233
+                        <h6 class="header sub-header">Personnel</h6>
234
+                        <table class="table personnel">
235
+                            <thead class="table-header">
236
+                                <tr>
237
+                                    <th value="person_name" >Person Name</th>
238
+                                    <th value="access_level">Access level</th>
239
+                                </tr>
240
+                            </thead>
241
+                            <tbody class="personnel-body"></tbody>
242
+                        </table>
243
+                    </div>
244
+
245
+                    <div class="float-right">
246
+                        <div class="dropdown download">
247
+                            <button class="btn btn-outline-success download-btn" type="button" title="Download" id="dropdown-menu-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="material-icons download-icon">archived</i></button>
248
+                            <div class="dropdown-menu" aria-labelledby="dropdown-menu-button">
249
+                                <span class="download-option" value="lab_report">Lab Report</span>
250
+                            </div>
251
+                        </div>
252
+
253
+                        <div class="btn btn-light transaction add-material" id="add-material">
254
+                            <i class="fas fa-plus add-material-icon"></i>
255
+                            <p class="add-text">Add</p>
256
+                        </div>
257
+
258
+                        <div class="search-form-wrapper">
259
+                            <input class="search-form" type="text" placeholder="Search for materials" name="search-form">
260
+                            <button class="clear-btn search-form-submit">
261
+                                <i class="material-icons clear-icon">close</i>
262
+                            </button>
263
+                        </div>
264
+                    </div>
265
+
266
+                    <!-- inventory -->
267
+                    <div class="sub-header-wrapper">
268
+                        <h6 class="header sub-header table-sub-header">Inventory</h6>
269
+                        <?php
270
+                            /* start user session */
271
+                            if(!isset($_SESSION)){
272
+                                session_start();
273
+                            }
274
+                            if($_SESSION["access_level"] == "admin" or $_SESSION["access_level"] == "investigator"){
275
+                                echo '<a class="edit-link" href="/inventory?lab_id=' . $_GET["lab_id"] . '" title="edit inventory">(Edit)</a>';
276
+                            }
277
+                        ?>
278
+                    </div>
279
+
280
+                    <div class="table-wrapper content-wrapper inventory">
281
+                        <table class="table">
282
+                            <thead class="table-header">
283
+                                <tr>
284
+                                    <th class="sort" value="mat_name" >Material
285
+                                        <i class="sort-icon sort-material fas fa-caret-down"></i>
286
+                                    </th>
287
+                                    <th  class="sort" value="man_name">Manufacturer
288
+                                        <i class="sort-alt fas fa-caret-down"></i>
289
+                                    </th>
290
+                                    <th value="capacity">Capacity</th>
291
+                                    <th value="quantity">Quantity</th>
292
+                                    <th value="total">Total</th>
293
+                                    <th value="uom">UOM</th>
294
+                                    <th >Location</th>
295
+                                    <th >Transactions</th>
296
+                                </tr>
297
+                            </thead>
298
+                            <tbody class="inventory-body"></tbody>
299
+                        </table>
300
+                    </div>
301
+                    <h6 class="header table-total"></h6>
302
+                </div>
303
+            </div>
304
+
305
+            <!-- footer -->
306
+            <?php require_once("footer.php")?>
307
+        </div>  
308
+
309
+        <!-- scripts -->
310
+        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
311
+        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
312
+        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
313
+        <script type="text/javascript" src="/scripts/main.js"></script>
314
+        <script type="text/javascript" src="/scripts/laboratory.js"></script>
315
+    </body>
316
+</html>

+ 240
- 0
public_html/manage-laboratories.php View File

@@ -0,0 +1,240 @@
1
+<!--    Authors         :   Carlos C. Corrada-Bravo
2
+                            David J. Ortiz-Rivera
3
+
4
+        Organization    :   Centro de Desarrollo y Consultoria Computacional
5
+        Project         :   OPASO Material Registry  
6
+        File            :   manage-laboratories
7
+        Description     :   Edit laboratory data -->
8
+
9
+<!-- verify session -->
10
+<?php require_once("header.php");
11
+
12
+    /* start user session */
13
+    if(!isset($_SESSION)){
14
+        session_start();
15
+    }
16
+
17
+    if(!($_SESSION["access_level"] === "admin") and !($_SESSION["access_level"] === "investigator")){
18
+        header("Location: /menu");
19
+        die();
20
+    }
21
+?>
22
+
23
+<!doctype html>
24
+<html lang="en">
25
+    <!-- encoding/imports/styling -->
26
+    <head>
27
+        <meta charset="utf-8">
28
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
29
+        <title class="title">Manage Laboratories</title>
30
+        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
31
+        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
32
+        <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
33
+        <link rel="stylesheet" href="./style/main.css">
34
+        <link rel="stylesheet" href="/style/manage.css">
35
+        <link rel="stylesheet" href="/style/add.css">
36
+    </head>
37
+
38
+    <!-- content -->
39
+    <body>
40
+        <!-- lab forms -->
41
+        <div class="form-shader close-form">
42
+            <!-- edit form -->
43
+            <div class="main-form close-form">
44
+                <div class="form-wrapper edit-lab">
45
+                    <div class="form-header-wrapper">
46
+                        <h5 class="form-header main-header">Edit Laboratory</h5>
47
+                        <div class="close-icon"><i class="close-form material-icons">close</i></div>
48
+                    </div>
49
+                    <div class="form">
50
+                        <div class="form-body edit-lab-body">
51
+                            <div class="li-wrapper large-field">
52
+                                <label for="lab_name">Lab Name</label>
53
+                                <input id="lab_name" class="main-required ap-field" type="text" placeholder="Lab Name" name="lab_name">
54
+                                <div class="invalid-feedback lab_name">Please provide a valid name</div>
55
+                            </div>
56
+                            <div class="li-append">
57
+                                <div class="li-wrapper small-field">
58
+                                    <label for="lab_room">Room</label>
59
+                                    <input id="lab_room" class="main-required ap-field" type="text" placeholder="Lab Room" name="lab_room">
60
+                                    <div class="invalid-feedback lab_room">Please provide a valid lab room</div>
61
+                                </div>
62
+                                <div class="li-wrapper margin-left medium-field">
63
+                                    <label for="department">Department</label>
64
+                                    <input id="department" class="main-required ap-field" type="text" placeholder="Department" name="department">
65
+                                    <div class="invalid-feedback department">Please provide a valid department</div>
66
+                                </div>
67
+                            </div>
68
+                            <div class="li-append">
69
+                                <div class="li-wrapper medium-field">
70
+                                    <label for="building">Building</label>
71
+                                    <input id="building" class="main-required ap-field" type="text" placeholder="Building" name="building">
72
+                                    <div class="invalid-feedback building">Please provide a valid building</div>
73
+                                </div>
74
+                                <div class="li-wrapper margin-left small-field">
75
+                                    <label for="extension">Extension</label>
76
+                                    <input id="extension" class="ap-field" type="text" name="extension" placeholder="Extension" oninput="this.value = this.value.replace(/[^0-9.]/g,'').replace(/(\..*)\./g, '$1');">
77
+                                </div>
78
+                            </div>
79
+                            <div class="li-wrapper medium-field">
80
+                                <label for="number">Principal Investigator</label>
81
+                                <!-- Select form -->
82
+                                <div class="select-form">
83
+                                    <select class="pi main-pi">
84
+                                    </select>
85
+                                </div>  
86
+                            </div>
87
+                        </div>
88
+                        <div class="form-actions">
89
+                            <button class="btn btn-primary action-btn submit" id="main-submit">Submit</button>
90
+                        </div>
91
+                    </div>
92
+                </div>
93
+            </div>
94
+
95
+            <!-- add form -->
96
+            <div class="add-form close-form">
97
+                <div class="add-form-wrapper edit-lab">
98
+                    <div class="add-form-header-wrapper">
99
+                        <h5 class="form-header">Add Laboratory</h5>
100
+                        <div class="close-icon"><i class="close-form material-icons">close</i></div>
101
+                    </div>
102
+                    <div class="add-form-body-wrapper">
103
+                        <div class="add-form-body">
104
+                            <div class="li-wrapper large-field">
105
+                                <label for="lab_name">Lab Name</label>
106
+                                <input id="add_lab_name" class="required ap-field" type="text" placeholder="Lab name" name="lab_name">
107
+                                <div class="invalid-feedback add_lab_name">Please provide a valid name</div>
108
+                            </div>
109
+                            <div class="li-append">
110
+                                <div class="li-wrapper small-field">
111
+                                    <label for="lab_room">Lab Room</label>
112
+                                    <input id="add_lab_room" class="required ap-field" type="text" placeholder="Lab room" name="lab_room">
113
+                                    <div class="invalid-feedback add_lab_room">Please provide a valid lab room</div>
114
+                                </div>
115
+                                <div class="li-wrapper margin-left medium-field">
116
+                                    <label for="department">Department</label>
117
+                                    <input id="add_department" class="required ap-field" type="text" placeholder="Department" name="department">
118
+                                    <div class="invalid-feedback add_department">Please provide a valid department</div>
119
+                                </div>
120
+                            </div>
121
+                            <div class="li-append">
122
+                                <div class="li-wrapper medium-field">
123
+                                    <label for="building">Building</label>
124
+                                    <input id="add_building" class="required ap-field" type="text" placeholder="Building" name="building">
125
+                                    <div class="invalid-feedback add_building">Please provide a valid building</div>
126
+                                </div>
127
+                                <div class="li-wrapper margin-left small-field">
128
+                                    <label for="extension">Extension</label>
129
+                                    <input id="add_extension" class="ap-field" type="text" name="extension" placeholder="Extension" oninput="this.value = this.value.replace(/[^0-9.]/g,'').replace(/(\..*)\./g, '$1');">
130
+                                </div>
131
+                            </div>
132
+                            <div class="li-wrapper medium-field">
133
+                                <label for="number">Principal Investigator</label>
134
+                                <!-- Select form -->
135
+                                <div class="select-form">
136
+                                    <select class="pi add-pi">
137
+                                    </select>
138
+                                </div>  
139
+                            </div>
140
+                            <small class="add-lab-warning">*All PIs must already be in the system</small>
141
+                        </div>
142
+                        <div class="add-form-actions">
143
+                            <button class="btn btn-primary action-btn submit" id="add-submit">Submit</button>
144
+                        </div>
145
+                    </div>
146
+                </div>
147
+            </div> 
148
+        </div>
149
+
150
+        <!-- alerts -->
151
+        <div class="alerts">
152
+            <div class="alert">
153
+                <div class="message-icon-wrapper">
154
+                    <i class="message-icon success-icon material-icons">done</i>
155
+                    <i class="message-icon error-icon failed-icon warning-icon material-icons">close</i>
156
+                </div>
157
+                <p class="alert-status"></p>
158
+                <p class="alert-message"></p>
159
+            </div>
160
+        </div>
161
+
162
+        <div class="content">
163
+            <!-- navbar -->
164
+            <?php require_once("navbar.php")?>
165
+            <div class="main">
166
+                    <div class="header-wrapper">
167
+                        <h5 class="header">Manage Laboratories</h5>
168
+
169
+                        <!-- processing -->
170
+                        <div class="processing">
171
+                            <p class="processing-text">Fetching laboratories...</p>
172
+                            <div class="loader"></div>
173
+                        </div>
174
+                    </div>
175
+                <div class="main-wrapper">
176
+
177
+                    <!-- search form -->
178
+                    <div class="float-right">
179
+
180
+                        <?php 
181
+                            /* start user session */
182
+                            if(!isset($_SESSION)){
183
+                                session_start();
184
+                            }
185
+                            if($_SESSION["access_level"] == "admin"){
186
+                                echo '<!-- Add Material -->
187
+                                        <div class="transaction btn btn-light" id="add">
188
+                                            <i class="fas fa-plus add-personnel-icon"></i>
189
+                                            <p class="add-text">Add</p>
190
+                                        </div>';
191
+                            }
192
+
193
+                        ?>
194
+
195
+                        <div class="search-form-wrapper">
196
+                            <input class="search-form" placeholder="Search for laboratories" type="text" name="search-form">
197
+                            <button class="clear-btn search-form-submit">
198
+                                <i class="material-icons clear-icon">close</i>
199
+                            </button>
200
+                        </div>
201
+                    </div>
202
+
203
+                    <!-- laboratories -->
204
+                    <h6 class="header sub-header">Full Laboratory List</h6>
205
+                    <div class="table-wrapper content-wrapper manage-labs">
206
+                        <table class="table">
207
+                            <thead class="table-header">
208
+                                <tr>
209
+                                    <th class="sort" value="lab_room">Lab Room
210
+                                        <i class="sort-primary fas fa-caret-down"></i>
211
+                                    </th>
212
+                                    <th value="lab_name">Lab Name</th>
213
+                                    <th>Department</th>
214
+                                    <th class="sort" value="building"> Building
215
+                                        <i class="sort-alt fas fa-caret-down"></i>
216
+                                    </th>
217
+                                    <th >Extension</th>
218
+                                    <th >PI</th>
219
+                                    <th >Actions</th>
220
+                                </tr>
221
+                            </thead>
222
+                            <tbody></tbody>
223
+                        </table>
224
+                    </div>
225
+                    <h6 class="header table-total"></h6>
226
+                </div>
227
+            </div>
228
+
229
+            <!-- footer -->
230
+            <?php require_once("footer.php")?>
231
+        </div>  
232
+
233
+        <!-- scripts -->
234
+        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
235
+        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
236
+        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
237
+        <script type="text/javascript" src="/scripts/main.js"></script>
238
+        <script type="text/javascript" src="/scripts/manage-laboratories.js"></script>
239
+    </body>
240
+</html>