Subversion Repositories SmartDukaan

Rev

Rev 35602 | Rev 35606 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<script>
    $('#myModal').on('hidden.bs.modal', function (e) {
        $(".activity-container .modal-body").empty();
    });

    // Cleanup for theModal (edit/assign ticket modal)
    $('#theModal').on('hidden.bs.modal', function (e) {
        $("#theModal .modal-content").empty();
        $('body').removeClass('modal-open');
        $('.modal-backdrop').remove();
    });

    // Ensure backdrop is removed on any modal close
    $(document).on('hidden.bs.modal', '.modal', function () {
        if ($('.modal:visible').length === 0) {
            $('body').removeClass('modal-open');
            $('.modal-backdrop').remove();
        }
    });

    $(function () {
        getPartnerAheadOptions($("#typeaheadpartnernameforassignee"), function (selectedPartner) {
            $("#assignee-ticket-search-by-partner-name").data('id', selectedPartner.partnerId);
            $("#assignee-partner-name-input").val(selectedPartner.partnerId);
        });
    });


    $(document).ready(function () {

        $('#ticket-table thead tr').clone(true).appendTo('#ticket-table thead');
        $('#ticket-table thead tr:eq(1) th').each(function (i) {
            var title = $(this).text();
            $(this).html('<input type="text" style = "width:60%;" placeholder="Search ' + title + '" />');

            $('input', this).on('keyup change', function () {
                if (table.column(i).search() !== this.value) {
                    table
                            .column(i)
                            .search(this.value)
                            .draw();
                }
            });
        })

        var table = $('#ticket-table').DataTable({
            orderCellsTop: true,
            fixedHeader: true
        })

    });
