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.

1460 lines
45 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
2 years ago
​
​
​
​
​
2 years ago
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
2 years ago
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
2 years ago
2 years ago
2 years ago
​
​
​
​
2 years ago
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
2 years ago
​
2 years ago
​
​
2 years ago
​
2 years ago
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
2 years ago
​
2 years ago
​
​
​
2 years ago
​
​
​
​
​
2 years ago
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Main Page</title>
  6. <!--Google Font -->
  7. <link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap" rel="stylesheet">
  8. <!--Bootstrap CSS-->
  9. <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
  10. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
  11. <link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
  12. <script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
  13. <script th:src="@{/js/invertcolor.js}"></script>
  14. <style>
  15. body {
  16. font-family: 'Lato', sans-serif;
  17. background-color: white;
  18. }
  19. body.inverted {
  20. background-color: black;
  21. color: white !important;
  22. filter: invert(1);
  23. }
  24. .card {
  25. border-radius: 15px;
  26. border: none;
  27. padding: 20px;
  28. background-color: #f0f4ff;
  29. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  30. margin-top: 20px;
  31. }
  32. .card-title {
  33. font-size: 1.2rem;
  34. font-weight: bold;
  35. }
  36. .card-text {
  37. color: #666;
  38. margin-bottom: 20px;
  39. }
  40. .progress {
  41. height: 20px;
  42. border-radius: 10px;
  43. }
  44. .progress-bar {
  45. background-color: #414f69;
  46. /* New color for the progress bar */
  47. border-radius: 10px;
  48. }
  49. .form-row {
  50. margin-bottom: 20px;
  51. }
  52. .form-step {
  53. display: none;
  54. }
  55. .form-step.active {
  56. display: block;
  57. }
  58. .container {
  59. max-width: 100%;
  60. }
  61. /*css for step 3*/
  62. .complaint-icons {
  63. display: flex;
  64. justify-content: space-around;
  65. margin-bottom: 20px;
  66. }
  67. .complaint-icon {
  68. text-align: center;
  69. cursor: pointer;
  70. }
  71. .complaint-icon img {
  72. width: 50px;
  73. height: 50px;
  74. }
  75. .complaint-fields {
  76. display: none;
  77. }
  78. .complaint-fields.active {
  79. display: block;
  80. }
  81. /*for radio button style*/
  82. .radio-group {
  83. display: flex;
  84. align-items: center;
  85. /* Ensures all items are aligned to the center */
  86. }
  87. .radio-item {
  88. display: flex;
  89. align-items: center;
  90. margin-right: 20px;
  91. /* Adds space between each radio item */
  92. }
  93. .radio-item input[type="radio"] {
  94. margin-right: 10px;
  95. /* Adds space between the radio button and its label */
  96. vertical-align: middle;
  97. /* Ensures vertical alignment */
  98. }
  99. .radio-item label {
  100. margin: 0;
  101. /* Removes any default margins that might affect alignment */
  102. }
  103. .back-button {
  104. background: none;
  105. border: none;
  106. color: #000;
  107. font-size: 16px;
  108. cursor: pointer;
  109. padding: 0;
  110. margin-right: auto;
  111. /* Align the button to the left */
  112. }
  113. .title {
  114. text-align: center;
  115. flex-grow: 1;
  116. font-size: 24px;
  117. font-weight: bold;
  118. margin: 0;
  119. }
  120. /*css for map in step2*/
  121. #map {
  122. height: 300px;
  123. width: 100%;
  124. position: relative;
  125. overflow: hidden;
  126. max-width: 100%;
  127. }
  128. #search-container {
  129. position: absolute;
  130. top: 10px;
  131. left: 50%;
  132. transform: translateX(-50%);
  133. z-index: 1000;
  134. width: 500px;
  135. box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
  136. background-color: white;
  137. border-radius: 4px;
  138. padding: 0;
  139. /* Removed extra padding to match the input width */
  140. }
  141. #search-box {
  142. width: 100%;
  143. /* Ensures the input takes up the entire width of the container */
  144. padding: 5px;
  145. font-size: 16px;
  146. border: 1px solid #ccc;
  147. border-radius: 4px;
  148. /* Rounded corners matching the container */
  149. box-sizing: border-box;
  150. /* Makes sure padding is considered in width */
  151. }
  152. #suggestions {
  153. border: 1px solid #ccc;
  154. border-radius: 4px;
  155. max-height: 200px;
  156. overflow-y: auto;
  157. margin-top: 5px;
  158. background-color: white;
  159. display: none;
  160. width: 100%;
  161. /* Matches the width of the container and input */
  162. box-sizing: border-box;
  163. /* Ensures the width includes borders and padding */
  164. }
  165. #suggestions ul {
  166. list-style: none;
  167. padding: 0;
  168. margin: 0;
  169. }
  170. #suggestions ul li {
  171. padding: 5px;
  172. cursor: pointer;
  173. }
  174. #suggestions ul li:hover {
  175. background-color: #f0f0f0;
  176. }
  177. /*header css*/
  178. .header {
  179. background-color: #3b4858;
  180. padding: 10px 20px;
  181. display: flex;
  182. align-items: center;
  183. justify-content: space-between;
  184. color: white;
  185. }
  186. .header .logo-left img {
  187. height: 60px;
  188. }
  189. .header .title {
  190. text-align: center;
  191. flex-grow: 1;
  192. }
  193. .header .title h2 {
  194. margin: 0;
  195. font-size: 1.5rem;
  196. }
  197. .header .logos-right img {
  198. height: 60px;
  199. margin-left: 10px;
  200. }
  201. /*header buttons*/
  202. .header {
  203. display: flex;
  204. align-items: center;
  205. justify-content: space-between;
  206. /* Space out the items within the header */
  207. }
  208. .header-buttons {
  209. padding-left: 5px;
  210. display: flex;
  211. align-items: center;
  212. gap: 10px;
  213. /* Adjust spacing between buttons */
  214. }
  215. #reader-btn,
  216. #invertColorBtn {
  217. padding: 5px 10px;
  218. font-size: 14px;
  219. cursor: pointer;
  220. }
  221. .loader {
  222. border: 16px solid #f3f3f3;
  223. /* Light grey */
  224. border-top: 16px solid #3498db;
  225. /* Blue */
  226. border-radius: 50%;
  227. width: 120px;
  228. height: 120px;
  229. animation: spin 2s linear infinite;
  230. position: absolute;
  231. top: 50%;
  232. left: 50%;
  233. margin: -60px 0 0 -100px;
  234. /* Center the loader */
  235. z-index: 9999;
  236. /* Ensure it's on top of everything */
  237. display: none;
  238. /* Initially hidden */
  239. }
  240. @keyframes spin {
  241. 0% {
  242. transform: rotate(0deg);
  243. }
  244. 100% {
  245. transform: rotate(360deg);
  246. }
  247. }
  248. /*for snack bar*/
  249. #snackbar {
  250. visibility: hidden;
  251. min-width: 250px;
  252. background-color: #333;
  253. color: #fff;
  254. text-align: center;
  255. border-radius: 2px;
  256. padding: 16px;
  257. position: fixed;
  258. z-index: 1;
  259. left: 50%;
  260. bottom: 30px;
  261. font-size: 17px;
  262. transform: translateX(-50%);
  263. }
  264. #snackbar.show {
  265. visibility: visible;
  266. -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
  267. animation: fadein 0.5s, fadeout 0.5s 2.5s;
  268. }
  269. @-webkit-keyframes fadein {
  270. from {
  271. bottom: 0;
  272. opacity: 0;
  273. }
  274. to {
  275. bottom: 30px;
  276. opacity: 1;
  277. }
  278. }
  279. @keyframes fadein {
  280. from {
  281. bottom: 0;
  282. opacity: 0;
  283. }
  284. to {
  285. bottom: 30px;
  286. opacity: 1;
  287. }
  288. }
  289. @-webkit-keyframes fadeout {
  290. from {
  291. bottom: 30px;
  292. opacity: 1;
  293. }
  294. to {
  295. bottom: 0;
  296. opacity: 0;
  297. }
  298. }
  299. @keyframes fadeout {
  300. from {
  301. bottom: 30px;
  302. opacity: 1;
  303. }
  304. to {
  305. bottom: 0;
  306. opacity: 0;
  307. }
  308. }
  309. /*for snack bar*/
  310. </style>
  311. </style>
  312. </head>
  313. <body>
  314. <div th:insert="~{fragments/header :: headerFragment}"></div>
  315. <div th:insert="~{fragments/accessibility :: accessibility}"></div>
  316. <div id="snackbar"></div>
  317. <!-- Progress Bar Section -->
  318. <div class="container resizable-content">
  319. <div class="mt-1">
  320. <div class="row align-items-center justify-content-center">
  321. <button class="back-button" onclick="window.location.href='home';">← Back</button>
  322. <!--<button id="invertColorBtn" onclick="invertColors()">Invert Colors</button>-->
  323. <h2 class="title">Registration of Complaint</h2>
  324. </div>
  325. </div>
  326. <div class="card ">
  327. <h3>Instructions:</h3>
  328. <p>Please fill your complaint details below and click the ‘Submit’ button at the bottom. You will be given a
  329. Complaint Number upon submitting the complaint that you can use to track the complaint.</p>
  330. </div>
  331. <div class="card ">
  332. <div class="progress">
  333. <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"
  334. style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
  335. </div>
  336. <!-- Step 1 -->
  337. <!-- Step 1 -->
  338. <div class="card form-step active " id="step-1">
  339. <div class="card-body">
  340. <h5 class="card-title">1. Complaining Person's Details:</h5>
  341. <div class="form-row">
  342. <div class="col-md-4">
  343. <label for="mobile">Mobile Number:</label>
  344. <div class="input-group">
  345. <input type="number" class="form-control" id="mobile"
  346. placeholder="Enter your Mobile Number">
  347. </div>
  348. </div>
  349. </div>
  350. <div class="form-row">
  351. <div class="col-md-4">
  352. <label for="name">Name:</label>
  353. <input type="text" class="form-control" id="name" placeholder="Enter your name">
  354. </div>
  355. <div class="col-md-4">
  356. <label for="gender">Gender/பாலினம்:<span class="required">*</span></label>
  357. <div class="radio-group">
  358. <div class="radio-item">
  359. <input type="radio" id="male" name="gender" value="male" checked>
  360. <label for="male">Male</label>
  361. </div>
  362. <div class="radio-item">
  363. <input type="radio" id="female" name="gender" value="female">
  364. <label for="female">Female</label>
  365. </div>
  366. <div class="radio-item">
  367. <input type="radio" id="transgender" name="gender" value="transgender">
  368. <label for="transgender">Transgender</label>
  369. </div>
  370. </div>
  371. </div>
  372. <div class="col-md-4">
  373. <label for="email">Email:</label>
  374. <input type="email" class="form-control" id="email" placeholder="Enter your email">
  375. </div>
  376. </div>
  377. <button id="nextStep1" class="btn btn-primary float-right" onclick="nextStep('nextStep1')"
  378. style="background-color: #414f69;">Next</button>
  379. </div>
  380. </div>
  381. <!--step-2-->
  382. <div class="card form-step readable" id="step-2">
  383. <div class="card-body">
  384. <h5 class="card-title">2. Complaint Location Details:</h5>
  385. <div class="form-row">
  386. <!-- loader section -->
  387. <div id="loader" class="loader" style="display: none;"></div>
  388. <!--map fields-->
  389. <div class="col-md-12">
  390. <div id="map"></div>
  391. <div id="search-container">
  392. <input type="text" id="search-box" placeholder="Search for a location...">
  393. <div id="suggestions"></div>
  394. </div>
  395. <div class="row">
  396. <div class="col-md-6">
  397. <label for="street">Street:</label>
  398. <input type="text" class="form-control" id="street">
  399. </div>
  400. <div class="col-md-6">
  401. <label for="longitude_field">Longtitude</label>
  402. <input type="text" class="form-control" id="longitude_field" name="longtitude">
  403. </div>
  404. <div class="col-md-6">
  405. <label for="latitude_field">Latitide</label>
  406. <input type="text" class="form-control" id="latitude_field">
  407. </div>
  408. <div class="col-md-6">
  409. <label for="street_id">Street Id</label>
  410. <input type="text" class="form-control" id="street_id">
  411. </div>
  412. <div class="col-md-6">
  413. <label for="landmark">Landmark</label>
  414. <input type="text" class="form-control" id="landmark">
  415. </div>
  416. </div>
  417. </div>
  418. </div>
  419. <button id="prevStep2" class="btn btn-secondary" onclick="prevStep('prevStep2')">Previous</button>
  420. <button id="nextStep2" class="btn btn-primary float-right" onclick="nextStep('nextStep2')"
  421. style="background-color: #414f69;">Next</button>
  422. </div>
  423. </div>
  424. <!-- Step 3 -->
  425. <div class="card form-step active readable" id="step-3">
  426. <div class="card-body">
  427. <h5 class="card-title">3. Complaint Type:</h5>
  428. <!-- Icons -->
  429. <div class="complaint-icons">
  430. <div class="complaint-icon" data-type="specific" data-id="112">
  431. <img src="images/road.png" alt="Pothole">
  432. <p>Pothole</p>
  433. </div>
  434. <div class="complaint-icon" data-type="specific" data-id="97">
  435. <img src="images/recycle.png" alt="garbage">
  436. <p>Garbage</p>
  437. </div>
  438. <div class="complaint-icon" data-type="specific" data-id="104">
  439. <img src="images/waste-bin.png" alt="broken-bin">
  440. <p>Broken-Bin</p>
  441. </div>
  442. <div class="complaint-icon" data-type="specific" data-id="146">
  443. <img src="images/street-lamp.png" alt="StreetLight">
  444. <p>StreetLight</p>
  445. </div>
  446. <div class="complaint-icon" data-type="specific" data-id="199">
  447. <img src="images/portable-bathroom.png" alt="public-toilet">
  448. <p>Public Toilet</p>
  449. </div>
  450. <div class="complaint-icon" data-type="specific" data-id="118">
  451. <img src="images/mosquito.png" alt="mosquito">
  452. <p>Mosquito Menace</p>
  453. </div>
  454. <div class="complaint-icon" data-type="specific" data-id="138">
  455. <img src="images/tsunami.png" alt="waterstag">
  456. <p>WaterStagnation</p>
  457. </div>
  458. <div class="complaint-icon" data-type="specific" data-id="142">
  459. <img src="images/sewage.png" alt="sewage">
  460. <p>Storm Water Drains</p>
  461. </div>
  462. <div class="complaint-icon" data-type="specific" data-id="119">
  463. <img src="images/dog.png" alt="dog">
  464. <p>Street Dog</p>
  465. </div>
  466. <!--<div class="complaint-icon" data-type="specific" data-id="">
  467. <img src="images/bad-weather.png" alt="weather">
  468. <p>Tree Fallen</p>
  469. </div>-->
  470. <div class="complaint-icon" data-type="others">
  471. <img src="images/menu.png" alt="Others">
  472. <p>Others</p>
  473. </div>
  474. </div>
  475. <!-- Specific Complaint Fields -->
  476. <div class="complaint-fields active" id="specific-fields">
  477. <div class="form-row">
  478. <div class="col-md-6">
  479. <label for="complaint-title">Complaint Title:</label>
  480. <input type="text" class="form-control" id="complaint-title"
  481. placeholder="Enter complaint title">
  482. </div>
  483. <div class="col-md-6">
  484. <label for="complaint-id">Complaint Type:</label>
  485. <input type="text" class="form-control" id="complaint-id" disabled>
  486. </div>
  487. </div>
  488. <div class="form-row">
  489. <div class="col-md-6">
  490. <label for="othercomplaint-details">Details of Complaint:</label>
  491. <textarea class="form-control" id="othercomplaint-details" rows="3"
  492. placeholder="Enter complaint details" maxlength="400"></textarea>
  493. </div>
  494. <div class="col-md-6">
  495. <label for="complaint-image">Upload Photo Or Video:</label>
  496. <input type="file" class="form-control" id="complaint-image" name="Comp_Image">
  497. </div>
  498. </div>
  499. </div>
  500. <!-- Others Complaint Fields -->
  501. <div class="complaint-fields" id="others-fields">
  502. <div class="form-row">
  503. <div class="col-md-4">
  504. <label for="type">Type:</label>
  505. <select class="form-control" id="type">
  506. <option value="">Please Select</option>
  507. </select>
  508. </div>
  509. <div class="col-md-4">
  510. <label for="sub-type">Sub-Type:</label>
  511. <select class="form-control" id="sub-type">
  512. <option value="">Select complaint</option>
  513. </select>
  514. </div>
  515. <div class="col-md-4">
  516. <label for="uploadothers">Upload Photo or Video:</label>
  517. <input type="file" class="form-control" id="uploadothers" accept="image/*,video/*">
  518. </div>
  519. </div>
  520. <div class="form-row">
  521. <div class="col-md-6">
  522. <label for="othercomplaintdetailsss">Details of Complaint:</label>
  523. <textarea class="form-control" id="othercomplaintdetailsss" rows="3"
  524. placeholder="Enter complaint details" maxlength="400"></textarea>
  525. </div>
  526. </div>
  527. </div>
  528. <button id="prevStep3" class="btn btn-secondary" onclick="prevStep('prevStep3')">Previous</button>
  529. <button id="nextStep3" class="btn btn-primary float-right" onclick="nextStep('nextStep3')"
  530. style="background-color: #414f69;">Next</button>
  531. </div>
  532. </div>
  533. <!-- Step 4 -->
  534. <div class="card form-step readable" id="step-4">
  535. <div class="card-body">
  536. <h5 class="card-title">4. Complaint Details:</h5>
  537. <table class="table">
  538. <tbody>
  539. <tr>
  540. <td><strong>Name</strong></td>
  541. <td>: <span id="summaryName"></span></td>
  542. <td><strong>Complaint Location</strong></td>
  543. <td>: <span id="summaryStreet"></span></td>
  544. </tr>
  545. <tr>
  546. <td><strong>Mobile Number</strong></td>
  547. <td>: <span id="summaryMobile"></span></td>
  548. <td><strong>Email Address</strong></td>
  549. <td>: <span id="summaryEmail"></span></td>
  550. </tr>
  551. <tr>
  552. <td><strong>Complaint Type</strong></td>
  553. <td>: <span id="summaryComplaintType"></span></td>
  554. <td><strong>Complaint Title</strong></td>
  555. <td>: <span id="summaryComplaintTitle"></span></td>
  556. </tr>
  557. <tr>
  558. <td><strong>Description</strong></td>
  559. <td>: <span id="summaryDescription"></span></td>
  560. <td><strong>Street Id</strong></td>
  561. <td>: <span id="summaryStreetId"></span></td>
  562. </tr>
  563. <tr>
  564. <td><strong>Landmark</strong></td>
  565. <td>: <span id="summaryLandmark"></span></td>
  566. <td><strong>Latitude</strong></td>
  567. <td>: <span id="summaryLatitude"></span></td>
  568. </tr>
  569. <tr>
  570. <td><strong>Longitude</strong></td>
  571. <td>: <span id="summaryLongitude"></span></td>
  572. <td><strong>Gender</strong></td>
  573. <td>: <span id="summaryGender"></span></td>
  574. </tr>
  575. <tr>
  576. <td><strong>Image / Video</strong></td>
  577. <td>:
  578. <img id="summaryImage" src="#" alt="Uploaded Image/Video" width="100"
  579. style="display:none;">
  580. </td>
  581. </tr>
  582. </tbody>
  583. </table>
  584. <button id="prevStep4" class="btn btn-secondary" onclick="prevStep('prevStep4')">Previous</button>
  585. <button id="submitButton" class="btn btn-success float-right">Submit</button>
  586. </div>
  587. </div>
  588. </div>
  589. </div>
  590. <!-- Bootstrap JS -->
  591. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  592. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
  593. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
  594. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  595. <!-- Font Awesome for Icons -->
  596. <script src="https://kit.fontawesome.com/a076d05399.js"></script>
  597. <!-- Progress Bar Script -->
  598. <script>
  599. //for snackbar script
  600. function showSnackbar(message) {
  601. var snackbar = document.getElementById("snackbar");
  602. snackbar.innerHTML = message;
  603. snackbar.className = "show";
  604. setTimeout(function () {snackbar.className = snackbar.className.replace("show", "");}, 3000);
  605. }
  606. //for snackbar script
  607. let currentStep = 1;
  608. let mapInitialized = false;
  609. function showStep(step) {
  610. $('.form-step').removeClass('active');
  611. $('#step-' + step).addClass('active');
  612. updateProgressBar(step);
  613. if (step === 2 && !mapInitialized) {
  614. document.getElementById('loader').style.display = 'block'; // Show loader before map initialization
  615. setTimeout(initializeMap, 3000); // Load the map after 3 seconds
  616. mapInitialized = true; // Ensure the map is only initialized once
  617. }
  618. // If we're on step 4, populate the summary fields
  619. if (step === 4) {
  620. populateSummary();
  621. }
  622. }
  623. function nextStep() {
  624. if (currentStep < 4) {
  625. // Perform validation for the current step
  626. if (validateStep(currentStep)) {
  627. currentStep++;
  628. showStep(currentStep);
  629. }
  630. }
  631. }
  632. function prevStep() {
  633. if (currentStep > 1) {
  634. currentStep--;
  635. showStep(currentStep);
  636. }
  637. }
  638. function updateProgressBar(step) {
  639. const progress = (step / 4) * 100;
  640. $('.progress-bar').css('width', progress + '%').attr('aria-valuenow', progress);
  641. }
  642. function validateStep(step) {
  643. let isValid = true;
  644. if (step === 1) {
  645. const mobile = $('#mobile').val().trim();
  646. const name = $('#name').val().trim();
  647. const email = $('#email').val().trim();
  648. // Validate mobile number
  649. if (mobile === '' || !/^\d{10}$/.test(mobile)) {
  650. isValid = false;
  651. showSnackbar("Please enter a valid 10-digit mobile number.");
  652. }
  653. // Validate name
  654. if (name === '') {
  655. isValid = false;
  656. showSnackbar("Please enter your name.");
  657. }
  658. // Validate email
  659. if (email === '' || !/^\S+@\S+\.\S+$/.test(email)) {
  660. isValid = false;
  661. showSnackbar("Please enter a valid email address.");
  662. }
  663. } else if (step === 2) {
  664. const street = $('#street').val().trim();
  665. const longitude = $('#longitude_field').val().trim();
  666. const latitude = $('#latitude_field').val().trim();
  667. const streetId = $('#street_id').val().trim();
  668. const landmark = $('#landmark').val().trim();
  669. // Validate street
  670. if (street === '') {
  671. isValid = false;
  672. showSnackbar("Please enter the street.");
  673. }
  674. // Validate longitude and latitude
  675. if (longitude === '' || isNaN(longitude)) {
  676. isValid = false;
  677. showSnackbar("Please enter a valid longitude.");
  678. }
  679. if (latitude === '' || isNaN(latitude)) {
  680. isValid = false;
  681. showSnackbar("Please enter a valid latitude.");
  682. }
  683. // Validate street ID
  684. if (streetId === '') {
  685. isValid = false;
  686. showSnackbar("Please enter the street ID.");
  687. }
  688. // Validate landmark
  689. if (landmark === '') {
  690. isValid = false;
  691. showSnackbar("Please enter the landmark.");
  692. }
  693. }
  694. return isValid;
  695. }
  696. function populateSummary() {
  697. const name = $('#name').val();
  698. const street = $('#street').val();
  699. const mobile = $('#mobile').val();
  700. const gender = $('input[name="gender"]:checked').val();
  701. const email = $('#email').val();
  702. // Check if 'specific-fields' is active and use its values
  703. if ($('#specific-fields').hasClass('active')) {
  704. const complaintTitle = $('#complaint-title').val();
  705. const complaintid = $('#complaint-id').val();
  706. const complaintDetails = $('#othercomplaint-details').val(); // Specific complaint details
  707. $('#summaryComplaintTitle').text(complaintTitle);
  708. $('#summaryComplaintType').text(complaintid);
  709. $('#summaryDescription').text(complaintDetails);
  710. } else if ($('#others-fields').hasClass('active')) {
  711. const complaintTitle = $('#type').find('option:selected').text();
  712. const complaintSubType = $('#sub-type').find('option:selected').text();
  713. const complaintDetails = $('#othercomplaintdetailsss').val(); // Others complaint details
  714. $('#summaryComplaintTitle').text(complaintTitle + ' - ' + complaintSubType);
  715. $('#summaryComplaintType').text('Other Complaint');
  716. $('#summaryDescription').text(complaintDetails);
  717. }
  718. const streetid = $('#street_id').val();
  719. const landmark = $('#landmark').val();
  720. const latitude = $('#latitude_field').val();
  721. const longtitude = $('#longitude_field').val();
  722. $('#summaryName').text(name);
  723. $('#summaryStreet').text(street);
  724. $('#summaryMobile').text(mobile);
  725. $('#summaryGender').text(gender);
  726. $('#summaryEmail').text(email);
  727. $('#summaryStreetId').text(streetid);
  728. $('#summaryLandmark').text(landmark);
  729. $('#summaryLatitude').text(latitude);
  730. $('#summaryLongitude').text(longtitude);
  731. // Handle image preview
  732. /* const fileInput = $('#complaint-image')[0]; // Assuming this is for the "Others" section
  733. if (fileInput.files && fileInput.files[0]) {
  734. const reader = new FileReader();
  735. reader.onload = function (e) {
  736. $('#summaryImage').attr('src', e.target.result).show();
  737. }
  738. reader.readAsDataURL(fileInput.files[0]);
  739. } else {
  740. $('#summaryImage').hide();
  741. }*/
  742. // If there's a separate image input for the specific form, handle it similarly:
  743. // Check if specific fields section is active
  744. if ($('#specific-fields').hasClass('active')) {
  745. const specificFileInput = $('#complaint-image')[0]; // Example ID for specific form
  746. if (specificFileInput.files && specificFileInput.files[0]) {
  747. const reader = new FileReader();
  748. reader.onload = function (e) {
  749. $('#summaryImage').attr('src', e.target.result).show();
  750. };
  751. reader.readAsDataURL(specificFileInput.files[0]);
  752. } else {
  753. $('#summaryImage').hide(); // Hide the image if no file is selected
  754. }
  755. }
  756. // Check if "Others" section is active
  757. else if ($('#others-fields').hasClass('active')) {
  758. const fileInput = $('#uploadothers')[0]; // Assuming this is for the "Others" section
  759. if (fileInput.files && fileInput.files[0]) {
  760. const reader = new FileReader();
  761. reader.onload = function (e) {
  762. $('#summaryImage').attr('src', e.target.result).show();
  763. };
  764. reader.readAsDataURL(fileInput.files[0]);
  765. } else {
  766. $('#summaryImage').hide(); // Hide the image if no file is selected
  767. }
  768. } else {
  769. $('#summaryImage').hide(); // Default hide if no section is active
  770. }
  771. }
  772. $(document).ready(function () {
  773. showStep(currentStep);
  774. });
  775. $(document).ready(function () {
  776. showStep(currentStep);
  777. });
  778. //for step3 onclick function
  779. $(document).ready(function () {
  780. // On icon click
  781. $('.complaint-icon').click(function () {
  782. const type = $(this).data('type'); // Get the type (specific or others)
  783. const title = $(this).find('p').text().trim(); // Get the icon name (complaint title)
  784. const complaintId = $(this).data('id'); // Get the complaint ID
  785. // Toggle complaint fields based on type
  786. $('.complaint-fields').removeClass('active');
  787. if (type === 'specific') {
  788. $('#specific-fields').addClass('active'); // Show specific fields form
  789. $('#others-fields').removeClass('active'); // Hide others form
  790. $('#complaint-title').val(title); // Set the complaint title to the icon name
  791. $('#complaint-id').val(complaintId); // Set the complaint ID to the corresponding ID
  792. } else if (type === 'others') {
  793. $('#others-fields').addClass('active'); // Show others form
  794. $('#specific-fields').removeClass('active'); // Hide specific fields form
  795. $('#complaint-title').val(''); // Clear the complaint title for 'Others'
  796. $('#complaint-id').val(''); // Clear the complaint ID for 'Others'
  797. }
  798. });
  799. });
  800. //for complaint group and complainttype wise options dropdown api
  801. $(document).ready(function () {
  802. const $type = $('#type');
  803. const $subType = $('#sub-type');
  804. $subType.prop('disabled', true);
  805. // Fetch and populate the Type dropdown
  806. $.ajax({
  807. url: '/api/getComplaintCategories',
  808. method: 'GET',
  809. success: function (response) {
  810. const data = typeof response === 'string' ? JSON.parse(response) : response;
  811. console.log('Response:', response); // Log the response to verify
  812. let optionsHtml = '<option value="">Please Select</option>';
  813. data.ComplaintCategoryListResult.forEach(function (group) {
  814. optionsHtml += `<option value="${group.groupid}">${group.groupname}</option>`;
  815. });
  816. $type.html(optionsHtml);
  817. },
  818. error: function (error) {
  819. console.error('Error fetching complaint categories:', error);
  820. }
  821. });
  822. // Handle Type dropdown change
  823. $type.change(function () {
  824. const selectedType = $(this).val();
  825. $subType.empty().append('<option value="">Select complaint</option>');
  826. if (selectedType) {
  827. $.ajax({
  828. url: `/api/getComplaintSubTypes?groupId=${selectedType}`,
  829. method: 'GET',
  830. success: function (response) {
  831. const data = typeof response === 'string' ? JSON.parse(response) : response;
  832. const selectedGroup = data.ComplaintCategoryListResult[0];
  833. console.log(data);
  834. if (selectedGroup && selectedGroup.group) {
  835. $subType.prop('disabled', false);
  836. selectedGroup.group.forEach(function (complaint) {
  837. $subType.append(`<option value="${complaint.id}">${complaint.complaintname}</option>`);
  838. });
  839. } else {
  840. $subType.prop('disabled', true);
  841. }
  842. },
  843. error: function (error) {
  844. console.error('Error fetching sub-types:', error);
  845. $subType.prop('disabled', true);
  846. }
  847. });
  848. } else {
  849. $subType.prop('disabled', true);
  850. }
  851. });
  852. });
  853. //script for reader
  854. // Script for reader functionality
  855. let readerActive = false;
  856. function toggleReader() {
  857. const readerBtn = document.getElementById('reader-btn');
  858. readerActive = !readerActive;
  859. if (readerActive) {
  860. readerBtn.classList.add('active');
  861. readerBtn.textContent = 'Disable Reader';
  862. enableReading();
  863. } else {
  864. readerBtn.classList.remove('active');
  865. readerBtn.textContent = 'Enable Reader';
  866. disableReading();
  867. }
  868. }
  869. function enableReading() {
  870. document.querySelectorAll('.readable').forEach(element => {
  871. element.addEventListener('mouseenter', speakText);
  872. element.addEventListener('click', speakText);
  873. });
  874. }
  875. function disableReading() {
  876. document.querySelectorAll('.readable').forEach(element => {
  877. element.removeEventListener('mouseenter', speakText);
  878. element.removeEventListener('click', speakText);
  879. });
  880. }
  881. function speakText(event) {
  882. if (readerActive) {
  883. const text = event.target.textContent;
  884. const utterance = new SpeechSynthesisUtterance(text);
  885. window.speechSynthesis.speak(utterance);
  886. }
  887. }
  888. //api for saving
  889. //for sweet alert
  890. function showSuccessAlert() {
  891. Swal.fire({
  892. icon: 'success',
  893. title: 'Complaint Registration Success',
  894. text: 'Complaint Number 123456. Use this Number for Complaint Status Check.',
  895. confirmButtonText: 'Back to Home',
  896. confirmButtonColor: '#3085d6',
  897. }).then((result) => {
  898. if (result.isConfirmed) {
  899. window.location.href = 'home';
  900. }
  901. });
  902. }
  903. //Script For Map
  904. var suggestedRoadName;
  905. var suggestedWard;
  906. var suggestedZone;
  907. var suggestedRoadId;
  908. function initializeMap() {
  909. // Create the map
  910. var map = L.map('map', {attributionControl: false}).setView([13.0827, 80.2707], 9);
  911. // Add tile layer and track loading status
  912. var tileLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  913. maxZoom: 19,
  914. attributionControl: false,
  915. }).addTo(map);
  916. // Hide loader once the map tiles are fully loaded
  917. tileLayer.on('load', function () {
  918. document.getElementById('loader').style.display = 'none';
  919. document.getElementById('map').style.visibility = 'visible'; // Ensure map is visible
  920. });
  921. var currentMarker = null;
  922. // Handle map click events
  923. map.on('click', function (e) {
  924. var lat = e.latlng.lat;
  925. var lng = e.latlng.lng;
  926. if (currentMarker) {
  927. map.removeLayer(currentMarker);
  928. }
  929. currentMarker = L.marker([lat, lng]).addTo(map);
  930. fetchLocationInfoByMap(lat, lng, currentMarker);
  931. });
  932. // Handle input events in the search box
  933. document.getElementById('search-box').addEventListener('input', function () {
  934. var query = this.value.trim();
  935. if (query.length > 2) {
  936. fetchSuggestions(query);
  937. } else {
  938. document.getElementById('suggestions').style.display = 'none';
  939. }
  940. });
  941. // Handle click events on suggestions
  942. document.getElementById('suggestions').addEventListener('click', function (e) {
  943. if (e.target.tagName === 'LI') {
  944. var latlngArray = JSON.parse(e.target.dataset.latlng);
  945. suggestedRoadId = e.target.dataset.roadId;
  946. suggestedRoadName = e.target.dataset.roadName;
  947. suggestedWard = e.target.dataset.ward;
  948. suggestedZone = e.target.dataset.zone;
  949. // Check if the data is in the correct format
  950. if (Array.isArray(latlngArray) && latlngArray.every(item => Array.isArray(item) && item.length === 2 && typeof item[0] === 'number' && typeof item[1] === 'number')) {
  951. // Calculate the average latitude and longitude
  952. var totalLat = 0;
  953. var totalLng = 0;
  954. latlngArray.forEach(function (coords) {
  955. totalLat += coords[1]; // Latitude
  956. totalLng += coords[0]; // Longitude
  957. });
  958. var avgLat = totalLat / latlngArray.length;
  959. var avgLng = totalLng / latlngArray.length;
  960. var latlng = [avgLat, avgLng];
  961. map.setView(latlng, 14);
  962. if (currentMarker) {
  963. map.removeLayer(currentMarker);
  964. }
  965. currentMarker = L.marker(latlng).addTo(map);
  966. fetchLocationInfoBySuggestions(latlng[0], latlng[1], currentMarker);
  967. // Clear the search box value
  968. document.getElementById('search-box').value = '';
  969. // Hide the suggestions
  970. document.getElementById('suggestions').style.display = 'none';
  971. } else {
  972. // Convert the incorrect format into the correct format
  973. const flattenCoordinates = (data) => {
  974. return data.reduce((acc, item) => {
  975. if (Array.isArray(item) && Array.isArray(item[0])) {
  976. // If item is a nested array, flatten it
  977. acc.push(...flattenCoordinates(item));
  978. } else if (Array.isArray(item) && item.length === 2 && typeof item[0] === 'number' && typeof item[1] === 'number') {
  979. // If item is a coordinate pair, add it to the list
  980. acc.push(item);
  981. }
  982. return acc;
  983. }, []);
  984. };
  985. // Flatten the nested latlngArray
  986. var flattenedLatlngArray = flattenCoordinates(latlngArray);
  987. // Now, continue with the same logic as before
  988. var totalLat = 0;
  989. var totalLng = 0;
  990. flattenedLatlngArray.forEach(function (coords) {
  991. totalLat += coords[1]; // Latitude
  992. totalLng += coords[0]; // Longitude
  993. });
  994. var avgLat = totalLat / flattenedLatlngArray.length;
  995. var avgLng = totalLng / flattenedLatlngArray.length;
  996. var latlng = [avgLat, avgLng];
  997. map.setView(latlng, 14);
  998. if (currentMarker) {
  999. map.removeLayer(currentMarker);
  1000. }
  1001. currentMarker = L.marker(latlng).addTo(map);
  1002. fetchLocationInfoBySuggestions(latlng[0], latlng[1], currentMarker);
  1003. // Clear the search box value
  1004. document.getElementById('search-box').value = '';
  1005. // Hide the suggestions
  1006. document.getElementById('suggestions').style.display = 'none';
  1007. }
  1008. }
  1009. });
  1010. }
  1011. function fetchSuggestions(query) {
  1012. // ArcGIS API URL to fetch suggestions based on the input query
  1013. const arcgisSuggestionUrl = `https://gisgcc.chennaicorporation.gov.in/server/rest/services/Hosted/Road_API/FeatureServer/0/query?where=UPPER(road_name)%20LIKE%20'%25${query.toUpperCase()}%25'&outFields=road_name,zone,ward,road_id&returnGeometry=true&f=geojson`;
  1014. fetch(arcgisSuggestionUrl)
  1015. .then(response => response.json())
  1016. .then(data => {
  1017. var suggestions = document.getElementById('suggestions');
  1018. suggestions.innerHTML = '';
  1019. if (data.features && data.features.length > 0) {
  1020. suggestions.style.display = 'block';
  1021. var ul = document.createElement('ul');
  1022. data.features.forEach(function (result) {
  1023. var lat = result.geometry.coordinates[1];
  1024. var lng = result.geometry.coordinates[0];
  1025. var roadName = result.properties.road_name || 'Unknown Road';
  1026. var zone = result.properties.zone || 'Unknown Zone';
  1027. var ward = result.properties.ward || 'Unknown Ward';
  1028. var roadId = result.properties.road_id || 'Unknown Road ID'
  1029. // Creating the suggestion item with road name, zone, and ward
  1030. var li = document.createElement('li');
  1031. li.textContent = `${roadName} - Zone: ${zone}, Ward: ${ward}`;
  1032. li.dataset.latlng = JSON.stringify([lat, lng]);
  1033. li.dataset.roadName = roadName;
  1034. li.dataset.roadId = roadId;
  1035. li.dataset.zone = zone;
  1036. li.dataset.ward = ward;
  1037. ul.appendChild(li);
  1038. });
  1039. suggestions.appendChild(ul);
  1040. } else {
  1041. suggestions.style.display = 'none';
  1042. }
  1043. })
  1044. .catch(error => console.error('Error fetching suggestions:', error));
  1045. }
  1046. function fetchLocationInfoByMap(lat, lng, marker) {
  1047. const arcgisUrl = `https://gisgcc.chennaicorporation.gov.in/server/rest/services/Hosted/Road_API/FeatureServer/0/query?where=&objectIds=&time=&geometry=%7B%22y%22%3A${lat}%2C%22x%22%3A${lng}%7D&geometryType=esriGeometryEnvelope&inSR=4326&defaultSR=4326&spatialRel=esriSpatialRelIntersects&distance=25&units=esriSRUnit_Meter&relationParam=&outFields=zone%2Cward%2Croad_id%2Croad_name&returnGeometry=false&maxAllowableOffset=&geometryPrecision=&outSR=&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnCentroid=false&timeReferenceUnknownClient=false&maxRecordCountFactor=&sqlFormat=none&resultType=&datumTransformation=&lodType=geohash&lod=&lodSR=&f=geojson`;
  1048. fetch(arcgisUrl)
  1049. .then(response => response.json())
  1050. .then(data => {
  1051. console.log(data);
  1052. let info;
  1053. if (data.features && data.features.length > 0) {
  1054. const properties = data.features[0].properties;
  1055. const roadName = properties.road_name || 'N/A';
  1056. const zone = properties.zone || 'N/A';
  1057. const ward = properties.ward || 'N/A';
  1058. const roadId = properties.road_id || 'N/A';
  1059. info = `Road Name: ${roadName}<br>Zone: ${zone}<br>Ward: ${ward}<br>Latitude: ${lat}<br>Longitude: ${lng}`;
  1060. document.getElementById("street").value = roadName;
  1061. document.getElementById("latitude_field").value = lat;
  1062. document.getElementById("longitude_field").value = lng;
  1063. document.getElementById("street_id").value = roadId;
  1064. document.getElementById("landmark").value = roadName;
  1065. marker.bindTooltip(info, {permanent: false, direction: 'top'}).openTooltip();
  1066. } else {
  1067. document.getElementById("street").value = "No road data found for this location";
  1068. document.getElementById("latitude_field").value = "No latitude data found for this location";
  1069. document.getElementById("longitude_field").value = "No latitude data found for this location";
  1070. document.getElementById("street_id").value = "No street id data found for this location";
  1071. document.getElementById("landmark").value = "No landmark data found for this location";
  1072. info = `No road data found for this location`
  1073. marker.bindTooltip(info, {permanent: false, direction: 'top'}).openTooltip();
  1074. }
  1075. })
  1076. .catch(error => {
  1077. console.error('Error fetching road data:', error);
  1078. marker.bindTooltip(`Error fetching road data.<br>Latitude: ${lat}<br>Longitude: ${lng}`, {permanent: false, direction: 'top'}).openTooltip();
  1079. });
  1080. }
  1081. function fetchLocationInfoBySuggestions(lat, lng, marker) {
  1082. const arcgisUrl = `https://gisgcc.chennaicorporation.gov.in/server/rest/services/Hosted/Road_API/FeatureServer/0/query?where=&objectIds=&time=&geometry=%7B%22y%22%3A${lat}%2C%22x%22%3A${lng}%7D&geometryType=esriGeometryEnvelope&inSR=4326&defaultSR=4326&spatialRel=esriSpatialRelIntersects&distance=25&units=esriSRUnit_Meter&relationParam=&outFields=zone%2Cward%2Croad_id%2Croad_name&returnGeometry=false&maxAllowableOffset=&geometryPrecision=&outSR=&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnCentroid=false&timeReferenceUnknownClient=false&maxRecordCountFactor=&sqlFormat=none&resultType=&datumTransformation=&lodType=geohash&lod=&lodSR=&f=geojson`;
  1083. fetch(arcgisUrl)
  1084. .then(response => response.json())
  1085. .then(data => {
  1086. console.log(data);
  1087. let info;
  1088. if (data.features && data.features.length > 0) {
  1089. const properties = data.features[0].properties;
  1090. const roadName = properties.road_name || 'N/A';
  1091. const zone = properties.zone || 'N/A';
  1092. const ward = properties.ward || 'N/A';
  1093. const roadId = properties.road_id || 'N/A';
  1094. info = `Road Name: ${roadName}<br>Zone: ${zone}<br>Ward: ${ward}<br>Latitude: ${lat}<br>Longitude: ${lng}`;
  1095. document.getElementById("street").value = roadName;
  1096. document.getElementById("latitude_field").value = lat;
  1097. document.getElementById("longitude_field").value = lng;
  1098. document.getElementById("street_id").value = roadId;
  1099. document.getElementById("landmark").value = roadName;
  1100. marker.bindTooltip(info, {permanent: false, direction: 'top'}).openTooltip();
  1101. } else {
  1102. document.getElementById("street").value = suggestedRoadName;
  1103. document.getElementById("latitude_field").value = lat;
  1104. document.getElementById("longitude_field").value = lng;
  1105. document.getElementById("street_id").value = suggestedRoadId;
  1106. document.getElementById("landmark").value = suggestedRoadName;
  1107. info = `Road Name: ${suggestedRoadName}<br>Zone: ${suggestedZone}<br>Ward: ${suggestedWard}<br>Latitude: ${lat}<br>Longitude: ${lng}`
  1108. marker.bindTooltip(info, {permanent: false, direction: 'top'}).openTooltip();
  1109. }
  1110. })
  1111. .catch(error => {
  1112. console.error('Error fetching road data:', error);
  1113. marker.bindTooltip(`Error fetching road data.<br>Latitude: ${lat}<br>Longitude: ${lng}`, {permanent: false, direction: 'top'}).openTooltip();
  1114. });
  1115. }
  1116. //script for map
  1117. //for saving...
  1118. /* $(document).ready(function () {
  1119. $('#submitButton').click(function (e) {
  1120. e.preventDefault(); // Prevent the default form submission
  1121. var complainantName = $('#summaryName').text().trim();
  1122. var complainantAddr = $('#summaryStreet').text().trim();
  1123. var mobileNo = $('#summaryMobile').text().trim();
  1124. var email = $('#summaryEmail').text().trim();
  1125. var complaintType = $('#summaryComplaintType').text().trim();
  1126. var complaintTitle = $('#summaryComplaintTitle').text().trim();
  1127. var complaintDetails = $('#summaryDescription').text().trim();
  1128. var streetId = $('#summaryStreetId').text().trim();
  1129. var landmark = $('#summaryLandmark').text().trim();
  1130. var latitude = $('#summaryLatitude').text().trim();
  1131. var longtitude = $('#summaryLongitude').text().trim();
  1132. var gender = $('#summaryGender').text().trim();
  1133. var imageSrc = $('#summaryImage').attr('src');
  1134. console.log({
  1135. serviceId: 'RegComplaint',
  1136. ComplainantName: complainantName,
  1137. ComplainantAddr: complainantAddr,
  1138. MobileNo: mobileNo,
  1139. Email: email,
  1140. ComplaintType: complaintType,
  1141. ComplaintTitle: complaintTitle,
  1142. ComplaintDetails: complaintDetails,
  1143. StreetId: streetId,
  1144. Comp_Image: imageSrc,
  1145. latitude: latitude,
  1146. longtitude: longtitude,
  1147. Landmark: landmark,
  1148. gender: gender
  1149. });
  1150. // AJAX call to the API
  1151. $.ajax({
  1152. url: 'https://erp.chennaicorporation.gov.in/pgr/external/mobileservice',
  1153. type: 'POST',
  1154. data: {
  1155. serviceId: 'RegComplaint',
  1156. ComplainantName: complainantName,
  1157. ComplainantAddr: complainantAddr,
  1158. MobileNo: mobileNo,
  1159. Email: email,
  1160. ComplaintType: complaintType,
  1161. ComplaintTitle: complaintTitle,
  1162. ComplaintDetails: complaintDetails,
  1163. StreetId: streetId,
  1164. Comp_Image: imageSrc,
  1165. latitude: latitude,
  1166. longtitude: longtitude,
  1167. Landmark: landmark,
  1168. gender: gender
  1169. },
  1170. success: function (response) {
  1171. // Handle success response
  1172. console.log('Success:', response);
  1173. alert('Complaint registered successfully!');
  1174. // You can also redirect or reset the form here
  1175. },
  1176. error: function (xhr, status, error) {
  1177. // Improved error handling
  1178. console.log('Error:', xhr.responseText, status, error);
  1179. alert('Error: ' + xhr.status + ' ' + xhr.statusText);
  1180. }
  1181. });
  1182. });
  1183. }); */
  1184. $(document).ready(function () {
  1185. $('#submitButton').click(function (e) {
  1186. e.preventDefault(); // Prevent the default form submission
  1187. // Collect data from the form fields
  1188. var complainantName = $('#summaryName').text().trim();
  1189. var complainantAddr = $('#summaryStreet').text().trim();
  1190. var mobileNo = $('#summaryMobile').text().trim();
  1191. var email = $('#summaryEmail').text().trim();
  1192. var complaintType = $('#summaryComplaintType').text().trim();
  1193. var complaintTitle = $('#summaryComplaintTitle').text().trim();
  1194. var complaintDetails = $('#summaryDescription').text().trim();
  1195. var streetId = $('#summaryStreetId').text().trim();
  1196. var landmark = $('#summaryLandmark').text().trim();
  1197. var latitude = $('#summaryLatitude').text().trim();
  1198. var longtitude = $('#summaryLongitude').text().trim(); // Note the misspelling
  1199. var gender = $('#summaryGender').text().trim();
  1200. var imageSrc = $('#summaryImage').attr('src');
  1201. console.log({
  1202. ComplainantName: complainantName,
  1203. ComplainantAddr: complainantAddr,
  1204. MobileNo: mobileNo,
  1205. Email: email,
  1206. ComplaintType: complaintType,
  1207. ComplaintTitle: complaintTitle,
  1208. ComplaintDetails: complaintDetails,
  1209. StreetId: streetId,
  1210. Comp_Image: imageSrc,
  1211. latitude: latitude,
  1212. longtitude: longtitude,
  1213. Landmark: landmark,
  1214. gender: gender
  1215. });
  1216. // AJAX call to your backend controller
  1217. $.ajax({
  1218. url: '/register', // Update to your Spring Boot endpoint
  1219. type: 'POST',
  1220. data: {
  1221. ComplainantName: complainantName,
  1222. ComplainantAddr: complainantAddr,
  1223. MobileNo: mobileNo,
  1224. Email: email,
  1225. ComplaintType: complaintType,
  1226. ComplaintTitle: complaintTitle,
  1227. ComplaintDetails: complaintDetails,
  1228. StreetId: streetId,
  1229. Comp_Image: imageSrc,
  1230. latitude: latitude,
  1231. longtitude: longtitude,
  1232. Landmark: landmark,
  1233. gender: gender
  1234. },
  1235. success: function (response) {
  1236. // SweetAlert upon success
  1237. Swal.fire({
  1238. title: 'Success!',
  1239. text: 'Your complaint has been submitted.',
  1240. icon: 'success',
  1241. confirmButtonText: 'OK'
  1242. }).then((result) => {
  1243. if (result.isConfirmed) {
  1244. // Redirect to home.html after clicking 'OK'
  1245. window.location.href = 'home';
  1246. }
  1247. });
  1248. },
  1249. error: function (xhr, status, error) {
  1250. // Improved error handling
  1251. console.log('Error:', xhr.responseText, status, error);
  1252. alert('Error: ' + xhr.status + ' ' + xhr.statusText);
  1253. }
  1254. });
  1255. });
  1256. });
  1257. </script>
  1258. </body>
  1259. </html>