Browse Source

Added road works Modules

master
Hariprasath S 1 week ago
parent
commit
343cb31a35
  1. 8
      .classpath
  2. 9
      src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java
  3. 230
      src/main/java/in/gov/chennaicorporation/gccoffice/works/controller/APIContoller.java
  4. 22
      src/main/java/in/gov/chennaicorporation/gccoffice/works/controller/MainController.java
  5. 4
      src/main/java/in/gov/chennaicorporation/gccoffice/works/service/ERPEstimateService.java
  6. 1865
      src/main/java/in/gov/chennaicorporation/gccoffice/works/service/EstimateService.java
  7. 4
      src/main/resources/application.properties
  8. 2
      src/main/resources/templates/fragments/modules/works/edit_stage_script.html
  9. 14
      src/main/resources/templates/fragments/modules/works/script.html
  10. 4
      src/main/resources/templates/fragments/modules/works/user_works_update_script.html
  11. 4
      src/main/resources/templates/fragments/modules/works/user_works_view_script.html
  12. 2
      src/main/resources/templates/fragments/modules/works/works_view_script.html
  13. 3931
      src/main/resources/templates/modules/works/addworkspage.html
  14. 4
      src/main/resources/templates/modules/works/erp-works-list.html
  15. 16
      src/main/resources/templates/modules/works/erp-works-update.html
  16. 27
      src/main/resources/templates/modules/works/erpworkslist.html
  17. 34
      src/main/resources/templates/modules/works/erpworkslist_old.html
  18. 4
      src/main/resources/templates/modules/works/erpworkslist_report.html
  19. 14
      src/main/resources/templates/modules/works/non-erp-works-add.html
  20. 79
      src/main/resources/templates/modules/works/nonerpworkslist.html
  21. 4
      src/main/resources/templates/modules/works/project_status_update.html

8
.classpath

@ -9,7 +9,6 @@
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
@ -29,12 +28,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

9
src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java

