| 24417 |
govind |
1 |
<script type="text/javascript">
|
|
|
2 |
|
|
|
3 |
$(document).ready(function() {
|
|
|
4 |
$('#authUser').multiselect({
|
|
|
5 |
includeSelectAllOption: true,
|
|
|
6 |
multiple:true,
|
|
|
7 |
maxHeight: 200,
|
|
|
8 |
buttonWidth: '180px',
|
|
|
9 |
numberDisplayed: 1,
|
|
|
10 |
nonSelectedText: 'AuthUsers',
|
|
|
11 |
nSelectedText: ' - AuthUser Selected',
|
|
|
12 |
allSelectedText: 'All AuthUser Selected',
|
|
|
13 |
enableFiltering: true,
|
|
|
14 |
enableCaseInsensitiveFiltering : true
|
|
|
15 |
});
|
| 25570 |
tejbeer |
16 |
|
|
|
17 |
$('#partner').multiselect({
|
|
|
18 |
includeSelectAllOption: true,
|
|
|
19 |
multiple:true,
|
|
|
20 |
maxHeight: 200,
|
|
|
21 |
buttonWidth: '180px',
|
|
|
22 |
numberDisplayed: 1,
|
|
|
23 |
nonSelectedText: 'Partners',
|
|
|
24 |
nSelectedText: ' - Partners Selected',
|
|
|
25 |
allSelectedText: 'All Partners Selected',
|
|
|
26 |
enableFiltering: true,
|
|
|
27 |
enableCaseInsensitiveFiltering : true
|
|
|
28 |
});
|
| 24417 |
govind |
29 |
$('#regionPosition').multiselect({
|
|
|
30 |
includeSelectAllOption: true,
|
|
|
31 |
multiple:true,
|
|
|
32 |
maxHeight: 200,
|
|
|
33 |
buttonWidth: '180px',
|
|
|
34 |
numberDisplayed: 1,
|
|
|
35 |
nonSelectedText: 'Region',
|
|
|
36 |
nSelectedText: ' - Region Selected',
|
|
|
37 |
allSelectedText: 'All Region Selected',
|
|
|
38 |
enableFiltering: true,
|
|
|
39 |
enableCaseInsensitiveFiltering : true
|
|
|
40 |
});
|
|
|
41 |
$('#escalationType').multiselect({
|
|
|
42 |
includeSelectAllOption: true,
|
|
|
43 |
multiple:true,
|
|
|
44 |
maxHeight: 200,
|
|
|
45 |
buttonWidth: '180px',
|
|
|
46 |
numberDisplayed: 1,
|
|
|
47 |
nonSelectedText: 'EscalationType',
|
|
|
48 |
nSelectedText: ' - EscalationType Selected',
|
|
|
49 |
allSelectedText: 'All EscalationType Selected',
|
|
|
50 |
enableFiltering: true,
|
|
|
51 |
enableCaseInsensitiveFiltering : true
|
|
|
52 |
});
|
|
|
53 |
$('#ticketCategoryPosition').multiselect({
|
|
|
54 |
includeSelectAllOption: true,
|
|
|
55 |
multiple:true,
|
|
|
56 |
maxHeight: 200,
|
|
|
57 |
buttonWidth: '180px',
|
|
|
58 |
numberDisplayed: 1,
|
|
|
59 |
nonSelectedText: 'Category',
|
|
|
60 |
nSelectedText: ' - Category Selected',
|
|
|
61 |
allSelectedText: 'All Category Selected',
|
|
|
62 |
enableFiltering: true,
|
|
|
63 |
enableCaseInsensitiveFiltering : true
|
|
|
64 |
});
|
| 25570 |
tejbeer |
65 |
|
| 24417 |
govind |
66 |
});
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
</script>
|
|
|
70 |
<section class="wrapper">
|
|
|
71 |
<div class="row">
|
|
|
72 |
<div class="col-lg-12">
|
| 32813 |
shampa |
73 |
<h3 class="page-header"><i class="icon_document_alt"></i>CREATE POSITION</h3>
|
| 24417 |
govind |
74 |
<ol class="breadcrumb">
|
|
|
75 |
<li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
|
|
|
76 |
<li><i class="icon_document_alt"></i>Create Position</li>
|
|
|
77 |
</ol>
|
|
|
78 |
</div>
|
|
|
79 |
</div>
|
| 31786 |
tejbeer |
80 |
|
| 31787 |
tejbeer |
81 |
|
| 24417 |
govind |
82 |
<form id="create-ticket-category-form">
|
|
|
83 |
<div class = "row">
|
|
|
84 |
<div class="col-lg-2 form-group">
|
|
|
85 |
<select class="form-control input-sm" id = "authUser" name="authUser" placeholder="AuthUser">
|
|
|
86 |
<option value="" disabled selected>AuthUser</option>
|
|
|
87 |
#foreach($authUser in $authUsers)
|
| 27410 |
tejbeer |
88 |
<option value="$authUser.getId()">$authUser.getName()</option>
|
| 24417 |
govind |
89 |
#end
|
|
|
90 |
</select>
|
|
|
91 |
</div>
|
|
|
92 |
<div class="col-lg-2 form-group">
|
|
|
93 |
<select class="form-control input-sm" id = "ticketCategoryPosition" name="ticketCategoryPosition" placeholder="Category">
|
|
|
94 |
<option value="" disabled selected>Category</option>
|
|
|
95 |
#foreach($ticketCategory in $ticketCategories)
|
|
|
96 |
<option value="$ticketCategory.getId()">$ticketCategory.getName()</option>
|
|
|
97 |
#end
|
|
|
98 |
</select>
|
|
|
99 |
</div>
|
|
|
100 |
<div class="col-lg-2 form-group">
|
|
|
101 |
<select class="form-control input-sm" id = "escalationType" name="escalationType" placeholder="escalationType">
|
|
|
102 |
<option value="" disabled selected>EscalationType</option>
|
|
|
103 |
#foreach($escalationType in $escalationTypes)
|
|
|
104 |
<option value="$escalationType">$escalationType</option>
|
|
|
105 |
#end
|
|
|
106 |
</select>
|
|
|
107 |
</div>
|
|
|
108 |
<div class="col-lg-2 form-group">
|
|
|
109 |
<select class="form-control input-sm" id = "regionPosition" name="regionPosition" placeholder="region">
|
|
|
110 |
<option value="" disabled selected>Region</option>
|
|
|
111 |
#foreach($region in $regions)
|
|
|
112 |
<option value="$region.getId()">$region.getName()</option>
|
|
|
113 |
#end
|
|
|
114 |
</select>
|
|
|
115 |
</div>
|
| 25570 |
tejbeer |
116 |
|
|
|
117 |
<div class="col-lg-2 form-group" id="partner-subregion-container">
|
|
|
118 |
<select class="form-control input-sm" id = "partner" name="partner" placeholder="Type" multiple="multiple">
|
|
|
119 |
</select>
|
|
|
120 |
</div>
|
| 31762 |
tejbeer |
121 |
|
|
|
122 |
<div class="col-lg-2 form-group">
|
|
|
123 |
<label> Ticket Assignee </label>
|
|
|
124 |
<input type="checkbox" id="ticketAssignee" name="ticketAssignee">
|
|
|
125 |
|
|
|
126 |
</div>
|
| 24417 |
govind |
127 |
<div class="col-lg-2">
|
|
|
128 |
<input class="btn btn-primary create-position-button" type="button" value="Create Position">
|
|
|
129 |
</div>
|
|
|
130 |
</div>
|
|
|
131 |
</form>
|
| 24471 |
govind |
132 |
</section>
|
|
|
133 |
<section class="wrapper">
|
| 28457 |
tejbeer |
134 |
|
|
|
135 |
|
|
|
136 |
|
| 24471 |
govind |
137 |
<div id="position-table">
|
|
|
138 |
<div class="row">
|
| 32819 |
shampa |
139 |
<div class="col-lg-12">
|
|
|
140 |
<div class="col-lg-3">
|
|
|
141 |
<table width="100%" cellpadding="5px">
|
|
|
142 |
<tr>
|
|
|
143 |
<td>
|
|
|
144 |
<div class="input-group">
|
|
|
145 |
<input type="file" class="form-control" value="Upload" id="positionupload">
|
|
|
146 |
<span class="input-group-btn">
|
|
|
147 |
<input class="btn btn-default upload-button positionfileupload" type="button" value="Upload">
|
|
|
148 |
</span>
|
|
|
149 |
</div>
|
|
|
150 |
</td>
|
|
|
151 |
<td>
|
|
|
152 |
<button class="btn btn-default" type="button" onclick="downloadCSVTemplate()">Download Template</button>
|
|
|
153 |
</td>
|
|
|
154 |
</tr>
|
|
|
155 |
</table>
|
| 32813 |
shampa |
156 |
|
| 32819 |
shampa |
157 |
</div>
|
|
|
158 |
</div>
|
|
|
159 |
<div class="col-lg-12">
|
| 28457 |
tejbeer |
160 |
<table class="table table-border table-condensed table-bordered" id="createPosition" style="width:100%">
|
|
|
161 |
<thead>
|
| 24471 |
govind |
162 |
<tr>
|
|
|
163 |
<th>User</th>
|
| 32813 |
shampa |
164 |
<th>Position Id</th>
|
| 24471 |
govind |
165 |
<th>Category</th>
|
|
|
166 |
<th>Region</th>
|
|
|
167 |
<th>Created TimeStamp</th>
|
|
|
168 |
<th>EscalationType</th>
|
| 25570 |
tejbeer |
169 |
<th>Partners</th>
|
| 31762 |
tejbeer |
170 |
<th>Ticket Assignee </th>
|
| 24471 |
govind |
171 |
<th>Action</th>
|
| 25570 |
tejbeer |
172 |
|
| 24471 |
govind |
173 |
</tr>
|
| 32819 |
shampa |
174 |
</thead>
|
|
|
175 |
<tbody>
|
| 24471 |
govind |
176 |
#if(!$positions.isEmpty())
|
|
|
177 |
#foreach($position in $positions)
|
|
|
178 |
<tr>
|
| 28836 |
amit.gupta |
179 |
<td>$authUserIdAndAuthUserMap.get($position.getAuthUserId()).getFullName()</td>
|
| 32813 |
shampa |
180 |
<td>$position.getId()</td>
|
| 24471 |
govind |
181 |
#if($position.getCategoryId()==0)
|
|
|
182 |
<td>All Category</td>
|
|
|
183 |
#else
|
|
|
184 |
<td>$categoryIdAndCategoryMap.get($position.getCategoryId()).getName()</td>
|
|
|
185 |
#end
|
|
|
186 |
#if($position.getRegionId()==0)
|
|
|
187 |
<td>All Region</td>
|
|
|
188 |
#else
|
|
|
189 |
<td>$regionIdAndRegionMap.get($position.getRegionId()).getName()</td>
|
|
|
190 |
#end
|
|
|
191 |
<td>$position.getFormattedCreateTimestamp()</td>
|
|
|
192 |
<td>$position.getEscalationType()</td>
|
| 25570 |
tejbeer |
193 |
<td>
|
| 27410 |
tejbeer |
194 |
<a class="positionPartnerView" data-positionid="$position.getId()" href="#"> view partners</a>
|
|
|
195 |
</td>
|
| 31762 |
tejbeer |
196 |
|
|
|
197 |
<td>
|
|
|
198 |
|
|
|
199 |
<input type="checkbox" id="ticketAssign" data-positionid="$position.getId()" name="ticketAssignee" #if($position.isTicketAssignee()) checked #end>
|
|
|
200 |
|
|
|
201 |
</td>
|
| 24471 |
govind |
202 |
<td><button class="btn btn-primary remove-position" data-positionid="$position.getId()">Remove</button></td>
|
|
|
203 |
</tr>
|
|
|
204 |
#end
|
|
|
205 |
#else
|
|
|
206 |
<tr>
|
|
|
207 |
<td colspan="12" style="text-align:center;">NO MATCHING DATA FOUND FOR CRITERIA</td>
|
|
|
208 |
</tr>
|
|
|
209 |
#end
|
|
|
210 |
</tbody>
|
|
|
211 |
</table>
|
|
|
212 |
</div>
|
|
|
213 |
</div>
|
|
|
214 |
</div>
|
| 28457 |
tejbeer |
215 |
|
| 24471 |
govind |
216 |
</section>
|
|
|
217 |
<div id="position-details-container" style="background:white;background-color:white;">
|
| 28457 |
tejbeer |
218 |
</div>
|
|
|
219 |
|
|
|
220 |
|
|
|
221 |
<script type="text/javascript">
|
|
|
222 |
$(document).ready(function() {
|
|
|
223 |
|
|
|
224 |
|
|
|
225 |
var dtable = $('#createPosition').DataTable({
|
|
|
226 |
"scrollX": true,
|
| 30713 |
tejbeer |
227 |
"scrollY": "518px",
|
| 28457 |
tejbeer |
228 |
"pageLength": 100,
|
|
|
229 |
scrollCollapse: true,
|
|
|
230 |
"fixedHeader": true,
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
});
|
|
|
234 |
|
| 32813 |
shampa |
235 |
});
|
|
|
236 |
|
|
|
237 |
$(document).ready(function() {
|
|
|
238 |
$('input.positionfileupload').on('click', function () {
|
|
|
239 |
var fileSelector = $('#positionupload')[0];
|
|
|
240 |
if (fileSelector != undefined && fileSelector.files[0] != undefined) {
|
|
|
241 |
if (confirm("Confirm Upload?")) {
|
|
|
242 |
var reader = new FileReader();
|
|
|
243 |
|
|
|
244 |
reader.onload = function (e) {
|
|
|
245 |
var csvContent = e.target.result;
|
|
|
246 |
var positions = parseCsv(csvContent);
|
|
|
247 |
|
|
|
248 |
// Now 'positions' is an array of objects containing CSV data
|
|
|
249 |
console.log('positionsssssss',positions);
|
|
|
250 |
|
|
|
251 |
// Assuming you have a function to send the data to the server
|
|
|
252 |
// Modify this function according to your needs
|
|
|
253 |
sendCsvDataToServer(positions);
|
|
|
254 |
};
|
|
|
255 |
|
|
|
256 |
reader.readAsText(fileSelector.files[0]);
|
|
|
257 |
}
|
|
|
258 |
} else {
|
|
|
259 |
alert("Please upload a file!");
|
|
|
260 |
}
|
|
|
261 |
return false;
|
|
|
262 |
});
|
|
|
263 |
});
|
|
|
264 |
|
|
|
265 |
function parseCsv(csvContent) {
|
|
|
266 |
var lines = csvContent.split('\n');
|
|
|
267 |
var positions = [];
|
|
|
268 |
|
|
|
269 |
for (var i = 0; i < lines.length; i++) {
|
|
|
270 |
var columns = lines[i].trim().split(','); // Use ',' as the delimiter for your CSV
|
|
|
271 |
|
|
|
272 |
// Check if the row has the expected number of columns and contains non-empty values
|
|
|
273 |
if (columns.length && columns.some(column => column.trim() !== '')) {
|
|
|
274 |
// Skip the header row
|
|
|
275 |
if (i === 0) continue;
|
|
|
276 |
|
|
|
277 |
var position = {
|
|
|
278 |
storeCode: columns[0] ? columns[0].trim() : '',
|
|
|
279 |
positionIdFrom: columns[1] ? columns[1].trim() : '',
|
|
|
280 |
positionIdTo: columns[2] ? columns[2].trim() : ''
|
|
|
281 |
};
|
|
|
282 |
|
|
|
283 |
positions.push(position);
|
|
|
284 |
}
|
|
|
285 |
}
|
|
|
286 |
|
|
|
287 |
return positions;
|
|
|
288 |
}
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
function sendCsvDataToServer(data) {
|
|
|
292 |
|
|
|
293 |
$.ajax({
|
|
|
294 |
type: "POST",
|
|
|
295 |
url: "${rc.contextPath}/partner-position/update",
|
|
|
296 |
data: JSON.stringify(data),
|
|
|
297 |
contentType: "application/json; charset=utf-8",
|
|
|
298 |
|
|
|
299 |
success: function(response) {
|
| 33761 |
ranu |
300 |
IdempotencyKey = uuidv4();
|
| 32813 |
shampa |
301 |
if (response) {
|
|
|
302 |
alert("Content updated successfully..");
|
|
|
303 |
}
|
|
|
304 |
}
|
|
|
305 |
});
|
|
|
306 |
|
|
|
307 |
|
|
|
308 |
}
|
|
|
309 |
|
| 28457 |
tejbeer |
310 |
|
|
|
311 |
</script>
|
| 32819 |
shampa |
312 |
|
|
|
313 |
|
|
|
314 |
<script>
|
|
|
315 |
function downloadCSVTemplate() {
|
|
|
316 |
// Define the CSV template content
|
|
|
317 |
const csvContent = 'Store code,Position Id From,Position Id To';
|
|
|
318 |
|
|
|
319 |
// Convert the CSV content to a Blob
|
|
|
320 |
const blob = new Blob([csvContent], { type: 'text/csv' });
|
|
|
321 |
|
|
|
322 |
// Create a download link
|
|
|
323 |
const downloadLink = document.createElement('a');
|
|
|
324 |
downloadLink.href = window.URL.createObjectURL(blob);
|
|
|
325 |
downloadLink.download = 'template.csv';
|
|
|
326 |
|
|
|
327 |
// Append the link to the body and trigger the download
|
|
|
328 |
document.body.appendChild(downloadLink);
|
|
|
329 |
downloadLink.click();
|
|
|
330 |
|
|
|
331 |
// Remove the link from the DOM
|
|
|
332 |
document.body.removeChild(downloadLink);
|
|
|
333 |
}
|
|
|
334 |
</script>
|
|
|
335 |
|