Subversion Repositories SmartDukaan

Rev

Rev 35626 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
24417 govind 1
<script>
35606 amit 2
    $(document).ready(function () {
3
        // Cleanup for myModal (activity/message modal)
4
        $('#myModal').on('hidden.bs.modal', function (e) {
5
            $(".activity-container .modal-body").empty();
6
        });
35602 amit 7
 
35606 amit 8
        // Cleanup for theModal (edit/assign ticket modal)
9
        $('#theModal').on('hidden.bs.modal', function (e) {
10
            $("#theModal .modal-content").empty();
35602 amit 11
            $('body').removeClass('modal-open');
12
            $('.modal-backdrop').remove();
35606 amit 13
        });
35602 amit 14
 
35606 amit 15
        // Ensure backdrop is removed on any modal close
16
        $(document).on('hidden.bs.modal', '.modal', function () {
17
            if ($('.modal:visible').length === 0) {
18
                $('body').removeClass('modal-open');
19
                $('.modal-backdrop').remove();
20
            }
21
        });
22
 
35592 amit 23
        getPartnerAheadOptions($("#typeaheadpartnernameforassignee"), function (selectedPartner) {
24
            $("#assignee-ticket-search-by-partner-name").data('id', selectedPartner.partnerId);
25
            $("#assignee-partner-name-input").val(selectedPartner.partnerId);
26
        });
31762 tejbeer 27
 
36040 ranu 28
        // Quick filter functionality for table
29
        initTableQuickFilter();
35592 amit 30
    });
36040 ranu 31
 
32
    // Table quick filter function
33
    function initTableQuickFilter() {
34
        var filterInput = jQuery('#table-quick-filter');
35
        var clearBtn = jQuery('#clear-quick-filter');
36
        var resultCount = jQuery('#filter-result-count');
37
 
38
        filterInput.on('keyup', function () {
39
            var searchText = jQuery(this).val().toLowerCase().trim();
40
            filterTable(searchText);
41
 
42
            // Show/hide clear button
43
            if (searchText.length > 0) {
44
                clearBtn.show();
45
            } else {
46
                clearBtn.hide();
47
                resultCount.text('');
48
            }
49
        });
50
 
51
        clearBtn.on('click', function () {
52
            filterInput.val('');
53
            filterTable('');
54
            jQuery(this).hide();
55
            resultCount.text('');
56
        });
57
    }
58
 
59
    function filterTable(searchText) {
60
        var table = jQuery('#ticket-table');
61
        var tbody = table.find('tbody');
62
        var rows = tbody.find('tr');
63
        var resultCount = jQuery('#filter-result-count');
64
        var visibleCount = 0;
65
        var totalCount = rows.length;
66
 
67
        // If no search text, show all rows
68
        if (!searchText) {
69
            rows.show();
70
            resultCount.text('');
71
            return;
72
        }
73
 
74
        // Filter rows based on search text
75
        rows.each(function () {
76
            var row = jQuery(this);
77
            var rowText = row.text().toLowerCase();
78
 
79
            // Check if any cell contains the search text
80
            if (rowText.indexOf(searchText) > -1) {
81
                row.show();
82
                visibleCount++;
83
            } else {
84
                row.hide();
85
            }
86
        });
87
 
88
        // Update result count
89
        if (visibleCount === 0) {
90
            resultCount.html('<span class="text-danger">No matches found</span>');
91
        } else {
92
            resultCount.text('Showing ' + visibleCount + ' of ' + totalCount + ' rows');
93
        }
94
    }
95
 
96
    // Re-apply filter when new content is loaded via AJAX (pagination, etc.)
97
    jQuery(document).on('ajaxComplete', function (event, xhr, settings) {
98
        // Check if this is a ticket-related AJAX call
99
        if (settings.url && settings.url.indexOf('ticket') > -1) {
100
            var searchText = jQuery('#table-quick-filter').val();
101
            if (searchText) {
102
                // Small delay to ensure DOM is updated
103
                setTimeout(function () {
104
                    filterTable(searchText.toLowerCase().trim());
105
                }, 100);
106
            }
107
        }
108
    });
109
 
110
    // Clear filter when status or order dropdowns change (these change the dataset)
111
    jQuery(document).on('change', '#ticketStatus, #orderBy', function () {
112
        clearQuickFilter();
113
    });
114
 
115
    function clearQuickFilter() {
116
        jQuery('#table-quick-filter').val('');
117
        jQuery('#clear-quick-filter').hide();
118
        jQuery('#filter-result-count').text('');
119
    }