@ -24,15 +24,14 @@ import java.util.Properties;
@EnableTransactionManagement
public class DataSourceConfig {
private static String host = "localhost:3306";
private static String dbpassword = "root";
// private static String host = "localhost:3306";
// private static String dbpassword = "root";
// private static String dbpassword = "gccroot";
// AWS
// private static String host =
// "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306";
// private static String dbpassword = "gcc-facial-password";
private static String host ="gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306";
private static String dbpassword = "gcc-facial-password";
////////////////////////////// (For GCC APP) ////////////////////////
@Configuration

230
src/main/java/in/gov/chennaicorporation/gccoffice/works/controller/APIContoller.java

@ -19,7 +19,7 @@ import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/gcc/works/api/estimates")
@RequestMapping("/gcc/api/works/estimates")
public class APIContoller {
@ -901,4 +901,232 @@ public class APIContoller {
return ResponseEntity.status(500).body(response);
}
}
//added by hariprasath
@GetMapping("/getWorkDetailsById")
@ResponseBody
public List<Map<String, Object>> getWorkDetailsById(
@RequestParam("estid") String estid) {
return estimateService.getWorkDetailsById(estid);
}
@GetMapping("/addWorksQuestions")
@ResponseBody
public List<Map<String, Object>> getQuestions(
@RequestParam("subcategory_id") int subcategoryId) {
return estimateService.getQuestions(subcategoryId);
}
@GetMapping("/subquestions")
@ResponseBody
public List<Map<String, Object>> getSubQuestions(
@RequestParam("aam_id") int aamId) {
return estimateService.getSubQuestions(aamId);
}
@GetMapping("/getzones")
@ResponseBody
public List<Map<String, Object>> getZones() {
return estimateService.getZones();
}
@GetMapping("/getwards")
@ResponseBody
public List<Map<String, Object>> getWards(
@RequestParam("zone") String zone) {
return estimateService.getWards(zone);
}
@GetMapping("/getroadsbyward")
@ResponseBody
public List<Map<String, Object>> getRoadNamesByWard(
@RequestParam("ward") String ward) {
return estimateService.getRoadNamesByWard(ward);
}
@PostMapping("/addWorkDetails")
@ResponseBody
public Map<String, Object> addWorkDetails(@RequestBody Map<String, Object> request) {
Map<String, Object> response = new HashMap<>();
try {
List<Map<String, Object>> details = (List<Map<String, Object>>) request.get("details");
List<Map<String, Object>> textDetails = (List<Map<String, Object>>) request.get("textDetails");
Integer createdBy = Integer.valueOf(String.valueOf(request.get("createdBy")));
Integer estid = Integer.valueOf(String.valueOf(request.get("estid")));
Integer subCatId = Integer.valueOf(String.valueOf(request.get("subcategory_id")));
String estimateNo = String.valueOf(request.get("estimate_no"));
// SUBCATEGORY 4 - DUPLICATE ROAD VALIDATION
if (subCatId == 4) {
String duplicateRoad = estimateService.checkDuplicateRoad(estid, textDetails);
if (duplicateRoad != null) {
response.put("status", false);
response.put("message", "Already " + duplicateRoad + " has been mapped for this Estimation");
return response;
}
}
estimateService.saveAllWorkDetails(createdBy, estid,estimateNo,subCatId , details, textDetails);
response.put("status", true);
response.put("message", "Work details saved successfully");
} catch (Exception e) {
e.printStackTrace();
response.put("status", false);
response.put("message", "Unable to save work details");
}
return response;
}
@GetMapping("/getSavedDetails")
@ResponseBody
public List<Map<String, Object>> getSavedWorkDetails(
@RequestParam("estid") int estid) {
return estimateService.getSavedWorkDetails(estid);
}
@PostMapping("/deleteSavedDetails")
@ResponseBody
public Map<String, Object> deleteSavedWorkDetails(@RequestParam("createdBy") int createdBy,
@RequestParam("estid") int estid, @RequestParam("ref_id") int refId) {
try {
return estimateService.deleteSavedWorkDetails(createdBy, estid, refId);
} catch (Exception e) {
e.printStackTrace();
Map<String, Object> response = new HashMap<>();
response.put("status", false);
response.put("message", "Unable to remove work details");
return response;
}
}
@GetMapping("/getEditDetails")
@ResponseBody
public List<Map<String, Object>> getEditWorkDetails(@RequestParam("estid") int estid,
@RequestParam("ref_id") int refId, @RequestParam("subcategory_id") int subcategoryId) {
return estimateService.getEditWorkDetails(estid, refId, subcategoryId);
}
@PostMapping("/updateSavedDetails")
@ResponseBody
public Map<String, Object> updateSavedWorkDetails(@RequestBody Map<String, Object> request) {
try {
Integer estid = Integer.valueOf(String.valueOf(request.get("estid")));
Integer refId = Integer.valueOf(String.valueOf(request.get("ref_id")));
Integer subcategoryId = Integer.valueOf(String.valueOf(request.get("subcategory_id")));
Integer createdBy = Integer.valueOf(String.valueOf(request.get("createdBy")));
String estimateNo =String.valueOf(request.get("estimate_no"));
List<Map<String, Object>> details = (List<Map<String, Object>>) request.get("details");
List<Map<String, Object>> textDetails = (List<Map<String, Object>>) request.get("textDetails");
/*
* Duplicate ROAD validation
*/
if (subcategoryId == 4) {
String duplicateRoad = estimateService.checkDuplicateRoadForUpdate(estid, refId, textDetails);
if (duplicateRoad != null) {
Map<String, Object> response = new HashMap<>();
response.put("status", false);
response.put("message", "Already " + duplicateRoad + " present in Database");
return response;
}
}
return estimateService.updateSavedWorkDetails(createdBy, estid, refId, estimateNo, subcategoryId, details,textDetails);
} catch (Exception e) {
e.printStackTrace();
Map<String, Object> response = new HashMap<>();
response.put("status", false);
response.put("message", "Unable to update work details");
return response;
}
}
@GetMapping("/checkWorkProgress")
@ResponseBody
public Map<String, Object> checkWorkProgress(@RequestParam("estid") int estid, @RequestParam("ref_id") int refId) {
Map<String, Object> response = new HashMap<>();
try {
boolean started = estimateService.isWorkProgressStarted(estid, refId);
response.put("status", true);
response.put("workStarted", started);
if (started) {
response.put("message", "Work progress is started, Unable to edit or remove");
}
} catch (Exception e) {
e.printStackTrace();
response.put("status", false);
response.put("message", "Unable to check work progress");
}
return response;
}
}

22
src/main/java/in/gov/chennaicorporation/gccoffice/works/controller/MainController.java

@ -223,4 +223,26 @@ public class MainController {
return BasePath + "project_status_update";
}
@GetMapping("/addworks")
public String addworksWebPage(
Model model,
@RequestParam(value = "estid", required = false) String estid,
@RequestParam(value = "sub_category_id", required = false) Integer sub_category_id,
@RequestParam(value = "estimate_no", required = false) String estimate_no,
@RequestParam(value = "sub_category", required = false) String sub_category)
{
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId", LoginUserId);
model.addAttribute("estid", estid);
model.addAttribute("sub_category_id", sub_category_id);
model.addAttribute("estimate_no", estimate_no);
model.addAttribute("sub_category", sub_category);
return BasePath + "addworkspage";
}
}

4
src/main/java/in/gov/chennaicorporation/gccoffice/works/service/ERPEstimateService.java

