Browse Source

first commit

master^2
SANKARASUBRAMANIAN 3 years ago
parent
commit
3281fd4055
  1. BIN
      .mvn/wrapper/maven-wrapper.jar
  2. 2
      .mvn/wrapper/maven-wrapper.properties
  3. 19
      src/main/java/com/feedback/it_asset/controller/APIController.java
  4. 79
      src/main/java/com/feedback/it_asset/controller/FeedbackController.java
  5. 4
      src/main/java/com/feedback/it_asset/entity/AssetCategory.java
  6. 8
      src/main/java/com/feedback/it_asset/entity/AssetCategoryQuestions.java
  7. 78
      src/main/java/com/feedback/it_asset/service/AssetDetailsService.java
  8. 4
      src/main/resources/application.properties
  9. 371
      src/main/resources/templates/dashboard.html
  10. 56
      src/main/resources/templates/gcc-asset-list.html
  11. 21
      src/main/resources/templates/gcc-complaint.html
  12. 2
      src/main/resources/templates/pending-complaint.html

BIN
.mvn/wrapper/maven-wrapper.jar

2
.mvn/wrapper/maven-wrapper.properties

@ -1,2 +0,0 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

19
src/main/java/com/feedback/it_asset/controller/APIController.java

@ -61,6 +61,7 @@ import com.feedback.it_asset.repository.GccAssetDetailsRep;
import com.feedback.it_asset.repository.GccFeedbackDataRep; import com.feedback.it_asset.repository.GccFeedbackDataRep;
import com.feedback.it_asset.repository.GccFeedbackRep; import com.feedback.it_asset.repository.GccFeedbackRep;
import com.feedback.it_asset.repository.GccFileDataRep; import com.feedback.it_asset.repository.GccFileDataRep;
import com.feedback.it_asset.service.AssetDetailsService;
import com.google.zxing.WriterException; import com.google.zxing.WriterException;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
@ -87,6 +88,24 @@ public class APIController {
private GccFeedbackRep gccFeedbackRep; private GccFeedbackRep gccFeedbackRep;
@Autowired @Autowired
private GccFeedbackDataRep gccFeedbackDataRep; private GccFeedbackDataRep gccFeedbackDataRep;
@Autowired
private AssetDetailsService assetDetailsService;
public APIController(AssetDetailsService assetDetailsService) {
this.assetDetailsService = assetDetailsService;
}
@GetMapping("/migrateData")
public String migrateData() {
try {
// Invoke the migrateData method from YourServiceClass
assetDetailsService.migrateData();
return "Data migration completed successfully.";
} catch (Exception e) {
e.printStackTrace();
return "Error during data migration: " + e.getMessage();
}
}
@GetMapping("/dashboard-summary") @GetMapping("/dashboard-summary")
public ResponseEntity<Map<String, Object>> getDashboardSummary() { public ResponseEntity<Map<String, Object>> getDashboardSummary() {

79
src/main/java/com/feedback/it_asset/controller/FeedbackController.java

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.feedback.it_asset.AppConfig; import com.feedback.it_asset.AppConfig;
import com.feedback.it_asset.entity.AssetCategory;
import com.feedback.it_asset.entity.AssetCategoryQuestions; import com.feedback.it_asset.entity.AssetCategoryQuestions;
import com.feedback.it_asset.entity.AssetParameterQuestions; import com.feedback.it_asset.entity.AssetParameterQuestions;
import com.feedback.it_asset.entity.GccAssetDetails; import com.feedback.it_asset.entity.GccAssetDetails;
@ -54,37 +55,73 @@ public class FeedbackController {
} }
*/ */
} }
// @GetMapping("/gcc-complaint/{qrcode}")
// public String viewPublicFeedbackForm(Model model, @PathVariable String qrcode) {
// String assetId = gccAssetDetailsRep.findByAssetCode(qrcode);
// Integer assetid = 0;
// if (assetId != null) {
// assetid = Integer.valueOf(assetId);
// }
//
// List<GccAssetDetails> assetDetailsList = gccAssetDetailsRep.findByAssetId(assetid);
// List<Integer> paramDbVal = new ArrayList<>();
// for (GccAssetDetails ad : assetDetailsList) {
// //Basic Asset Details
// model.addAttribute("assetId", ad.getAssetId());
// model.addAttribute("assetName", ad.getAssetName());
// /////////////////////
// List<AssetCategoryQuestions> assetCategoryQuestionList = assetCategoryQuestionsRep.findByCatId(ad.getAssetCategory().getcId());
// model.addAttribute("feedbackquestionlist", assetCategoryQuestionList);
// System.out.println(ad.getParamId());
// String paramDbStr = ad.getParamId().replaceAll("[\\[\\]\\s]", "");
// String[] paramIdStr = paramDbStr.split(",");
// for (String a : paramIdStr) {
// paramDbVal.add(Integer.parseInt(a));
// }
// List<AssetParameterQuestions> assetParameterQuestionList = assetParameterQuestionsRep.findByParameterId(paramDbVal);
// model.addAttribute("assetparameterquestionlist", assetParameterQuestionList);
// }
// model.addAttribute("title", "GCC Complaint Form");
// //model.addAttribute("baseurl", appConfig.getBaseUrl());
// return "gcc-complaint";
// }
@GetMapping("/gcc-complaint/{qrcode}") @GetMapping("/gcc-complaint/{qrcode}")
public String viewPublicFeedbackForm(Model model, @PathVariable String qrcode) { public String viewPublicFeedbackForm(Model model, @PathVariable String qrcode) {
String assetId = gccAssetDetailsRep.findByAssetCode(qrcode);
Integer assetid = 0;
if (assetId != null) {
assetid = Integer.valueOf(assetId);
}
String assetId = gccAssetDetailsRep.findByAssetCode(qrcode);
Integer assetid = (assetId != null) ? Integer.valueOf(assetId) : null;
List<GccAssetDetails> assetDetailsList = gccAssetDetailsRep.findByAssetId(assetid);
for (GccAssetDetails ad : assetDetailsList) {
// Basic Asset Details
model.addAttribute("assetId", ad.getAssetId());
model.addAttribute("assetName", ad.getAssetName());
List<GccAssetDetails> assetDetailsList = gccAssetDetailsRep.findByAssetId(assetid);
List<Integer> paramDbVal = new ArrayList<>();
for (GccAssetDetails ad : assetDetailsList) {
//Basic Asset Details
model.addAttribute("assetId", ad.getAssetId());
model.addAttribute("assetName", ad.getAssetName());
/////////////////////
List<AssetCategoryQuestions> assetCategoryQuestionList = assetCategoryQuestionsRep.findByCatId(ad.getAssetCategory().getcId());
AssetCategory assetCategory = ad.getAssetCategory();
if (assetCategory != null) {
model.addAttribute("assetCategoryId", assetCategory.getcId());
List<AssetCategoryQuestions> assetCategoryQuestionList = assetCategoryQuestionsRep.findByCatId(assetCategory.getcId());
model.addAttribute("feedbackquestionlist", assetCategoryQuestionList); model.addAttribute("feedbackquestionlist", assetCategoryQuestionList);
System.out.println(ad.getParamId());
String paramDbStr = ad.getParamId().replaceAll("[\\[\\]\\s]", "");
String[] paramIdStr = paramDbStr.split(",");
for (String a : paramIdStr) {
paramDbVal.add(Integer.parseInt(a));
List<Integer> paramDbVal = new ArrayList<>();
if (ad.getParamId() != null) {
String paramDbStr = ad.getParamId().replaceAll("[\\[\\]\\s]", "");
String[] paramIdStr = paramDbStr.split(",");
for (String a : paramIdStr) {
paramDbVal.add(Integer.parseInt(a));
}
} }
List<AssetParameterQuestions> assetParameterQuestionList = assetParameterQuestionsRep.findByParameterId(paramDbVal); List<AssetParameterQuestions> assetParameterQuestionList = assetParameterQuestionsRep.findByParameterId(paramDbVal);
model.addAttribute("assetparameterquestionlist", assetParameterQuestionList); model.addAttribute("assetparameterquestionlist", assetParameterQuestionList);
} }
model.addAttribute("title", "GCC Complaint Form");
//model.addAttribute("baseurl", appConfig.getBaseUrl());
return "gcc-complaint";
} }
model.addAttribute("title", "GCC Complaint Form");
return "gcc-complaint";
}
@RequestMapping(value="/gcc-complaint/save", method = RequestMethod.POST) @RequestMapping(value="/gcc-complaint/save", method = RequestMethod.POST)
public String savePublicFeedback(@RequestParam MultiValueMap<String, String> formData, public String savePublicFeedback(@RequestParam MultiValueMap<String, String> formData,
@RequestParam(name = "uname") String name, @RequestParam(name = "uname") String name,

4
src/main/java/com/feedback/it_asset/entity/AssetCategory.java

@ -15,9 +15,9 @@ import jakarta.persistence.Table;
public class AssetCategory { public class AssetCategory {
@Id @Id
@GeneratedValue(strategy= GenerationType.IDENTITY) @GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name = "cat_id",nullable = false)
@Column(name = "cat_id",nullable = true)
private Integer cId; private Integer cId;
@Column(name = "name",nullable = false)
@Column(name = "name",nullable = true)
private String catName; private String catName;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false") @Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete; private Boolean isDelete;

8
src/main/java/com/feedback/it_asset/entity/AssetCategoryQuestions.java

@ -16,17 +16,17 @@ import jakarta.persistence.Table;
public class AssetCategoryQuestions { public class AssetCategoryQuestions {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cmq_id", nullable = false)
@Column(name = "cmq_id", nullable = true)
private Integer cmqId; private Integer cmqId;
@ManyToOne @ManyToOne
@JoinColumn(name="cat_id", nullable = false)
@JoinColumn(name="cat_id", nullable = true)
private AssetCategory assetCategory; private AssetCategory assetCategory;
@Column(name = "eng_question", nullable = false)
@Column(name = "eng_question", nullable = true)
private String engQuestion; private String engQuestion;
@Column(name = "tamil_question", nullable = false)
@Column(name = "tamil_question", nullable = true)
private String tamilQuestion; private String tamilQuestion;
@Column(name = "com_group_id", nullable = true) @Column(name = "com_group_id", nullable = true)

78
src/main/java/com/feedback/it_asset/service/AssetDetailsService.java

@ -0,0 +1,78 @@
package com.feedback.it_asset.service;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.springframework.stereotype.Service;
@Service
public class AssetDetailsService {
private static final String SOURCE_JDBC_URL = "jdbc:mysql://localhost:3306/gcc_asset_details";
private static final String DESTINATION_JDBC_URL = "jdbc:mysql://localhost:3306/it_assets";
private static final String SOURCE_USERNAME = "root";
private static final String SOURCE_PASSWORD = "root";
private static final String DESTINATION_USERNAME = "root";
private static final String DESTINATION_PASSWORD = "root";
public void migrateData() {
try {
// Load the JDBC driver
Class.forName("com.mysql.cj.jdbc.Driver");
// Establish connections for source and destination databases
try (
Connection sourceConnection = DriverManager.getConnection(SOURCE_JDBC_URL, SOURCE_USERNAME, SOURCE_PASSWORD);
Connection destinationConnection = DriverManager.getConnection(DESTINATION_JDBC_URL, DESTINATION_USERNAME, DESTINATION_PASSWORD)
) {
// SQL query to fetch data from the source schema
String sqlQuery = "SELECT ta.ASSET_ID, ta.ASSET_NO, td.DEPT_NAME, tl.LOC_NAME, tsu.SEC_USER_NAME " +
"FROM tbl_asset ta " +
"JOIN tbl_mas_dept td ON ta.DEPT_ID = td.DEPT_ID " +
"JOIN tbl_mas_loc tl ON ta.LOC_ID = tl.LOC_ID " +
"JOIN tbl_mas_sec_user tsu ON ta.SECUSER_ID = tsu.SEC_USER_ID ";
// Create a prepared statement for the source database
try (PreparedStatement preparedStatementSource = sourceConnection.prepareStatement(sqlQuery)) {
// Execute the query in the source database
try (var resultSet = preparedStatementSource.executeQuery()) {
// SQL query to insert data into the destination schema for asset_data
String insertAssetDataQuery = "INSERT INTO gcc_asset_details (asset_id, asset_code, department_name, position, assign_person) VALUES (?, ?, ?, ?, ?)";
// SQL query to insert data into the destination schema for asset_category
// String insertAssetCategoryQuery = "INSERT INTO asset_category (category_name) VALUES (?)";
// Create prepared statements for the destination database
try (PreparedStatement preparedStatementDestinationAssetData = destinationConnection.prepareStatement(insertAssetDataQuery)) {
// Process the result set and insert data into the destination schema
while (resultSet.next()) {
// Insert data into asset_data table
preparedStatementDestinationAssetData.setString(1, resultSet.getString("ASSET_ID"));
preparedStatementDestinationAssetData.setString(2, resultSet.getString("ASSET_NO"));
preparedStatementDestinationAssetData.setString(3, resultSet.getString("DEPT_NAME"));
preparedStatementDestinationAssetData.setString(4, resultSet.getString("LOC_NAME"));
preparedStatementDestinationAssetData.setString(5, resultSet.getString("SEC_USER_NAME"));
int rowsAffectedAssetData = preparedStatementDestinationAssetData.executeUpdate();
System.out.println("Rows affected for asset_data: " + rowsAffectedAssetData);
// Insert data into asset_category table
// preparedStatementDestinationAssetCategory.setString(1, resultSet.getString("category_name"));
// int rowsAffectedAssetCategory = preparedStatementDestinationAssetCategory.executeUpdate();
// System.out.println("Rows affected for asset_category: " + rowsAffectedAssetCategory);
}
}
}
}
}
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace(); // Handle the exception appropriately
}
}
}

4
src/main/resources/application.properties

@ -1,6 +1,6 @@
spring.datasource.url=jdbc:mysql://localhost:3306/it_asset
spring.datasource.url=jdbc:mysql://localhost:3306/it_assets
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=root
spring.datasource.password=Sha619!@
#spring.datasource.password=gccroot #spring.datasource.password=gccroot

371
src/main/resources/templates/dashboard.html

@ -1,19 +1,5 @@
<!doctype html> <!doctype html>
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Include Moment.js -->
<script src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<!-- Include Date Range Picker -->
<link rel="stylesheet" type="text/css" href="assets/js/plugins/bootstrap-daterangepicker/daterangepicker.css" />
<script src="assets/js/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- Include Chart.js -->
<script src="assets/js/plugins/chart.js/chart.umd.js"></script>
<head th:replace="fragments/head :: head"></head> <head th:replace="fragments/head :: head"></head>
<body> <body>
@ -157,7 +143,7 @@
</div> </div>
<div class="py-3"> <div class="py-3">
<div class="fs-1 fw-bold" th:utext="${totalYesFeedbacks}">000</div>
<div class="fs-1 fw-bold" id="totalYesFeedbacks" th:utext="${totalYesFeedbacks}">000</div>
<div class="fw-semibold text-success">Closed Complaints</div> <div class="fw-semibold text-success">Closed Complaints</div>
</div> </div>
@ -173,11 +159,12 @@
<!-- Bars Chart Container --> <!-- Bars Chart Container -->
<!-- Chart.js Chart is initialized in js/pages/be_pages_dashboard.min.js which was auto compiled from _js/pages/be_pages_dashboard.js --> <!-- Chart.js Chart is initialized in js/pages/be_pages_dashboard.min.js which was auto compiled from _js/pages/be_pages_dashboard.js -->
<!-- For more info and examples you can check out http://www.chartjs.org/docs/ --> <!-- For more info and examples you can check out http://www.chartjs.org/docs/ -->
<canvas id="js-chartjs-analytics-bars"></canvas>
<canvas id="myChart" ></canvas>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- END Store Growth --> <!-- END Store Growth -->
@ -196,240 +183,156 @@
<!-- END Page Container --> <!-- END Page Container -->
<!-- Scripts --> <!-- Scripts -->
<script th:replace="fragments/script :: script"></script>
<!-- Page JS Plugins -->
<script src="assets/js/plugins/chart.js/chart.umd.js"></script>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Date Range Picker Script -->
<script src="assets/js/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<script>
var dash;
function convert() {
dash = /*[[${dashboard}]]*/ {};
console.log(dash)
}
convert();
// Initialize Chart with feedbackAnalysis data
function initChart(feedbackAnalysis) {
// Set Global Chart.js configuration
Chart.defaults.color = '#818d96';
Chart.defaults.scale.grid.color = 'transparent';
Chart.defaults.scale.grid.zeroLineColor = 'transparent';
Chart.defaults.scale.beginAtZero = true;
Chart.defaults.elements.line.borderWidth = 1;
Chart.defaults.plugins.legend.labels.boxWidth = 12;
console.log('Feedback Analysis:', feedbackAnalysis);
// Get Chart Container
let chartBarsCon = document.getElementById('js-chartjs-analytics-bars');
// Set Chart and Chart Data variables
let chartBars, chartLinesBarsData;
// Extract counts for "Yes" and "No"
let totalYesCounts = Array.isArray(feedbackAnalysis) ? (feedbackAnalysis.find(entry => entry.Yes)?.Yes || Array(12).fill(0)) : Array(12).fill(0);
let totalNoCounts = Array.isArray(feedbackAnalysis) ? (feedbackAnalysis.find(entry => entry.No)?.No || Array(12).fill(0)) : Array(12).fill(0);
// Calculate "Total Complaints," "Closed Complaints," and "Pending Complaints"
let totalComplaints = totalYesCounts.map((count, index) => count + (totalNoCounts[index] || 0));
let closedComplaints = totalYesCounts.slice();
let pendingComplaints = totalNoCounts.slice();
// Bars Chart Data
chartLinesBarsData = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<!-- Your existing script tag follows -->
<script th:replace="fragments/script :: script"></script>
<!-- Page JS Plugins -->
<script src="assets/js/plugins/chart.js/chart.umd.js"></script>
<!-- Include Date Range Picker -->
<script type="text/javascript" src="assets/js/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="assets/js/plugins/bootstrap-daterangepicker/daterangepicker.css" />
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
var pageDashboard = {
chartBars: undefined,
chartLinesBarsData: {
datasets: [ datasets: [
{
label: 'Total Complaints',
fill: true,
backgroundColor: '#' + (Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0'),
borderColor: 'transparent',
pointBackgroundColor: '#' + (Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0'),
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: '#' + (Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0'),
data: totalComplaints
},
{
label: 'Closed Complaints',
fill: true,
backgroundColor: '#' + (Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0'),
borderColor: 'transparent',
pointBackgroundColor: '#' + (Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0'),
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: '#' + (Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0'),
data: closedComplaints
},
{
label: 'Pending Complaints',
fill: true,
backgroundColor: '#' + (Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0'),
borderColor: 'transparent',
pointBackgroundColor: '#' + (Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0'),
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: '#' + (Math.random() * 0xFFFFFF << 0).toString(16).padStart(6, '0'),
data: pendingComplaints
}
{ data: [] }, // Assuming totalFeedbacks is an array
{ data: [] }, // Assuming totalYesFeedbacks is an array
{ data: [] } // Assuming totalNoFeedbacks is an array
] ]
};
},
// Destroy the existing chart if it exists
if (chartBars) {
chartBars.destroy();
}
updateChartLinesBarsData: function (newData) {
// Ensure the chart is initialized before updating
if (this.chartBars) {
// Assuming labels for the chart are ['Jan', 'Feb', 'Mar', ..., 'Dec']
var labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
// Convert single values to arrays with the same value for each label
var totalFeedbacksData = Array(labels).fill(newData.totalFeedbacks);
var totalYesFeedbacksData = Array(labels).fill(newData.totalYesFeedbacks);
var totalNoFeedbacksData = Array(labels).fill(newData.totalNoFeedbacks);
// Update the chart data
this.chartBars.data.datasets[0].data = totalFeedbacksData;
this.chartBars.data.datasets[1].data = totalYesFeedbacksData;
this.chartBars.data.datasets[2].data = totalNoFeedbacksData;
// Update the chart
this.chartBars.update();
} else {
console.error('Chart is not initialized. Unable to update data.');
}
},
getAndPushData: function () {
var self = this;
// Init Chart
if (chartBarsCon !== null) {
chartBars = new Chart(chartBarsCon, {
type: 'bar',
data: chartLinesBarsData,
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
tooltip: {
callbacks: {
label: function (context) {
return context.dataset.label + ': ' + context.parsed.y + '';
}
}
}
}
$.ajax({
url: 'api/dashboard-summary',
method: 'GET',
dataType: 'json',
success: function (response) {
console.log('Data fetched successfully:', response);
self.updateChartLinesBarsData(response);
},
error: function (xhr, status, error) {
console.error('Error:', error);
} }
}); });
} }
}
};
$(document).ready(function () { $(document).ready(function () {
initChart(dash);
});
var ctx = document.getElementById('myChart').getContext('2d');
// Assuming pageDashboard is an object or class instance
// initChart(dash);
// // Initialize when page loads
// Dashmix.onLoad(() => pageDashboard.init());
</script>
<script type="text/javascript">
$(function() {
var start = moment().subtract(29, 'days');
var end = moment();
function cb(start, end) {
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
});
</script>
<script type="text/javascript">
//Chart Update data
/* static updateChartLinesBarsData(newData) {
// Update the chart data;
pageDashboard.chartLinesBarsData.datasets[0].data = newData.totalFeedbacks;
pageDashboard.chartLinesBarsData.datasets[1].data = newData.positiveFeedbacks;
pageDashboard.chartLinesBarsData.datasets[2].data = newData.negativeFeedbacks;
// Update the chart
if (pageDashboard.chartBars !== undefined) {
pageDashboard.chartBars.data = pageDashboard.chartLinesBarsData;
pageDashboard.chartBars.update();
}
}
function getAndpushdata(){
$.ajax({
url: 'api/dashboard', // Replace with the URL to fetch the updated data
method: 'GET', // Replace with the appropriate HTTP method
dataType: 'json', // Replace with the data type you are expecting
success: function (response) {
// Assuming the response contains the updated chart data in the expected format
pageDashboard.updateChartLinesBarsData(response);
},
error: function (xhr, status, error) {
// Handle the error scenario
console.error('Error:', error);
}
});
} */
// Assuming pageDashboard is an object or class instance
var pageDashboard = {
chartLinesBarsData: {
datasets: [
{ data: [] }, // Assuming totalFeedbacks is an array
{ data: [] }, // Assuming positiveFeedbacks is an array
{ data: [] } // Assuming negativeFeedbacks is an array
]
},
chartBars: undefined, // Assuming chartBars is initially undefined
updateChartLinesBarsData: function(newData) {
// Update the chart data
this.chartLinesBarsData.datasets[0].data = newData.totalFeedbacks;
this.chartLinesBarsData.datasets[1].data = newData.positiveFeedbacks;
this.chartLinesBarsData.datasets[2].data = newData.negativeFeedbacks;
// Update the chart
if (this.chartBars !== undefined) {
this.chartBars.data = this.chartLinesBarsData;
this.chartBars.update();
}
},
getAndPushData: function() {
var self = this; // Store a reference to the current object
$.ajax({
url: 'api/dashboard', // Replace with the URL to fetch the updated data
method: 'GET', // Replace with the appropriate HTTP method
dataType: 'json', // Replace with the data type you are expecting
success: function(response) {
// Assuming the response contains the updated chart data in the expected format
self.updateChartLinesBarsData(response);
self.initChart(response);
var data = {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
datasets: [
{
label: 'Total Complaints',
data: [],
fill: true,
backgroundColor: '#c7d7e6',
borderColor: 'transparent',
pointBackgroundColor: '#c7d7e6',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: '#c7d7e6',
}, },
error: function(xhr, status, error) {
// Handle the error scenario
console.error('Error:', error);
{
label: 'Closed Complaint',
data: [],
fill: true,
backgroundColor: '#c2d7ab',
borderColor: 'transparent',
pointBackgroundColor: '#c2d7ab',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: '#c2d7ab',
},
{
label: 'Pending Complaint',
data: [],
fill: true,
backgroundColor: '#e9cb91',
borderColor: 'transparent',
pointBackgroundColor: '#e9cb91',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: '#e9cb91',
},
]
};
var options = {
responsive: true,
scales: {
x: { beginAtZero: true },
y: { beginAtZero: true }
} }
});
}
};
};
// Create the chart
pageDashboard.chartBars = new Chart(ctx, {
type: 'bar',
data: data,
options: options
});
// Fetch initial data and update the chart
pageDashboard.getAndPushData();
});
// Call the getAndPushData method to fetch and update chart data
pageDashboard.getAndPushData();
$(function() {
var start = moment().subtract(29, 'days');
var end = moment();
function cb(start, end) {
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
</script>
cb(start, end);
});
</script>
</body> </body>
</html> </html>

56
src/main/resources/templates/gcc-asset-list.html

@ -65,18 +65,20 @@
<tbody> <tbody>
<tr th:each="assetlist, i : ${assetdetailslist}" class="${assetdetailslist}"> <tr th:each="assetlist, i : ${assetdetailslist}" class="${assetdetailslist}">
<td th:text="${i.count}">0</td> <td th:text="${i.count}">0</td>
<td class="text-center" th:text="${assetlist.assetCategory.catName}"></td>
<td class="text-center" th:text="${assetlist.assetCategory?.catName}"></td>
<td class="text-center" th:text="${assetlist.departmentName}"></td> <td class="text-center" th:text="${assetlist.departmentName}"></td>
<td th:text="${assetlist.person}"></td> <td th:text="${assetlist.person}"></td>
<td th:text="${assetlist.assetName}"></td>
<td th:text="${assetlist.assetId}"></td>
<td th:text="${assetlist.position}"></td> <td th:text="${assetlist.position}"></td>
<td> <td>
<a tabindex="0" class="text-danger" data-bs-toggle="popover" data-bs-trigger="focus" title="" th:attr="data-bs-content=${'&lt;img src=&quot;data:image/png;base64,' + assetlist.qrcodeimg + '&quot; width=&quot;100%&quot; /&gt;'}" data-bs-html="true" th:text="${assetlist.assetCode}" style="font-size:10px;cursor:pointer"></a> <a tabindex="0" class="text-danger" data-bs-toggle="popover" data-bs-trigger="focus" title="" th:attr="data-bs-content=${'&lt;img src=&quot;data:image/png;base64,' + assetlist.qrcodeimg + '&quot; width=&quot;100%&quot; /&gt;'}" data-bs-html="true" th:text="${assetlist.assetCode}" style="font-size:10px;cursor:pointer"></a>
</td> </td>
<td th:if="${assetlist.isActive}"><span class="badge bg-success">Active</span></td> <td th:if="${assetlist.isActive}"><span class="badge bg-success">Active</span></td>
<td th:unless="${assetlist.isActive}"><span class="badge bg-warning">InActive</span></td> <td th:unless="${assetlist.isActive}"><span class="badge bg-warning">InActive</span></td>
<td class="text-center"> <td class="text-center">
<a th:onclick="views( [[${assetlist}]] );" data-bs-toggle="tooltip" data-bs-animation="true" data-bs-placement="top" title=""> <i class="fa fa-pen-to-square" onclick="openModalWithDefaultData()" id="showModalButton" style="font-size: 18px;"></i></a>
<a th:onclick="views( [[${assetlist}]] );" data-bs-toggle="tooltip" data-bs-animation="true" data-bs-placement="top" title=""> <i class="fa fa-pen-to-square" id="showModalButton" style="font-size: 18px;"></i></a>
<!-- <a th:href="@{#}" th:onclick="return false;" data-bs-toggle="tooltip" data-bs-animation="true" data-bs-placement="top" title="Edit"><i class="far fa-pen-to-square" style="font-size: 18px;"></i></a>&nbsp;&nbsp; --> <!-- <a th:href="@{#}" th:onclick="return false;" data-bs-toggle="tooltip" data-bs-animation="true" data-bs-placement="top" title="Edit"><i class="far fa-pen-to-square" style="font-size: 18px;"></i></a>&nbsp;&nbsp; -->
<a th:href="@{#}" th:onclick="return callDelete([[${assetlist.assetName}]], [[${assetlist.assetId}]] );;" data-bs-toggle="tooltip" data-bs-animation="true" data-bs-placement="top" title="Delete"><i class="far fa-trash-can" style="font-size: 18px;"></i></a> <a th:href="@{#}" th:onclick="return callDelete([[${assetlist.assetName}]], [[${assetlist.assetId}]] );;" data-bs-toggle="tooltip" data-bs-animation="true" data-bs-placement="top" title="Delete"><i class="far fa-trash-can" style="font-size: 18px;"></i></a>
<a tabindex="0" class="text-danger" data-bs-toggle="popover" data-bs-trigger="focus" title="" th:attr="data-bs-content=${'&lt;img src=&quot;data:image/png;base64,' + assetlist.assetimg + '&quot; width=&quot;100%&quot; /&gt;'}" data-bs-html="true" style="font-size:10px;cursor:pointer"><i class="far fa-image" style="font-size: 18px;"></i></a> <a tabindex="0" class="text-danger" data-bs-toggle="popover" data-bs-trigger="focus" title="" th:attr="data-bs-content=${'&lt;img src=&quot;data:image/png;base64,' + assetlist.assetimg + '&quot; width=&quot;100%&quot; /&gt;'}" data-bs-html="true" style="font-size:10px;cursor:pointer"><i class="far fa-image" style="font-size: 18px;"></i></a>
@ -218,12 +220,18 @@
<input type="text" class="form-control" name="person" id="person" required> <input type="text" class="form-control" name="person" id="person" required>
</div> </div>
</div> </div>
<div class="col-md-6 alert-light border-0">
<div class="col-md-3 alert-light border-0">
<div class="mb-3"> <div class="mb-3">
<label class="form-check-label" for="assetName">Asset Name</label>
<input type="text" class="form-control" name="assetName" id="assetName" required>
<label class="form-check-label" for="assetId">Asset Id</label>
<input type="text" class="form-control" name="assetId" id="assetId" required>
</div> </div>
</div> </div>
<!-- <div class="col-md-6 alert-light border-0">
<div class="mb-3">
<label class="form-check-label" for="assetName">Asset Id</label>
<input type="text" class="form-control" name="assetName" id="assetName" required>
</div>
</div>-->
<div class="col-md-3 alert-light border-0"> <div class="col-md-3 alert-light border-0">
<div class="mb-3"> <div class="mb-3">
@ -377,6 +385,7 @@
}); });
function getParameter(){ function getParameter(){
var catid = $('#assetCategory').val();//$('#catId').find(":selected").val(); var catid = $('#assetCategory').val();//$('#catId').find(":selected").val();
var paramHTML='' var paramHTML=''
if(catid!='' || catid>0){ if(catid!='' || catid>0){
@ -403,27 +412,24 @@
} }
return false; return false;
} }
function views (assetlist){
$('#views').modal({
backdrop: 'static',
keyboard: false
});
$('#views').modal('show');
document.getElementById("PopAssetId").value =assetlist.assetId;
document.getElementById("catName").value =assetlist.assetCategory.catName;
document.getElementById("departmentName").value =assetlist.departmentName;
document.getElementById("person").value =assetlist.person;
document.getElementById("position").value =assetlist.position;
document.getElementById("assetName").value =assetlist.assetName;
function views(assetlist) {
console.log(assetlist)
$('#views').modal({
backdrop: 'static',
keyboard: false
});
$('#views').modal('show');
document.getElementById("PopAssetId").value = assetlist.assetId;
/* document.getElementById("catName").value = assetlist.assetCategory.catName;*/
document.getElementById("departmentName").value = assetlist.departmentName;
document.getElementById("person").value = assetlist.person;
document.getElementById("position").value = assetlist.position;
document.getElementById("assetId").value = assetlist.assetId;
} }
// ERP DATA CALL via API
</script> </script>

21
src/main/resources/templates/gcc-complaint.html

@ -61,12 +61,18 @@
<div class="card-header bg-secondary text-white"> <div class="card-header bg-secondary text-white">
Gcc Asset Details Gcc Asset Details
</div> </div>
<div class="card-body">
<div class="mb-0">
<p class="card-title mb-0 text-center" th:text="${assetName}">Title</p>
</div>
<div class="mb-3">
<div class="card-body">
<label for="assetId">Asset Id</label>
<div class="mb-0 text-center">
<!--<p class="card-title mb-0 text-center" th:text="${assetId}">Title</p>-->
<input type="text" class="form-control text-center" name="person" id="person" th:value="${assetId}" readonly />
</div>
<div class="mb-0"> <div class="mb-0">
<p class="card-title mb-0 text-center" th:text="${assetAddress}">Address</p> <p class="card-title mb-0 text-center" th:text="${assetAddress}">Address</p>
@ -81,9 +87,9 @@
<div class="card-body"> <div class="card-body">
<div class="mb-3"> <div class="mb-3">
<label for="uname">Name (Optional):</label>
<input type="text" class="form-control" name="uname" id="uname" placeholder="" required />
<input type="hidden" class="form-control" name="assetId" id="assetId" th:value="${assetId}" required />
<label for="person">Name (Optional):</label>
<input type="text" class="form-control" name="person" id="person" placeholder="" required />
<p class="card-title mb-0 text-center" th:text="${person}">Address</p>
</div> </div>
<div class="mb-3"> <div class="mb-3">
@ -362,3 +368,4 @@
</script> </script>
</body> </body>
</html> </html>

2
src/main/resources/templates/pending-complaint.html

@ -201,7 +201,7 @@
function viewnegfeedback (feedback) { function viewnegfeedback (feedback) {
//console.log(feedback);
console.log(feedback);
alert("ji"); alert("ji");
document.getElementById("assetCode").value =feedback.gccAssetDetails.assetCode; document.getElementById("assetCode").value =feedback.gccAssetDetails.assetCode;
document.getElementById("assetName").value =feedback.gccAssetDetails.assetName; document.getElementById("assetName").value =feedback.gccAssetDetails.assetName;

Loading…
Cancel
Save