</script>
#parse("activity-modal-styles.vm")
<section class="wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><i class="icon_document_alt"></i>TICKET</h3>
            <ol class="breadcrumb">
                <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
                <li><i class="icon_document_alt"></i>My Ticket</li>
            </ol>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-2 form-group">
            <select class="form-control input-sm" id="ticketStatus" name="ticketStatus" placeholder="Type">
                #foreach($ticketStatus in $ticketStatusValues)
                    #if($ticketStatus=="RESOLVED")
                        #if($roleType)
                            #if($selectedticketStatus==$ticketStatus)
                                <option value="$ticketStatus" selected>$ticketStatus</option>
                            #else
                                <option value="$ticketStatus">$ticketStatus</option>
                            #end
                        #end
                    #else
                        #if($selectedticketStatus==$ticketStatus)
                            <option value="$ticketStatus" selected>$ticketStatus</option>
                        #else
                            <option value="$ticketStatus">$ticketStatus</option>
                        #end
                    #end
                #end
            </select>
        </div>
        <div class="col-lg-2 form-group">
            <select class="form-control input-sm" id="orderBy" name="orderBy" placeholder="Type">
                #foreach($orderby in $orderByValues)
                    #if($orderby=="UNSORTED")
                    #else
                        #if($selectedorderby==$orderby)
                            #if($orderby=="ASCENDING")
                                <option value="$orderby" selected>OLD TO NEW</option>
                            #else
                                <option value="$orderby" selected>NEW TO OLD</option>
                            #end
                        #else
                            #if($orderby=="ASCENDING")
                                <option value="$orderby">OLD TO NEW</option>
                            #else
                                <option value="$orderby">NEW TO OLD</option>
                            #end
                        #end
                    #end
                #end
            </select>
        </div>
        #if($roleType)
        <div class="col-lg-6 form-group pull-right">
            <div class="col-lg-6">
                <select class="form-control" id="assigneesearchType" name="assigneesearchType"
                        placeholder="Search Type">
                    <option value="" disabled selected>Search Type</option>
                    #foreach($searchType1 in $ticketSearchTypes)
                        #if($ticketSearchType.getValue()==$searchType1.getValue())
                            <option value="$searchType1" selected>$ticketSearchType.getValue()</option>
                        #else
                            <option value="$searchType1">$searchType1.getValue()</option>
                        #end
                    #end
                </select>
            </div>


            <div class="col-lg-6">
                <input type="hidden" id="assignee-partner-name-input" name="assignee-partner-name-input" value="">
                <div class="assigneebyPartnerName" style="display: none;">
                    <div class="input-group">
                        <input placeholder="Partner Name" type="text" class="typeahead form-control"
                               id="typeaheadpartnernameforassignee" value="" name="Item" data-provide="typeahead"
                               autocomplete="off">
                        <span class="input-group-btn">
                                <button class="btn btn-primary" id="assignee-ticket-search-by-partner-name" type="button"
                            data-id="">Go!</button>
                        </span>
                    </div>
                </div>
                <div class="assigneebyTicketId" style="display: none;">
                    <div class="input-group">
                        <input placeholder="Ticket Id" type="text" class="form-control" id="assignee-search-by-ticketId"
                               value="">
                        <span class="input-group-btn">
                                <button class="btn btn-primary" id="assignee-retailer-details-search-button-by-ticketId"
                            type="button">Go!</button>
                        </span>
                    </div>
                </div>
            </div>
        #end
    </div>
    </div>
    <div id="my-ticket-table">
        <div class="row">
            <div class="col-lg-12">
                <table class="table table-border table-condensed table-bordered" id="ticket-table">
                    <thead>
                    <tr>
                        <th>Ticket Id</th>
                        #if($roleType)
                            <th>Partner</th>
                        #end
                        <th>Category</th>
                        <th>SubCategory</th>
                        <th>Message</th>
                        <th>Created By</th>
                        <th>Created TimeStamp</th>
                        #if($isCrmUser)
                            <th>Assign</th>
                        #end
                        #if($roleType)
                            <th>Action</th>
                        #else
                            <th>Action</th>
                        #end
                    </tr>
                    </thead>
                    <tbody>
                        #if($tickets.size()>0)
                            #foreach($ticket in $tickets)
                            <tr>
                                <td>$ticket.getId()</td>
                                #if($roleType)
                                    <td><a href="#" class="partner-link" data-fofoid="$ticket.getFofoId()">$fofoIdsAndCustomRetailer.get($ticket.getFofoId()).getBusinessName()</a></td>
                                #end
                                <td>$subCategoryIdAndCategoryMap.get($ticket.getSubCategoryId()).getName()</td>

                                <td><a href="#" data-toggle="modal" data-target="#myModal"
                                       data-ticketid="$ticket.getId()" data-internal="true" data-role="$roleType"
                                       data-crm="$isCrmUser" class="activities-link"
                                       data-assignee="#if($authUserIdAndAuthUserMap.get($ticket.getId()))$authUserIdAndAuthUserMap.get($ticket.getId()).getFirstName()#end">$subCategoryIdAndSubCategoryMap.get($ticket.getSubCategoryId()).getName()</a>
                                </td>
                                <td>#if($activityMap.get($ticket.getId()) && $activityMap.get($ticket.getId()).size() > 0)$activityMap.get($ticket.getId()).get(0).getMessage()#else
                                    -#end</td>
                                #if($activityMapWithActivityId.get($ticket.getFirstActivityId()).get(0).getCreatedBy() > 0)
                                    <td>$authUserMap.get($activityMapWithActivityId.get($ticket.getFirstActivityId()).get(0).getCreatedBy()).getFirstName() $authUserMap.get($activityMapWithActivityId.get($ticket.getFirstActivityId()).get(0).getCreatedBy()).getLastName()</td>
                                #else
                                    <td>Partner</td>
                                #end

                                <td>$ticket.getFormattedCreateTimestamp()</td>
                                #if($isCrmUser)
                                    #if($ticket.getCloseTimestamp())
                                        <td><button class="btn btn-primary edit-ticket" data-ticketid1="$ticket.getId()" disabled>Edit</button></td>
                                    #else
                                        <td><button class="btn btn-primary edit-ticket" data-ticketid1="$ticket.getId()">Edit</button></td>
                                    #end
                                #end
                                #if($roleType)
                                    #if($ticket.getCloseTimestamp())
                                        <td>$ticket.getFormattedCloseTimestamp()</td>
                                    #else
                                        #if($ticket.getLastActivity()=="RESOLVED")
                                            <td>Resolved</td>
                                        #else
                                            ## CRM users can resolve any ticket
                                            ## Sales users can resolve their own Sales category tickets
                                            ## RBM users can resolve their own RBM category tickets
                                            #set($ticketCategoryId = $subCategoryIdAndCategoryMap.get($ticket.getSubCategoryId()).getId())
                                            #set($canResolve = $isCrmUser || ($isSalesUser && $ticketCategoryId == $salesCategoryId) || ($isRbmUser && $ticketCategoryId == $rbmCategoryId))
                                            #if($canResolve)
                                                <td>
                                                    <button class="btn btn-primary ticket-last-activity"
                                                            data-ticketid="$ticket.getId()" data-activity="$resolved"
                                                            data-partnername="$fofoIdsAndCustomRetailer.get($ticket.getFofoId()).getBusinessName()">
                                                        Resolved
                                                    </button>
                                                </td>
                                            #else
                                                <td><span class="label label-warning">Pending Resolution</span></td>
                                            #end
                                        #end
                                    #end
                                #else
                                    #if($ticket.getCloseTimestamp())
                                        <td>Closed</td>
                                    #else
                                        #if($ticket.getLastActivity()=="RESOLVED")
                                            <td>
                                                <button class="btn btn-primary ticket-last-activity"
                                                        data-ticketid="$ticket.getId()"
                                                        data-activity="$resolved-accepted">Accept
                                                </button>
                                                <button class="btn btn-danger ticket-last-activity"
                                                        data-ticketid="$ticket.getId()"
                                                        data-activity="$resolved-rejected">Reopen
                                                </button>
                                            </td>
                                        #else
                                            <td><span class="label label-info">In Progress</span></td>
                                        #end
                                    #end
                                #end
                            </tr>
                            #end
                        #else
                        <tr>
                            <td colspan="12" style="text-align:center;">NO MATCHING DATA FOUND FOR CRITERIA</td>
                        </tr>
                        #end
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</section>
<div id="ticket-details-container" style="background:white;background-color:white;">
</div>
#set($showFileUpload = true)
#parse("activity-modal.vm")

## Edit ticket modal for CRM users to assign tickets
#if($isCrmUser)
<div class="edit-container">
    <div class="modal fade text-center" id="theModal" tabindex="-1" role="dialog" data-backdrop="true" data-keyboard="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
            </div>
        </div>
    </div>
</div>
#end