@ -240,8 +240,8 @@ public class ERPEstimateService {
String loginId,
String finYear, String oValue) {
StringBuilder sql = new StringBuilder("SELECT ew.`estid`, ew.`estimate_no`, DATE(ew.`estimate_date`) AS `estimate_date`,"
+ "ew.`zone`, ew.`ward`, dm.dept_name as `department`, wm.name as `category`, "
+ "trim(tm.description) as `sub_category`, ew.`project_name`, ew.`estimation_amount`, ew.`est_val_with_oh` FROM erp_works ew "
+ "ew.`zone`, ew.`ward`, dm.dept_name as `department`, wm.name as `category`, ew.`sub_category` as sub_category_id, "
+ "trim(tm.description) as `sub_category`, ew.`project_name`, ew.`estimation_amount`, ew.`est_val_with_oh` FROM works_details ew "
+ "LEFT JOIN department_master dm ON dm.id = ew.department "
+ "LEFT JOIN workstype_master wm ON wm.id = ew.category "
+ "LEFT JOIN typeofwork_master tm ON tm.id = ew.sub_category");

1865
src/main/java/in/gov/chennaicorporation/gccoffice/works/service/EstimateService.java
File diff suppressed because it is too large
View File

4
src/main/resources/application.properties

@ -1,5 +1,5 @@
spring.profiles.active=local
#spring.profiles.active=production
#spring.profiles.active=local
spring.profiles.active=production
#For Server production
#assets.base-url=/gcc/assets/
#For local test

2
src/main/resources/templates/fragments/modules/works/edit_stage_script.html

@ -56,7 +56,7 @@ function get_works_stage_data_data(){
function get_works_stage_details() {
var formData = new FormData();
var apiUrl = '/gcc/works/api/estimates/getUserEstWorkDetailsById?estid='+estid;
var apiUrl = '/gcc/api/works/estimates/getUserEstWorkDetailsById?estid='+estid;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({

14
src/main/resources/templates/fragments/modules/works/script.html

@ -26,7 +26,7 @@
}
function loadScheme() {
fetch('/gcc/works/api/estimates/getSchemeList')
fetch('/gcc/api/works/estimates/getSchemeList')
.then(response => response.json())
.then(data => {
let schemeDropdown = document.getElementById('erpscheme');
@ -43,7 +43,7 @@
}
function loadCategory() {
fetch('/gcc/works/api/estimates/getCategoryList')
fetch('/gcc/api/works/estimates/getCategoryList')
.then(response => response.json())
.then(data => {
let categoryDropdown = document.getElementById('erpcategory');
@ -60,7 +60,7 @@
}
function loadSubCategory() {
fetch('/gcc/works/api/estimates/getSubCategoryList')
fetch('/gcc/api/works/estimates/getSubCategoryList')
.then(response => response.json())
.then(data => {
let subCategoryDropdown = document.getElementById('erpsubcategory');
@ -77,7 +77,7 @@
}
function loadDepartment() {
fetch('/gcc/works/api/estimates/getDepartmentList')
fetch('/gcc/api/works/estimates/getDepartmentList')
.then(response => response.json())
.then(data => {
let departmentDropdown = document.getElementById('erpdepartment');
@ -94,7 +94,7 @@
}
function loadSource() {
fetch('/gcc/works/api/estimates/getSourceofFundList')
fetch('/gcc/api/works/estimates/getSourceofFundList')
.then(response => response.json())
.then(data => {
let SourceDropDown = document.getElementById('erpfundsource');
@ -131,7 +131,7 @@
}
function loadDepartmentFilter() {
fetch('/gcc/works/api/estimates/getDepartmentList')
fetch('/gcc/api/works/estimates/getDepartmentList')
.then(response => response.json())
.then(data => {
let departmentDropdown = document.getElementById('departmentf');
@ -148,7 +148,7 @@
}
function loadSourceFilter() {
fetch('/gcc/works/api/estimates/getSourceofFundList')
fetch('/gcc/api/works/estimates/getSourceofFundList')
.then(response => response.json())
.then(data => {
let SourceDropDown = document.getElementById('fundsourcef');

4
src/main/resources/templates/fragments/modules/works/user_works_update_script.html

@ -179,7 +179,7 @@
function get_works_update_details() {
var formData = new FormData();
var apiUrl = '/gcc/works/api/estimates/getUserEstWorkDetailsById?estid='+estid;
var apiUrl = '/gcc/api/works/estimates/getUserEstWorkDetailsById?estid='+estid;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
@ -193,13 +193,11 @@
resolve(jsonResponse);
}else{
//call_petition_search_from("Invalid Petition Number: Please provide a valid petition number.");
console.log('Fetched petition details ('+petitionNo+') Is null:');
}
},
error: function(xhr, status, error) {
// Reject the Promise with the error message
console.error('Error fetching petition details ('+petitionNo+'):', error.message);
reject(error);
}
});

4
src/main/resources/templates/fragments/modules/works/user_works_view_script.html

@ -174,7 +174,7 @@
function get_works_details() {
var formData = new FormData();
var apiUrl = '/gcc/works/api/estimates/getUserEstWorkDetailsById?estid='+estid;
var apiUrl = '/gcc/api/works/estimates/getUserEstWorkDetailsById?estid='+estid;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
@ -253,7 +253,7 @@
}
function getStageList(estid){
var formData = new FormData();
var apiUrl = '/gcc/works/api/estimates/getUserEstWorkStageDetailsByEstid?estid='+estid;
var apiUrl = '/gcc/api/works/estimates/getUserEstWorkStageDetailsByEstid?estid='+estid;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({

2
src/main/resources/templates/fragments/modules/works/works_view_script.html

@ -62,7 +62,7 @@
function get_works_details() {
var formData = new FormData();
var apiUrl = '/gcc/works/api/estimates/getestimateworkdetailsById?estid='+estid;
var apiUrl = '/gcc/api/works/estimates/getestimateworkdetailsById?estid='+estid;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({

3931
src/main/resources/templates/modules/works/addworkspage.html
File diff suppressed because it is too large
View File

4
src/main/resources/templates/modules/works/erp-works-list.html

@ -318,7 +318,7 @@
//alert("finYear:"+finYear);
//alert("oValue:"+oValue);
var apiUrl = '/gcc/works/api/estimates/getFilteredERpWorksList?loginId='+createdBy+'&finYear='+finYear+'&oValue='+oValue;
var apiUrl = '/gcc/api/works/estimates/getFilteredERpWorksList?loginId='+createdBy+'&finYear='+finYear+'&oValue='+oValue;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
@ -714,7 +714,7 @@
formData.set("isiconic", iconicProjectValue);
$.ajax({
url: "/gcc/works/api/estimates/saveEstimateWorkDetails",
url: "/gcc/api/works/estimates/saveEstimateWorkDetails",
type: "POST",
contentType: false,
processData: false,

16
src/main/resources/templates/modules/works/erp-works-update.html

@ -550,7 +550,7 @@
// AJAX call
$.ajax({
url: "/gcc/works/api/estimates/getERPWorksDetails",
url: "/gcc/api/works/estimates/getERPWorksDetails",
type: "GET",
data: requestData,
dataType: "json",
@ -724,7 +724,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
function loadScheme() {
fetch('/gcc/works/api/estimates/getSchemeList')
fetch('/gcc/api/works/estimates/getSchemeList')
.then(response => response.json())
.then(data => {
let schemeDropdown = document.getElementById('scheme');
@ -741,7 +741,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
function loadCategory() {
fetch('/gcc/works/api/estimates/getCategoryList')
fetch('/gcc/api/works/estimates/getCategoryList')
.then(response => response.json())
.then(data => {
let categoryDropdown = document.getElementById('category');
@ -758,7 +758,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
function loadSubCategory() {
fetch('/gcc/works/api/estimates/getSubCategoryList')
fetch('/gcc/api/works/estimates/getSubCategoryList')
.then(response => response.json())
.then(data => {
let subCategoryDropdown = document.getElementById('subcategory');
@ -775,7 +775,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
function loadDepartment() {
fetch('/gcc/works/api/estimates/getDepartmentList')
fetch('/gcc/api/works/estimates/getDepartmentList')
.then(response => response.json())
.then(data => {
let departmentDropdown = document.getElementById('department');
@ -792,7 +792,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
function loadSource() {
fetch('/gcc/works/api/estimates/getSourceofFundList')
fetch('/gcc/api/works/estimates/getSourceofFundList')
.then(response => response.json())
.then(data => {
let SourceDropDown = document.getElementById('fundsource');
@ -809,7 +809,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
function loadEstCode() {
fetch('/gcc/works/api/estimates/getEstimateCode')
fetch('/gcc/api/works/estimates/getEstimateCode')
.then(response => response.json())
.then(data => {
let estCodeDropdown = document.getElementById('estcode');
@ -877,7 +877,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
$.ajax({
url: "/gcc/works/api/estimates/save",
url: "/gcc/api/works/estimates/save",
type: "POST",
data: formData,
processData: false,

27
src/main/resources/templates/modules/works/erpworkslist.html

@ -131,6 +131,7 @@
<th>Estimation Amount</th>
<th>Order Value</th>
<th>Add Works</th>
</tr>
</thead>
<tbody>
@ -316,7 +317,7 @@
var oValue = document.getElementById('oValue').value;
//alert(finYear);
//alert(oValue);
var apiUrl = '/gcc/works/api/estimates/getFilteredERpWorksListByLogin?loginId='+createdBy+'&finYear='+finYear+'&oValue='+oValue;
var apiUrl = '/gcc/api/works/estimates/getFilteredERpWorksListByLogin?loginId='+createdBy+'&finYear='+finYear+'&oValue='+oValue;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
@ -385,6 +386,16 @@
</div>
</div>`;
AddWorksButtonHTML = `
<div>
<button id="addworksbtn"
class="btn btn-primary"
onclick="return gotopage('${row['estid']}', '${row['sub_category_id']}' ,'${row['estimate_no']}','${row['sub_category']}' );">
Add works
</button>
</div>
`;
table.row.add([
rowNum++,
actionHTML,
@ -396,7 +407,8 @@
row['sub_category'],
row['project_name'],
row['estimation_amount'],
row['est_val_with_oh']
row['est_val_with_oh'],
AddWorksButtonHTML
]);
});
@ -408,6 +420,15 @@
remove_loading(); // remove Loading
}
function gotopage(estid, subCategoryId,estimate_no,sub_category) {
var url = "/gcc/works/addworks"
+ "?estid=" + encodeURIComponent(estid)
+ "&sub_category_id=" + encodeURIComponent(subCategoryId)
+ "&estimate_no=" + encodeURIComponent(estimate_no)
+ "&sub_category=" + encodeURIComponent(sub_category);
window.open(url, "_blank");
}
function viewUserWorksSummary(estid){
$("#viewWorks").modal({
@ -726,7 +747,7 @@
formData.set("isiconic", iconicProjectValue);
$.ajax({
url: "/gcc/works/api/estimates/updateEstimateWorkDetails",
url: "/gcc/api/works/estimates/updateEstimateWorkDetails",
type: "POST",
contentType: false,
processData: false,

34
src/main/resources/templates/modules/works/erpworkslist_old.html

@ -1356,7 +1356,7 @@
});
} else {
$.ajax({
url: "/gcc/works/api/estimates/getFilteredWorks",
url: "/gcc/api/works/estimates/getFilteredWorks",
type: "GET",
data: {
zone: zone,
@ -1463,7 +1463,7 @@
$('#worksDatatable').on('click', 'td:nth-child(2)', function () {
var estimateNo = $(this).text().trim();
$.ajax({
url: '/gcc/works/api/estimates/fetchERPdetails',
url: '/gcc/api/works/estimates/fetchERPdetails',
method: 'GET',
data: {estimateNo: estimateNo},
success: function (response) {
@ -1786,7 +1786,7 @@
}
$.ajax({
url: "/gcc/works/api/estimates/updateERPEstimate",
url: "/gcc/api/works/estimates/updateERPEstimate",
type: "POST",
contentType: false,
processData: false,
@ -1940,7 +1940,7 @@
}
function loadScheme() {
fetch('/gcc/works/api/estimates/getSchemeList')
fetch('/gcc/api/works/estimates/getSchemeList')
.then(response => response.json())
.then(data => {
let schemeDropdown = document.getElementById('erpscheme');
@ -1957,7 +1957,7 @@
}
function loadCategory() {
fetch('/gcc/works/api/estimates/getCategoryList')
fetch('/gcc/api/works/estimates/getCategoryList')
.then(response => response.json())
.then(data => {
let categoryDropdown = document.getElementById('erpcategory');
@ -1974,7 +1974,7 @@
}
function loadSubCategory() {
fetch('/gcc/works/api/estimates/getSubCategoryList')
fetch('/gcc/api/works/estimates/getSubCategoryList')
.then(response => response.json())
.then(data => {
let subCategoryDropdown = document.getElementById('erpsubcategory');
@ -1991,7 +1991,7 @@
}
function loadDepartment() {
fetch('/gcc/works/api/estimates/getDepartmentList')
fetch('/gcc/api/works/estimates/getDepartmentList')
.then(response => response.json())
.then(data => {
let departmentDropdown = document.getElementById('erpdepartment');
@ -2008,7 +2008,7 @@
}
function loadSource() {
fetch('/gcc/works/api/estimates/getSourceofFundList')
fetch('/gcc/api/works/estimates/getSourceofFundList')
.then(response => response.json())
.then(data => {
let SourceDropDown = document.getElementById('erpfundsource');
@ -2045,7 +2045,7 @@
}
function loadDepartmentFilter() {
fetch('/gcc/works/api/estimates/getDepartmentList')
fetch('/gcc/api/works/estimates/getDepartmentList')
.then(response => response.json())
.then(data => {
let departmentDropdown = document.getElementById('departmentf');
@ -2062,7 +2062,7 @@
}
function loadSourceFilter() {
fetch('/gcc/works/api/estimates/getSourceofFundList')
fetch('/gcc/api/works/estimates/getSourceofFundList')
.then(response => response.json())
.then(data => {
let SourceDropDown = document.getElementById('fundsourcef');
@ -2125,7 +2125,7 @@
function fetchEstimateInformation(estimateCode) {
$.ajax({
url: '/gcc/works/api/estimates/getestimatedetails', // API to fetch employee details
url: '/gcc/api/works/estimates/getestimatedetails', // API to fetch employee details
type: 'GET',
data: {estimateCode: estimateCode}, // Pass EMPLOYEE_CODE as a parameter
success: function (response) {
@ -2255,7 +2255,7 @@
function fetchEstimateDetails(estimateCode) {
$.ajax({
url: '/gcc/works/api/estimates/getestimatedetails', // API to fetch employee details
url: '/gcc/api/works/estimates/getestimatedetails', // API to fetch employee details
type: 'GET',
data: {estimateCode: estimateCode}, // Pass EMPLOYEE_CODE as a parameter
success: function (response) {
@ -2308,7 +2308,7 @@
$(document).ready(function () {
$.ajax({
url: "/gcc/works/api/estimates/reasonlist",
url: "/gcc/api/works/estimates/reasonlist",
type: "GET",
dataType: "json",
success: function (response) {
@ -2422,7 +2422,7 @@
console.log("subCategoryId", subCategoryId)
$.ajax({
url: "/gcc/works/api/estimates/questions", // Your API endpoint
url: "/gcc/api/works/estimates/questions", // Your API endpoint
type: "GET",
data: {subCatId: subCategoryId}, // Passing sub_cat_id dynamically
dataType: "json",
@ -2684,7 +2684,7 @@
function fetchRelatedQuestions(answerId, parentDiv) {
$.ajax({
url: `/gcc/works/api/estimates/answerIdd?answerId=${answerId}`, // Your API URL
url: `/gcc/api/works/estimates/answerIdd?answerId=${answerId}`, // Your API URL
type: "GET",
dataType: "json",
success: function (response) {
@ -2818,7 +2818,7 @@
}
$.ajax({
url: "/gcc/works/api/estimates/saveErplist",
url: "/gcc/api/works/estimates/saveErplist",
type: "POST",
contentType: "application/json",
data: JSON.stringify(selectedData),
@ -2861,7 +2861,7 @@
// Fetch Saved Data for the Estimate Number
$.ajax({
url: `/gcc/works/api/estimates/fetchErpData?estimateNumber=${encodeURIComponent(estimateNo)}`,
url: `/gcc/api/works/estimates/fetchErpData?estimateNumber=${encodeURIComponent(estimateNo)}`,
type: "GET",
success: function (response) {
console.log("response>>>>>>>>>>>>>>", response)

4
src/main/resources/templates/modules/works/erpworkslist_report.html

@ -350,7 +350,7 @@
/* Get Erp works Data */
async function get_erp_work_data() {
var apiUrl = '/gcc/works/api/estimates/getFilteredERpWorksListByLogin?loginId='+createdBy;
var apiUrl = '/gcc/api/works/estimates/getFilteredERpWorksListByLogin?loginId='+createdBy;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
@ -741,7 +741,7 @@
formData.set("isiconic", iconicProjectValue);
$.ajax({
url: "/gcc/works/api/estimates/updateEstimateWorkDetails",
url: "/gcc/api/works/estimates/updateEstimateWorkDetails",
type: "POST",
contentType: false,
processData: false,

14
src/main/resources/templates/modules/works/non-erp-works-add.html

@ -585,7 +585,7 @@
}
function loadScheme() {
fetch('/gcc/works/api/estimates/getSchemeList')
fetch('/gcc/api/works/estimates/getSchemeList')
.then(response => response.json())
.then(data => {
let schemeDropdown = document.getElementById('scheme');
@ -602,7 +602,7 @@
}
function loadCategory() {
fetch('/gcc/works/api/estimates/getCategoryList')
fetch('/gcc/api/works/estimates/getCategoryList')
.then(response => response.json())
.then(data => {
let categoryDropdown = document.getElementById('category');
@ -619,7 +619,7 @@
}
function loadSubCategory() {
fetch('/gcc/works/api/estimates/getSubCategoryList')
fetch('/gcc/api/works/estimates/getSubCategoryList')
.then(response => response.json())
.then(data => {
let subCategoryDropdown = document.getElementById('subcategory');
@ -636,7 +636,7 @@
}
function loadDepartment() {
fetch('/gcc/works/api/estimates/getDepartmentList')
fetch('/gcc/api/works/estimates/getDepartmentList')
.then(response => response.json())
.then(data => {
let departmentDropdown = document.getElementById('department');
@ -653,7 +653,7 @@
}
function loadSource() {
fetch('/gcc/works/api/estimates/getSourceofFundList')
fetch('/gcc/api/works/estimates/getSourceofFundList')
.then(response => response.json())
.then(data => {
let SourceDropDown = document.getElementById('fundsource');
@ -851,7 +851,7 @@
// Submit the form data using AJAX
$.ajax({
url: "/gcc/works/api/estimates/nonerpForm",
url: "/gcc/api/works/estimates/nonerpForm",
type: "POST",
data: formData,
processData: false,
@ -894,7 +894,7 @@
$(document).ready(function () {
$.ajax({
url: "/gcc/works/api/estimates/reasonlist",
url: "/gcc/api/works/estimates/reasonlist",
type: "GET",
dataType: "json",
success: function (response) {

79
src/main/resources/templates/modules/works/nonerpworkslist.html

@ -213,12 +213,24 @@
<td th:text="${work['sub_category']}"></td>
<td th:text="${work['filenumber']}"></td>
<td th:text="${work['estimation_amount']}"></td>
<td>
<button type="button"
class="btn btn-primary btn-sm add-works-btn"
th:data-estid="${work['estid']}"
th:data-subcategory-id="${work['sub_category_id']}"
th:data-estimate-no="${work['estimate_no']}"
th:data-sub-category="${work['sub_category']}">
Add Works
</button>
</td>
<!-- <td>
<button class="btn btn-primary btn-sm view-btn"
th:attr="data-id=${work['estimate_no']}">
Add Works
</button>
</td>
</td> -->
<!-- <td>
<button class="btn btn-primary btn-sm btn-view"
th:attr="data-id=${work['estimate_no']}">
@ -947,7 +959,7 @@
/* Get Erp works Data */
async function get_erp_work_data() {
var apiUrl = '/gcc/works/api/estimates/getFilteredERpWorksList?loginId='+createdBy;
var apiUrl = '/gcc/api/works/estimates/getFilteredERpWorksList?loginId='+createdBy;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
@ -1201,7 +1213,7 @@
});
} else {
$.ajax({
url: "/gcc/works/api/estimates/getFilteredWorks",
url: "/gcc/api/works/estimates/getFilteredWorks",
type: "GET",
data: {
zone: zone,
@ -1308,7 +1320,7 @@
$('#worksDatatable').on('click', 'td:nth-child(2)', function () {
var estimateNo = $(this).text().trim();
$.ajax({
url: '/gcc/works/api/estimates/fetchnonerpdetails',
url: '/gcc/api/works/estimates/fetchnonerpdetails',
method: 'GET',
data: {estimateNo: estimateNo},
success: function (response) {
@ -1645,7 +1657,7 @@
}
$.ajax({
url: "/gcc/works/api/estimates/updateEstimate",
url: "/gcc/api/works/estimates/updateEstimate",
type: "POST",
contentType: false,
processData: false,
@ -1866,7 +1878,7 @@
}
function loadScheme() {
fetch('/gcc/works/api/estimates/getSchemeList')
fetch('/gcc/api/works/estimates/getSchemeList')
.then(response => response.json())
.then(data => {
let schemeDropdown = document.getElementById('scheme');
@ -1883,7 +1895,7 @@
}
function loadCategory() {
fetch('/gcc/works/api/estimates/getCategoryList')
fetch('/gcc/api/works/estimates/getCategoryList')
.then(response => response.json())
.then(data => {
let categoryDropdown = document.getElementById('category');
@ -1900,7 +1912,7 @@
}
function loadSubCategory() {
fetch('/gcc/works/api/estimates/getSubCategoryList')
fetch('/gcc/api/works/estimates/getSubCategoryList')
.then(response => response.json())
.then(data => {
let subCategoryDropdown = document.getElementById('subcategory');
@ -1917,7 +1929,7 @@
}
function loadDepartment() {
fetch('/gcc/works/api/estimates/getDepartmentList')
fetch('/gcc/api/works/estimates/getDepartmentList')
.then(response => response.json())
.then(data => {
let departmentDropdown = document.getElementById('department');
@ -1934,7 +1946,7 @@
}
function loadSource() {
fetch('/gcc/works/api/estimates/getSourceofFundList')
fetch('/gcc/api/works/estimates/getSourceofFundList')
.then(response => response.json())
.then(data => {
let SourceDropDown = document.getElementById('fundsource');
@ -1971,7 +1983,7 @@
}
function loadDepartmentFilter() {
fetch('/gcc/works/api/estimates/getDepartmentList')
fetch('/gcc/api/works/estimates/getDepartmentList')
.then(response => response.json())
.then(data => {
let departmentDropdown = document.getElementById('departmentf');
@ -1988,7 +2000,7 @@
}
function loadSourceFilter() {
fetch('/gcc/works/api/estimates/getSourceofFundList')
fetch('/gcc/api/works/estimates/getSourceofFundList')
.then(response => response.json())
.then(data => {
let SourceDropDown = document.getElementById('fundsourcef');
@ -2051,7 +2063,7 @@
function fetchEstimateInformation(estimateCode) {
$.ajax({
url: '/gcc/works/api/estimates/getestimatedetails', // API to fetch employee details
url: '/gcc/api/works/estimates/getestimatedetails', // API to fetch employee details
type: 'GET',
data: {estimateCode: estimateCode}, // Pass EMPLOYEE_CODE as a parameter
success: function (response) {
@ -2181,7 +2193,7 @@
function fetchEstimateDetails(estimateCode) {
$.ajax({
url: '/gcc/works/api/estimates/getestimatedetails', // API to fetch employee details
url: '/gcc/api/works/estimates/getestimatedetails', // API to fetch employee details
type: 'GET',
data: {estimateCode: estimateCode}, // Pass EMPLOYEE_CODE as a parameter
success: function (response) {
@ -2234,7 +2246,7 @@
$(document).ready(function () {
$.ajax({
url: "/gcc/works/api/estimates/reasonlist",
url: "/gcc/api/works/estimates/reasonlist",
type: "GET",
dataType: "json",
success: function (response) {
@ -2324,7 +2336,7 @@
// First, fetch the sub-category ID using its name
$.ajax({
url: "/gcc/works/api/estimates/subcategory/id",
url: "/gcc/api/works/estimates/subcategory/id",
//working one
type: "GET",
data: {name: subCategoryName},
@ -2346,7 +2358,7 @@
console.log("subCategoryId", subCategoryId)
$.ajax({
url: "/gcc/works/api/estimates/questions", // Your API endpoint
url: "/gcc/api/works/estimates/questions", // Your API endpoint
type: "GET",
data: {subCatId: subCategoryId}, // Passing sub_cat_id dynamically
dataType: "json",
@ -2486,7 +2498,7 @@
function fetchRelatedQuestions(answerId, parentDiv) {
$.ajax({
url: `/gcc/works/api/estimates/answerIdd?answerId=${answerId}`, // Your API URL
url: `/gcc/api/works/estimates/answerIdd?answerId=${answerId}`, // Your API URL
type: "GET",
dataType: "json",
success: function (response) {
@ -2596,7 +2608,7 @@
}
$.ajax({
url: "/gcc/works/api/estimates/save",
url: "/gcc/api/works/estimates/save",
type: "POST",
contentType: "application/json",
data: JSON.stringify(selectedData),
@ -2626,7 +2638,7 @@
// Fetch Saved Data for the Estimate Number
$.ajax({
url: `/gcc/works/api/estimates/fetch?estimateNumber=${encodeURIComponent(estimateNo)}`,
url: `/gcc/api/works/estimates/fetch?estimateNumber=${encodeURIComponent(estimateNo)}`,
type: "GET",
success: function (response) {
console.log("response>>>>>>>>>>>>>>", response)
@ -2710,6 +2722,33 @@
$("#dynamicCardsViewContainer").html(formHtml);
}
$(document).on("click", ".add-works-btn", function () {
var estid = $(this).data("estid");
var subCategoryId = $(this).data("subcategory-id");
var estimateNo = $(this).data("estimate-no");
var subCategory = $(this).data("sub-category");
console.log(subCategoryId,+","+subCategory);
gotopage(estid,subCategoryId,estimateNo,subCategory);
});
function gotopage(estid, subCategoryId, estimate_no, sub_category) {
var url = "/gcc/works/addworks"
+ "?estid=" + encodeURIComponent(estid)
+ "&sub_category_id=" + encodeURIComponent(subCategoryId)
+ "&estimate_no=" + encodeURIComponent(estimate_no)
+ "&sub_category=" + encodeURIComponent(sub_category);
window.open(url, "_blank");
return false;
}
</script>
</body>

4
src/main/resources/templates/modules/works/project_status_update.html

@ -306,7 +306,7 @@
async function get_erp_work_data() {
var apiUrl = '/gcc/works/api/estimates/getProjectUpdatedList?loginid='+createdBy;
var apiUrl = '/gcc/api/works/estimates/getProjectUpdatedList?loginid='+createdBy;
// Return a Promise
return new Promise(function(resolve, reject) {
$.ajax({
@ -453,7 +453,7 @@
formData.append("projectfile", projectFile);
$.ajax({
url: "/gcc/works/api/estimates/saveProjectStatus",
url: "/gcc/api/works/estimates/saveProjectStatus",
type: "POST",
contentType: false,
processData: false,

Loading…
Cancel
Save