24417 govind 120
</script>
35626 amit 121
<style>
122
    .pagination-wrapper {
123
        display: flex;
124
        align-items: center;
125
        justify-content: space-between;
126
        padding: 10px 0;
127
        flex-wrap: wrap;
128
    }
129
    .pagination-wrapper .pagination {
130
        margin: 0;
131
    }
132
    .pagination-wrapper .page-size-select {
133
        width: auto;
134
        display: inline-block;
135
    }
136
    .pagination-info {
137
        color: #666;
138
    }
139
    .search-form {
140
        margin-bottom: 15px;
141
    }
142
    .search-form .form-group {
143
        margin-bottom: 0;
144
    }
145
    tr.ticket-unread {
146
        background-color: #f0f7ff !important;
147
        font-weight: bold;
148
    }
149
    tr.ticket-unread td {
150
        font-weight: bold;
151
    }
152
    .unread-badge {
153
        display: inline-block;
154
        width: 8px;
155
        height: 8px;
156
        background-color: #007bff;
157
        border-radius: 50%;
158
        margin-right: 4px;
159
        vertical-align: middle;
160
    }
161
    .last-activity-preview {
162
        font-size: 11px;
163
        color: #666;
164
        font-weight: normal;
165
        display: block;
166
        white-space: nowrap;
167
        overflow: hidden;
168
        text-overflow: ellipsis;
169
        max-width: 200px;
170
    }
36040 ranu 171
 
172
    /* Quick filter styles */
173
    #table-quick-filter {
174
        border-left: none;
175
    }
176
 
177
    #table-quick-filter:focus {
178
        border-color: #66afe9;
179
        box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
180
    }
181
 
182
    #clear-quick-filter {
183
        border-left: none;
184
    }
185
 
186
    .input-group-addon {
187
        background-color: #fff;
188
        border-right: none;
189
    }
190
 
191
    #filter-result-count {
192
        font-size: 13px;
193
    }
194
 
195
    #ticket-table tbody tr.filter-highlight td {
196
        background-color: #fff3cd !important;
197
    }
35626 amit 198
</style>
35571 amit 199
#parse("activity-modal-styles.vm")
24417 govind 200
<section class="wrapper">
35592 amit 201
    <div class="row">
202
        <div class="col-lg-12">
203
            <h3 class="page-header"><i class="icon_document_alt"></i>TICKET</h3>
204
            <ol class="breadcrumb">
205
                <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
206
                <li><i class="icon_document_alt"></i>My Ticket</li>
207
            </ol>
208
        </div>
209
    </div>
35626 amit 210
 
211
    ## Search Form
212
    <div class="row search-form">
213
        <div class="col-lg-12">
36040 ranu 214
            #*<form id="ticket-search-form" class="form-inline" onsubmit="return false;">
35626 amit 215
                <div class="form-group">
216
                    <input type="text" id="ticket-search-input" class="form-control" style="width: 300px;"
217
                           placeholder="Search ticket ID, partner, category, creator..."
218
                           value="$!searchText">
219
                </div>
220
                <button type="submit" class="btn btn-primary" id="ticket-search-btn">Search</button>
221
                <a href="javascript:void(0)" class="btn btn-default" id="ticket-search-clear"
222
                   style="#if(!$searchText || $searchText == '')display:none;#end">Clear</a>
36040 ranu 223
            </form>*#
224
            <div class="row" style="margin-bottom: 10px;">
225
                <div class="col-lg-4">
226
                    <div class="input-group">
227
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
228
                        <input type="text" id="table-quick-filter" class="form-control"
229
                               placeholder="Filter current page...">
230
                        <span class="input-group-btn">
231
                    <button class="btn btn-default" type="button" id="clear-quick-filter" style="display:none;">
232
                        <i class="fa fa-times"></i>
233
                    </button>
234
                </span>
235
                    </div>
236
                </div>
237
                <div class="col-lg-2">
238
                    <span id="filter-result-count" class="text-muted" style="line-height: 34px;"></span>
239
                </div>
240
            </div>
35626 amit 241
        </div>
242
    </div>
243
 
35592 amit 244
    <div class="row">
245
        <div class="col-lg-2 form-group">
246
            <select class="form-control input-sm" id="ticketStatus" name="ticketStatus" placeholder="Type">
247
                #foreach($ticketStatus in $ticketStatusValues)
248
                    #if($ticketStatus=="RESOLVED")
249
                        #if($roleType)
250
                            #if($selectedticketStatus==$ticketStatus)
