Redmind commited on
Commit
874429a
·
verified ·
1 Parent(s): 158ecc4

Update sidepane.html

Browse files
Files changed (1) hide show
  1. sidepane.html +210 -105
sidepane.html CHANGED
@@ -1,105 +1,210 @@
1
- <!-- sidepane.html -->
2
-
3
- <!-- This file represents the sidepane component of a web application. It contains the navigation menu and sidebar. -->
4
-
5
- <nav class="main-header navbar navbar-expand navbar-white navbar-light" style="text-align: center;margin-left: 100px;">
6
- <div class="container-fluid d-flex justify-content-center align-items-center">
7
- <img src="/static/img/redmindlogo3.jpg" alt="Logo" style="width: 80px; height: auto; margin-right: 10px;">
8
-
9
- <h3 style="text-align: center; margin-bottom: 0;">Redmind GPT - {{title}}</h3>
10
- <button class="btn btn-primary" style="position: absolute; top: 30px;right:10px;" onclick="logout()">Logout</button>
11
-
12
- </div>
13
- <!-- Left navbar links -->
14
- <!-- <ul class="navbar-nav">
15
- <li class="nav-item">
16
- <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
17
- </li>
18
- </ul> -->
19
- </nav>
20
-
21
- <!-- Main Sidebar Container -->
22
- <aside class="main-sidebar sidebar-dark-primary elevation-4" style="width: 200px; position: fixed; top: 0; left: 0; height: 100vh; overflow: hidden;">
23
- <!-- Sidebar -->
24
- <div class="sidebar">
25
- <!-- Sidebar Menu -->
26
- <nav class="mt-2">
27
- <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
28
- <!-- Navigation Links -->
29
- <li class="nav-item">
30
- <a href="{{url_for('dashboard')}}" class="nav-link">
31
- <i class="nav-icon fas fa-home"></i>
32
- <p>Dashboard</p>
33
- </a>
34
- </li>
35
- <li class="nav-item">
36
- <a href="{{ url_for('company_profile') }}" class="nav-link">
37
- <i class="nav-icon fas fa-users"></i>
38
- <p>Company Profile</p>
39
- </a>
40
- </li>
41
- <li class="nav-item">
42
- <a href="{{ url_for('knowledgebase') }}" class="nav-link">
43
- <i class="nav-icon fas fa-cogs"></i>
44
- <p>KnowledgeBase</p>
45
- </a>
46
- </li>
47
- <li class="nav-item">
48
- <a href="{{ url_for('data_connectors') }}" class="nav-link">
49
- <i class="nav-icon fas fa-cogs"></i>
50
- <p>Data Connectors</p>
51
- </a>
52
- </li>
53
- <li class="nav-item">
54
- <a href="{{ url_for('API_connectors') }}" class="nav-link">
55
- <i class="nav-icon fas fa-cogs"></i>
56
- <p>API Connectors</p>
57
- </a>
58
- </li>
59
- <li class="nav-item">
60
- <a href="{{url_for('prompt_template')}}" class="nav-link">
61
- <i class="nav-icon fas fa-cogs"></i>
62
- <p>Prompt Templates</p>
63
- </a>
64
- </li>
65
- <!--<li class="nav-item">
66
- <a href="#" class="nav-link">
67
- <i class="nav-icon fas fa-cogs"></i>
68
- <p>LLM Settings</p>
69
- </a>
70
- <ul class="nav nav-treeview">
71
- <li class="nav-item">
72
- <a href="#" class="nav-link">
73
- <i class="far fa-circle nav-icon"></i>
74
- <p>Sublink 1</p>
75
- </a>
76
- </li>
77
- <li class="nav-item">
78
- <a href="#" class="nav-link">
79
- <i class="far fa-circle nav-icon"></i>
80
- <p>Sublink 2</p>
81
- </a>
82
- </li>
83
-
84
- </ul>
85
- </li> -->
86
-
87
- <!-- Add more navigation links here -->
88
- </ul>
89
- </nav>
90
- <!-- /.sidebar-menu -->
91
- </div>
92
- <!-- /.sidebar -->
93
- </aside>
94
-
95
-
96
- <!-- AdminLTE JS -->
97
- <script >
98
- function logout() {
99
- // Clear session storage
100
- sessionStorage.clear();
101
-
102
- // Redirect to the login page
103
- window.location.href = '/';
104
- }
105
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- sidepane.html -->
2
+
3
+ <!-- This file represents the sidepane component of a web application. It contains the navigation menu and sidebar. -->
4
+ <!DOCTYPE html>
5
+ <html lang="en">
6
+
7
+ <head>
8
+ <meta charset="UTF-8">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
+ <title>Company Profile</title>
11
+ <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
12
+
13
+ <div class="container-fluid d-flex justify-content-center align-items-center">
14
+ <img src="/static/img/redmindlogo3.jpg" alt="Logo" style="width: 80px; height: auto; margin-right: 10px;">
15
+
16
+ <h3 style="text-align: center; margin-bottom: 0;">Redmind GPT - {{title}}</h3>
17
+ <button class="btn btn-primary" style="position: absolute; top: 30px;right:40px;" onclick="logout()">Logout</button>
18
+
19
+ </div>
20
+ <!-- Left navbar links -->
21
+ <!-- <ul class="navbar-nav">
22
+ <li class="nav-item">
23
+ <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
24
+ </li>
25
+ </ul> -->
26
+ </nav>
27
+
28
+ <!-- Main Sidebar Container -->
29
+ <aside class="main-sidebar sidebar-dark-primary elevation-4" style="width: 200px; position: fixed; top: 0; left: 0; height: 100vh; overflow: hidden;">
30
+ <!-- Sidebar -->
31
+ <div class="sidebar">
32
+ <!-- Sidebar Menu -->
33
+ <nav class="mt-2">
34
+ <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
35
+
36
+ <input type="hidden" id="userRole" name="userRole" value={{role}}>
37
+ <input type="hidden" id="company_id" name="company_id" value={{company_id}}>
38
+ <div class="form-group"style="display: none;">
39
+ <label for="llm_tools" >LLM Tools<span class="text-danger">*</span></label>
40
+ <select class="form-control" id="llm_tools" name="llm_tools" multiple required style="display: none;">
41
+ <option value="Database">Database</option>
42
+ <option value="Static Documents">Static Documents</option>
43
+ <option value="API">API</option>
44
+ </select>
45
+ <div class="invalid-feedback">
46
+ Please select at least one LLM tool.
47
+ </div>
48
+ </div>
49
+
50
+ <li class="nav-item">
51
+ <a href="{{url_for('dashboard')}}" class="nav-link">
52
+ <i class="nav-icon fas fa-home"></i>
53
+ <p>Dashboard</p>
54
+ </a>
55
+ </li>
56
+ <li class="nav-item" >
57
+ <a href="{{ url_for('company_profile') }}" class="nav-link">
58
+ <i class="nav-icon fas fa-users"></i>
59
+ <p>Company Profile</p>
60
+ </a>
61
+ </li>
62
+ <li class="nav-item" id="knowledgebase_link">
63
+ <a href="{{ url_for('knowledgebase') }}" class="nav-link">
64
+ <i class="nav-icon fas fa-cogs"></i>
65
+ <p>KnowledgeBase</p>
66
+ </a>
67
+ </li>
68
+ <li class="nav-item" id="data_connectors_link">
69
+ <a href="{{ url_for('data_connectors') }}" class="nav-link">
70
+ <i class="nav-icon fas fa-cogs"></i>
71
+ <p>Data Connectors</p>
72
+ </a>
73
+ </li>
74
+ <li class="nav-item" id="api_connectors_link">
75
+ <a href="{{ url_for('API_connectors') }}" class="nav-link">
76
+ <i class="nav-icon fas fa-cogs"></i>
77
+ <p>API Connectors</p>
78
+ </a>
79
+ </li>
80
+ <li class="nav-item">
81
+ <a href="{{url_for('prompt_template')}}" class="nav-link">
82
+ <i class="nav-icon fas fa-cogs"></i>
83
+ <p>Prompt Templates</p>
84
+ </a>
85
+ </li>
86
+ <!--<li class="nav-item">
87
+ <a href="#" class="nav-link">
88
+ <i class="nav-icon fas fa-cogs"></i>
89
+ <p>LLM Settings</p>
90
+ </a>
91
+ <ul class="nav nav-treeview">
92
+ <li class="nav-item">
93
+ <a href="#" class="nav-link">
94
+ <i class="far fa-circle nav-icon"></i>
95
+ <p>Sublink 1</p>
96
+ </a>
97
+ </li>
98
+ <li class="nav-item">
99
+ <a href="#" class="nav-link">
100
+ <i class="far fa-circle nav-icon"></i>
101
+ <p>Sublink 2</p>
102
+ </a>
103
+ </li>
104
+
105
+ </ul>
106
+ </li> -->
107
+
108
+ <!-- Add more navigation links here -->
109
+ </ul>
110
+ </nav>
111
+ <!-- /.sidebar-menu -->
112
+ </div>
113
+ <!-- /.sidebar -->
114
+ </aside>
115
+
116
+
117
+ <!-- AdminLTE JS -->
118
+ <script >
119
+
120
+ function logout() {
121
+ sessionStorage.removeItem('role');
122
+ sessionStorage.clear();
123
+ window.location.href = '/';
124
+ }
125
+
126
+
127
+ document.addEventListener("DOMContentLoaded", function() {
128
+
129
+ const company_id1 = document.getElementById("company_id").value;
130
+ const role1 = document.getElementById("userRole").value;
131
+ sessionStorage.setItem('siderole1',role1);
132
+ sessionStorage.setItem('sidecompanyId1',company_id1);
133
+
134
+ const sidecompanyId = sessionStorage.getItem('sidecompanyId1');
135
+ const siderole = sessionStorage.getItem('siderole1');
136
+ if (sidecompanyId && siderole) {
137
+ console.log("Company ID inside sidepane:", sidecompanyId);
138
+ console.log("Role inside sidepane:",siderole);
139
+
140
+ editCompany(sidecompanyId,siderole);
141
+ if (siderole==='admin')
142
+ {
143
+ console.log("inside admin before edit");
144
+ updateLinkVisibility(siderole);
145
+ }
146
+ }
147
+
148
+ });
149
+
150
+ async function updateLinkVisibility(siderole) {
151
+ //const role = sessionStorage.getItem('role');
152
+ if(siderole==='admin')
153
+ {
154
+ const displayState = JSON.parse(sessionStorage.getItem('displayState'));
155
+
156
+ // Update the visibility of links based on the stored state
157
+ document.getElementById('api_connectors_link').style.display = displayState.apiConnectors;
158
+ document.getElementById('knowledgebase_link').style.display = displayState.knowledgeBase;
159
+ document.getElementById('data_connectors_link').style.display = displayState.dataConnectors
160
+ }
161
+ }
162
+ async function editCompany(sidecompanyId,siderole) {
163
+ console.log("inside edit ", sidecompanyId);
164
+ console.log("inside edit role role",siderole);
165
+ $.getJSON(`/api/getcompanydetails/${sidecompanyId}`, function (company) {
166
+ // Set the value of #llm_tools and trigger change event
167
+ $('#llm_tools').val(company.llm_tools.split(',')).trigger('change');
168
+
169
+ // Get the selected values from #llm_tools
170
+ const llmTools = $('#llm_tools').val(); // This is an array
171
+
172
+ console.log("inside sidepane edit llmTools", llmTools);
173
+ //const role =sessionStorage.getItem('role');
174
+
175
+ if (llmTools && llmTools.length > 0) {
176
+ console.log("inside if");
177
+ if (siderole === 'admin') {
178
+ // Example: Conditionally display some links based on llm_tools
179
+ if (api_connectors_link) {
180
+ api_connectors_link.style.display = llmTools.includes('API') ? 'block' : 'none';
181
+ console.log("state api",api_connectors_link.style.display );
182
+ }
183
+
184
+ if (knowledgebase_link) {
185
+ knowledgebase_link.style.display = llmTools.includes('Static Documents') ? 'block' : 'none';
186
+ console.log("state know", knowledgebase_link.style.display);
187
+ }
188
+
189
+ if (data_connectors_link) {
190
+ data_connectors_link.style.display = llmTools.includes('Database') ? 'block' : 'none';
191
+ console.log("state dataconn", data_connectors_link.style.display);
192
+ }
193
+
194
+ console.log("inside storageadmin");
195
+ sessionStorage.setItem('displayState', JSON.stringify({
196
+ apiConnectors: api_connectors_link.style.display,
197
+ knowledgeBase: knowledgebase_link.style.display ,
198
+ dataConnectors: data_connectors_link.style.display
199
+
200
+ }));
201
+ }
202
+ }
203
+ }).fail(function () {
204
+ alert("Error retrieving company details.");
205
+ });
206
+
207
+ }
208
+ </script>
209
+ </head>
210
+ </html>