Browse Source

Asset Entry - Asset Type field should display data from Master List Data

master
aswinsundar 4 years ago
parent
commit
e742c0c5a0
  1. 12
      src/main/java/com/asset/master/MasterRestController.java
  2. 10
      src/main/resources/static/assets/js/local.js
  3. 53
      src/main/resources/templates/asset-detail-entry.html
  4. 8
      src/main/resources/templates/asset-master-entry.html

12
src/main/java/com/asset/master/MasterRestController.java

@ -14,12 +14,12 @@ public class MasterRestController {
@Autowired @Autowired
MasterRepository masterRepo; MasterRepository masterRepo;
// @GetMapping(value = "/search/getMasterName")
// public List<Master> getMasterName() {
// List<Master> obj = masterRepo.findAllMasterName();
// System.out.println("OBJ---:"+obj);
// return obj;
// }
@GetMapping(value = "/getMasterName")
public List<Master> getMasterName() {
List<Master> obj = masterRepo.findAllMasterName();
//System.out.println("OBJ--2-:"+obj);
return obj;
}
// @GetMapping(value = "/client/{searchTerms}") // @GetMapping(value = "/client/{searchTerms}")
// public List<Map<String,Object>> getClientNameKeyword(@PathVariable("searchTerms") String searchTerms) { // public List<Map<String,Object>> getClientNameKeyword(@PathVariable("searchTerms") String searchTerms) {

10
src/main/resources/static/assets/js/local.js

@ -187,15 +187,11 @@ function verifyOtp(){
} }
//Getting Master Name //Getting Master Name
function getMasterName() {
//$('#assetStreet option:not(:first)').remove();
//var locationId = $this.value;
/*function getMasterName() {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/qr-feedback/master/search/getMasterName',
//data: {'locationId':locationId},
url: '/qr-feedback/master/getMasterName',
dataType: 'json', dataType: 'json',
success: function(bodyMessage) { success: function(bodyMessage) {
var tempJson = bodyMessage['obj']; var tempJson = bodyMessage['obj'];
@ -210,4 +206,4 @@ function getMasterName() {
alert(ts) alert(ts)
} }
}); });
}
}*/

53
src/main/resources/templates/asset-detail-entry.html

@ -9,7 +9,33 @@
<!-- head tag --> <!-- head tag -->
<div th:replace="fragment/Head.html::head"></div> <div th:replace="fragment/Head.html::head"></div>
<script>
$(document).ready(function(){
getMasterName();
});
//Getting Master Name
function getMasterName() {
$.ajax({
type: "GET",
url: '/qr-feedback/master/getMasterName',
dataType: 'json',
success: function(obj) {
for (var i = 0; i < obj.length; i++) {
var tempJsonValue = obj[i]['masterId'];
var tempJsonLabel = obj[i]['masterName'];
$('#masterName').append("<option value='" + tempJsonValue + "'>" + tempJsonLabel + "</option>");
}
}, error: function(e, ts, et)
{
alert(ts)
}
});
}
</script>
<body> <body>
<!-- header tag --> <!-- header tag -->
@ -44,68 +70,65 @@
<div class="row g-3"> <div class="row g-3">
<div class="col-md-4"> <div class="col-md-4">
<label for="zone" class="form-label">Zone</label> <label for="zone" class="form-label">Zone</label>
<select th:field="*{zoneNo}" id="zoneNo" class="form-select" onchange="getDiv(this);">
<select th:field="*{zoneNo}" id="zoneNo" class="form-select" onchange="getDiv(this);" autocomplete="off" required>
<option th:value="''">---Select Zone---</option> <option th:value="''">---Select Zone---</option>
</select> </select>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="div" class="form-label">Div</label> <label for="div" class="form-label">Div</label>
<select th:field="*{divNo}" id="divNo" class="form-select" onchange="getArea(this);">
<select th:field="*{divNo}" id="divNo" class="form-select" onchange="getArea(this);" autocomplete="off" required>
<option th:value="''">---Select Div---</option> <option th:value="''">---Select Div---</option>
</select> </select>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetArea" class="form-label">Area</label> <label for="assetArea" class="form-label">Area</label>
<select th:field="*{assetArea}" id="assetArea" class="form-select" onchange="getLocation(this);">
<select th:field="*{assetArea}" id="assetArea" class="form-select" onchange="getLocation(this);" autocomplete="off" required>
<option th:value="''">---Select Area---</option> <option th:value="''">---Select Area---</option>
</select> </select>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetLocation" class="form-label">Locality</label> <label for="assetLocation" class="form-label">Locality</label>
<select th:field="*{assetLocality}" id="assetLocation" class="form-select" onchange="getStreet(this);">
<select th:field="*{assetLocality}" id="assetLocation" class="form-select" onchange="getStreet(this);" autocomplete="off" required>
<option th:value="''">---Select Locality---</option> <option th:value="''">---Select Locality---</option>
</select> </select>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetStreet" class="form-label">Street</label> <label for="assetStreet" class="form-label">Street</label>
<select th:field="*{assetStreet}" id="assetStreet" class="form-select">
<select th:field="*{assetStreet}" id="assetStreet" class="form-select" autocomplete="off" required>
<option th:value="''">---Select Street---</option> <option th:value="''">---Select Street---</option>
</select> </select>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetType" class="form-label">Asset Type</label> <label for="assetType" class="form-label">Asset Type</label>
<select id="assetType" class="form-select" th:field="*{assetType}">
<select id="masterName" class="form-select" th:field="*{assetType}" autocomplete="off" required>
<option th:value="''">---Select Asset Type---</option> <option th:value="''">---Select Asset Type---</option>
<option th:value="'Park'">Park</option>
<option th:value="'Amma Unavangam'">Amma Unavangam</option>
<option th:value="'Public Toilet'">Public Toilet</option>
</select> </select>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetName" class="form-label">Name of the Asset</label> <label for="assetName" class="form-label">Name of the Asset</label>
<input type="text" class="form-control" id="assetName" th:field="*{assetName}">
<input type="text" class="form-control" id="assetName" th:field="*{assetName}" autocomplete="off" required>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetAddress" class="form-label">Address of the Asset</label> <label for="assetAddress" class="form-label">Address of the Asset</label>
<input type="text" class="form-control" id="assetAddress" th:field="*{assetAddress}">
<input type="text" class="form-control" id="assetAddress" th:field="*{assetAddress}" autocomplete="off" required>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetOpeningTime" class="form-label">Opening Timing</label> <label for="assetOpeningTime" class="form-label">Opening Timing</label>
<input type="time" class="form-control" id="assetOpeningTime" th:field="*{assetOpeningTime}">
<input type="time" class="form-control" id="assetOpeningTime" th:field="*{assetOpeningTime}" autocomplete="off" required>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetClosingTime" class="form-label">Closing Timing</label> <label for="assetClosingTime" class="form-label">Closing Timing</label>
<input type="time" class="form-control" id="assetClosingTime" th:field="*{assetClosingTime}">
<input type="time" class="form-control" id="assetClosingTime" th:field="*{assetClosingTime}" autocomplete="off" required>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetGeoLocation" class="form-label">Latitude</label> <label for="assetGeoLocation" class="form-label">Latitude</label>
<!-- <input type="text" class="form-control" id="assetLatitude" onclick="getLocation()"> --> <!-- <input type="text" class="form-control" id="assetLatitude" onclick="getLocation()"> -->
<input type="text" class="form-control" id="assetLatitude" th:field="*{assetLatitude}" data-bs-toggle="modal" data-bs-target="#largeModal" readonly>
<input type="text" class="form-control" id="assetLatitude" th:field="*{assetLatitude}" data-bs-toggle="modal" data-bs-target="#largeModal" readonly autocomplete="off" required>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="assetGeoLocation" class="form-label">Longitude</label> <label for="assetGeoLocation" class="form-label">Longitude</label>
<input type="text" class="form-control" id="assetLongitude" th:field="*{assetLongitude}" data-bs-toggle="modal" data-bs-target="#largeModal" readonly>
<input type="text" class="form-control" id="assetLongitude" th:field="*{assetLongitude}" data-bs-toggle="modal" data-bs-target="#largeModal" readonly autocomplete="off" required>
</div> </div>
<!-- Large Modal --> <!-- Large Modal -->

8
src/main/resources/templates/asset-master-entry.html

@ -105,7 +105,7 @@ $('#assetMasterEntryFormRest').click(function(){
<div class="row g-3"> <div class="row g-3">
<div class="col-md-4"> <div class="col-md-4">
<label for="assetName" class="form-label">Asset Type Name</label> <label for="assetName" class="form-label">Asset Type Name</label>
<input type="text" class="form-control" id="masterName" th:value="${masterListObj.masterName}" name="masterListObj.masterName" autocomplete="off">
<input type="text" class="form-control" id="masterName" th:value="${masterListObj.masterName}" name="masterListObj.masterName" autocomplete="off" required>
</div> </div>
</div> </div>
</div> </div>
@ -126,7 +126,7 @@ $('#assetMasterEntryFormRest').click(function(){
<div class="col-10"> <div class="col-10">
<label for="assetParameters" class="form-label">Asset Parameters</label> <label for="assetParameters" class="form-label">Asset Parameters</label>
<!-- <input type="text" class="form-control" id="masterParameters" th:field="*{masterParametersList.masterParameters}" required> --> <!-- <input type="text" class="form-control" id="masterParameters" th:field="*{masterParametersList.masterParameters}" required> -->
<input type="text" class="form-control" id="masterParameters_1" name="masterParametersListObj.masterParameters" required autocomplete="off">
<input type="text" class="form-control" id="masterParameters_1" name="masterParametersListObj.masterParameters" autocomplete="off" required>
</div> </div>
<div class="col-2"> <div class="col-2">
@ -156,10 +156,10 @@ $('#assetMasterEntryFormRest').click(function(){
<div class="row g-3"> <div class="row g-3">
<div class="col-10"> <div class="col-10">
<label for="assetQuestionEnglish" class="form-label">English</label> <label for="assetQuestionEnglish" class="form-label">English</label>
<input type="text" class="form-control" id="masterQuestionEnglish_1" name="masterQuestionListObj.masterQuestionEnglish" required autocomplete="off">
<input type="text" class="form-control" id="masterQuestionEnglish_1" name="masterQuestionListObj.masterQuestionEnglish" autocomplete="off" required>
<label for="assetQuestionTamil" class="form-label">&#2980;&#2990;&#3007;&#2996;&#3021;</label> <label for="assetQuestionTamil" class="form-label">&#2980;&#2990;&#3007;&#2996;&#3021;</label>
<input type="text" class="form-control" id="masterQuestionTamil_1" name="masterQuestionListObj.masterQuestionTamil" required autocomplete="off">
<input type="text" class="form-control" id="masterQuestionTamil_1" name="masterQuestionListObj.masterQuestionTamil" autocomplete="off" required>
</div> </div>
<div class="col-2"> <div class="col-2">

Loading…
Cancel
Save