251
                                <option value="$ticketStatus" selected>$ticketStatus</option>
252
                            #else
253
                                <option value="$ticketStatus">$ticketStatus</option>
254
                            #end
255
                        #end
256
                    #else
257
                        #if($selectedticketStatus==$ticketStatus)
258
                            <option value="$ticketStatus" selected>$ticketStatus</option>
259
                        #else
260
                            <option value="$ticketStatus">$ticketStatus</option>
261
                        #end
262
                    #end
263
                #end
264
            </select>
265
        </div>
266
        <div class="col-lg-2 form-group">
267
            <select class="form-control input-sm" id="orderBy" name="orderBy" placeholder="Type">
268
                #foreach($orderby in $orderByValues)
269
                    #if($orderby=="UNSORTED")
270
                    #else
271
                        #if($selectedorderby==$orderby)
272
                            #if($orderby=="ASCENDING")
273
                                <option value="$orderby" selected>OLD TO NEW</option>
274
                            #else
275
                                <option value="$orderby" selected>NEW TO OLD</option>
276
                            #end
277
                        #else
278
                            #if($orderby=="ASCENDING")
279
                                <option value="$orderby">OLD TO NEW</option>
280
                            #else
281
                                <option value="$orderby">NEW TO OLD</option>
282
                            #end
283
                        #end
284
                    #end
285
                #end
286
            </select>
287
        </div>
288
        #if($roleType)
289
        <div class="col-lg-6 form-group pull-right">
36040 ranu 290
            ## Quick Filter for Table
291
 
292
            #*<div class="col-lg-6">
35592 amit 293
                <select class="form-control" id="assigneesearchType" name="assigneesearchType"
294
                        placeholder="Search Type">
295
                    <option value="" disabled selected>Search Type</option>
296
                    #foreach($searchType1 in $ticketSearchTypes)
297
                        #if($ticketSearchType.getValue()==$searchType1.getValue())
298
                            <option value="$searchType1" selected>$ticketSearchType.getValue()</option>
299
                        #else
300
                            <option value="$searchType1">$searchType1.getValue()</option>
301
                        #end
302
                    #end
303
                </select>
36040 ranu 304
            </div>*#
35592 amit 305
 
306
 
36040 ranu 307
            #*<div class="col-lg-6">
35592 amit 308
                <input type="hidden" id="assignee-partner-name-input" name="assignee-partner-name-input" value="">
309
                <div class="assigneebyPartnerName" style="display: none;">
310
                    <div class="input-group">
311
                        <input placeholder="Partner Name" type="text" class="typeahead form-control"
312
                               id="typeaheadpartnernameforassignee" value="" name="Item" data-provide="typeahead"
313
                               autocomplete="off">
314
                        <span class="input-group-btn">
315
	      			<button class="btn btn-primary" id="assignee-ticket-search-by-partner-name" type="button"
316
                            data-id="">Go!</button>
24787 govind 317
	    		</span>
35592 amit 318
                    </div>
319
                </div>
320
                <div class="assigneebyTicketId" style="display: none;">
321
                    <div class="input-group">
322
                        <input placeholder="Ticket Id" type="text" class="form-control" id="assignee-search-by-ticketId"
323
                               value="">
324
                        <span class="input-group-btn">
325
	      			<button class="btn btn-primary" id="assignee-retailer-details-search-button-by-ticketId"
326
                            type="button">Go!</button>
24787 govind 327
	    		</span>
35592 amit 328
                    </div>
329
                </div>
36040 ranu 330
            </div>*#
35592 amit 331
        #end
24417 govind 332
    </div>
35592 amit 333
    </div>
31762 tejbeer 334
 
36040 ranu 335
 
35626 amit 336
    <div id="ticket-content-area">
337
    #parse("ticket-content.vm")
35592 amit 338
    </div>
339
 
340
</section>
24417 govind 341
<div id="ticket-details-container" style="background:white;background-color:white;">
342
</div>
35571 amit 343
#set($showFileUpload = true)
344
#parse("activity-modal.vm")
35594 amit 345
 
346
## Edit ticket modal for CRM users to assign tickets
347
#if($isCrmUser)
348
<div class="edit-container">
35602 amit 349
    <div class="modal fade text-center" id="theModal" tabindex="-1" role="dialog" data-backdrop="true" data-keyboard="true">
350
        <div class="modal-dialog" role="document">
35594 amit 351
            <div class="modal-content">
352
            </div>
353
        </div>
354
    </div>
355
</div>
356
#end