Subversion Repositories SmartDukaan

Rev

Details | 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>
96
    $(document).on('click', '.approve-geo', function () {
97
        var leadId = $(this).data('leadid');
98
        if (!confirm('Approve geolocation for Lead #' + leadId + '?')) return;
99
 
100
        doPostAjaxRequestWithParamsHandler(
101
                context + '/lead-geo/review',
102
                {leadId: leadId, status: 'APPROVED', remark: ''},
103
                function (response) {
104
                    alert('Geolocation approved successfully');
105
                    $('#geo-row-' + leadId).fadeOut();
106
                }
107
        );
108
    });
109
 
110
    $(document).on('click', '.reject-geo', function () {
111
        var leadId = $(this).data('leadid');
112
        $('#rejectLeadId').val(leadId);
113
        $('#rejectRemark').val('');
114
        $('#rejectRemarkModal').modal('show');
115
    });
116
 
117
    $(document).on('click', '.confirm-reject-geo', function () {
118
        var leadId = $('#rejectLeadId').val();
119
        var remark = $('#rejectRemark').val();
120
 
121
        doPostAjaxRequestWithParamsHandler(
122
                context + '/lead-geo/review',
123
                {leadId: leadId, status: 'REJECTED', remark: remark},
124
                function (response) {
125
                    alert('Geolocation rejected');
126
                    $('#rejectRemarkModal').modal('hide');
127
                    $('#geo-row-' + leadId).fadeOut();
128
                }
129
        );
130
    });
131
</script>