You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

708 lines
27 KiB

3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <script th:inline="javascript">
  2. var nodata = `<center><img src="../../assets/images/nodata_ani.gif" width="40%"><br><p class="text-warning">Data are not availble at this moment please check later</p></center>`;
  3. var complaintTypesList = /*[[${complaintTypesList}]]*/ [];
  4. var complaintTypes =[];
  5. var complaintHTML='';
  6. console.log(complaintTypesList.length);
  7. for (var i = 0; i < complaintTypesList.length; i++) {
  8. complaintTypes[complaintTypesList[i].complaintTypeId] = complaintTypesList[i].complaintType;
  9. }
  10. /* Event Id Search */
  11. function callReSetEventId(eventid){
  12. $.ajax({
  13. type: "GET",
  14. url: '/api/mtm/setEventId',
  15. data: {
  16. 'eventid': eventid
  17. },
  18. }).done(function(response) {
  19. location.reload();
  20. }).fail(function(jqXHR, textStatus, errorThrown) {
  21. /*
  22. // Log the error and any relevant information
  23. console.error("Error sending request: " + textStatus + " " + errorThrown);
  24. */
  25. });
  26. return false;
  27. }
  28. function callSetEventId(){
  29. var eventid = $("#search_eid").val();
  30. $.ajax({
  31. type: "GET",
  32. url: '/api/mtm/setEventId',
  33. data: {
  34. 'eventid': eventid
  35. },
  36. }).done(function(response) {
  37. location.reload();
  38. }).fail(function(jqXHR, textStatus, errorThrown) {
  39. /*
  40. // Log the error and any relevant information
  41. console.error("Error sending request: " + textStatus + " " + errorThrown);
  42. */
  43. });
  44. return false;
  45. }
  46. /* Event Id Search */
  47. function callSetEventById(eventid,link){
  48. $.ajax({
  49. type: "GET",
  50. url: '/api/mtm/setEventId',
  51. data: {
  52. 'eventid': eventid
  53. },
  54. }).done(function(response) {
  55. window.location.href = link;
  56. }).fail(function(jqXHR, textStatus, errorThrown) {
  57. /*
  58. // Log the error and any relevant information
  59. console.error("Error sending request: " + textStatus + " " + errorThrown);
  60. */
  61. });
  62. return false;
  63. }
  64. /* ///////////////// */
  65. /* // for Petition // */
  66. function callViewFiles( id , pet_num){
  67. $('#modaltitle').html(`Petition (${pet_num}) Files`);
  68. $.ajax({
  69. type: "GET",
  70. dataType: 'json',
  71. url: "/api/mtm/petitionFilesBypetitionId?pid="+id,
  72. success: function(data){
  73. petitionFiles = data;
  74. var fileLength = petitionFiles.length;
  75. var fileHTML='';
  76. if(fileLength>0){
  77. for (var i = 0; i < fileLength; i++) {
  78. var petitionFile = petitionFiles[i];
  79. var fileId = petitionFile.mtmPetitionFileId;
  80. var fileName = petitionFile.fileName;
  81. var fileSize = null;
  82. var fileType = null;
  83. // Get the file size and type from the data object
  84. if (petitionFile.data && petitionFile.data.wrappedBlob) {
  85. var binaryStream = petitionFile.data.wrappedBlob.binaryStream;
  86. if (binaryStream) {
  87. // Get the file size
  88. fileSize = Object.keys(binaryStream).length;
  89. // Get the file type
  90. fileType = fileName.split(".").pop();
  91. }
  92. }
  93. var filetypeico = "file-lines";
  94. if(fileType=='pdf'){
  95. filetypeico = "file-pdf";
  96. }
  97. else{
  98. filetypeico = "file-image";
  99. }
  100. sno=i+1;
  101. /*
  102. fileHTML+=`
  103. <li>
  104. <a class="d-flex py-2" href="/blob/${fileId}/download">
  105. <div class="flex-shrink-0 me-3 ms-2 overlay-container overlay-left">
  106. <i class="far fa-3x fa-${filetypeico}"></i>
  107. </div>
  108. <div class="flex-grow-1">
  109. <div class="fw-semibold">FileName: ${fileName}</div>
  110. <div class="fs-sm text-muted">FileType: ${fileType}</div>
  111. </div>
  112. </a>
  113. </li>
  114. `;
  115. */
  116. fileHTML+=`
  117. <tr>
  118. <td>${sno}</td>
  119. <td>${fileName}</td>
  120. <td>${fileType}</td>
  121. <td class="text-center" style="width: 100px;">
  122. <a href="/blob/${fileId}/download" data-toggle="tooltip" data-animation="true" data-placement="top" class="js-tooltip-enabled" aria-label="Downlaod" data-original-title="Download"><i class="fa fa-fw fa-download" style="font-size: 18px;"></i></a>
  123. <a href="#" onclick="return call_blobData(${fileId},'petition');" data-toggle="tooltip" data-animation="true" data-placement="top" class="js-tooltip-enabled" aria-label="View Files" data-original-title="View"><i class="far fa-3x fa-${filetypeico}" style="font-size: 18px;"></i></a>
  124. </td>
  125. </tr>
  126. `;
  127. }
  128. //$('#filehtml').html('<ul class="nav-items push">'+fileHTML+'</ul>');
  129. fileHTML = `<table class="table table-bordered table-vcenter">
  130. <thead>
  131. <tr>
  132. <th>S.no</th>
  133. <th>File Name</th>
  134. <th>File Type</th>
  135. <th>Action</th>
  136. </tr>
  137. </thead>
  138. <tbody>
  139. ${fileHTML}
  140. </tbody>
  141. </table>`;
  142. $('#filehtml').html(fileHTML);
  143. }
  144. else{
  145. $('#filehtml').html('<center>NO Data</center>');
  146. }
  147. $('#viewFile').modal({
  148. backdrop: 'static',
  149. keyboard: false
  150. })
  151. $('#viewFile').modal('show');
  152. }
  153. });
  154. return false;
  155. }
  156. function call_view_complaint(mapid){
  157. $.ajax({
  158. type: "GET",
  159. url: '/api/mtm/getComMappingDetailsByMapId',
  160. data: {
  161. 'mapid': mapid,
  162. },
  163. dataType: 'json',
  164. }).done(function(response) {
  165. //alert(response.length);
  166. // Handle the response here
  167. if(response.length<=0){
  168. //console.error("Error:"+response);
  169. $("#error").html("<p class='text-danger m-0 p-0'>Invalid Acknowledgement Number!</p>");
  170. }
  171. else{
  172. var complaintBodyHTML='';
  173. var com_txt = response[0].mtmComplaintTypes.complaintType;
  174. var com_status=response[0].status;
  175. var com_status_txt = `<span class="badge bg-info">UNDER PROGRESS</span> <i class="fa fa-arrow-right"></i> ${response[0].officer_name}`;
  176. if(com_status=='close'){
  177. var com_status_txt = `<span class="badge bg-success">Completed</span> <i class="fa fa-arrow-right"></i> ${response[0].officer_name}`;
  178. }
  179. complaintBodyHTML+=`<tr>
  180. <td class="fw-semibold">
  181. ${com_txt} <i class="fa fa-arrow-right"></i> ${com_status_txt}
  182. </td>
  183. </tr>`;
  184. var complaintHTML=`
  185. <table class="table table-bordered table-vcenter">
  186. <thead>
  187. <tr>
  188. <th>Complaint <i class="fa fa-arrow-right"></i> Status</th>
  189. </tr>
  190. </thead>
  191. <tbody>
  192. ${complaintBodyHTML}
  193. </tbody>
  194. </table>
  195. `;
  196. var date_txt = convertdate(response[0].mtmEventsPetitionId.cDate);
  197. var statusHTML = `<table class="table table-borderless table-vcenter p-0 m-0" style="font-size:12px;">
  198. <tbody>
  199. <tr>
  200. <th style="padding: 0.45rem 0.45rem;">நாள் / Date : </th>
  201. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  202. ${date_txt}
  203. </td>
  204. </tr>
  205. <tr>
  206. <th style="padding: 0.45rem 0.45rem;">Table No / User No: </th>
  207. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  208. ${response[0].mtmEventsPetitionId.tableNo}
  209. </td>
  210. </tr>
  211. <tr>
  212. <th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
  213. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  214. ${response[0].mtmEventsPetitionId.petitionNumber}
  215. </td>
  216. </tr>
  217. <tr>
  218. <th style="padding: 0.45rem 0.45rem;">பெயர் / Name :</th>
  219. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  220. ${response[0].mtmEventsPetitionId.petitionerName}
  221. </td>
  222. </tr>
  223. <tr>
  224. <th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / No.</th>
  225. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  226. ${response[0].mtmEventsPetitionId.petitionerMobile}
  227. </td>
  228. </tr>
  229. <tr style="font-size:12px;">
  230. <td colspan="2" style="padding: 0.45rem 0.45rem;"><b>புகாரின் தன்மை / Nature of complaint:</b><br>
  231. ${response[0].mtmEventsPetitionId.petitionerNatureOfComplaint}
  232. </td>
  233. <tr style="font-size:12px;">
  234. <td colspan="2" style="padding: 0.45rem 0.45rem;">
  235. ${complaintHTML}
  236. </td>
  237. </tr>
  238. <tr style="text-align: right;">
  239. <th scope="row" colspan="2" style="padding: 0.45rem 0.45rem;">வட்டார அலுவலகம்<br>Office of the Regional Deputy Commissioner</th>
  240. </tr>
  241. </tbody>
  242. </table>`;
  243. $('#petitionStatusDetails').html(statusHTML);
  244. $("#error").html("");
  245. $('#complaintStatus').modal({
  246. backdrop: 'static',
  247. keyboard: false
  248. });
  249. $('#complaintStatus').modal('show');
  250. return false;
  251. }
  252. }).fail(function(jqXHR, textStatus, errorThrown) {
  253. /*
  254. // Log the error and any relevant information
  255. console.error("Error sending request: " + textStatus + " " + errorThrown);
  256. console.error("URL: /api/ogin");
  257. console.error("Query parameters:", {
  258. 'ptax': ptax,
  259. 'uname': uname,
  260. 'upass': upass
  261. });
  262. */
  263. });
  264. return false;
  265. }
  266. function call_view_petition(petitionNo){
  267. var petition_no = petitionNo;
  268. $.ajax({
  269. type: "GET",
  270. url: '/api/mtm/getPetitionStatusPublic',
  271. data: {
  272. 'petition_no': petition_no,
  273. },
  274. dataType: 'json',
  275. }).done(function(response) {
  276. // Handle the response here
  277. if(response.length<=0){
  278. $("#error").html("<p class='text-danger m-0 p-0'>Invalid Acknowledgement Number!</p>");
  279. }
  280. else{
  281. var complaint = response[0].petitionerComplaint;
  282. var complaintArray = complaint.split(',');
  283. var complaintBodyHTML=``;
  284. $.ajax({
  285. type: "GET",
  286. url: '/api/mtm/getComMappingDetailsByPetId',
  287. data: {
  288. 'petid': response[0].petitionId
  289. },
  290. dataType: 'json',
  291. }).done(function(response2) {
  292. complaintBodyHTML=``;
  293. var mapid=0;
  294. for(j = 0; j < response2.length; j++){
  295. var com_txt= complaintTypes[response2[j].mtmComplaintTypes.complaintTypeId];
  296. //console.log(response2[j].mtmComplaintTypes.complaintTypeId);
  297. var com_status_link=``;
  298. var com_status=response2[j].status;
  299. var com_status_txt = `<span class="badge bg-info">UNDER PROGRESS</span> <i class="fa fa-arrow-right"></i> ${response2[j].officer_name}`;
  300. if(com_status=='close'){
  301. var com_status_txt = `<span class="badge bg-success">Completed</span> <i class="fa fa-arrow-right"></i> ${response2[j].officer_name}`;
  302. var com_status_link=`<a href="#" onclick="return call_close_details(${response2[j].mapId});">View</a>`;
  303. mapid = response2[j].mapId
  304. }
  305. complaintBodyHTML+=`<tr>
  306. <td class="text-center" scope="row">${j+1}</td>
  307. <td class="fw-semibold">
  308. ${com_txt} <i class="fa fa-arrow-right"></i> ${com_status_txt}
  309. </td>
  310. <td class="fw-semibold">${com_status_link}</td>
  311. </tr>`;
  312. }
  313. if(response2.length==0){
  314. var complaint = response[0].petitionerComplaint;
  315. var complaintArray = complaint.split(',');
  316. var complaintBodyHTML='';
  317. for(j = 0; j < complaintArray.length; j++){
  318. var sno = (j+1);
  319. var com_txt= complaintTypes[complaintArray[j]];
  320. var com_status=0;
  321. var com_status_txt = `<span class="badge bg-danger">Not Assigned</span>`;
  322. complaintBodyHTML+=`<tr>
  323. <td class="text-center" scope="row">${sno}</td>
  324. <td class="fw-semibold">
  325. ${com_txt} <i class="fa fa-arrow-right"></i> ${com_status_txt}
  326. </td>
  327. <td> - </td>
  328. </tr>`;
  329. }
  330. }
  331. else if(response2.length==1){
  332. call_close_details(mapid);
  333. }
  334. var complaintHTML=`
  335. <table class="table table-bordered table-vcenter">
  336. <thead>
  337. <tr>
  338. <th class="text-center" style="width: 50px;">#</th>
  339. <th>Complaint <i class="fa fa-arrow-right"></i> Status</th>
  340. <th class="text-center" style="width: 50px;"><i class="fa fa-link"></i></th>
  341. </tr>
  342. </thead>
  343. <tbody>
  344. ${complaintBodyHTML}
  345. </tbody>
  346. </table>
  347. `;
  348. var date_txt = convertdate(response[0].cDate);
  349. var statusHTML = `<table class="table table-borderless table-vcenter p-0 m-0" style="font-size:12px;">
  350. <tbody>
  351. <tr>
  352. <th style="padding: 0.45rem 0.45rem;">நாள் / Date : </th>
  353. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  354. ${date_txt}
  355. </td>
  356. </tr>
  357. <tr>
  358. <th style="padding: 0.45rem 0.45rem;">Table No / User No: </th>
  359. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  360. ${response[0].tableNo}
  361. </td>
  362. </tr>
  363. <tr>
  364. <th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
  365. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  366. ${response[0].petitionNumber}
  367. </td>
  368. </tr>
  369. <tr>
  370. <th style="padding: 0.45rem 0.45rem;">பெயர் / Name :</th>
  371. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  372. ${response[0].petitionerName}
  373. </td>
  374. </tr>
  375. <tr>
  376. <th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / No.</th>
  377. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  378. ${response[0].petitionerMobile}
  379. </td>
  380. </tr>
  381. <tr style="font-size:12px;">
  382. <td colspan="2" style="padding: 0.45rem 0.45rem;"><b>புகாரின் தன்மை / Nature of complaint:</b><br>
  383. ${response[0].petitionerNatureOfComplaint}
  384. </td>
  385. <tr style="font-size:12px;">
  386. <td colspan="2" style="padding: 0.45rem 0.45rem;">
  387. ${complaintHTML}
  388. </td>
  389. </tr>
  390. </tbody>
  391. </table>`;
  392. statusHTML = `<div class="card mb-0">
  393. <div class="card-header bg-modal-title"><h3>Complaint Details</h3></div>
  394. <div class="card-body">${statusHTML}</div>
  395. </div>`;
  396. petupdateForm = `<div class="card mb-0">
  397. <div class="card-header bg-modal-title"><h3>Complaint Update Details</h3></div>
  398. <div class="card-body text-center"><br><br>
  399. Select View from Left 'Complaint <i class="fa fa-arrow-right"></i> Status'
  400. <br><br><br>
  401. </div>
  402. </div>`;
  403. $('#petitionUpdateForm').html(petupdateForm);
  404. $('#petitionStatusForm').html(statusHTML);
  405. $("#error").html("");
  406. $('#petitionStatus').modal({
  407. backdrop: 'static',
  408. keyboard: false
  409. });
  410. $('#petitionStatus').modal('show');
  411. });
  412. return false;
  413. }
  414. }).fail(function(jqXHR, textStatus, errorThrown) {
  415. /*
  416. // Log the error and any relevant information
  417. console.error("Error sending request: " + textStatus + " " + errorThrown);
  418. console.error("URL: /api/ogin");
  419. */
  420. });
  421. return false;
  422. }
  423. function call_close_petition_details(mapid){
  424. $.ajax({
  425. type: "GET",
  426. url: '/api/mtm/getComMappingActionByMapId',
  427. data: {
  428. 'mapid': mapid,
  429. },
  430. dataType: 'json',
  431. }).done(function(response) {
  432. //alert(response.length);
  433. // Handle the response here
  434. if(response.length<=0){
  435. //console.error("Error:"+response);
  436. var err=`<div scope="row" class="text-warning text-center">Dev Ref ID: ${mapid}</div>
  437. <div scope="row" class="text-danger text-center">No data Found!</div>`;
  438. $('#petitionStatusForm').html(err);
  439. $('#petitionUpdateForm').html(err);
  440. $('#petitionStatusupdate').modal({
  441. backdrop: 'static',
  442. keyboard: false
  443. });
  444. $('#petitionStatusupdate').modal('show');
  445. }
  446. else{
  447. var complaintBodyHTML='';
  448. var com_txt = response[0].mtmEventsPetitionMapping.mtmComplaintTypes.complaintType;
  449. var com_status=response[0].status;
  450. var date_txt = response[0].cDate;
  451. var action_taken_date= convertdate(date_txt);
  452. var com_status_txt = `<span class="badge bg-info">UNDER PROGRESS</span> <i class="fa fa-arrow-right"></i> ${response[0].officer_name}`;
  453. if(com_status=='close'){
  454. var com_status_txt = `<span class="badge bg-success">Completed</span> <i class="fa fa-arrow-right"></i> ${response[0].officer_name}`;
  455. }
  456. complaintBodyHTML+=`<tr>
  457. <td class="fw-semibold">
  458. ${com_txt} <i class="fa fa-arrow-right"></i> ${com_status_txt}
  459. </td>
  460. </tr>`;
  461. var complaintHTML=`
  462. <table class="table table-bordered table-vcenter">
  463. <thead>
  464. <tr>
  465. <th>Complaint <i class="fa fa-arrow-right"></i> Status</th>
  466. </tr>
  467. </thead>
  468. <tbody>
  469. ${complaintBodyHTML}
  470. </tbody>
  471. </table>
  472. `;
  473. var date_txt = convertdate(response[0].mtmEventsPetitionMapping.mtmEventsPetitionId.cDate);
  474. var statusHTML = `<table class="table table-borderless table-vcenter p-0 m-0" style="font-size:12px;">
  475. <tbody>
  476. <tr>
  477. <th style="padding: 0.45rem 0.45rem;">நாள் / Date : </th>
  478. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  479. ${date_txt}
  480. </td>
  481. </tr>
  482. <tr>
  483. <th style="padding: 0.45rem 0.45rem;">Table No / User No: </th>
  484. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  485. ${response[0].mtmEventsPetitionMapping.mtmEventsPetitionId.tableNo}
  486. </td>
  487. </tr>
  488. <tr>
  489. <th style="padding: 0.45rem 0.45rem;">ஒப்புகை சீட்டு எண்/ Acknowledgement No:</th>
  490. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  491. ${response[0].mtmEventsPetitionMapping.mtmEventsPetitionId.petitionNumber}
  492. </td>
  493. </tr>
  494. <tr>
  495. <th style="padding: 0.45rem 0.45rem;">பெயர் / Name :</th>
  496. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  497. ${response[0].mtmEventsPetitionMapping.mtmEventsPetitionId.petitionerName}
  498. </td>
  499. </tr>
  500. <tr>
  501. <th style="padding: 0.45rem 0.45rem;">கைபேசி எண் / No.</th>
  502. <td class="fw-semibold" style="padding: 0.45rem 0.45rem;">
  503. ${response[0].mtmEventsPetitionMapping.mtmEventsPetitionId.petitionerMobile}
  504. </td>
  505. </tr>
  506. <tr style="font-size:12px;">
  507. <td colspan="2" style="padding: 0.45rem 0.45rem;"><b>புகாரின் தன்மை / Nature of complaint:</b><br>
  508. ${response[0].mtmEventsPetitionMapping.mtmEventsPetitionId.petitionerNatureOfComplaint}
  509. </td>
  510. <tr style="font-size:12px;">
  511. <td colspan="2" style="padding: 0.45rem 0.45rem;">
  512. ${complaintHTML}
  513. </td>
  514. </tr>
  515. </tbody>
  516. </table>`;
  517. statusHTML=`<div class="card mb-0">
  518. <div class="card-header bg-modal-title"><h3>Complaint Details</h3></div>
  519. <div class="card-body">${statusHTML}</div>
  520. </div>`;
  521. $('#petitionStatusForm').html(statusHTML);
  522. call_close_details(mapid);
  523. return false;
  524. }
  525. }).fail(function(jqXHR, textStatus, errorThrown) {
  526. // Log the error and any relevant information
  527. console.error("Error sending request: " + textStatus + " " + errorThrown);
  528. });
  529. return false;
  530. }
  531. function call_close_details(mapid){
  532. $.ajax({
  533. type: "GET",
  534. url: '/api/mtm/getComMappingActionByMapId',
  535. data: {
  536. 'mapid': mapid,
  537. },
  538. dataType: 'json',
  539. }).done(function(response) {
  540. // Handle the response here
  541. if(response.length<=0){
  542. petupdateForm = `<div class="card mb-0">
  543. <div class="card-header bg-modal-title"><h3>Complaint Update Details</h3>
  544. <div class="card-header-right">
  545. <p class="bg-warning lbl-card"> Ref ID: ${mapid}</p>
  546. </div>
  547. </div>
  548. <div class="card-body">${nodata}</div>
  549. </div>`;
  550. $('#petitionUpdateForm').html(petupdateForm);
  551. $("#formError").html("");
  552. }
  553. else{
  554. var complaintBodyHTML='';
  555. var com_txt = response[0].mtmEventsPetitionMapping.mtmComplaintTypes.complaintType;
  556. var com_status=response[0].status;
  557. var date_txt = response[0].cDate;
  558. var action_taken_date= convertdate(date_txt);
  559. var fromdate=convertdate(response[0].mtmEventsPetitionMapping.mtmEventsPetitionId.cDate);
  560. var todate = action_taken_date;
  561. var petupdateForm=`
  562. <label class="form-label">நடவடிக்கை தேதி / Action Date:</label>
  563. <div class="mb-0 text-warning">${action_taken_date}
  564. <a href="#" onclick="return false;"data-toggle="tooltip" data-html="true" data-animation="true" data-placement="top" title="In Days: ${date_difference(fromdate,todate,'days')}<br> In Time: ${date_difference(fromdate,todate,'time')}"> <i class="ik ik-clock text-success"></i> </a></div>
  565. <hr>
  566. <label class="form-label">நடவடிக்கை / Action:</label>
  567. <div class="text"><p>${response[0].comments}</p></div>
  568. <hr>
  569. <label class="form-label">ஆவணப் பதிவேற்றம் / Document Upload:</label><br>
  570. <p class="mb-0 text btn" onclick="call_blobData(${response[0].solMapId},'action');">${response[0].fileName}</p>
  571. <div id="formError" class="text-danger"></div>
  572. </div>
  573. `;
  574. petupdateForm = `<div class="card mb-0">
  575. <div class="card-header bg-modal-title"><h3>Complaint Update Details</h3>
  576. <div class="card-header-right">
  577. <span class="badge badge-pill badge-success mb-1">Ref ID: ${mapid}</span>
  578. </div>
  579. </div>
  580. <div class="card-body">${petupdateForm}</div>
  581. </div>`;
  582. $('#petitionUpdateForm').html(petupdateForm);
  583. $("#formError").html("");
  584. }
  585. $('#petitionStatus').modal({
  586. backdrop: 'static',
  587. keyboard: false
  588. });
  589. $('#petitionStatus').modal('show');
  590. $('[data-toggle="tooltip"]').tooltip();
  591. }).fail(function(jqXHR, textStatus, errorThrown) {
  592. // Log the error and any relevant information
  593. console.error("Error sending request: " + textStatus + " " + errorThrown);
  594. });
  595. return false;
  596. }
  597. function call_blobData(id,inTable){
  598. $.ajax({
  599. type: "GET",
  600. url: '/api/mtm/viewBlobData',
  601. data: {
  602. 'id': id,
  603. 'table': inTable,
  604. },
  605. dataType: 'json',
  606. }).done(function(response) {
  607. var fileHTML = '';
  608. // Handle the response here
  609. if(response.length<=0){
  610. fileHTML = `<p class='text-danger m-0 p-0'>No Data!</p>`;
  611. }
  612. else{
  613. if(response[1]=='application/pdf'){
  614. var fileHTML = `<iframe src="data:application/pdf;base64,${response[0]}" type="application/pdf" width="100%" height="600px"></iframe>`;
  615. }
  616. else if(response[1]=='application/octet-stream'){
  617. fileHTML =`<p class='text-danger m-0 p-0'>File Preview not avaiable.<br>Try to download and view.</p>`;
  618. }
  619. else{
  620. fileHTML =`<img src="data:${response[1]};base64,${response[0]}" alt="File">`;
  621. }
  622. }
  623. /*
  624. console.log(response);
  625. console.log(response.length);
  626. console.log(response[1]);
  627. console.log(fileHTML);
  628. */
  629. $('#viewFileHtml').html(fileHTML);
  630. $('#viewCloseFile').modal({
  631. backdrop: 'static',
  632. keyboard: false
  633. });
  634. $('#viewCloseFile').modal('show');
  635. }).fail(function(jqXHR, textStatus, errorThrown) {
  636. // Log the error and any relevant information
  637. console.error("Error sending request: " + textStatus + " " + errorThrown);
  638. });
  639. return false;
  640. }
  641. /* //////////////// */
  642. </script>