Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
36642 ranu 1
<div class="container-fluid">
2
    <div class="row">
3
        <div class="col-lg-12">
4
            <h4 class="page-header">Pending Geolocation Reviews</h4>
5
        </div>
6
    </div>
7
 
8
    #if($pendingLocations.isEmpty())
9
        <div class="alert alert-info">No pending geolocation submissions to review.</div>
10
    #else
11
        <div class="table-responsive">
12
            <table class="table table-bordered table-striped table-hover" id="geoReviewTable">
13
                <thead>
14
                <tr>
15
                    <th>Lead ID</th>
16
                    <th>Partner Name</th>
17
                    <th>Mobile</th>
18
                    <th>City</th>
19
                    <th>Latitude</th>
20
                    <th>Longitude</th>
21
                    <th>Photo</th>
22
                    <th>Submissions</th>
23
                    <th>Submitted On</th>
24
                    <th>Action</th>
25
                </tr>
26
                </thead>
27
                <tbody>
28
                    #foreach($loc in $pendingLocations)
29
                        #set($lead = $leadMap.get($loc.getLeadId()))
30
                    <tr id="geo-row-$loc.getLeadId()">
31
                        <td>$loc.getLeadId()</td>
32
                        <td>
33
                            #if($lead)
34
                                $!lead.getFirstName() $!lead.getLastName()
35
                            #else
36
                                -
37
                            #end
38
                        </td>
39
                        <td>$!loc.getMobileNumber()</td>
40
                        <td>
41
                            #if($lead) $!lead.getCity() #end
42
                        </td>
43
                        <td>$loc.getLatitude()</td>
44
                        <td>$loc.getLongitude()</td>
45
                        <td>
46
                            #if($loc.getImageDocumentId() > 0)
47
                                <a href="${rc.contextPath}/open-attachment?documentId=$loc.getImageDocumentId()"
48
                                   target="_blank" class="btn btn-xs btn-default">
49
                                    View Photo
50
                                </a>
51
                            #else
52
                                -
53
                            #end
54
                        </td>
55
                        <td>$loc.getSubmissionCount()</td>
56
                        <td>$loc.getCreatedTimestamp()</td>
57
                        <td>
58
                            <div class="btn-group">
59
                                <button class="btn btn-xs btn-success approve-geo" data-leadid="$loc.getLeadId()">
60
                                    Approve
61
                                </button>
62
                                <button class="btn btn-xs btn-danger reject-geo" data-leadid="$loc.getLeadId()">
63
                                    Reject
64
                                </button>
65
                            </div>
66
                        </td>
67
                    </tr>
68
                    #end
69
                </tbody>
70
            </table>
71
        </div>
72
    #end
73
</div>
74
 
75
<!-- Reject Remark Modal -->
76
<div class="modal fade" id="rejectRemarkModal" tabindex="-1">
77
    <div class="modal-dialog modal-sm">
78
        <div class="modal-content">
79
            <div class="modal-header">
80
                <h5 class="modal-title">Rejection Reason</h5>
81
                <button type="button" class="close" data-dismiss="modal">&times;</button>
82
            </div>
83
            <div class="modal-body">
84
                <input type="hidden" id="rejectLeadId">
85
                <textarea class="form-control" id="rejectRemark" rows="3"
86
                          placeholder="Enter reason for rejection"></textarea>
87
            </div>
88
            <div class="modal-footer">
89
                <button class="btn btn-danger confirm-reject-geo">Reject</button>
90
            </div>
91
        </div>
92
    </div>
93
</div>
94
 
95
<script>
37498 amit 96
    // Fragment is re-injected with .html(), which re-runs this script; clear the
97
    // namespace first so handlers replace rather than stack.
98
    $(document).off('.leadgeoreview');
99
    $(document).on('click.leadgeoreview', '.approve-geo', function () {
36642 ranu 100
        var leadId = $(this).data('leadid');
101
        if (!confirm('Approve geolocation for Lead #' + leadId + '?')) return;
102
 
103
        doPostAjaxRequestWithParamsHandler(
104
                context + '/lead-geo/review',
105
                {leadId: leadId, status: 'APPROVED', remark: ''},
106
                function (response) {
107
                    alert('Geolocation approved successfully');
108
                    $('#geo-row-' + leadId).fadeOut();
109
                }
110
        );
111
    });
112
 
37498 amit 113
    $(document).on('click.leadgeoreview', '.reject-geo', function () {
36642 ranu 114
        var leadId = $(this).data('leadid');
115
        $('#rejectLeadId').val(leadId);
116
        $('#rejectRemark').val('');
117
        $('#rejectRemarkModal').modal('show');
118
    });
119
 
37498 amit 120
    $(document).on('click.leadgeoreview', '.confirm-reject-geo', function () {
36642 ranu 121
        var leadId = $('#rejectLeadId').val();
122
        var remark = $('#rejectRemark').val();
123
 
124
        doPostAjaxRequestWithParamsHandler(
125
                context + '/lead-geo/review',
126
                {leadId: leadId, status: 'REJECTED', remark: remark},
127
                function (response) {
128
                    alert('Geolocation rejected');
129
                    $('#rejectRemarkModal').modal('hide');
130
                    $('#geo-row-' + leadId).fadeOut();
131
                }
132
        );
133
    });
134
</script>