| 37110 |
aman |
1 |
<style>
|
|
|
2 |
#agreementEsignTable td {
|
|
|
3 |
vertical-align: middle !important;
|
|
|
4 |
}
|
|
|
5 |
|
|
|
6 |
#agreementEsignTable .action-btns {
|
|
|
7 |
display: inline-flex;
|
|
|
8 |
gap: 4px;
|
|
|
9 |
flex-wrap: nowrap;
|
|
|
10 |
align-items: center;
|
|
|
11 |
}
|
|
|
12 |
</style>
|
|
|
13 |
<section class="wrapper">
|
|
|
14 |
<div class="row">
|
|
|
15 |
<div class="col-lg-12">
|
|
|
16 |
<h3 class="page-header"><i class="icon_document_alt"></i>BUSINESS AGREEMENT E-SIGN</h3>
|
|
|
17 |
<ol class="breadcrumb">
|
|
|
18 |
<li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
|
|
|
19 |
<li><i class="icon_document_alt"></i>Business Agreement E-Sign</li>
|
|
|
20 |
</ol>
|
|
|
21 |
</div>
|
|
|
22 |
</div>
|
|
|
23 |
|
|
|
24 |
<div class="col-lg-12">
|
|
|
25 |
<table class="table table-border table-condensed table-bordered" id="agreementEsignTable" style="width:100%">
|
|
|
26 |
<thead class="row htable" style="background:#F5F5F5;">
|
|
|
27 |
<tr style="color:black;">
|
|
|
28 |
<th>ID</th>
|
|
|
29 |
<th>Partner Name</th>
|
|
|
30 |
<th>Code</th>
|
|
|
31 |
<th>City</th>
|
|
|
32 |
<th>RBM</th>
|
|
|
33 |
<th style="text-align:center;">Agreement Doc</th>
|
|
|
34 |
<th style="text-align:center;">E-Sign Status</th>
|
|
|
35 |
<th style="text-align:center;">Action</th>
|
|
|
36 |
</tr>
|
|
|
37 |
</thead>
|
|
|
38 |
<tbody>
|
|
|
39 |
#foreach($st in $eligibleTimelines)
|
|
|
40 |
#set($obId = $st.getOnboardingId())
|
|
|
41 |
#set($panel = $panelMap.get($obId))
|
|
|
42 |
#if($panel)
|
|
|
43 |
#set($verified = $esignDoneIds.contains($obId))
|
|
|
44 |
#set($esign = $esignMap.get($obId))
|
|
|
45 |
#set($hasDoc = false)
|
|
|
46 |
#if($esign && $esign.getAttachment() > 0)#set($hasDoc = true)#end
|
|
|
47 |
<tr>
|
|
|
48 |
<td>$obId</td>
|
|
|
49 |
<td>$!panel.getOutLetName()</td>
|
|
|
50 |
<td>$!panel.getCode()</td>
|
|
|
51 |
<td>$!panel.getCity()</td>
|
|
|
52 |
<td>
|
|
|
53 |
#if($panel.getAuthId() != 0 && $authUseMap.get($panel.getAuthId()))
|
|
|
54 |
$authUseMap.get($panel.getAuthId()).getName()
|
|
|
55 |
#end
|
|
|
56 |
</td>
|
|
|
57 |
<td style="text-align:center;">
|
|
|
58 |
#if($hasDoc)
|
|
|
59 |
<button type="button" class="btn btn-info btn-xs esign-view-doc-btn"
|
|
|
60 |
data-doc-url="${context}/document/$esign.getAttachment()">
|
|
|
61 |
<i class="fa fa-eye"></i> View
|
|
|
62 |
</button>
|
|
|
63 |
#else
|
|
|
64 |
<span class="text-muted" style="font-size:11px;">Not uploaded</span>
|
|
|
65 |
#end
|
|
|
66 |
</td>
|
|
|
67 |
<td style="text-align:center;">
|
|
|
68 |
#if($verified)
|
|
|
69 |
<span class="label label-success" style="font-size:11px;">Verified</span>
|
|
|
70 |
#elseif($hasDoc)
|
|
|
71 |
<span class="label label-info" style="font-size:11px;">Uploaded</span>
|
|
|
72 |
#else
|
|
|
73 |
<span class="label label-warning" style="font-size:11px;">Pending</span>
|
|
|
74 |
#end
|
|
|
75 |
</td>
|
|
|
76 |
<td style="text-align:center;">
|
|
|
77 |
<div class="action-btns">
|
|
|
78 |
#if(!$verified)
|
|
|
79 |
<button type="button" class="btn btn-primary btn-sm esign-upload-btn"
|
|
|
80 |
data-id="$obId" data-partner-name="$!panel.getOutLetName()">
|
|
|
81 |
<i class="fa fa-upload"></i> Upload
|
|
|
82 |
</button>
|
|
|
83 |
#if($isEsignApprover)
|
|
|
84 |
<button type="button" class="btn btn-success btn-sm esign-verify-btn"
|
|
|
85 |
data-onboarding-id="$obId" data-partner-name="$!panel.getOutLetName()">
|
|
|
86 |
<i class="fa fa-check"></i> Verify E-Sign
|
|
|
87 |
</button>
|
|
|
88 |
#end
|
|
|
89 |
#else
|
|
|
90 |
<span class="text-muted" style="font-size:11px;">—</span>
|
|
|
91 |
#end
|
|
|
92 |
</div>
|
|
|
93 |
</td>
|
|
|
94 |
</tr>
|
|
|
95 |
#end
|
|
|
96 |
#end
|
|
|
97 |
</tbody>
|
|
|
98 |
</table>
|
|
|
99 |
</div>
|
|
|
100 |
|
|
|
101 |
<!-- Upload Signed Agreement Modal -->
|
|
|
102 |
<div class="modal fade" id="agreementEsignModal" role="dialog">
|
|
|
103 |
<div class="modal-dialog">
|
|
|
104 |
<div class="modal-content">
|
|
|
105 |
<div class="modal-header">
|
|
|
106 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
107 |
<h4 class="modal-title">Upload Signed Agreement - <span id="esign-modal-partner-name"></span></h4>
|
|
|
108 |
</div>
|
|
|
109 |
<div class="modal-body">
|
|
|
110 |
<input type="hidden" id="esign-onboarding-id">
|
|
|
111 |
<input type="hidden" id="esign-attachment-id">
|
|
|
112 |
<div class="form-group">
|
|
|
113 |
<label>Signed Agreement (PDF / image):</label>
|
|
|
114 |
<input type="file" class="form-control" id="esign-attachment-file" required>
|
|
|
115 |
<p class="help-block" style="font-size:11px;">Upload the partner's signed business agreement, then Gaurav Sharma verifies it.</p>
|
|
|
116 |
</div>
|
|
|
117 |
</div>
|
|
|
118 |
<div class="modal-footer">
|
|
|
119 |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
|
|
120 |
<button type="button" class="btn btn-primary" id="esign-upload-submit-btn">
|
|
|
121 |
<i class="fa fa-paper-plane"></i> Save
|
|
|
122 |
</button>
|
|
|
123 |
</div>
|
|
|
124 |
</div>
|
|
|
125 |
</div>
|
|
|
126 |
</div>
|
|
|
127 |
|
|
|
128 |
<!-- Document View Modal -->
|
|
|
129 |
<div class="modal fade" id="esignDocViewModal" role="dialog">
|
|
|
130 |
<div class="modal-dialog modal-lg">
|
|
|
131 |
<div class="modal-content">
|
|
|
132 |
<div class="modal-header">
|
|
|
133 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
134 |
<h4 class="modal-title">Signed Agreement</h4>
|
|
|
135 |
</div>
|
|
|
136 |
<div class="modal-body" style="text-align:center;">
|
|
|
137 |
<img id="esign-doc-preview" src="" style="max-width:100%; max-height:500px;">
|
|
|
138 |
</div>
|
|
|
139 |
<div class="modal-footer">
|
|
|
140 |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
|
|
141 |
</div>
|
|
|
142 |
</div>
|
|
|
143 |
</div>
|
|
|
144 |
</div>
|
|
|
145 |
</section>
|
|
|
146 |
|
|
|
147 |
<script type="text/javascript">
|
|
|
148 |
$(document).ready(function () {
|
|
|
149 |
if ($.fn.DataTable.isDataTable('#agreementEsignTable')) {
|
|
|
150 |
$('#agreementEsignTable').DataTable().destroy();
|
|
|
151 |
}
|
|
|
152 |
$('#agreementEsignTable').DataTable({
|
|
|
153 |
"scrollX": true,
|
|
|
154 |
"order": [[0, "desc"]],
|
|
|
155 |
"pageLength": 25
|
|
|
156 |
});
|
|
|
157 |
});
|
|
|
158 |
|
|
|
159 |
// Unbind previous handlers to prevent duplicates on AJAX reload
|
|
|
160 |
$(document).off('click', '.esign-verify-btn');
|
|
|
161 |
$(document).off('click', '.esign-upload-btn');
|
|
|
162 |
$(document).off('click', '.esign-view-doc-btn');
|
|
|
163 |
$(document).off('input', '#esign-attachment-file');
|
|
|
164 |
$(document).off('click', '#esign-upload-submit-btn');
|
|
|
165 |
|
|
|
166 |
// View uploaded document
|
|
|
167 |
$(document).on('click', '.esign-view-doc-btn', function () {
|
|
|
168 |
$('#esign-doc-preview').attr('src', $(this).data('doc-url'));
|
|
|
169 |
$('#esignDocViewModal').modal('show');
|
|
|
170 |
});
|
|
|
171 |
|
|
|
172 |
// Open upload modal
|
|
|
173 |
$(document).on('click', '.esign-upload-btn', function () {
|
|
|
174 |
var onboardingId = $(this).data('id');
|
|
|
175 |
var partnerName = $(this).data('partner-name');
|
|
|
176 |
$('#esign-onboarding-id').val(onboardingId);
|
|
|
177 |
$('#esign-modal-partner-name').text(partnerName);
|
|
|
178 |
$('#esign-attachment-id').val('');
|
|
|
179 |
$('#esign-attachment-file').val('');
|
|
|
180 |
$('#agreementEsignModal').modal('show');
|
|
|
181 |
});
|
|
|
182 |
|
|
|
183 |
// File upload -> get document id
|
|
|
184 |
$(document).on('input', '#esign-attachment-file', function () {
|
|
|
185 |
if (confirm('Confirm file upload ?')) {
|
|
|
186 |
var file = this.files[0];
|
|
|
187 |
uploadDocument(file, function (documentId) {
|
|
|
188 |
$('#esign-attachment-id').val(documentId);
|
|
|
189 |
});
|
|
|
190 |
}
|
|
|
191 |
});
|
|
|
192 |
|
|
|
193 |
// Save uploaded agreement
|
|
|
194 |
$(document).on('click', '#esign-upload-submit-btn', function () {
|
|
|
195 |
var onboardingId = $('#esign-onboarding-id').val();
|
|
|
196 |
var attachment = $('#esign-attachment-id').val();
|
|
|
197 |
if (!attachment || attachment.trim() === '') {
|
|
|
198 |
alert('Please upload the signed agreement file first.');
|
|
|
199 |
return;
|
|
|
200 |
}
|
|
|
201 |
doPostAjaxRequestWithJsonHandler(
|
|
|
202 |
context + "/agreementEsignUpload?onboardingId=" + onboardingId + "&attachment=" + attachment,
|
|
|
203 |
"{}",
|
|
|
204 |
function (response) {
|
|
|
205 |
alert('Signed agreement uploaded.');
|
|
|
206 |
$('#agreementEsignModal').modal('hide');
|
|
|
207 |
$('.modal-backdrop').remove();
|
|
|
208 |
$('body').removeClass('modal-open');
|
|
|
209 |
doGetAjaxRequestHandler(context + "/agreementEsignPanel", function (response) {
|
|
|
210 |
$('#main-content').html(response);
|
|
|
211 |
});
|
|
|
212 |
}
|
|
|
213 |
);
|
|
|
214 |
});
|
|
|
215 |
|
|
|
216 |
// Verify agreement e-sign (Gaurav marks AGREEMENT_ESIGN done -> unblocks PO)
|
|
|
217 |
$(document).on('click', '.esign-verify-btn', function () {
|
|
|
218 |
var onboardingId = $(this).data('onboarding-id');
|
|
|
219 |
var partnerName = $(this).data('partner-name');
|
|
|
220 |
if (confirm("Confirm the business agreement e-sign for " + partnerName + " ?\n\nThis marks the store timeline entry and unblocks PO creation.")) {
|
|
|
221 |
doPutAjaxRequestHandler(
|
|
|
222 |
context + "/agreementEsignVerify?onboardingId=" + onboardingId,
|
|
|
223 |
function (response) {
|
|
|
224 |
alert("Agreement e-sign verified for " + partnerName);
|
|
|
225 |
$('.modal-backdrop').remove();
|
|
|
226 |
$('body').removeClass('modal-open');
|
|
|
227 |
doGetAjaxRequestHandler(context + "/agreementEsignPanel", function (response) {
|
|
|
228 |
$('#main-content').html(response);
|
|
|
229 |
});
|
|
|
230 |
}
|
|
|
231 |
);
|
|
|
232 |
}
|
|
|
233 |
});
|
|
|
234 |
</script>
|