@ -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)
@ -2709,6 +2721,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 >